{
  "version": 3,
  "sources": ["../../../../../src/lib/tools/LaserTool/childStates/Lasering.ts"],
  "sourcesContent": ["import { StateNode } from '@tldraw/editor'\nimport { LaserTool } from '../LaserTool'\n\nexport class Lasering extends StateNode {\n\tstatic override id = 'lasering'\n\tstatic override trackPerformance = true\n\n\tprivate scribbleId = ''\n\tprivate sessionId = ''\n\n\toverride onEnter(info: { sessionId: string; scribbleId: string }) {\n\t\tthis.sessionId = info.sessionId\n\t\tthis.scribbleId = info.scribbleId\n\t\tthis.pushPointToScribble()\n\t}\n\n\toverride onPointerMove() {\n\t\tthis.pushPointToScribble()\n\t}\n\n\tprivate pushPointToScribble() {\n\t\t// The session's idle timeout fires when ticks stall (a backgrounded tab, a throttled mobile\n\t\t// browser), so it can fade out and be removed while a stroke is still in progress. Adding a\n\t\t// point to it would throw (#10125), so continue the stroke in a fresh session instead.\n\t\tif (!this.editor.scribbles.isSessionActive(this.sessionId)) {\n\t\t\tconst { sessionId, scribbleId } = (this.parent as LaserTool).startScribble()\n\t\t\tthis.sessionId = sessionId\n\t\t\tthis.scribbleId = scribbleId\n\t\t}\n\t\tconst { x, y } = this.editor.inputs.getCurrentPagePoint()\n\t\tthis.editor.scribbles.addPointToSession(this.sessionId, this.scribbleId, x, y)\n\t}\n\n\toverride onTick() {\n\t\tthis.editor.scribbles.extendSession(this.sessionId)\n\t}\n\n\toverride onPointerUp() {\n\t\tthis.complete()\n\t}\n\n\toverride onCancel() {\n\t\tthis.onComplete()\n\t}\n\n\toverride onComplete() {\n\t\tthis.complete()\n\t}\n\n\tprivate complete() {\n\t\tif (this.editor.scribbles.isSessionActive(this.sessionId)) {\n\t\t\tthis.editor.scribbles.complete(this.scribbleId)\n\t\t}\n\t\tthis.parent.transition('idle')\n\t}\n}\n"],
  "mappings": "AAAA,SAAS,iBAAiB;AAGnB,MAAM,iBAAiB,UAAU;AAAA,EACvC,OAAgB,KAAK;AAAA,EACrB,OAAgB,mBAAmB;AAAA,EAE3B,aAAa;AAAA,EACb,YAAY;AAAA,EAEX,QAAQ,MAAiD;AACjE,SAAK,YAAY,KAAK;AACtB,SAAK,aAAa,KAAK;AACvB,SAAK,oBAAoB;AAAA,EAC1B;AAAA,EAES,gBAAgB;AACxB,SAAK,oBAAoB;AAAA,EAC1B;AAAA,EAEQ,sBAAsB;AAI7B,QAAI,CAAC,KAAK,OAAO,UAAU,gBAAgB,KAAK,SAAS,GAAG;AAC3D,YAAM,EAAE,WAAW,WAAW,IAAK,KAAK,OAAqB,cAAc;AAC3E,WAAK,YAAY;AACjB,WAAK,aAAa;AAAA,IACnB;AACA,UAAM,EAAE,GAAG,EAAE,IAAI,KAAK,OAAO,OAAO,oBAAoB;AACxD,SAAK,OAAO,UAAU,kBAAkB,KAAK,WAAW,KAAK,YAAY,GAAG,CAAC;AAAA,EAC9E;AAAA,EAES,SAAS;AACjB,SAAK,OAAO,UAAU,cAAc,KAAK,SAAS;AAAA,EACnD;AAAA,EAES,cAAc;AACtB,SAAK,SAAS;AAAA,EACf;AAAA,EAES,WAAW;AACnB,SAAK,WAAW;AAAA,EACjB;AAAA,EAES,aAAa;AACrB,SAAK,SAAS;AAAA,EACf;AAAA,EAEQ,WAAW;AAClB,QAAI,KAAK,OAAO,UAAU,gBAAgB,KAAK,SAAS,GAAG;AAC1D,WAAK,OAAO,UAAU,SAAS,KAAK,UAAU;AAAA,IAC/C;AACA,SAAK,OAAO,WAAW,MAAM;AAAA,EAC9B;AACD;",
  "names": []
}
