import { ISignal , Signal } from '@lumino/signaling' ; import { IDebugger } from '../../tokens' ; /**
 * A model for a callstack.
 */ export class CallstackModel implements IDebugger . Model . ICallstack { /**
     * Get all the frames.
     */ get frames ( ) : IDebugger . IStackFrame [ ] { return this . _state ; } /**
     * Set the frames.
     */ set frames ( newFrames ) { this . _state = newFrames ; const frame = newFrames . find ( frame => Private . getFrameId ( frame ) === Private . getFrameId ( this . frame ) ) ; if ( ! frame ) { this . frame = newFrames [ 0 ] ; } this . _framesChanged . emit ( newFrames ) ; } /**
     * Get the current frame.
     */ get frame ( ) : IDebugger . IStackFrame { return this . _currentFrame ; } /**
     * Set the current frame.
     */ set frame ( frame ) { this . _currentFrame = frame ; this . _currentFrameChanged . emit ( frame ) ; } /**
     * Signal emitted when the frames have changed.
     */ get framesChanged ( ) : ISignal < this , IDebugger . IStackFrame [ ] > { return this . _framesChanged ; } /**
     * Signal emitted when the current frame has changed.
     */ get currentFrameChanged ( ) : ISignal < this , IDebugger . IStackFrame > { return this . _currentFrameChanged ; } private _state : IDebugger . IStackFrame [ ] = [ ] ; private _currentFrame : IDebugger . IStackFrame ; private _framesChanged = new Signal < this , IDebugger . IStackFrame [ ] > ( this ) ; private _currentFrameChanged = new Signal < this , IDebugger . IStackFrame > ( this ) ; } /**
 * A namespace for private data.
 */ namespace Private { param frame export function getFrameId ( frame ) { return `${ frame ?. source ?. path }-${ frame ?. id }` ; } }