@operato/scene-ops 10.16.2 → 10.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,7 +64,7 @@ function dispatchSceneEditOp(scene, op, ctx = {}) {
64
64
  return NOOP_RESULT;
65
65
  const oldValues = captureOldKeys(target.model, op.patch);
66
66
  const merged = (0, apply_model_js_1.mergeComponent)(target.model, op.patch);
67
- target.set(merged);
67
+ target.set(withClearedKeys(merged, op.patch));
68
68
  /* `set` does not push a snapshot by itself — ask the commander for one. */
69
69
  scene.commander?.execute(null, false);
70
70
  return {
@@ -80,7 +80,7 @@ function dispatchSceneEditOp(scene, op, ctx = {}) {
80
80
  delete cleanPatch.components; /* children move by add/remove/modify */
81
81
  const oldValues = captureOldKeys(root.model, cleanPatch);
82
82
  const merged = (0, apply_model_js_1.mergeComponent)(root.model, cleanPatch);
83
- root.set(merged);
83
+ root.set(withClearedKeys(merged, cleanPatch));
84
84
  scene.commander?.execute(null, false);
85
85
  return { applied: true, inverseOps: [{ op: 'modifyScene', patch: oldValues }] };
86
86
  }
@@ -348,6 +348,23 @@ function collectAllRefids(scene) {
348
348
  * This is the patch of the inverse `modify`. A key the model did not have is kept as null,
349
349
  * which the mergers read as "remove it" — so undoing an added key removes it again.
350
350
  */
351
+ /**
352
+ * `null` in a patch means "this key should not be there" - it is how an inverse restores a
353
+ * property the component did not have before the edit (see `captureOldKeys`).
354
+ *
355
+ * `mergeComponent` deletes such a key from the merged model, but a component's `set()` only writes
356
+ * the keys it is given, so the old value stayed: an AI edit that added a first binding or a first
357
+ * fill colour could not be reverted - the chat said "reverted" and the property was still there.
358
+ * Handing the key over as `undefined` makes `set()` clear it.
359
+ */
360
+ function withClearedKeys(merged, patch) {
361
+ const out = { ...merged };
362
+ for (const k of Object.keys(patch || {})) {
363
+ if (patch[k] === null)
364
+ out[k] = undefined;
365
+ }
366
+ return out;
367
+ }
351
368
  function captureOldKeys(model, patch) {
352
369
  const out = {};
353
370
  for (const k of Object.keys(patch || {})) {
@@ -1 +1 @@
1
- {"version":3,"file":"apply-scene.js","sourceRoot":"","sources":["../../src/apply-scene.ts"],"names":[],"mappings":";;AA4CA,gDAUC;AAQD,kDAmMC;AAWD,kDAmCC;AAaD,0DAkDC;AAQD,4CAOC;AAQD,wCAOC;AA/XD,qDAAiD;AAuBjD,MAAM,WAAW,GAAmB,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAAA;AAEtE;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAAU,EAAE,MAAuC;IACpF,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrC,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,EAAE,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACrE,IAAI,OAAO;YAAE,OAAO,OAAO,CAAA;IAC7B,CAAC;IACD,IAAI,OAAO,MAAM,CAAC,EAAE,KAAK,QAAQ,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1D,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAA;IAC5C,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,KAAU,EACV,EAAe,EACf,MAAuB,EAAE;IAEzB,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE;QAAE,OAAO,WAAW,CAAA;IACrC,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;IAElD,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;QACd,KAAK,KAAK,CAAC,CAAC,CAAC;YACX,MAAM,UAAU,GAAG,SAAS,C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K,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IACjE,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["/**\n * Applying edit operations to a scene that is open on screen.\n *\n * The difference from `apply-model.ts` is the commander. Everything here goes through\n * things-scene's own mutation API (`scene.add`, `target.set`, `scene.align`, …), so the\n * commander records a snapshot and the user keeps undo, the dirty mark and their selection.\n * Rebuilding the model and handing it back would take all three away.\n *\n * The scene is typed `any` on purpose: things-scene's Scene is a large surface and this\n * module needs eight methods of it. Typing it loosely is what lets the whole file be tested\n * with a plain object, which is how the operations below are actually covered.\n */\nimport type { ArrangeLayout, SceneActionOp, SceneEditOp } from './ops.js'\nimport { mergeComponent } from './apply-model.js'\n\nexport interface DispatchContext {\n /**\n * Fill an `add` component out with the defaults of its type before it goes in.\n *\n * The host does this because the defaults live in its template registry — an editor knows\n * what a fresh component of each type looks like, and this module does not. Left out, the\n * component goes to the scene exactly as given.\n */\n normalize?: (c: any) => any\n}\n\nexport interface DispatchResult {\n /** False when nothing happened — an unknown refid, too few targets, an op we do not take. */\n applied: boolean\n /**\n * How to undo this one operation, computed from the scene as it was. One operation can\n * need several: an `align` of five components inverts to five `modify`s.\n */\n inverseOps: SceneEditOp[]\n}\n\nconst NOOP_RESULT: DispatchResult = { applied: false, inverseOps: [] }\n\n/**\n * Find a component by refid, or by id when that is all the caller has.\n *\n * refid is issued by things-scene to everything in the scene; id is an optional string the\n * author may have set. refid is tried first because it is the one that is always there.\n */\nexport function findSceneComponent(scene: any, target: { id?: string; refid?: number }): any {\n if (!scene) return null\n if (typeof target.refid === 'number') {\n const byRefid = scene.rootContainer?.refidIndexMap?.get(target.refid)\n if (byRefid) return byRefid\n }\n if (typeof target.id === 'string' && target.id.length > 0) {\n return scene.findById?.(target.id) ?? null\n }\n return null\n}\n\n/**\n * Carry out one edit operation on a live scene.\n *\n * `replace` is not taken here — swapping the whole model is the host's own path, because it\n * has to decide what happens to the selection and the undo stack.\n */\nexport function dispatchSceneEditOp(\n scene: any,\n op: SceneEditOp,\n ctx: DispatchContext = {}\n): DispatchResult {\n if (!scene || !op) return NOOP_RESULT\n const normalize = ctx.normalize ?? ((c: any) => c)\n\n switch (op.op) {\n case 'add': {\n const normalized = normalize(op.component)\n /* The inverse needs the refid the scene is about to issue, so we diff around the add. */\n const prevRefids = new Set<number>(collectAllRefids(scene))\n scene.add(normalized, {})\n const newRefids = collectAllRefids(scene).filter(r => !prevRefids.has(r))\n const inverseOps: SceneEditOp[] = newRefids.map(refid => ({ op: 'remove', refid }))\n return { applied: true, inverseOps }\n }\n\n case 'remove': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target || !target.parent) return NOOP_RESULT\n const savedModel = JSON.parse(JSON.stringify(target.model))\n const prevSelected = scene.selected ?? []\n scene.selected = [target]\n scene.remove()\n scene.selected = prevSelected.filter((c: any) => c !== target)\n return { applied: true, inverseOps: [{ op: 'add', component: savedModel }] }\n }\n\n case 'modify': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target) return NOOP_RESULT\n const oldValues = captureOldKeys(target.model, op.patch as any)\n const merged = mergeComponent(target.model, op.patch as any)\n target.set(merged)\n /* `set` does not push a snapshot by itself — ask the commander for one. */\n scene.commander?.execute(null, false)\n return {\n applied: true,\n inverseOps: [{ op: 'modify', refid: op.refid, patch: oldValues }]\n }\n }\n\n case 'modifyScene': {\n const root = scene.root\n if (!root || typeof root.set !== 'function') return NOOP_RESULT\n const cleanPatch = { ...((op.patch as any) || {}) }\n delete cleanPatch.components /* children move by add/remove/modify */\n const oldValues = captureOldKeys(root.model, cleanPatch)\n const merged = mergeComponent(root.model, cleanPatch)\n root.set(merged)\n scene.commander?.execute(null, false)\n return { applied: true, inverseOps: [{ op: 'modifyScene', patch: oldValues }] }\n }\n\n case 'align': {\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n const beforeBounds = targets.map((c: any) => ({\n refid: c.get('refid'),\n left: c.get('left'),\n top: c.get('top'),\n width: c.get('width'),\n height: c.get('height')\n }))\n const prevSelected = scene.selected ?? []\n scene.selected = targets\n scene.align(op.direction)\n scene.selected = prevSelected\n /* Undo restores the coordinates we read, rather than trying to invert the alignment. */\n const inverseOps: SceneEditOp[] = beforeBounds.map(b => ({\n op: 'modify',\n refid: b.refid,\n patch: { left: b.left, top: b.top, width: b.width, height: b.height } as any\n }))\n return { applied: true, inverseOps }\n }\n\n case 'distribute': {\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n const beforeBounds = targets.map((c: any) => ({\n refid: c.get('refid'),\n left: c.get('left'),\n top: c.get('top')\n }))\n const prevSelected = scene.selected ?? []\n scene.selected = targets\n /* things-scene spells these in capitals. */\n scene.distribute(op.axis === 'horizontal' ? 'HORIZONTAL' : 'VERTICAL')\n scene.selected = prevSelected\n const inverseOps: SceneEditOp[] = beforeBounds.map(b => ({\n op: 'modify',\n refid: b.refid,\n patch: { left: b.left, top: b.top } as any\n }))\n return { applied: true, inverseOps }\n }\n\n case 'group': {\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n const prevRefids = new Set<number>(collectAllRefids(scene))\n const prevSelected = scene.selected ?? []\n scene.selected = targets\n scene.group()\n scene.selected = prevSelected\n const newRefids = collectAllRefids(scene).filter(r => !prevRefids.has(r))\n const inverseOps: SceneEditOp[] = newRefids.map(refid => ({ op: 'ungroup', refid }))\n return { applied: true, inverseOps }\n }\n\n case 'ungroup': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target) return NOOP_RESULT\n const childRefids: number[] = []\n const children = (target as any).components ?? []\n for (const child of children) {\n const r = child.get?.('refid')\n if (typeof r === 'number') childRefids.push(r)\n }\n const prevSelected = scene.selected ?? []\n scene.selected = [target]\n scene.ungroup()\n scene.selected = prevSelected.filter((c: any) => c !== target)\n const inverseOps: SceneEditOp[] =\n childRefids.length >= 2 ? [{ op: 'group', refids: childRefids }] : []\n return { applied: true, inverseOps }\n }\n\n case 'zorder': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target) return NOOP_RESULT\n const prevSelected = scene.selected ?? []\n scene.selected = [target]\n scene.zorder(op.direction)\n scene.selected = prevSelected\n /*\n * Best effort. forward/backward invert exactly; front/back do not — sending something\n * to the front and then to the back does not put it back where it was.\n */\n const opp: Record<string, 'front' | 'back' | 'forward' | 'backward'> = {\n forward: 'backward',\n backward: 'forward',\n front: 'back',\n back: 'front'\n }\n const dir = opp[op.direction]\n const inverseOps: SceneEditOp[] = dir ? [{ op: 'zorder', refid: op.refid, direction: dir }] : []\n return { applied: true, inverseOps }\n }\n\n case 'arrange': {\n /*\n * things-scene has no native call for this, so the positions are computed here and\n * written with `set`. Only left/top move; width and height are the author's.\n */\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n\n const beforePositions = targets.map((c: any) => ({\n refid: c.get('refid'),\n left: c.get('left'),\n top: c.get('top')\n }))\n const sizes = targets.map((c: any) => ({\n width: typeof c.get('width') === 'number' ? c.get('width') : 0,\n height: typeof c.get('height') === 'number' ? c.get('height') : 0\n }))\n\n const positions = computeArrangePositions(op.layout, beforePositions, sizes)\n for (let i = 0; i < targets.length; i++) {\n const t = targets[i]\n const pos = positions[i]\n const merged = mergeComponent(t.model, { left: pos.left, top: pos.top } as any)\n t.set(merged)\n }\n /* One snapshot for the whole arrangement — moving twelve things is one undo. */\n scene.commander?.execute(null, false)\n\n const inverseOps: SceneEditOp[] = beforePositions.map(b => ({\n op: 'modify',\n refid: b.refid,\n patch: { left: b.left, top: b.top } as any\n }))\n return { applied: true, inverseOps }\n }\n\n case 'replace':\n return NOOP_RESULT\n\n default:\n return NOOP_RESULT\n }\n}\n\n/**\n * Carry out one view action on a live scene.\n *\n * Returns false when it could not — an unknown action, a missing component. Nothing here\n * touches the model, so nothing here enters the undo history.\n *\n * `setSceneMode` changes `scene.mode`; a host holding its own reactive copy re-reads it.\n * things-scene spells the modes 1 for edit and 0 for view.\n */\nexport function dispatchSceneAction(scene: any, action: SceneActionOp): boolean {\n if (!scene || !action) return false\n switch (action.action) {\n case 'selectComponents': {\n const refids = Array.isArray(action.refids) ? action.refids : []\n scene.selected = refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n return true\n }\n case 'centerToComponent': {\n const target = findSceneComponent(scene, { refid: action.refid })\n if (!target) return false\n scene.centerTo(target, action.animated !== false)\n return true\n }\n case 'fitToView': {\n scene.fit(action.mode ?? 'fit')\n return true\n }\n case 'setSceneMode': {\n scene.mode = action.mode === 'edit' ? 1 : 0\n return true\n }\n case 'highlightComponents': {\n /* things-scene's own call — it outlines in 2D and in 3D. */\n const refids = Array.isArray(action.refids) ? action.refids : []\n const targets = refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (typeof scene.highlightSearchResults === 'function') {\n scene.highlightSearchResults(targets)\n }\n if (typeof scene.invalidate === 'function') scene.invalidate()\n return true\n }\n default:\n return false\n }\n}\n\n/**\n * Where each component goes for a grid, row or column arrangement.\n *\n * - Only left/top are produced; sizes are the author's and are left alone.\n * - grid cells are as wide and as tall as the largest component, so components of\n * different sizes do not overlap. Filled row by row.\n * - row and column walk each component's own size plus the gap, and `align` decides the\n * cross axis.\n * - Without an anchor, the first component's current position is the origin, so the result\n * starts where the user is already looking.\n */\nexport function computeArrangePositions(\n layout: ArrangeLayout,\n current: Array<{ left: number; top: number }>,\n sizes: Array<{ width: number; height: number }>\n): Array<{ left: number; top: number }> {\n if (current.length === 0) return []\n const anchor = layout.anchor ?? { left: current[0].left, top: current[0].top }\n const gap = typeof layout.gap === 'number' ? layout.gap : 10\n\n if (layout.type === 'grid') {\n const cols = Math.max(1, Math.floor(layout.cols))\n const cellW = sizes.reduce((m, s) => Math.max(m, s.width), 0)\n const cellH = sizes.reduce((m, s) => Math.max(m, s.height), 0)\n return current.map((_, i) => {\n const row = Math.floor(i / cols)\n const col = i % cols\n return {\n left: anchor.left + col * (cellW + gap),\n top: anchor.top + row * (cellH + gap)\n }\n })\n }\n\n if (layout.type === 'row') {\n const align = layout.align ?? 'start'\n const maxH = sizes.reduce((m, s) => Math.max(m, s.height), 0)\n const out: Array<{ left: number; top: number }> = []\n let cursor = anchor.left\n for (const s of sizes) {\n let top = anchor.top\n if (align === 'center') top = anchor.top + (maxH - s.height) / 2\n else if (align === 'end') top = anchor.top + (maxH - s.height)\n out.push({ left: cursor, top })\n cursor += s.width + gap\n }\n return out\n }\n\n const align = layout.align ?? 'start'\n const maxW = sizes.reduce((m, s) => Math.max(m, s.width), 0)\n const out: Array<{ left: number; top: number }> = []\n let cursor = anchor.top\n for (const s of sizes) {\n let left = anchor.left\n if (align === 'center') left = anchor.left + (maxW - s.width) / 2\n else if (align === 'end') left = anchor.left + (maxW - s.width)\n out.push({ left, top: cursor })\n cursor += s.height + gap\n }\n return out\n}\n\n/**\n * Every refid currently in the scene.\n *\n * Called on both sides of an `add` or a `group`, so that the difference tells us which refids\n * the scene just issued — which is the only way to write their inverse.\n */\nexport function collectAllRefids(scene: any): number[] {\n const refids: number[] = []\n const map = scene?.rootContainer?.refidIndexMap\n if (map && typeof map.forEach === 'function') {\n map.forEach((_: any, refid: number) => refids.push(refid))\n }\n return refids\n}\n\n/**\n * The current values of exactly the keys a patch is about to change, deep-cloned.\n *\n * This is the patch of the inverse `modify`. A key the model did not have is kept as null,\n * which the mergers read as \"remove it\" — so undoing an added key removes it again.\n */\nexport function captureOldKeys(model: any, patch: any): any {\n const out: any = {}\n for (const k of Object.keys(patch || {})) {\n const v = model?.[k]\n out[k] = v === undefined ? null : JSON.parse(JSON.stringify(v))\n }\n return out\n}\n"]}
1
+ {"version":3,"file":"apply-scene.js","sourceRoot":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AAC,GAAG,SAAS,CAAA;IAC3C,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAgB,cAAc,CAAC,KAAU,EAAE,KAAU;IACnD,MAAM,GAAG,GAAQ,EAAE,CAAA;IACnB,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;QACzC,MAAM,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;QACpB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IACjE,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["/**\n * Applying edit operations to a scene that is open on screen.\n *\n * The difference from `apply-model.ts` is the commander. Everything here goes through\n * things-scene's own mutation API (`scene.add`, `target.set`, `scene.align`, …), so the\n * commander records a snapshot and the user keeps undo, the dirty mark and their selection.\n * Rebuilding the model and handing it back would take all three away.\n *\n * The scene is typed `any` on purpose: things-scene's Scene is a large surface and this\n * module needs eight methods of it. Typing it loosely is what lets the whole file be tested\n * with a plain object, which is how the operations below are actually covered.\n */\nimport type { ArrangeLayout, SceneActionOp, SceneEditOp } from './ops.js'\nimport { mergeComponent } from './apply-model.js'\n\nexport interface DispatchContext {\n /**\n * Fill an `add` component out with the defaults of its type before it goes in.\n *\n * The host does this because the defaults live in its template registry — an editor knows\n * what a fresh component of each type looks like, and this module does not. Left out, the\n * component goes to the scene exactly as given.\n */\n normalize?: (c: any) => any\n}\n\nexport interface DispatchResult {\n /** False when nothing happened — an unknown refid, too few targets, an op we do not take. */\n applied: boolean\n /**\n * How to undo this one operation, computed from the scene as it was. One operation can\n * need several: an `align` of five components inverts to five `modify`s.\n */\n inverseOps: SceneEditOp[]\n}\n\nconst NOOP_RESULT: DispatchResult = { applied: false, inverseOps: [] }\n\n/**\n * Find a component by refid, or by id when that is all the caller has.\n *\n * refid is issued by things-scene to everything in the scene; id is an optional string the\n * author may have set. refid is tried first because it is the one that is always there.\n */\nexport function findSceneComponent(scene: any, target: { id?: string; refid?: number }): any {\n if (!scene) return null\n if (typeof target.refid === 'number') {\n const byRefid = scene.rootContainer?.refidIndexMap?.get(target.refid)\n if (byRefid) return byRefid\n }\n if (typeof target.id === 'string' && target.id.length > 0) {\n return scene.findById?.(target.id) ?? null\n }\n return null\n}\n\n/**\n * Carry out one edit operation on a live scene.\n *\n * `replace` is not taken here — swapping the whole model is the host's own path, because it\n * has to decide what happens to the selection and the undo stack.\n */\nexport function dispatchSceneEditOp(\n scene: any,\n op: SceneEditOp,\n ctx: DispatchContext = {}\n): DispatchResult {\n if (!scene || !op) return NOOP_RESULT\n const normalize = ctx.normalize ?? ((c: any) => c)\n\n switch (op.op) {\n case 'add': {\n const normalized = normalize(op.component)\n /* The inverse needs the refid the scene is about to issue, so we diff around the add. */\n const prevRefids = new Set<number>(collectAllRefids(scene))\n scene.add(normalized, {})\n const newRefids = collectAllRefids(scene).filter(r => !prevRefids.has(r))\n const inverseOps: SceneEditOp[] = newRefids.map(refid => ({ op: 'remove', refid }))\n return { applied: true, inverseOps }\n }\n\n case 'remove': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target || !target.parent) return NOOP_RESULT\n const savedModel = JSON.parse(JSON.stringify(target.model))\n const prevSelected = scene.selected ?? []\n scene.selected = [target]\n scene.remove()\n scene.selected = prevSelected.filter((c: any) => c !== target)\n return { applied: true, inverseOps: [{ op: 'add', component: savedModel }] }\n }\n\n case 'modify': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target) return NOOP_RESULT\n const oldValues = captureOldKeys(target.model, op.patch as any)\n const merged = mergeComponent(target.model, op.patch as any)\n target.set(withClearedKeys(merged, op.patch as any))\n /* `set` does not push a snapshot by itself — ask the commander for one. */\n scene.commander?.execute(null, false)\n return {\n applied: true,\n inverseOps: [{ op: 'modify', refid: op.refid, patch: oldValues }]\n }\n }\n\n case 'modifyScene': {\n const root = scene.root\n if (!root || typeof root.set !== 'function') return NOOP_RESULT\n const cleanPatch = { ...((op.patch as any) || {}) }\n delete cleanPatch.components /* children move by add/remove/modify */\n const oldValues = captureOldKeys(root.model, cleanPatch)\n const merged = mergeComponent(root.model, cleanPatch)\n root.set(withClearedKeys(merged, cleanPatch))\n scene.commander?.execute(null, false)\n return { applied: true, inverseOps: [{ op: 'modifyScene', patch: oldValues }] }\n }\n\n case 'align': {\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n const beforeBounds = targets.map((c: any) => ({\n refid: c.get('refid'),\n left: c.get('left'),\n top: c.get('top'),\n width: c.get('width'),\n height: c.get('height')\n }))\n const prevSelected = scene.selected ?? []\n scene.selected = targets\n scene.align(op.direction)\n scene.selected = prevSelected\n /* Undo restores the coordinates we read, rather than trying to invert the alignment. */\n const inverseOps: SceneEditOp[] = beforeBounds.map(b => ({\n op: 'modify',\n refid: b.refid,\n patch: { left: b.left, top: b.top, width: b.width, height: b.height } as any\n }))\n return { applied: true, inverseOps }\n }\n\n case 'distribute': {\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n const beforeBounds = targets.map((c: any) => ({\n refid: c.get('refid'),\n left: c.get('left'),\n top: c.get('top')\n }))\n const prevSelected = scene.selected ?? []\n scene.selected = targets\n /* things-scene spells these in capitals. */\n scene.distribute(op.axis === 'horizontal' ? 'HORIZONTAL' : 'VERTICAL')\n scene.selected = prevSelected\n const inverseOps: SceneEditOp[] = beforeBounds.map(b => ({\n op: 'modify',\n refid: b.refid,\n patch: { left: b.left, top: b.top } as any\n }))\n return { applied: true, inverseOps }\n }\n\n case 'group': {\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n const prevRefids = new Set<number>(collectAllRefids(scene))\n const prevSelected = scene.selected ?? []\n scene.selected = targets\n scene.group()\n scene.selected = prevSelected\n const newRefids = collectAllRefids(scene).filter(r => !prevRefids.has(r))\n const inverseOps: SceneEditOp[] = newRefids.map(refid => ({ op: 'ungroup', refid }))\n return { applied: true, inverseOps }\n }\n\n case 'ungroup': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target) return NOOP_RESULT\n const childRefids: number[] = []\n const children = (target as any).components ?? []\n for (const child of children) {\n const r = child.get?.('refid')\n if (typeof r === 'number') childRefids.push(r)\n }\n const prevSelected = scene.selected ?? []\n scene.selected = [target]\n scene.ungroup()\n scene.selected = prevSelected.filter((c: any) => c !== target)\n const inverseOps: SceneEditOp[] =\n childRefids.length >= 2 ? [{ op: 'group', refids: childRefids }] : []\n return { applied: true, inverseOps }\n }\n\n case 'zorder': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target) return NOOP_RESULT\n const prevSelected = scene.selected ?? []\n scene.selected = [target]\n scene.zorder(op.direction)\n scene.selected = prevSelected\n /*\n * Best effort. forward/backward invert exactly; front/back do not — sending something\n * to the front and then to the back does not put it back where it was.\n */\n const opp: Record<string, 'front' | 'back' | 'forward' | 'backward'> = {\n forward: 'backward',\n backward: 'forward',\n front: 'back',\n back: 'front'\n }\n const dir = opp[op.direction]\n const inverseOps: SceneEditOp[] = dir ? [{ op: 'zorder', refid: op.refid, direction: dir }] : []\n return { applied: true, inverseOps }\n }\n\n case 'arrange': {\n /*\n * things-scene has no native call for this, so the positions are computed here and\n * written with `set`. Only left/top move; width and height are the author's.\n */\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n\n const beforePositions = targets.map((c: any) => ({\n refid: c.get('refid'),\n left: c.get('left'),\n top: c.get('top')\n }))\n const sizes = targets.map((c: any) => ({\n width: typeof c.get('width') === 'number' ? c.get('width') : 0,\n height: typeof c.get('height') === 'number' ? c.get('height') : 0\n }))\n\n const positions = computeArrangePositions(op.layout, beforePositions, sizes)\n for (let i = 0; i < targets.length; i++) {\n const t = targets[i]\n const pos = positions[i]\n const merged = mergeComponent(t.model, { left: pos.left, top: pos.top } as any)\n t.set(merged)\n }\n /* One snapshot for the whole arrangement — moving twelve things is one undo. */\n scene.commander?.execute(null, false)\n\n const inverseOps: SceneEditOp[] = beforePositions.map(b => ({\n op: 'modify',\n refid: b.refid,\n patch: { left: b.left, top: b.top } as any\n }))\n return { applied: true, inverseOps }\n }\n\n case 'replace':\n return NOOP_RESULT\n\n default:\n return NOOP_RESULT\n }\n}\n\n/**\n * Carry out one view action on a live scene.\n *\n * Returns false when it could not — an unknown action, a missing component. Nothing here\n * touches the model, so nothing here enters the undo history.\n *\n * `setSceneMode` changes `scene.mode`; a host holding its own reactive copy re-reads it.\n * things-scene spells the modes 1 for edit and 0 for view.\n */\nexport function dispatchSceneAction(scene: any, action: SceneActionOp): boolean {\n if (!scene || !action) return false\n switch (action.action) {\n case 'selectComponents': {\n const refids = Array.isArray(action.refids) ? action.refids : []\n scene.selected = refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n return true\n }\n case 'centerToComponent': {\n const target = findSceneComponent(scene, { refid: action.refid })\n if (!target) return false\n scene.centerTo(target, action.animated !== false)\n return true\n }\n case 'fitToView': {\n scene.fit(action.mode ?? 'fit')\n return true\n }\n case 'setSceneMode': {\n scene.mode = action.mode === 'edit' ? 1 : 0\n return true\n }\n case 'highlightComponents': {\n /* things-scene's own call — it outlines in 2D and in 3D. */\n const refids = Array.isArray(action.refids) ? action.refids : []\n const targets = refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (typeof scene.highlightSearchResults === 'function') {\n scene.highlightSearchResults(targets)\n }\n if (typeof scene.invalidate === 'function') scene.invalidate()\n return true\n }\n default:\n return false\n }\n}\n\n/**\n * Where each component goes for a grid, row or column arrangement.\n *\n * - Only left/top are produced; sizes are the author's and are left alone.\n * - grid cells are as wide and as tall as the largest component, so components of\n * different sizes do not overlap. Filled row by row.\n * - row and column walk each component's own size plus the gap, and `align` decides the\n * cross axis.\n * - Without an anchor, the first component's current position is the origin, so the result\n * starts where the user is already looking.\n */\nexport function computeArrangePositions(\n layout: ArrangeLayout,\n current: Array<{ left: number; top: number }>,\n sizes: Array<{ width: number; height: number }>\n): Array<{ left: number; top: number }> {\n if (current.length === 0) return []\n const anchor = layout.anchor ?? { left: current[0].left, top: current[0].top }\n const gap = typeof layout.gap === 'number' ? layout.gap : 10\n\n if (layout.type === 'grid') {\n const cols = Math.max(1, Math.floor(layout.cols))\n const cellW = sizes.reduce((m, s) => Math.max(m, s.width), 0)\n const cellH = sizes.reduce((m, s) => Math.max(m, s.height), 0)\n return current.map((_, i) => {\n const row = Math.floor(i / cols)\n const col = i % cols\n return {\n left: anchor.left + col * (cellW + gap),\n top: anchor.top + row * (cellH + gap)\n }\n })\n }\n\n if (layout.type === 'row') {\n const align = layout.align ?? 'start'\n const maxH = sizes.reduce((m, s) => Math.max(m, s.height), 0)\n const out: Array<{ left: number; top: number }> = []\n let cursor = anchor.left\n for (const s of sizes) {\n let top = anchor.top\n if (align === 'center') top = anchor.top + (maxH - s.height) / 2\n else if (align === 'end') top = anchor.top + (maxH - s.height)\n out.push({ left: cursor, top })\n cursor += s.width + gap\n }\n return out\n }\n\n const align = layout.align ?? 'start'\n const maxW = sizes.reduce((m, s) => Math.max(m, s.width), 0)\n const out: Array<{ left: number; top: number }> = []\n let cursor = anchor.top\n for (const s of sizes) {\n let left = anchor.left\n if (align === 'center') left = anchor.left + (maxW - s.width) / 2\n else if (align === 'end') left = anchor.left + (maxW - s.width)\n out.push({ left, top: cursor })\n cursor += s.height + gap\n }\n return out\n}\n\n/**\n * Every refid currently in the scene.\n *\n * Called on both sides of an `add` or a `group`, so that the difference tells us which refids\n * the scene just issued — which is the only way to write their inverse.\n */\nexport function collectAllRefids(scene: any): number[] {\n const refids: number[] = []\n const map = scene?.rootContainer?.refidIndexMap\n if (map && typeof map.forEach === 'function') {\n map.forEach((_: any, refid: number) => refids.push(refid))\n }\n return refids\n}\n\n/**\n * The current values of exactly the keys a patch is about to change, deep-cloned.\n *\n * This is the patch of the inverse `modify`. A key the model did not have is kept as null,\n * which the mergers read as \"remove it\" — so undoing an added key removes it again.\n */\n/**\n * `null` in a patch means \"this key should not be there\" - it is how an inverse restores a\n * property the component did not have before the edit (see `captureOldKeys`).\n *\n * `mergeComponent` deletes such a key from the merged model, but a component's `set()` only writes\n * the keys it is given, so the old value stayed: an AI edit that added a first binding or a first\n * fill colour could not be reverted - the chat said \"reverted\" and the property was still there.\n * Handing the key over as `undefined` makes `set()` clear it.\n */\nfunction withClearedKeys(merged: any, patch: any): any {\n const out = { ...merged }\n for (const k of Object.keys(patch || {})) {\n if (patch[k] === null) out[k] = undefined\n }\n return out\n}\n\nexport function captureOldKeys(model: any, patch: any): any {\n const out: any = {}\n for (const k of Object.keys(patch || {})) {\n const v = model?.[k]\n out[k] = v === undefined ? null : JSON.parse(JSON.stringify(v))\n }\n return out\n}\n"]}
@@ -85,10 +85,4 @@ export declare function computeArrangePositions(layout: ArrangeLayout, current:
85
85
  * the scene just issued — which is the only way to write their inverse.
86
86
  */
87
87
  export declare function collectAllRefids(scene: any): number[];
88
- /**
89
- * The current values of exactly the keys a patch is about to change, deep-cloned.
90
- *
91
- * This is the patch of the inverse `modify`. A key the model did not have is kept as null,
92
- * which the mergers read as "remove it" — so undoing an added key removes it again.
93
- */
94
88
  export declare function captureOldKeys(model: any, patch: any): any;
@@ -56,7 +56,7 @@ export function dispatchSceneEditOp(scene, op, ctx = {}) {
56
56
  return NOOP_RESULT;
57
57
  const oldValues = captureOldKeys(target.model, op.patch);
58
58
  const merged = mergeComponent(target.model, op.patch);
59
- target.set(merged);
59
+ target.set(withClearedKeys(merged, op.patch));
60
60
  /* `set` does not push a snapshot by itself — ask the commander for one. */
61
61
  scene.commander?.execute(null, false);
62
62
  return {
@@ -72,7 +72,7 @@ export function dispatchSceneEditOp(scene, op, ctx = {}) {
72
72
  delete cleanPatch.components; /* children move by add/remove/modify */
73
73
  const oldValues = captureOldKeys(root.model, cleanPatch);
74
74
  const merged = mergeComponent(root.model, cleanPatch);
75
- root.set(merged);
75
+ root.set(withClearedKeys(merged, cleanPatch));
76
76
  scene.commander?.execute(null, false);
77
77
  return { applied: true, inverseOps: [{ op: 'modifyScene', patch: oldValues }] };
78
78
  }
@@ -340,6 +340,23 @@ export function collectAllRefids(scene) {
340
340
  * This is the patch of the inverse `modify`. A key the model did not have is kept as null,
341
341
  * which the mergers read as "remove it" — so undoing an added key removes it again.
342
342
  */
343
+ /**
344
+ * `null` in a patch means "this key should not be there" - it is how an inverse restores a
345
+ * property the component did not have before the edit (see `captureOldKeys`).
346
+ *
347
+ * `mergeComponent` deletes such a key from the merged model, but a component's `set()` only writes
348
+ * the keys it is given, so the old value stayed: an AI edit that added a first binding or a first
349
+ * fill colour could not be reverted - the chat said "reverted" and the property was still there.
350
+ * Handing the key over as `undefined` makes `set()` clear it.
351
+ */
352
+ function withClearedKeys(merged, patch) {
353
+ const out = { ...merged };
354
+ for (const k of Object.keys(patch || {})) {
355
+ if (patch[k] === null)
356
+ out[k] = undefined;
357
+ }
358
+ return out;
359
+ }
343
360
  export function captureOldKeys(model, patch) {
344
361
  const out = {};
345
362
  for (const k of Object.keys(patch || {})) {
@@ -1 +1 @@
1
- {"version":3,"file":"apply-scene.js","sourceRoot":"","sources":["../../src/apply-scene.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAuBjD,MAAM,WAAW,GAAmB,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAAA;AAEtE;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAU,EAAE,MAAuC;IACpF,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,IAAI,OAAO,MAAM,CAA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AC/B,MAAM,IAAI,CAAC,CAAC,MAAM,GAAG,GAAG,CAAA;IAC1B,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAU;IACzC,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,MAAM,GAAG,GAAG,KAAK,EAAE,aAAa,EAAE,aAAa,CAAA;IAC/C,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QAC7C,GAAG,CAAC,OAAO,CAAC,CAAC,CAAM,EAAE,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAC5D,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAU,EAAE,KAAU;IACnD,MAAM,GAAG,GAAQ,EAAE,CAAA;IACnB,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;QACzC,MAAM,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;QACpB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IACjE,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["/**\n * Applying edit operations to a scene that is open on screen.\n *\n * The difference from `apply-model.ts` is the commander. Everything here goes through\n * things-scene's own mutation API (`scene.add`, `target.set`, `scene.align`, …), so the\n * commander records a snapshot and the user keeps undo, the dirty mark and their selection.\n * Rebuilding the model and handing it back would take all three away.\n *\n * The scene is typed `any` on purpose: things-scene's Scene is a large surface and this\n * module needs eight methods of it. Typing it loosely is what lets the whole file be tested\n * with a plain object, which is how the operations below are actually covered.\n */\nimport type { ArrangeLayout, SceneActionOp, SceneEditOp } from './ops.js'\nimport { mergeComponent } from './apply-model.js'\n\nexport interface DispatchContext {\n /**\n * Fill an `add` component out with the defaults of its type before it goes in.\n *\n * The host does this because the defaults live in its template registry — an editor knows\n * what a fresh component of each type looks like, and this module does not. Left out, the\n * component goes to the scene exactly as given.\n */\n normalize?: (c: any) => any\n}\n\nexport interface DispatchResult {\n /** False when nothing happened — an unknown refid, too few targets, an op we do not take. */\n applied: boolean\n /**\n * How to undo this one operation, computed from the scene as it was. One operation can\n * need several: an `align` of five components inverts to five `modify`s.\n */\n inverseOps: SceneEditOp[]\n}\n\nconst NOOP_RESULT: DispatchResult = { applied: false, inverseOps: [] }\n\n/**\n * Find a component by refid, or by id when that is all the caller has.\n *\n * refid is issued by things-scene to everything in the scene; id is an optional string the\n * author may have set. refid is tried first because it is the one that is always there.\n */\nexport function findSceneComponent(scene: any, target: { id?: string; refid?: number }): any {\n if (!scene) return null\n if (typeof target.refid === 'number') {\n const byRefid = scene.rootContainer?.refidIndexMap?.get(target.refid)\n if (byRefid) return byRefid\n }\n if (typeof target.id === 'string' && target.id.length > 0) {\n return scene.findById?.(target.id) ?? null\n }\n return null\n}\n\n/**\n * Carry out one edit operation on a live scene.\n *\n * `replace` is not taken here — swapping the whole model is the host's own path, because it\n * has to decide what happens to the selection and the undo stack.\n */\nexport function dispatchSceneEditOp(\n scene: any,\n op: SceneEditOp,\n ctx: DispatchContext = {}\n): DispatchResult {\n if (!scene || !op) return NOOP_RESULT\n const normalize = ctx.normalize ?? ((c: any) => c)\n\n switch (op.op) {\n case 'add': {\n const normalized = normalize(op.component)\n /* The inverse needs the refid the scene is about to issue, so we diff around the add. */\n const prevRefids = new Set<number>(collectAllRefids(scene))\n scene.add(normalized, {})\n const newRefids = collectAllRefids(scene).filter(r => !prevRefids.has(r))\n const inverseOps: SceneEditOp[] = newRefids.map(refid => ({ op: 'remove', refid }))\n return { applied: true, inverseOps }\n }\n\n case 'remove': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target || !target.parent) return NOOP_RESULT\n const savedModel = JSON.parse(JSON.stringify(target.model))\n const prevSelected = scene.selected ?? []\n scene.selected = [target]\n scene.remove()\n scene.selected = prevSelected.filter((c: any) => c !== target)\n return { applied: true, inverseOps: [{ op: 'add', component: savedModel }] }\n }\n\n case 'modify': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target) return NOOP_RESULT\n const oldValues = captureOldKeys(target.model, op.patch as any)\n const merged = mergeComponent(target.model, op.patch as any)\n target.set(merged)\n /* `set` does not push a snapshot by itself — ask the commander for one. */\n scene.commander?.execute(null, false)\n return {\n applied: true,\n inverseOps: [{ op: 'modify', refid: op.refid, patch: oldValues }]\n }\n }\n\n case 'modifyScene': {\n const root = scene.root\n if (!root || typeof root.set !== 'function') return NOOP_RESULT\n const cleanPatch = { ...((op.patch as any) || {}) }\n delete cleanPatch.components /* children move by add/remove/modify */\n const oldValues = captureOldKeys(root.model, cleanPatch)\n const merged = mergeComponent(root.model, cleanPatch)\n root.set(merged)\n scene.commander?.execute(null, false)\n return { applied: true, inverseOps: [{ op: 'modifyScene', patch: oldValues }] }\n }\n\n case 'align': {\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n const beforeBounds = targets.map((c: any) => ({\n refid: c.get('refid'),\n left: c.get('left'),\n top: c.get('top'),\n width: c.get('width'),\n height: c.get('height')\n }))\n const prevSelected = scene.selected ?? []\n scene.selected = targets\n scene.align(op.direction)\n scene.selected = prevSelected\n /* Undo restores the coordinates we read, rather than trying to invert the alignment. */\n const inverseOps: SceneEditOp[] = beforeBounds.map(b => ({\n op: 'modify',\n refid: b.refid,\n patch: { left: b.left, top: b.top, width: b.width, height: b.height } as any\n }))\n return { applied: true, inverseOps }\n }\n\n case 'distribute': {\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n const beforeBounds = targets.map((c: any) => ({\n refid: c.get('refid'),\n left: c.get('left'),\n top: c.get('top')\n }))\n const prevSelected = scene.selected ?? []\n scene.selected = targets\n /* things-scene spells these in capitals. */\n scene.distribute(op.axis === 'horizontal' ? 'HORIZONTAL' : 'VERTICAL')\n scene.selected = prevSelected\n const inverseOps: SceneEditOp[] = beforeBounds.map(b => ({\n op: 'modify',\n refid: b.refid,\n patch: { left: b.left, top: b.top } as any\n }))\n return { applied: true, inverseOps }\n }\n\n case 'group': {\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n const prevRefids = new Set<number>(collectAllRefids(scene))\n const prevSelected = scene.selected ?? []\n scene.selected = targets\n scene.group()\n scene.selected = prevSelected\n const newRefids = collectAllRefids(scene).filter(r => !prevRefids.has(r))\n const inverseOps: SceneEditOp[] = newRefids.map(refid => ({ op: 'ungroup', refid }))\n return { applied: true, inverseOps }\n }\n\n case 'ungroup': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target) return NOOP_RESULT\n const childRefids: number[] = []\n const children = (target as any).components ?? []\n for (const child of children) {\n const r = child.get?.('refid')\n if (typeof r === 'number') childRefids.push(r)\n }\n const prevSelected = scene.selected ?? []\n scene.selected = [target]\n scene.ungroup()\n scene.selected = prevSelected.filter((c: any) => c !== target)\n const inverseOps: SceneEditOp[] =\n childRefids.length >= 2 ? [{ op: 'group', refids: childRefids }] : []\n return { applied: true, inverseOps }\n }\n\n case 'zorder': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target) return NOOP_RESULT\n const prevSelected = scene.selected ?? []\n scene.selected = [target]\n scene.zorder(op.direction)\n scene.selected = prevSelected\n /*\n * Best effort. forward/backward invert exactly; front/back do not — sending something\n * to the front and then to the back does not put it back where it was.\n */\n const opp: Record<string, 'front' | 'back' | 'forward' | 'backward'> = {\n forward: 'backward',\n backward: 'forward',\n front: 'back',\n back: 'front'\n }\n const dir = opp[op.direction]\n const inverseOps: SceneEditOp[] = dir ? [{ op: 'zorder', refid: op.refid, direction: dir }] : []\n return { applied: true, inverseOps }\n }\n\n case 'arrange': {\n /*\n * things-scene has no native call for this, so the positions are computed here and\n * written with `set`. Only left/top move; width and height are the author's.\n */\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n\n const beforePositions = targets.map((c: any) => ({\n refid: c.get('refid'),\n left: c.get('left'),\n top: c.get('top')\n }))\n const sizes = targets.map((c: any) => ({\n width: typeof c.get('width') === 'number' ? c.get('width') : 0,\n height: typeof c.get('height') === 'number' ? c.get('height') : 0\n }))\n\n const positions = computeArrangePositions(op.layout, beforePositions, sizes)\n for (let i = 0; i < targets.length; i++) {\n const t = targets[i]\n const pos = positions[i]\n const merged = mergeComponent(t.model, { left: pos.left, top: pos.top } as any)\n t.set(merged)\n }\n /* One snapshot for the whole arrangement — moving twelve things is one undo. */\n scene.commander?.execute(null, false)\n\n const inverseOps: SceneEditOp[] = beforePositions.map(b => ({\n op: 'modify',\n refid: b.refid,\n patch: { left: b.left, top: b.top } as any\n }))\n return { applied: true, inverseOps }\n }\n\n case 'replace':\n return NOOP_RESULT\n\n default:\n return NOOP_RESULT\n }\n}\n\n/**\n * Carry out one view action on a live scene.\n *\n * Returns false when it could not — an unknown action, a missing component. Nothing here\n * touches the model, so nothing here enters the undo history.\n *\n * `setSceneMode` changes `scene.mode`; a host holding its own reactive copy re-reads it.\n * things-scene spells the modes 1 for edit and 0 for view.\n */\nexport function dispatchSceneAction(scene: any, action: SceneActionOp): boolean {\n if (!scene || !action) return false\n switch (action.action) {\n case 'selectComponents': {\n const refids = Array.isArray(action.refids) ? action.refids : []\n scene.selected = refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n return true\n }\n case 'centerToComponent': {\n const target = findSceneComponent(scene, { refid: action.refid })\n if (!target) return false\n scene.centerTo(target, action.animated !== false)\n return true\n }\n case 'fitToView': {\n scene.fit(action.mode ?? 'fit')\n return true\n }\n case 'setSceneMode': {\n scene.mode = action.mode === 'edit' ? 1 : 0\n return true\n }\n case 'highlightComponents': {\n /* things-scene's own call — it outlines in 2D and in 3D. */\n const refids = Array.isArray(action.refids) ? action.refids : []\n const targets = refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (typeof scene.highlightSearchResults === 'function') {\n scene.highlightSearchResults(targets)\n }\n if (typeof scene.invalidate === 'function') scene.invalidate()\n return true\n }\n default:\n return false\n }\n}\n\n/**\n * Where each component goes for a grid, row or column arrangement.\n *\n * - Only left/top are produced; sizes are the author's and are left alone.\n * - grid cells are as wide and as tall as the largest component, so components of\n * different sizes do not overlap. Filled row by row.\n * - row and column walk each component's own size plus the gap, and `align` decides the\n * cross axis.\n * - Without an anchor, the first component's current position is the origin, so the result\n * starts where the user is already looking.\n */\nexport function computeArrangePositions(\n layout: ArrangeLayout,\n current: Array<{ left: number; top: number }>,\n sizes: Array<{ width: number; height: number }>\n): Array<{ left: number; top: number }> {\n if (current.length === 0) return []\n const anchor = layout.anchor ?? { left: current[0].left, top: current[0].top }\n const gap = typeof layout.gap === 'number' ? layout.gap : 10\n\n if (layout.type === 'grid') {\n const cols = Math.max(1, Math.floor(layout.cols))\n const cellW = sizes.reduce((m, s) => Math.max(m, s.width), 0)\n const cellH = sizes.reduce((m, s) => Math.max(m, s.height), 0)\n return current.map((_, i) => {\n const row = Math.floor(i / cols)\n const col = i % cols\n return {\n left: anchor.left + col * (cellW + gap),\n top: anchor.top + row * (cellH + gap)\n }\n })\n }\n\n if (layout.type === 'row') {\n const align = layout.align ?? 'start'\n const maxH = sizes.reduce((m, s) => Math.max(m, s.height), 0)\n const out: Array<{ left: number; top: number }> = []\n let cursor = anchor.left\n for (const s of sizes) {\n let top = anchor.top\n if (align === 'center') top = anchor.top + (maxH - s.height) / 2\n else if (align === 'end') top = anchor.top + (maxH - s.height)\n out.push({ left: cursor, top })\n cursor += s.width + gap\n }\n return out\n }\n\n const align = layout.align ?? 'start'\n const maxW = sizes.reduce((m, s) => Math.max(m, s.width), 0)\n const out: Array<{ left: number; top: number }> = []\n let cursor = anchor.top\n for (const s of sizes) {\n let left = anchor.left\n if (align === 'center') left = anchor.left + (maxW - s.width) / 2\n else if (align === 'end') left = anchor.left + (maxW - s.width)\n out.push({ left, top: cursor })\n cursor += s.height + gap\n }\n return out\n}\n\n/**\n * Every refid currently in the scene.\n *\n * Called on both sides of an `add` or a `group`, so that the difference tells us which refids\n * the scene just issued — which is the only way to write their inverse.\n */\nexport function collectAllRefids(scene: any): number[] {\n const refids: number[] = []\n const map = scene?.rootContainer?.refidIndexMap\n if (map && typeof map.forEach === 'function') {\n map.forEach((_: any, refid: number) => refids.push(refid))\n }\n return refids\n}\n\n/**\n * The current values of exactly the keys a patch is about to change, deep-cloned.\n *\n * This is the patch of the inverse `modify`. A key the model did not have is kept as null,\n * which the mergers read as \"remove it\" — so undoing an added key removes it again.\n */\nexport function captureOldKeys(model: any, patch: any): any {\n const out: any = {}\n for (const k of Object.keys(patch || {})) {\n const v = model?.[k]\n out[k] = v === undefined ? null : JSON.parse(JSON.stringify(v))\n }\n return out\n}\n"]}
1
+ {"version":3,"file":"apply-scene.js","sourceRoot":"","sources":["../../src/apply-scene.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAuBjD,MAAM,WAAW,GAAmB,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAAA;AAEtE;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAU,EAAE,MAAuC;IACpF,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrC,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,EAAE,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,KAA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OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["/**\n * Applying edit operations to a scene that is open on screen.\n *\n * The difference from `apply-model.ts` is the commander. Everything here goes through\n * things-scene's own mutation API (`scene.add`, `target.set`, `scene.align`, …), so the\n * commander records a snapshot and the user keeps undo, the dirty mark and their selection.\n * Rebuilding the model and handing it back would take all three away.\n *\n * The scene is typed `any` on purpose: things-scene's Scene is a large surface and this\n * module needs eight methods of it. Typing it loosely is what lets the whole file be tested\n * with a plain object, which is how the operations below are actually covered.\n */\nimport type { ArrangeLayout, SceneActionOp, SceneEditOp } from './ops.js'\nimport { mergeComponent } from './apply-model.js'\n\nexport interface DispatchContext {\n /**\n * Fill an `add` component out with the defaults of its type before it goes in.\n *\n * The host does this because the defaults live in its template registry — an editor knows\n * what a fresh component of each type looks like, and this module does not. Left out, the\n * component goes to the scene exactly as given.\n */\n normalize?: (c: any) => any\n}\n\nexport interface DispatchResult {\n /** False when nothing happened — an unknown refid, too few targets, an op we do not take. */\n applied: boolean\n /**\n * How to undo this one operation, computed from the scene as it was. One operation can\n * need several: an `align` of five components inverts to five `modify`s.\n */\n inverseOps: SceneEditOp[]\n}\n\nconst NOOP_RESULT: DispatchResult = { applied: false, inverseOps: [] }\n\n/**\n * Find a component by refid, or by id when that is all the caller has.\n *\n * refid is issued by things-scene to everything in the scene; id is an optional string the\n * author may have set. refid is tried first because it is the one that is always there.\n */\nexport function findSceneComponent(scene: any, target: { id?: string; refid?: number }): any {\n if (!scene) return null\n if (typeof target.refid === 'number') {\n const byRefid = scene.rootContainer?.refidIndexMap?.get(target.refid)\n if (byRefid) return byRefid\n }\n if (typeof target.id === 'string' && target.id.length > 0) {\n return scene.findById?.(target.id) ?? null\n }\n return null\n}\n\n/**\n * Carry out one edit operation on a live scene.\n *\n * `replace` is not taken here — swapping the whole model is the host's own path, because it\n * has to decide what happens to the selection and the undo stack.\n */\nexport function dispatchSceneEditOp(\n scene: any,\n op: SceneEditOp,\n ctx: DispatchContext = {}\n): DispatchResult {\n if (!scene || !op) return NOOP_RESULT\n const normalize = ctx.normalize ?? ((c: any) => c)\n\n switch (op.op) {\n case 'add': {\n const normalized = normalize(op.component)\n /* The inverse needs the refid the scene is about to issue, so we diff around the add. */\n const prevRefids = new Set<number>(collectAllRefids(scene))\n scene.add(normalized, {})\n const newRefids = collectAllRefids(scene).filter(r => !prevRefids.has(r))\n const inverseOps: SceneEditOp[] = newRefids.map(refid => ({ op: 'remove', refid }))\n return { applied: true, inverseOps }\n }\n\n case 'remove': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target || !target.parent) return NOOP_RESULT\n const savedModel = JSON.parse(JSON.stringify(target.model))\n const prevSelected = scene.selected ?? []\n scene.selected = [target]\n scene.remove()\n scene.selected = prevSelected.filter((c: any) => c !== target)\n return { applied: true, inverseOps: [{ op: 'add', component: savedModel }] }\n }\n\n case 'modify': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target) return NOOP_RESULT\n const oldValues = captureOldKeys(target.model, op.patch as any)\n const merged = mergeComponent(target.model, op.patch as any)\n target.set(withClearedKeys(merged, op.patch as any))\n /* `set` does not push a snapshot by itself — ask the commander for one. */\n scene.commander?.execute(null, false)\n return {\n applied: true,\n inverseOps: [{ op: 'modify', refid: op.refid, patch: oldValues }]\n }\n }\n\n case 'modifyScene': {\n const root = scene.root\n if (!root || typeof root.set !== 'function') return NOOP_RESULT\n const cleanPatch = { ...((op.patch as any) || {}) }\n delete cleanPatch.components /* children move by add/remove/modify */\n const oldValues = captureOldKeys(root.model, cleanPatch)\n const merged = mergeComponent(root.model, cleanPatch)\n root.set(withClearedKeys(merged, cleanPatch))\n scene.commander?.execute(null, false)\n return { applied: true, inverseOps: [{ op: 'modifyScene', patch: oldValues }] }\n }\n\n case 'align': {\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n const beforeBounds = targets.map((c: any) => ({\n refid: c.get('refid'),\n left: c.get('left'),\n top: c.get('top'),\n width: c.get('width'),\n height: c.get('height')\n }))\n const prevSelected = scene.selected ?? []\n scene.selected = targets\n scene.align(op.direction)\n scene.selected = prevSelected\n /* Undo restores the coordinates we read, rather than trying to invert the alignment. */\n const inverseOps: SceneEditOp[] = beforeBounds.map(b => ({\n op: 'modify',\n refid: b.refid,\n patch: { left: b.left, top: b.top, width: b.width, height: b.height } as any\n }))\n return { applied: true, inverseOps }\n }\n\n case 'distribute': {\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n const beforeBounds = targets.map((c: any) => ({\n refid: c.get('refid'),\n left: c.get('left'),\n top: c.get('top')\n }))\n const prevSelected = scene.selected ?? []\n scene.selected = targets\n /* things-scene spells these in capitals. */\n scene.distribute(op.axis === 'horizontal' ? 'HORIZONTAL' : 'VERTICAL')\n scene.selected = prevSelected\n const inverseOps: SceneEditOp[] = beforeBounds.map(b => ({\n op: 'modify',\n refid: b.refid,\n patch: { left: b.left, top: b.top } as any\n }))\n return { applied: true, inverseOps }\n }\n\n case 'group': {\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n const prevRefids = new Set<number>(collectAllRefids(scene))\n const prevSelected = scene.selected ?? []\n scene.selected = targets\n scene.group()\n scene.selected = prevSelected\n const newRefids = collectAllRefids(scene).filter(r => !prevRefids.has(r))\n const inverseOps: SceneEditOp[] = newRefids.map(refid => ({ op: 'ungroup', refid }))\n return { applied: true, inverseOps }\n }\n\n case 'ungroup': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target) return NOOP_RESULT\n const childRefids: number[] = []\n const children = (target as any).components ?? []\n for (const child of children) {\n const r = child.get?.('refid')\n if (typeof r === 'number') childRefids.push(r)\n }\n const prevSelected = scene.selected ?? []\n scene.selected = [target]\n scene.ungroup()\n scene.selected = prevSelected.filter((c: any) => c !== target)\n const inverseOps: SceneEditOp[] =\n childRefids.length >= 2 ? [{ op: 'group', refids: childRefids }] : []\n return { applied: true, inverseOps }\n }\n\n case 'zorder': {\n const target = findSceneComponent(scene, { refid: op.refid })\n if (!target) return NOOP_RESULT\n const prevSelected = scene.selected ?? []\n scene.selected = [target]\n scene.zorder(op.direction)\n scene.selected = prevSelected\n /*\n * Best effort. forward/backward invert exactly; front/back do not — sending something\n * to the front and then to the back does not put it back where it was.\n */\n const opp: Record<string, 'front' | 'back' | 'forward' | 'backward'> = {\n forward: 'backward',\n backward: 'forward',\n front: 'back',\n back: 'front'\n }\n const dir = opp[op.direction]\n const inverseOps: SceneEditOp[] = dir ? [{ op: 'zorder', refid: op.refid, direction: dir }] : []\n return { applied: true, inverseOps }\n }\n\n case 'arrange': {\n /*\n * things-scene has no native call for this, so the positions are computed here and\n * written with `set`. Only left/top move; width and height are the author's.\n */\n const targets = op.refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (targets.length < 2) return NOOP_RESULT\n\n const beforePositions = targets.map((c: any) => ({\n refid: c.get('refid'),\n left: c.get('left'),\n top: c.get('top')\n }))\n const sizes = targets.map((c: any) => ({\n width: typeof c.get('width') === 'number' ? c.get('width') : 0,\n height: typeof c.get('height') === 'number' ? c.get('height') : 0\n }))\n\n const positions = computeArrangePositions(op.layout, beforePositions, sizes)\n for (let i = 0; i < targets.length; i++) {\n const t = targets[i]\n const pos = positions[i]\n const merged = mergeComponent(t.model, { left: pos.left, top: pos.top } as any)\n t.set(merged)\n }\n /* One snapshot for the whole arrangement — moving twelve things is one undo. */\n scene.commander?.execute(null, false)\n\n const inverseOps: SceneEditOp[] = beforePositions.map(b => ({\n op: 'modify',\n refid: b.refid,\n patch: { left: b.left, top: b.top } as any\n }))\n return { applied: true, inverseOps }\n }\n\n case 'replace':\n return NOOP_RESULT\n\n default:\n return NOOP_RESULT\n }\n}\n\n/**\n * Carry out one view action on a live scene.\n *\n * Returns false when it could not — an unknown action, a missing component. Nothing here\n * touches the model, so nothing here enters the undo history.\n *\n * `setSceneMode` changes `scene.mode`; a host holding its own reactive copy re-reads it.\n * things-scene spells the modes 1 for edit and 0 for view.\n */\nexport function dispatchSceneAction(scene: any, action: SceneActionOp): boolean {\n if (!scene || !action) return false\n switch (action.action) {\n case 'selectComponents': {\n const refids = Array.isArray(action.refids) ? action.refids : []\n scene.selected = refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n return true\n }\n case 'centerToComponent': {\n const target = findSceneComponent(scene, { refid: action.refid })\n if (!target) return false\n scene.centerTo(target, action.animated !== false)\n return true\n }\n case 'fitToView': {\n scene.fit(action.mode ?? 'fit')\n return true\n }\n case 'setSceneMode': {\n scene.mode = action.mode === 'edit' ? 1 : 0\n return true\n }\n case 'highlightComponents': {\n /* things-scene's own call — it outlines in 2D and in 3D. */\n const refids = Array.isArray(action.refids) ? action.refids : []\n const targets = refids.map(r => findSceneComponent(scene, { refid: r })).filter((c: any) => c)\n if (typeof scene.highlightSearchResults === 'function') {\n scene.highlightSearchResults(targets)\n }\n if (typeof scene.invalidate === 'function') scene.invalidate()\n return true\n }\n default:\n return false\n }\n}\n\n/**\n * Where each component goes for a grid, row or column arrangement.\n *\n * - Only left/top are produced; sizes are the author's and are left alone.\n * - grid cells are as wide and as tall as the largest component, so components of\n * different sizes do not overlap. Filled row by row.\n * - row and column walk each component's own size plus the gap, and `align` decides the\n * cross axis.\n * - Without an anchor, the first component's current position is the origin, so the result\n * starts where the user is already looking.\n */\nexport function computeArrangePositions(\n layout: ArrangeLayout,\n current: Array<{ left: number; top: number }>,\n sizes: Array<{ width: number; height: number }>\n): Array<{ left: number; top: number }> {\n if (current.length === 0) return []\n const anchor = layout.anchor ?? { left: current[0].left, top: current[0].top }\n const gap = typeof layout.gap === 'number' ? layout.gap : 10\n\n if (layout.type === 'grid') {\n const cols = Math.max(1, Math.floor(layout.cols))\n const cellW = sizes.reduce((m, s) => Math.max(m, s.width), 0)\n const cellH = sizes.reduce((m, s) => Math.max(m, s.height), 0)\n return current.map((_, i) => {\n const row = Math.floor(i / cols)\n const col = i % cols\n return {\n left: anchor.left + col * (cellW + gap),\n top: anchor.top + row * (cellH + gap)\n }\n })\n }\n\n if (layout.type === 'row') {\n const align = layout.align ?? 'start'\n const maxH = sizes.reduce((m, s) => Math.max(m, s.height), 0)\n const out: Array<{ left: number; top: number }> = []\n let cursor = anchor.left\n for (const s of sizes) {\n let top = anchor.top\n if (align === 'center') top = anchor.top + (maxH - s.height) / 2\n else if (align === 'end') top = anchor.top + (maxH - s.height)\n out.push({ left: cursor, top })\n cursor += s.width + gap\n }\n return out\n }\n\n const align = layout.align ?? 'start'\n const maxW = sizes.reduce((m, s) => Math.max(m, s.width), 0)\n const out: Array<{ left: number; top: number }> = []\n let cursor = anchor.top\n for (const s of sizes) {\n let left = anchor.left\n if (align === 'center') left = anchor.left + (maxW - s.width) / 2\n else if (align === 'end') left = anchor.left + (maxW - s.width)\n out.push({ left, top: cursor })\n cursor += s.height + gap\n }\n return out\n}\n\n/**\n * Every refid currently in the scene.\n *\n * Called on both sides of an `add` or a `group`, so that the difference tells us which refids\n * the scene just issued — which is the only way to write their inverse.\n */\nexport function collectAllRefids(scene: any): number[] {\n const refids: number[] = []\n const map = scene?.rootContainer?.refidIndexMap\n if (map && typeof map.forEach === 'function') {\n map.forEach((_: any, refid: number) => refids.push(refid))\n }\n return refids\n}\n\n/**\n * The current values of exactly the keys a patch is about to change, deep-cloned.\n *\n * This is the patch of the inverse `modify`. A key the model did not have is kept as null,\n * which the mergers read as \"remove it\" — so undoing an added key removes it again.\n */\n/**\n * `null` in a patch means \"this key should not be there\" - it is how an inverse restores a\n * property the component did not have before the edit (see `captureOldKeys`).\n *\n * `mergeComponent` deletes such a key from the merged model, but a component's `set()` only writes\n * the keys it is given, so the old value stayed: an AI edit that added a first binding or a first\n * fill colour could not be reverted - the chat said \"reverted\" and the property was still there.\n * Handing the key over as `undefined` makes `set()` clear it.\n */\nfunction withClearedKeys(merged: any, patch: any): any {\n const out = { ...merged }\n for (const k of Object.keys(patch || {})) {\n if (patch[k] === null) out[k] = undefined\n }\n return out\n}\n\nexport function captureOldKeys(model: any, patch: any): any {\n const out: any = {}\n for (const k of Object.keys(patch || {})) {\n const v = model?.[k]\n out[k] = v === undefined ? null : JSON.parse(JSON.stringify(v))\n }\n return out\n}\n"]}
@@ -1 +1 @@
1
- {"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../node_modules/typescript/lib/lib.esnext.float16.d.ts","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/tslib/tslib.d.ts","../src/model.ts","../src/ops.ts","../src/apply-model.ts","../src/apply-scene.ts","../src/index.ts","../../../node_modules/@types/node/globals.typedarray.d.ts","../../../node_modules/@types/node/buffer.buffer.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/web-globals/abortcontroller.d.ts","../../../node_modules/@types/node/web-globals/blob.d.ts","../../../node_modules/@types/node/web-globals/console.d.ts","../../../node_modules/@types/node/web-globals/crypto.d.ts","../../../node_modules/@types/node/web-globals/domexception.d.ts","../../../node_modules/@types/node/web-globals/encoding.d.ts","../../../node_modules/@types/node/web-globals/events.d.ts","../../../node_modules/undici-types/utility.d.ts","../../../node_modules/undici-types/header.d.ts","../../../node_modules/undici-types/readable.d.ts","../../../node_modules/undici-types/fetch.d.ts","../../../node_modules/undici-types/formdata.d.ts","../../../node_modules/undici-types/connector.d.ts","../../../node_modules/undici-types/client-stats.d.ts","../../../node_modules/undici-types/client.d.ts","../../../node_modules/undici-types/errors.d.ts","../../../node_modules/undici-types/dispatcher.d.ts","../../../node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/undici-types/global-origin.d.ts","../../../node_modules/undici-types/pool-stats.d.ts","../../../node_modules/undici-types/pool.d.ts","../../../node_modules/undici-types/handlers.d.ts","../../../node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/undici-types/round-robin-pool.d.ts","../../../node_modules/undici-types/h2c-client.d.ts","../../../node_modules/undici-types/agent.d.ts","../../../node_modules/undici-types/dispatcher1-wrapper.d.ts","../../../node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/undici-types/mock-call-history.d.ts","../../../node_modules/undici-types/mock-agent.d.ts","../../../node_modules/undici-types/mock-client.d.ts","../../../node_modules/undici-types/mock-pool.d.ts","../../../node_modules/undici-types/snapshot-agent.d.ts","../../../node_modules/undici-types/mock-errors.d.ts","../../../node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/undici-types/socks5-proxy-agent.d.ts","../../../node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/undici-types/retry-handler.d.ts","../../../node_modules/undici-types/retry-agent.d.ts","../../../node_modules/undici-types/api.d.ts","../../../node_modules/undici-types/cache-interceptor.d.ts","../../../node_modules/undici-types/interceptors.d.ts","../../../node_modules/undici-types/util.d.ts","../../../node_modules/undici-types/cookies.d.ts","../../../node_modules/undici-types/patch.d.ts","../../../node_modules/undici-types/websocket.d.ts","../../../node_modules/undici-types/eventsource.d.ts","../../../node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/undici-types/content-type.d.ts","../../../node_modules/undici-types/cache.d.ts","../../../node_modules/undici-types/index.d.ts","../../../node_modules/@types/node/web-globals/fetch.d.ts","../../../node_modules/@types/node/web-globals/importmeta.d.ts","../../../node_modules/@types/node/web-globals/messaging.d.ts","../../../node_modules/@types/node/web-globals/navigator.d.ts","../../../node_modules/@types/node/web-globals/performance.d.ts","../../../node_modules/@types/node/web-globals/storage.d.ts","../../../node_modules/@types/node/web-globals/streams.d.ts","../../../node_modules/@types/node/web-globals/timers.d.ts","../../../node_modules/@types/node/web-globals/url.d.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/ffi.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/inspector.generated.d.ts","../../../node_modules/@types/node/inspector/promises.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/path/posix.d.ts","../../../node_modules/@types/node/path/win32.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/quic.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/sea.d.ts","../../../node_modules/@types/node/sqlite.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/iter.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/test/reporters.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/util/types.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vfs.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/zlib/iter.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/@jest/expect-utils/build/index.d.ts","../../../node_modules/chalk/index.d.ts","../../../node_modules/@sinclair/typebox/typebox.d.ts","../../../node_modules/@jest/schemas/build/index.d.ts","../../../node_modules/pretty-format/build/index.d.ts","../../../node_modules/jest-diff/build/index.d.ts","../../../node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/expect/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts"],"fileIdsList":[[56,121,129,134,137,139,140,141,154],[56,121,129,134,137,139,140,141,154,185],[56,121,129,134,137,139,140,141,154,187,190],[56,118,119,121,129,134,137,139,140,141,154],[56,120,121,129,134,137,139,140,141,154],[121,129,134,137,139,140,141,154],[56,121,129,134,137,139,140,141,154,163],[56,121,122,127,129,132,134,137,139,140,141,143,154,159,172],[56,121,122,123,129,132,134,137,139,140,141,154],[56,121,124,129,134,137,139,140,141,154,173],[56,121,125,126,129,134,137,139,140,141,145,154],[56,121,126,129,134,137,139,140,141,154,159,169],[56,121,127,129,132,134,137,139,140,141,143,154],[56,120,121,128,129,134,137,139,140,141,154],[56,121,129,130,134,137,139,140,141,154],[56,121,129,131,132,134,137,139,140,141,154],[56,120,121,129,132,134,137,139,140,141,154],[56,121,129,132,134,135,137,139,140,141,154,159,172],[56,121,129,132,134,135,137,139,140,141,154,161,163],[56,108,121,129,132,134,136,137,139,140,141,143,154,159,172],[56,121,129,132,134,136,137,139,140,141,143,154,159,169,172],[56,121,129,134,136,137,138,139,140,141,154,159,169,172],[55,56,57,58,59,60,61,62,63,64,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181],[56,121,129,132,134,137,139,140,141,154],[56,121,129,134,137,139,141,154],[56,121,129,134,137,139,140,141,142,154,172],[56,121,129,132,134,137,139,140,141,143,154,159],[56,121,129,134,137,139,140,141,145,154],[56,121,129,134,137,139,140,141,146,154],[56,121,129,132,134,137,139,140,141,149,154],[56,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180],[56,121,129,134,137,139,140,141,151,154],[56,121,129,134,137,139,140,141,152,154],[56,121,126,129,134,135,137,139,140,141,143,154,161,169],[56,121,129,132,134,137,139,140,141,154,155],[56,121,129,134,137,139,140,141,154,156,173,177],[56,121,129,132,134,137,139,140,141,154,159,161,162,163],[56,121,129,134,137,139,140,141,154,160,163],[56,121,129,132,134,137,139,140,141,154,159,161],[56,121,129,132,134,137,139,140,141,154,159,162,163],[56,121,129,134,137,139,140,141,154,163,173],[56,121,129,134,137,139,140,141,154,164],[56,118,121,129,134,137,139,140,141,154,159,166,172],[56,121,129,134,137,139,140,141,154,159,165],[56,121,129,132,134,137,139,140,141,154,167,168],[56,121,129,134,137,139,140,141,154,167,168],[56,121,126,129,134,137,139,140,141,143,154,159,169],[56,121,129,134,137,139,140,141,154,170],[56,121,129,134,137,139,140,141,143,154,171],[56,121,129,134,136,137,139,140,141,152,154,172],[56,121,129,134,137,139,140,141,154,173,174],[56,121,126,129,134,137,139,140,141,154,174],[56,121,129,134,137,139,140,141,154,159,175],[56,121,129,134,135,137,139,140,141,154],[56,121,129,134,137,139,140,141,142,154,177],[56,121,129,134,137,139,140,141,154,178],[56,121,124,129,134,137,139,140,141,154],[56,121,126,129,134,137,139,140,141,154],[56,121,129,134,137,139,140,141,154,173],[56,108,121,129,134,137,139,140,141,154],[56,121,129,134,137,139,140,141,154,172],[56,121,129,134,137,139,140,141,154,179],[56,121,129,134,137,139,140,141,149,154],[56,121,129,134,137,139,140,141,154,168],[56,108,121,129,132,134,135,137,139,140,141,143,149,154,159,163,172,175,177,179],[56,121,129,134,137,139,140,141,154,159,180],[56,121,129,134,137,139,140,141,154,161,181],[56,121,129,134,137,139,140,141,154,183,189],[56,121,129,134,137,139,140,141,154,187],[56,121,129,134,137,139,140,141,154,184,188],[56,121,129,134,137,139,140,141,154,186],[56,71,74,77,78,121,129,134,137,139,140,141,154,172],[56,74,121,129,134,137,139,140,141,154,159,172],[56,74,78,121,129,134,137,139,140,141,154,172],[56,121,129,134,137,139,140,141,154,159],[56,68,121,129,134,137,139,140,141,154],[56,72,121,129,134,137,139,140,141,154],[56,70,71,74,121,129,134,137,139,140,141,154,172],[56,121,129,134,137,139,140,141,143,154,169],[56,121,129,134,137,139,140,141,154,182],[56,68,121,129,134,137,139,140,141,154,182],[56,70,74,121,129,134,137,139,140,141,143,154,172],[56,65,66,67,69,73,121,129,132,134,137,139,140,141,154,159,172],[56,74,121,129,134,137,139,140,141,154],[56,74,83,92,121,129,134,137,139,140,141,154],[56,66,72,121,129,134,137,139,140,141,154],[56,74,102,103,121,129,134,137,139,140,141,154],[56,66,69,74,121,129,134,137,139,140,141,154,163,172,182],[56,70,74,121,129,134,137,139,140,141,154,172],[56,65,121,129,134,137,139,140,141,154],[56,68,69,70,72,73,74,75,76,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,103,104,105,106,107,121,129,134,137,139,140,141,154],[56,74,95,98,121,129,134,137,139,140,141,154],[56,74,83,85,86,121,129,134,137,139,140,141,154],[56,72,74,85,87,121,129,134,137,139,140,141,154],[56,73,121,129,134,137,139,140,141,154],[56,66,68,74,121,129,134,137,139,140,141,154],[56,74,78,85,87,121,129,134,137,139,140,141,154],[56,78,121,129,134,137,139,140,141,154],[56,72,74,77,121,129,134,137,139,140,141,154,172],[56,66,70,74,83,121,129,134,137,139,140,141,154],[56,74,95,121,129,134,137,139,140,141,154],[56,87,121,129,134,137,139,140,141,154],[56,66,70,74,78,121,129,134,137,139,140,141,154],[56,68,74,102,121,129,134,137,139,140,141,154,163,179,182],[49,50,51,56,121,129,134,137,139,140,141,154],[49,51,52,56,121,129,134,137,139,140,141,154],[49,50,51,52,53,56,121,129,134,137,139,140,141,154],[49,56,121,129,134,137,139,140,141,154],[49,50,56,121,129,134,137,139,140,141,154]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"196cb558a13d4533a5163286f30b0509ce0210e4b316c56c38d4c0fd2fb38405","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6a5253138c5432c68a1510c70fe78a644fe2e632111ba778e1978010d6edfec","impliedFormat":1},{"version":"2bff0eeeb7940e0ffa525dd3ed8a8f139e02b896a130a5ff9094bba7bb492ddd","signature":"411a3210bdc804b7a5fac9e8411bdf55a775a21974daa0ed15bff6bb9efe471b"},{"version":"c71a9cd939f621d4f184238f86126bf86e5fb4309b8c337548a98dc00607f7e9","signature":"b56dd87ffa39030b9094bcbf2d36dbfa5bb273b9d9b059b11c2793c204e9177f"},{"version":"a38e9da950955cfce7f801fff612888302ffe12804be0cd55ac6d8dce1ce3968","signature":"cc238e55e711f6994d9cf7775451e243edb79d1ce2c8254884775fe9450a473e"},{"version":"b1ae624b1550a46d4b8c45385df83d9445d883368b731bef2c8a19fdbfec3233","signature":"0feba10954d2edf22d2e7d4559ab145dae2fb17a1e507b6e75d66f598148a70d"},{"version":"4b54ceb00fe6b4e6f2612cb966e3648ac70b5bc238e87ab8c1c363609a74b429","signature":"8229d30586d3560e5a3c150a0a2988e6d9a9306e7bc0fe0b702c66d6b1d940db"},{"version":"0ccdaa19852d25ecd84eec365c3bfa16e7859cadecf6e9ca6d0dbbbee439743f","affectsGlobalScope":true,"impliedFormat":1},{"version":"f9b68a1c3f8f45b4c199fa5b3ac09497230cb8f2f0cdcfebe5817b30b836a64a","affectsGlobalScope":true,"impliedFormat":1},{"version":"f53a7652392cf26ebbe4e29fd0672aa87c93bd6d0241289c13fab87b9ac35c8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5e01375c9e124a83b52ee4b3244ed1a4d214a6cfb54ac73e164a823a4a7860a","affectsGlobalScope":true,"impliedFormat":1},{"version":"f90ae2bbce1505e67f2f6502392e318f5714bae82d2d969185c4a6cecc8af2fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b58e207b93a8f1c88bbf2a95ddc686ac83962b13830fe8ad3f404ffc7051fb4","affectsGlobalScope":true,"impliedFormat":1},{"version":"1fefabcb2b06736a66d2904074d56268753654805e829989a46a0161cd8412c5","affectsGlobalScope":true,"impliedFormat":1},{"version":"b00a630557d1622ad312633bdbfbdb9c6b7220d948dca9f899db30679f160074","affectsGlobalScope":true,"impliedFormat":1},{"version":"c18a99f01eb788d849ad032b31cafd49de0b19e083fe775370834c5675d7df8e","affectsGlobalScope":true,"impliedFormat":1},{"version":"5247874c2a23b9a62d178ae84f2db6a1d54e6c9a2e7e057e178cc5eea13757fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"cdcf9ea426ad970f96ac930cd176d5c69c6c24eebd9fc580e1572d6c6a88f62c","impliedFormat":1},{"version":"88809d6c1b9c78d04a133646a6feb926def05a8774c308c7c93bc32ee163d271","impliedFormat":1},{"version":"156a859e21ef3244d13afeeba4e49760a6afa035c149dda52f0c45ea8903b338","impliedFormat":1},{"version":"21d7fab00c101ddf754b392e11534e6b20c6bda269b2ccbcdf3453cbe21d8a39","impliedFormat":1},{"version":"615754924717c0b1e293e083b83503c0a872717ad5aa60ed7f1a699eb1b4ea5c","impliedFormat":1},{"version":"d3c85d4dde1a4918009e37426ee4a940cbbd4100e2e74d03e2de0d50a77bb488","impliedFormat":1},{"version":"68834d631c8838c715f225509cfc3927913b9cc7a4870460b5b60c8dbdb99baf","impliedFormat":1},{"version":"60e3ba4b2d24548107060e5d13bffafbbbaa53d001c07bbe40386deda569b5e8","impliedFormat":1},{"version":"a712be2c8cbe0154bd17d1d7bff503d7c04331e0745eb9eea3d303e0e5d9401e","impliedFormat":1},{"version":"25bd6ae1b97ea991433337310fc406cc7c9f271b67b7c79dd24eee384759f3d4","impliedFormat":1},{"version":"ea6bc8de8b59f90a7a3960005fd01988f98fd0784e14bc6922dde2e93305ec7d","impliedFormat":1},{"version":"36107995674b29284a115e21a0618c4c2751b32a8766dd4cb3ba740308b16d59","impliedFormat":1},{"version":"914a0ae30d96d71915fc519ccb4efbf2b62c0ddfb3a3fc6129151076bc01dc60","impliedFormat":1},{"version":"38004e6801340cb890afb8cb5a9fc8972297e7f88ab94026e4b0b3c61fb32f8a","impliedFormat":1},{"version":"4ca7fb8f6018ea836b1ad24f67d5e7c2cf7410af7462e0ccc90b012944f5d7ae","impliedFormat":1},{"version":"4d327f7d72ad0918275cea3eee49a6a8dc8114ae1d5b7f3f5d0774de75f7439a","impliedFormat":1},{"version":"149f9a9e7f04e67afa0e2a49fc0ff421035c01d6b793cfcae7d2e9f6819431e2","impliedFormat":1},{"version":"e8a9dfa4c75ef6d25df8b40eaa9c31e0a69452aaf2ced4a3f4215dbdbaa876f4","impliedFormat":1},{"version":"a70af845a2eb9dd6e2723e319e14ea7fb28b129ec1361c21509b49305448c323","impliedFormat":1},{"version":"b53dc572d4f187904207ae1166652de47aab8eeb00c254d009cb226863076b56","impliedFormat":1},{"version":"57354d2f022ed64ede57b2e052306dd076a138b551abc7d30ef5e6718ce2f76a","impliedFormat":1},{"version":"0b6e25234b4eec6ed96ab138d96eb70b135690d7dd01f3dd8a8ab291c35a683a","impliedFormat":1},{"version":"9666f2f84b985b62400d2e5ab0adae9ff44de9b2a34803c2c5bd3c8325b17dc0","impliedFormat":1},{"version":"40cd35c95e9cf22cfa5bd84e96408b6fcbca55295f4ff822390abb11afbc3dca","impliedFormat":1},{"version":"b1616b8959bf557feb16369c6124a97a0e74ed6f49d1df73bb4b9ddf68acf3f3","impliedFormat":1},{"version":"f501234c5aeeeb5d7659412335227466aaacf30b952372d60afeb21c02c96348","impliedFormat":1},{"version":"40b463c6766ca1b689bfcc46d26b5e295954f32ad43e37ee6953c0a677e4ae2b","impliedFormat":1},{"version":"358f74dc35927dc88ea86dd201a2b98e701c281615e6b30a4c153eb0bb90ef71","impliedFormat":1},{"version":"8b91ff5bb912be3ea213cbcf0075aace1f5d4ff249a0d227ed673868cb7bfabc","impliedFormat":1},{"version":"80aae6afc67faa5ac0b32b5b8bc8cc9f7fa299cff15cf09cc2e11fd28c6ae29e","impliedFormat":1},{"version":"f473cd2288991ff3221165dcf73cd5d24da30391f87e85b3dd4d0450c787a391","impliedFormat":1},{"version":"499e5b055a5aba1e1998f7311a6c441a369831c70905cc565ceac93c28083d53","impliedFormat":1},{"version":"8aee8b6d4f9f62cf3776cda1305fb18763e2aade7e13cea5bbe699112df85214","impliedFormat":1},{"version":"98498b101803bb3dde9f76a56e65c14b75db1cc8bec5f4db72be541570f74fc5","impliedFormat":1},{"version":"706abfbafe0ed5f685357375e89bbf48879549ea1772185d77d15f587c5c9400","impliedFormat":1},{"version":"5d0375ca7310efb77e3ef18d068d53784faf62705e0ad04569597ae0e755c401","impliedFormat":1},{"version":"013ff793053d33a15be4614efdd6c50247bbf0b26d6bc58ba338622a7441b543","impliedFormat":1},{"version":"addf417b9eb3f938fddf8d81e96393a165e4be0d4a8b6402292f9c634b1cb00d","impliedFormat":1},{"version":"436d7b4543b340b0f3eef4310d524242e41369b9652aa9c70428767c4dcac455","impliedFormat":1},{"version":"adf27937dba6af9f08a68c5b1d3fce0ca7d4b960c57e6d6c844e7d1a8e53adae","impliedFormat":1},{"version":"12950411eeab8563b349cb7959543d92d8d02c289ed893d78499a19becb5a8cc","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"e99963ae1e3a48ca7a7958c02f3e88bb963eb7978c28b68ae6b8c9f03309d83c","impliedFormat":1},{"version":"c3f5289820990ab66b70c7fb5b63cb674001009ff84b13de40619619a9c8175f","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3275d55fac10b799c9546804126239baf020d220136163f763b55a74e50e750","affectsGlobalScope":true,"impliedFormat":1},{"version":"fa68a0a3b7cb32c00e39ee3cd31f8f15b80cac97dce51b6ee7fc14a1e8deb30b","affectsGlobalScope":true,"impliedFormat":1},{"version":"1cf059eaf468efcc649f8cf6075d3cb98e9a35a0fe9c44419ec3d2f5428d7123","affectsGlobalScope":true,"impliedFormat":1},{"version":"6c36e755bced82df7fb6ce8169265d0a7bb046ab4e2cb6d0da0cb72b22033e89","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7721c4f69f93c91360c26a0a84ee885997d748237ef78ef665b153e622b36c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"279d0cc1a72879918854265c3405369aa2d4d23509b8694ea102995b298cc5e2","affectsGlobalScope":true,"impliedFormat":1},{"version":"90e85f9bc549dfe2b5749b45fe734144e96cd5d04b38eae244028794e142a77e","affectsGlobalScope":true,"impliedFormat":1},{"version":"e0a5deeb610b2a50a6350bd23df6490036a1773a8a71d70f2f9549ab009e67ee","affectsGlobalScope":true,"impliedFormat":1},{"version":"594ae90cacd813fa392ff80d2e0a8eff4e41f4a136329a940e321399dd8895b4","impliedFormat":1},{"version":"d1f333ade8ff35a409b4984e1f11956fe11c61855b0c7e9b59f0313e48b40c4a","impliedFormat":1},{"version":"0224aa4b3464895d69c413a640a19ac2166778a74eb5eb3b36b021c72d42b274","impliedFormat":1},{"version":"575aa163c4c32e5b82e0e99b1f9f80806e1d78bfa259706e05139251c022277b","affectsGlobalScope":true,"impliedFormat":1},{"version":"7fb21326854faaa31ef02c9d51629fb6acedacb9396e74bf22ff8409441ea9ae","impliedFormat":1},{"version":"2fbf504c4791f9d32cd766cfe6b605bcda63289b925401953a7900db9af85348","impliedFormat":1},{"version":"ed0fb633cae35948d9e144004299a4bdf1ab912667c787b7fbffcd6d8c7b92a2","impliedFormat":1},{"version":"1678b04557dca52feab73cc67610918a7f5e25bfdba3e7fa081acd625d93106d","impliedFormat":1},{"version":"7db737262597ae2e35daa8cc1748f482cf4b0914e00a3d5a32cf6c4fc869a375","impliedFormat":1},{"version":"9c90f502816bd0179556bb875e86c944af3f6b995cde63199edbe4e0b1219aba","impliedFormat":1},{"version":"97581dc7099ef3d844c83706d53a7ecf895c0e867fbf6b9dc035bb3080f677bd","impliedFormat":1},{"version":"e494b286c8e27c52f8c7f945aa80ff223f2a3cd4f7a2619fa8991f1459e26f07","impliedFormat":1},{"version":"f54f5f9e10bbceba7515dfad0ffc89dffdb8d749d0604594c57a725cf6d79c20","impliedFormat":1},{"version":"41d17e1ad9a002feb11c8cdd2777e5bbc0cdb1e3f595d237e4dded0b6949983b","impliedFormat":1},{"version":"8c7e618c2a91ea7f6b5cca272a295864e92c16413be8fc56a943e8c7d5320011","affectsGlobalScope":true,"impliedFormat":1},{"version":"13f487e411f9657df0e76572e500c1209b8fe95ee3b4cc6e6e7913c15f56207d","impliedFormat":1},{"version":"9d37b8a9678efbcdf38238b59ce8e6f7db70aba1a516f3a4a671a301dbacfb3d","impliedFormat":1},{"version":"a47a792b8cff71443be8dfb199f2b77e102a7bf9d4f90c18059f05d9af2d7413","impliedFormat":1},{"version":"ad50512520720d10294c629cb4e2df23891c3fcbeaca00fbfb9e6bbea65f3dd6","impliedFormat":1},{"version":"189769511b45c93b23ba76069f7701d3b631cfbedc1eb94c7753486c78736f78","impliedFormat":1},{"version":"2c2bdaa1d8ead9f68628d6d9d250e46ee8e81aa4898b4769a36956ae15e060fe","impliedFormat":1},{"version":"ba389fd3d7fba6670e97bc82eb12469dcb371d22f24e63859c1df5a083c823ed","impliedFormat":1},{"version":"5ff4433a2deae4f85ab1377e90a7554ce6b47ae51c69a84ca30a6e22fae85834","impliedFormat":1},{"version":"82b91e4e42e6c41bc7fc1b6c2dc5eba6a2ba98375eb1f210e6ff6bba2d54177e","impliedFormat":1},{"version":"97234c5303866576f913d0ccae7d58d6322d9e803c7bf1228a3fda46ab8087b2","affectsGlobalScope":true,"impliedFormat":1},{"version":"961dec547748827cb6b45f6fdc66273f7bacd9c73103c6779f070f2fd07f23f9","impliedFormat":1},{"version":"8e9c23ba78aabc2e0a27033f18737a6df754067731e69dc5f52823957d60a4b6","impliedFormat":1},{"version":"73eeb740dacc45adc607a4f59f90fa9dbe2717d93d82f115f45f34e18f8d644a","impliedFormat":1},{"version":"ec501101c2a96133a6c695f934c8f6642149cc728571b29cbb7b770984c1088e","impliedFormat":1},{"version":"b214ebcf76c51b115453f69729ee8aa7b7f8eccdae2a922b568a45c2d7ff52f7","impliedFormat":1},{"version":"429c9cdfa7d126255779efd7e6d9057ced2d69c81859bbab32073bad52e9ba76","impliedFormat":1},{"version":"d251cda16f3f6a3e07f07c9e6e823ef6c583c63f653eb8777dafa749a78298e3","impliedFormat":1},{"version":"361939136b496a38b3e6b7be750bbb6998ef289bb8dd304c673138542ca16137","affectsGlobalScope":true,"impliedFormat":1},{"version":"230763250f20449fa7b3c9273e1967adb0023dc890d4be1553faca658ee65971","impliedFormat":1},{"version":"c3e9078b60cb329d1221f5878e88cecfa3e74460550e605a58fcfb41a66029ff","impliedFormat":1},{"version":"89e2568ebc2ec1e4149384b105e80e8bbf41eb4d711547f1121f4f628028de96","impliedFormat":1},{"version":"441b9bb09013654aa3d050e68b06464d8959b473e85868249d9d18f692acd35b","impliedFormat":1},{"version":"bc18a1991ba681f03e13285fa1d7b99b03b67ee671b7bc936254467177543890","impliedFormat":1},{"version":"55246f15e33ff1e2e9e679b25fa9790a48db55dc63d567fe25fac8b6a0efe911","impliedFormat":1},{"version":"fa94bbf532b7af8f394b95fa310980d6e20bd2d4c871c6a6cb9f70f03750a44b","impliedFormat":1},{"version":"925734f303b7f0cc111d42aeb21781d38a79e6d5ac05b2b1400cd1861a75d27b","impliedFormat":1},{"version":"5b26c4dd672d88336bb929787c9bfb55119e80ba89ec6dc923da1c063892843e","affectsGlobalScope":true,"impliedFormat":1},{"version":"7fa2214bb0d64701bc6f9ce8cde2fd2ff8c571e0b23065fa04a8a5a6beb91511","impliedFormat":1},{"version":"7286e4e5f80c0b1ab16addbdbbc9dd47fbae1c42034189261177b84d745cde3b","impliedFormat":1},{"version":"f12624a4a8d042b68914eac1b0a16571fc1c523173fcdf2517c65d191bd5a86c","impliedFormat":1},{"version":"cd2a656ba1d250c2002190b683e3826bf4362b6919450bc0f9bbf5612ebad837","impliedFormat":1},{"version":"841983e39bd4cbb463be385e92fda11057cab368bf27100a801c492f1d86cbaa","impliedFormat":1},{"version":"3e221ff0522e6ff95aa74a5211126aaf4d7e85ed8c8ff19290d591ad4bef988f","impliedFormat":1},{"version":"7da83f6429c6298ebf2be43d296b56ecfc94c9c28f5471b2f23b87545b914cea","impliedFormat":1},{"version":"e4156ddb25aa0e3b5303d372f26957b36778f0f6bbd4326359269873295e3058","affectsGlobalScope":true,"impliedFormat":1},{"version":"cc1b433a84cae05ddc5672d4823170af78606ad21ecef60dbc4570190cbf1357","impliedFormat":1},{"version":"751048d4aa67e20e5ecd2692340ea0d19bae42a20cc651d6f56d095e411ce3ac","impliedFormat":1},{"version":"7f78cfb2b343838612c192cb251746e3a7c62ac7675726a47e130d9b213f6580","impliedFormat":1},{"version":"aed8f3e5c7e53462565eedf34a9bcb700393cb2c1ab0c768602b929c3ed3145d","impliedFormat":1},{"version":"8e2577e7262051fd3c5bd6ca2b2056d358ff8853565720f92455860824c25188","impliedFormat":1},{"version":"7ec8d7d483f7394f9da611b10d3a0e402f76ff5c991261e6ce43a15f81ca4258","impliedFormat":1},{"version":"bb9dbb4b2ad81e3e71ec5ba4314973718555b9d04ba2a17dfbf875efecb8e2c0","impliedFormat":1},{"version":"9021dc5be8f3a87af5cede29221188a6497e2092b6889e0be212ef6b6b7153e9","impliedFormat":1},{"version":"4a8c8fd951d9fd9e0775f0aae8ed1f8b528204e24a2600bea3a1228ea83de52c","impliedFormat":1},{"version":"5b9cc0c724a8ebc7a873ab8e73c20b2416cef04b9e9d7f95ef1fa0fdcd4e0ec8","impliedFormat":1},{"version":"99ab6d0d660ce4d21efb52288a39fd35bb3f556980ec5463b1ae8f304a3bbc85","impliedFormat":1},{"version":"80a4b7023a2cc9f14d3f2e4635d6615ab3eff4b5b3630f62a8e73992fdd8cdb9","impliedFormat":1},{"version":"ec62d16f95636123624a69191a35b5df44b4b0a6428977e856c5739c0a787471","impliedFormat":1},{"version":"afa1c49f8e559e413d57343339db857d2a8159435cf9cf7d4deb41718fff1b88","impliedFormat":1},{"version":"c46f111af647c4134ae869653130610d62da321f90ebf19e186a3ea4bed79350","impliedFormat":1},{"version":"cdcc132f207d097d7d3aa75615ab9a2e71d6a478162dde8b67f88ea19f3e54de","impliedFormat":1},{"version":"0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","impliedFormat":1},{"version":"e1028394c1cf96d5d057ecc647e31e457b919092f882ed0c7092152b077fed9d","impliedFormat":1},{"version":"f315e1e65a1f80992f0509e84e4ae2df15ecd9ef73df975f7c98813b71e4c8da","impliedFormat":1},{"version":"5b9586e9b0b6322e5bfbd2c29bd3b8e21ab9d871f82346cb71020e3d84bae73e","impliedFormat":1},{"version":"3e70a7e67c2cb16f8cd49097360c0309fe9d1e3210ff9222e9dac1f8df9d4fb6","impliedFormat":1},{"version":"ab68d2a3e3e8767c3fba8f80de099a1cfc18c0de79e42cb02ae66e22dfe14a66","impliedFormat":1},{"version":"d96cc6598148bf1a98fb2e8dcf01c63a4b3558bdaec6ef35e087fd0562eb40ec","impliedFormat":1},{"version":"f8db4fea512ab759b2223b90ecbbe7dae919c02f8ce95ec03f7fb1cf757cfbeb","affectsGlobalScope":true,"impliedFormat":1}],"root":[[50,54]],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"esModuleInterop":true,"experimentalDecorators":true,"importHelpers":true,"inlineSources":true,"module":99,"noEmitOnError":true,"outDir":"./","rootDir":"..","skipLibCheck":true,"sourceMap":true,"strict":true,"target":99,"useDefineForClassFields":true},"referencedMap":[[183,1],[186,2],[185,1],[191,3],[118,4],[119,4],[120,5],[56,6],[121,7],[122,8],[123,9],[124,10],[125,11],[126,12],[127,13],[128,14],[129,15],[130,15],[131,16],[132,17],[133,1],[134,18],[135,19],[57,1],[55,1],[136,20],[137,21],[138,22],[182,23],[139,24],[140,25],[141,24],[142,26],[143,27],[145,28],[146,29],[147,29],[148,29],[149,30],[150,31],[151,32],[152,33],[153,34],[154,35],[155,35],[156,36],[157,1],[158,1],[159,37],[160,38],[161,39],[162,40],[163,41],[164,42],[165,43],[166,44],[167,45],[168,46],[169,47],[170,48],[171,49],[172,50],[173,51],[174,52],[175,53],[176,54],[177,55],[178,56],[58,24],[59,1],[60,57],[61,58],[62,1],[63,59],[64,1],[109,60],[110,61],[111,62],[112,62],[113,63],[114,1],[115,7],[116,64],[117,61],[179,65],[180,66],[181,67],[144,1],[184,1],[190,68],[188,69],[189,70],[187,71],[49,1],[47,1],[48,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[19,1],[20,1],[4,1],[21,1],[25,1],[22,1],[23,1],[24,1],[26,1],[27,1],[28,1],[5,1],[29,1],[30,1],[31,1],[32,1],[6,1],[36,1],[33,1],[34,1],[35,1],[37,1],[7,1],[38,1],[43,1],[44,1],[39,1],[40,1],[41,1],[42,1],[1,1],[45,1],[46,1],[83,72],[97,73],[80,74],[98,75],[107,76],[71,77],[72,78],[70,79],[106,80],[101,81],[105,82],[74,83],[84,84],[94,85],[73,86],[104,87],[68,88],[69,81],[75,84],[76,1],[82,89],[79,84],[66,90],[108,91],[99,92],[87,93],[86,84],[88,94],[91,95],[85,96],[89,97],[102,80],[77,98],[78,99],[92,100],[67,75],[96,101],[95,84],[81,99],[90,102],[93,103],[100,1],[65,1],[103,104],[52,105],[53,106],[54,107],[50,108],[51,109]],"version":"5.9.3"}
1
+ {"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../node_modules/typescript/lib/lib.esnext.float16.d.ts","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/tslib/tslib.d.ts","../src/model.ts","../src/ops.ts","../src/apply-model.ts","../src/apply-scene.ts","../src/index.ts","../../../node_modules/@types/node/globals.typedarray.d.ts","../../../node_modules/@types/node/buffer.buffer.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/web-globals/abortcontroller.d.ts","../../../node_modules/@types/node/web-globals/blob.d.ts","../../../node_modules/@types/node/web-globals/console.d.ts","../../../node_modules/@types/node/web-globals/crypto.d.ts","../../../node_modules/@types/node/web-globals/domexception.d.ts","../../../node_modules/@types/node/web-globals/encoding.d.ts","../../../node_modules/@types/node/web-globals/events.d.ts","../../../node_modules/undici-types/utility.d.ts","../../../node_modules/undici-types/header.d.ts","../../../node_modules/undici-types/readable.d.ts","../../../node_modules/undici-types/fetch.d.ts","../../../node_modules/undici-types/formdata.d.ts","../../../node_modules/undici-types/connector.d.ts","../../../node_modules/undici-types/client-stats.d.ts","../../../node_modules/undici-types/client.d.ts","../../../node_modules/undici-types/errors.d.ts","../../../node_modules/undici-types/dispatcher.d.ts","../../../node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/undici-types/global-origin.d.ts","../../../node_modules/undici-types/pool-stats.d.ts","../../../node_modules/undici-types/pool.d.ts","../../../node_modules/undici-types/handlers.d.ts","../../../node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/undici-types/round-robin-pool.d.ts","../../../node_modules/undici-types/h2c-client.d.ts","../../../node_modules/undici-types/agent.d.ts","../../../node_modules/undici-types/dispatcher1-wrapper.d.ts","../../../node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/undici-types/mock-call-history.d.ts","../../../node_modules/undici-types/mock-agent.d.ts","../../../node_modules/undici-types/mock-client.d.ts","../../../node_modules/undici-types/mock-pool.d.ts","../../../node_modules/undici-types/snapshot-agent.d.ts","../../../node_modules/undici-types/mock-errors.d.ts","../../../node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/undici-types/socks5-proxy-agent.d.ts","../../../node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/undici-types/retry-handler.d.ts","../../../node_modules/undici-types/retry-agent.d.ts","../../../node_modules/undici-types/api.d.ts","../../../node_modules/undici-types/cache-interceptor.d.ts","../../../node_modules/undici-types/interceptors.d.ts","../../../node_modules/undici-types/util.d.ts","../../../node_modules/undici-types/cookies.d.ts","../../../node_modules/undici-types/patch.d.ts","../../../node_modules/undici-types/websocket.d.ts","../../../node_modules/undici-types/eventsource.d.ts","../../../node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/undici-types/content-type.d.ts","../../../node_modules/undici-types/cache.d.ts","../../../node_modules/undici-types/index.d.ts","../../../node_modules/@types/node/web-globals/fetch.d.ts","../../../node_modules/@types/node/web-globals/importmeta.d.ts","../../../node_modules/@types/node/web-globals/messaging.d.ts","../../../node_modules/@types/node/web-globals/navigator.d.ts","../../../node_modules/@types/node/web-globals/performance.d.ts","../../../node_modules/@types/node/web-globals/storage.d.ts","../../../node_modules/@types/node/web-globals/streams.d.ts","../../../node_modules/@types/node/web-globals/timers.d.ts","../../../node_modules/@types/node/web-globals/url.d.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/ffi.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/inspector.generated.d.ts","../../../node_modules/@types/node/inspector/promises.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/path/posix.d.ts","../../../node_modules/@types/node/path/win32.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/quic.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/sea.d.ts","../../../node_modules/@types/node/sqlite.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/iter.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/test/reporters.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/util/types.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vfs.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/zlib/iter.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/@jest/expect-utils/build/index.d.ts","../../../node_modules/chalk/index.d.ts","../../../node_modules/@sinclair/typebox/typebox.d.ts","../../../node_modules/@jest/schemas/build/index.d.ts","../../../node_modules/pretty-format/build/index.d.ts","../../../node_modules/jest-diff/build/index.d.ts","../../../node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/expect/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts"],"fileIdsList":[[56,121,129,134,137,139,140,141,154],[56,121,129,134,137,139,140,141,154,185],[56,121,129,134,137,139,140,141,154,187,190],[56,118,119,121,129,134,137,139,140,141,154],[56,120,121,129,134,137,139,140,141,154],[121,129,134,137,139,140,141,154],[56,121,129,134,137,139,140,141,154,163],[56,121,122,127,129,132,134,137,139,140,141,143,154,159,172],[56,121,122,123,129,132,134,137,139,140,141,154],[56,121,124,129,134,137,139,140,141,154,173],[56,121,125,126,129,134,137,139,140,141,145,154],[56,121,126,129,134,137,139,140,141,154,159,169],[56,121,127,129,132,134,137,139,140,141,143,154],[56,120,121,128,129,134,137,139,140,141,154],[56,121,129,130,134,137,139,140,141,154],[56,121,129,131,132,134,137,139,140,141,154],[56,120,121,129,132,134,137,139,140,141,154],[56,121,129,132,134,135,137,139,140,141,154,159,172],[56,121,129,132,134,135,137,139,140,141,154,161,163],[56,108,121,129,132,134,136,137,139,140,141,143,154,159,172],[56,121,129,132,134,136,137,139,140,141,143,154,159,169,172],[56,121,129,134,136,137,138,139,140,141,154,159,169,172],[55,56,57,58,59,60,61,62,63,64,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181],[56,121,129,132,134,137,139,140,141,154],[56,121,129,134,137,139,141,154],[56,121,129,134,137,139,140,141,142,154,172],[56,121,129,132,134,137,139,140,141,143,154,159],[56,121,129,134,137,139,140,141,145,154],[56,121,129,134,137,139,140,141,146,154],[56,121,129,132,134,137,139,140,141,149,154],[56,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180],[56,121,129,134,137,139,140,141,151,154],[56,121,129,134,137,139,140,141,152,154],[56,121,126,129,134,135,137,139,140,141,143,154,161,169],[56,121,129,132,134,137,139,140,141,154,155],[56,121,129,134,137,139,140,141,154,156,173,177],[56,121,129,132,134,137,139,140,141,154,159,161,162,163],[56,121,129,134,137,139,140,141,154,160,163],[56,121,129,132,134,137,139,140,141,154,159,161],[56,121,129,132,134,137,139,140,141,154,159,162,163],[56,121,129,134,137,139,140,141,154,163,173],[56,121,129,134,137,139,140,141,154,164],[56,118,121,129,134,137,139,140,141,154,159,166,172],[56,121,129,134,137,139,140,141,154,159,165],[56,121,129,132,134,137,139,140,141,154,167,168],[56,121,129,134,137,139,140,141,154,167,168],[56,121,126,129,134,137,139,140,141,143,154,159,169],[56,121,129,134,137,139,140,141,154,170],[56,121,129,134,137,139,140,141,143,154,171],[56,121,129,134,136,137,139,140,141,152,154,172],[56,121,129,134,137,139,140,141,154,173,174],[56,121,126,129,134,137,139,140,141,154,174],[56,121,129,134,137,139,140,141,154,159,175],[56,121,129,134,135,137,139,140,141,154],[56,121,129,134,137,139,140,141,142,154,177],[56,121,129,134,137,139,140,141,154,178],[56,121,124,129,134,137,139,140,141,154],[56,121,126,129,134,137,139,140,141,154],[56,121,129,134,137,139,140,141,154,173],[56,108,121,129,134,137,139,140,141,154],[56,121,129,134,137,139,140,141,154,172],[56,121,129,134,137,139,140,141,154,179],[56,121,129,134,137,139,140,141,149,154],[56,121,129,134,137,139,140,141,154,168],[56,108,121,129,132,134,135,137,139,140,141,143,149,154,159,163,172,175,177,179],[56,121,129,134,137,139,140,141,154,159,180],[56,121,129,134,137,139,140,141,154,161,181],[56,121,129,134,137,139,140,141,154,183,189],[56,121,129,134,137,139,140,141,154,187],[56,121,129,134,137,139,140,141,154,184,188],[56,121,129,134,137,139,140,141,154,186],[56,71,74,77,78,121,129,134,137,139,140,141,154,172],[56,74,121,129,134,137,139,140,141,154,159,172],[56,74,78,121,129,134,137,139,140,141,154,172],[56,121,129,134,137,139,140,141,154,159],[56,68,121,129,134,137,139,140,141,154],[56,72,121,129,134,137,139,140,141,154],[56,70,71,74,121,129,134,137,139,140,141,154,172],[56,121,129,134,137,139,140,141,143,154,169],[56,121,129,134,137,139,140,141,154,182],[56,68,121,129,134,137,139,140,141,154,182],[56,70,74,121,129,134,137,139,140,141,143,154,172],[56,65,66,67,69,73,121,129,132,134,137,139,140,141,154,159,172],[56,74,121,129,134,137,139,140,141,154],[56,74,83,92,121,129,134,137,139,140,141,154],[56,66,72,121,129,134,137,139,140,141,154],[56,74,102,103,121,129,134,137,139,140,141,154],[56,66,69,74,121,129,134,137,139,140,141,154,163,172,182],[56,70,74,121,129,134,137,139,140,141,154,172],[56,65,121,129,134,137,139,140,141,154],[56,68,69,70,72,73,74,75,76,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,103,104,105,106,107,121,129,134,137,139,140,141,154],[56,74,95,98,121,129,134,137,139,140,141,154],[56,74,83,85,86,121,129,134,137,139,140,141,154],[56,72,74,85,87,121,129,134,137,139,140,141,154],[56,73,121,129,134,137,139,140,141,154],[56,66,68,74,121,129,134,137,139,140,141,154],[56,74,78,85,87,121,129,134,137,139,140,141,154],[56,78,121,129,134,137,139,140,141,154],[56,72,74,77,121,129,134,137,139,140,141,154,172],[56,66,70,74,83,121,129,134,137,139,140,141,154],[56,74,95,121,129,134,137,139,140,141,154],[56,87,121,129,134,137,139,140,141,154],[56,66,70,74,78,121,129,134,137,139,140,141,154],[56,68,74,102,121,129,134,137,139,140,141,154,163,179,182],[49,50,51,56,121,129,134,137,139,140,141,154],[49,51,52,56,121,129,134,137,139,140,141,154],[49,50,51,52,53,56,121,129,134,137,139,140,141,154],[49,56,121,129,134,137,139,140,141,154],[49,50,56,121,129,134,137,139,140,141,154]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"196cb558a13d4533a5163286f30b0509ce0210e4b316c56c38d4c0fd2fb38405","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6a5253138c5432c68a1510c70fe78a644fe2e632111ba778e1978010d6edfec","impliedFormat":1},{"version":"2bff0eeeb7940e0ffa525dd3ed8a8f139e02b896a130a5ff9094bba7bb492ddd","signature":"411a3210bdc804b7a5fac9e8411bdf55a775a21974daa0ed15bff6bb9efe471b"},{"version":"c71a9cd939f621d4f184238f86126bf86e5fb4309b8c337548a98dc00607f7e9","signature":"b56dd87ffa39030b9094bcbf2d36dbfa5bb273b9d9b059b11c2793c204e9177f"},{"version":"a38e9da950955cfce7f801fff612888302ffe12804be0cd55ac6d8dce1ce3968","signature":"cc238e55e711f6994d9cf7775451e243edb79d1ce2c8254884775fe9450a473e"},{"version":"cd8827c36d3396bc1fbb376886b0b1b437a10b615ffbf20265f1e5948db25ed8","signature":"45261b6e7702fe74734e5061fba9a84c5eba7b9f189b07d298f8cf7baa068a7b"},{"version":"4b54ceb00fe6b4e6f2612cb966e3648ac70b5bc238e87ab8c1c363609a74b429","signature":"8229d30586d3560e5a3c150a0a2988e6d9a9306e7bc0fe0b702c66d6b1d940db"},{"version":"0ccdaa19852d25ecd84eec365c3bfa16e7859cadecf6e9ca6d0dbbbee439743f","affectsGlobalScope":true,"impliedFormat":1},{"version":"f9b68a1c3f8f45b4c199fa5b3ac09497230cb8f2f0cdcfebe5817b30b836a64a","affectsGlobalScope":true,"impliedFormat":1},{"version":"f53a7652392cf26ebbe4e29fd0672aa87c93bd6d0241289c13fab87b9ac35c8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5e01375c9e124a83b52ee4b3244ed1a4d214a6cfb54ac73e164a823a4a7860a","affectsGlobalScope":true,"impliedFormat":1},{"version":"f90ae2bbce1505e67f2f6502392e318f5714bae82d2d969185c4a6cecc8af2fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b58e207b93a8f1c88bbf2a95ddc686ac83962b13830fe8ad3f404ffc7051fb4","affectsGlobalScope":true,"impliedFormat":1},{"version":"1fefabcb2b06736a66d2904074d56268753654805e829989a46a0161cd8412c5","affectsGlobalScope":true,"impliedFormat":1},{"version":"b00a630557d1622ad312633bdbfbdb9c6b7220d948dca9f899db30679f160074","affectsGlobalScope":true,"impliedFormat":1},{"version":"c18a99f01eb788d849ad032b31cafd49de0b19e083fe775370834c5675d7df8e","affectsGlobalScope":true,"impliedFormat":1},{"version":"5247874c2a23b9a62d178ae84f2db6a1d54e6c9a2e7e057e178cc5eea13757fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"cdcf9ea426ad970f96ac930cd176d5c69c6c24eebd9fc580e1572d6c6a88f62c","impliedFormat":1},{"version":"88809d6c1b9c78d04a133646a6feb926def05a8774c308c7c93bc32ee163d271","impliedFormat":1},{"version":"156a859e21ef3244d13afeeba4e49760a6afa035c149dda52f0c45ea8903b338","impliedFormat":1},{"version":"21d7fab00c101ddf754b392e11534e6b20c6bda269b2ccbcdf3453cbe21d8a39","impliedFormat":1},{"version":"615754924717c0b1e293e083b83503c0a872717ad5aa60ed7f1a699eb1b4ea5c","impliedFormat":1},{"version":"d3c85d4dde1a4918009e37426ee4a940cbbd4100e2e74d03e2de0d50a77bb488","impliedFormat":1},{"version":"68834d631c8838c715f225509cfc3927913b9cc7a4870460b5b60c8dbdb99baf","impliedFormat":1},{"version":"60e3ba4b2d24548107060e5d13bffafbbbaa53d001c07bbe40386deda569b5e8","impliedFormat":1},{"version":"a712be2c8cbe0154bd17d1d7bff503d7c04331e0745eb9eea3d303e0e5d9401e","impliedFormat":1},{"version":"25bd6ae1b97ea991433337310fc406cc7c9f271b67b7c79dd24eee384759f3d4","impliedFormat":1},{"version":"ea6bc8de8b59f90a7a3960005fd01988f98fd0784e14bc6922dde2e93305ec7d","impliedFormat":1},{"version":"36107995674b29284a115e21a0618c4c2751b32a8766dd4cb3ba740308b16d59","impliedFormat":1},{"version":"914a0ae30d96d71915fc519ccb4efbf2b62c0ddfb3a3fc6129151076bc01dc60","impliedFormat":1},{"version":"38004e6801340cb890afb8cb5a9fc8972297e7f88ab94026e4b0b3c61fb32f8a","impliedFormat":1},{"version":"4ca7fb8f6018ea836b1ad24f67d5e7c2cf7410af7462e0ccc90b012944f5d7ae","impliedFormat":1},{"version":"4d327f7d72ad0918275cea3eee49a6a8dc8114ae1d5b7f3f5d0774de75f7439a","impliedFormat":1},{"version":"149f9a9e7f04e67afa0e2a49fc0ff421035c01d6b793cfcae7d2e9f6819431e2","impliedFormat":1},{"version":"e8a9dfa4c75ef6d25df8b40eaa9c31e0a69452aaf2ced4a3f4215dbdbaa876f4","impliedFormat":1},{"version":"a70af845a2eb9dd6e2723e319e14ea7fb28b129ec1361c21509b49305448c323","impliedFormat":1},{"version":"b53dc572d4f187904207ae1166652de47aab8eeb00c254d009cb226863076b56","impliedFormat":1},{"version":"57354d2f022ed64ede57b2e052306dd076a138b551abc7d30ef5e6718ce2f76a","impliedFormat":1},{"version":"0b6e25234b4eec6ed96ab138d96eb70b135690d7dd01f3dd8a8ab291c35a683a","impliedFormat":1},{"version":"9666f2f84b985b62400d2e5ab0adae9ff44de9b2a34803c2c5bd3c8325b17dc0","impliedFormat":1},{"version":"40cd35c95e9cf22cfa5bd84e96408b6fcbca55295f4ff822390abb11afbc3dca","impliedFormat":1},{"version":"b1616b8959bf557feb16369c6124a97a0e74ed6f49d1df73bb4b9ddf68acf3f3","impliedFormat":1},{"version":"f501234c5aeeeb5d7659412335227466aaacf30b952372d60afeb21c02c96348","impliedFormat":1},{"version":"40b463c6766ca1b689bfcc46d26b5e295954f32ad43e37ee6953c0a677e4ae2b","impliedFormat":1},{"version":"358f74dc35927dc88ea86dd201a2b98e701c281615e6b30a4c153eb0bb90ef71","impliedFormat":1},{"version":"8b91ff5bb912be3ea213cbcf0075aace1f5d4ff249a0d227ed673868cb7bfabc","impliedFormat":1},{"version":"80aae6afc67faa5ac0b32b5b8bc8cc9f7fa299cff15cf09cc2e11fd28c6ae29e","impliedFormat":1},{"version":"f473cd2288991ff3221165dcf73cd5d24da30391f87e85b3dd4d0450c787a391","impliedFormat":1},{"version":"499e5b055a5aba1e1998f7311a6c441a369831c70905cc565ceac93c28083d53","impliedFormat":1},{"version":"8aee8b6d4f9f62cf3776cda1305fb18763e2aade7e13cea5bbe699112df85214","impliedFormat":1},{"version":"98498b101803bb3dde9f76a56e65c14b75db1cc8bec5f4db72be541570f74fc5","impliedFormat":1},{"version":"706abfbafe0ed5f685357375e89bbf48879549ea1772185d77d15f587c5c9400","impliedFormat":1},{"version":"5d0375ca7310efb77e3ef18d068d53784faf62705e0ad04569597ae0e755c401","impliedFormat":1},{"version":"013ff793053d33a15be4614efdd6c50247bbf0b26d6bc58ba338622a7441b543","impliedFormat":1},{"version":"addf417b9eb3f938fddf8d81e96393a165e4be0d4a8b6402292f9c634b1cb00d","impliedFormat":1},{"version":"436d7b4543b340b0f3eef4310d524242e41369b9652aa9c70428767c4dcac455","impliedFormat":1},{"version":"adf27937dba6af9f08a68c5b1d3fce0ca7d4b960c57e6d6c844e7d1a8e53adae","impliedFormat":1},{"version":"12950411eeab8563b349cb7959543d92d8d02c289ed893d78499a19becb5a8cc","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"e99963ae1e3a48ca7a7958c02f3e88bb963eb7978c28b68ae6b8c9f03309d83c","impliedFormat":1},{"version":"c3f5289820990ab66b70c7fb5b63cb674001009ff84b13de40619619a9c8175f","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3275d55fac10b799c9546804126239baf020d220136163f763b55a74e50e750","affectsGlobalScope":true,"impliedFormat":1},{"version":"fa68a0a3b7cb32c00e39ee3cd31f8f15b80cac97dce51b6ee7fc14a1e8deb30b","affectsGlobalScope":true,"impliedFormat":1},{"version":"1cf059eaf468efcc649f8cf6075d3cb98e9a35a0fe9c44419ec3d2f5428d7123","affectsGlobalScope":true,"impliedFormat":1},{"version":"6c36e755bced82df7fb6ce8169265d0a7bb046ab4e2cb6d0da0cb72b22033e89","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7721c4f69f93c91360c26a0a84ee885997d748237ef78ef665b153e622b36c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"279d0cc1a72879918854265c3405369aa2d4d23509b8694ea102995b298cc5e2","affectsGlobalScope":true,"impliedFormat":1},{"version":"90e85f9bc549dfe2b5749b45fe734144e96cd5d04b38eae244028794e142a77e","affectsGlobalScope":true,"impliedFormat":1},{"version":"e0a5deeb610b2a50a6350bd23df6490036a1773a8a71d70f2f9549ab009e67ee","affectsGlobalScope":true,"impliedFormat":1},{"version":"594ae90cacd813fa392ff80d2e0a8eff4e41f4a136329a940e321399dd8895b4","impliedFormat":1},{"version":"d1f333ade8ff35a409b4984e1f11956fe11c61855b0c7e9b59f0313e48b40c4a","impliedFormat":1},{"version":"0224aa4b3464895d69c413a640a19ac2166778a74eb5eb3b36b021c72d42b274","impliedFormat":1},{"version":"575aa163c4c32e5b82e0e99b1f9f80806e1d78bfa259706e05139251c022277b","affectsGlobalScope":true,"impliedFormat":1},{"version":"7fb21326854faaa31ef02c9d51629fb6acedacb9396e74bf22ff8409441ea9ae","impliedFormat":1},{"version":"2fbf504c4791f9d32cd766cfe6b605bcda63289b925401953a7900db9af85348","impliedFormat":1},{"version":"ed0fb633cae35948d9e144004299a4bdf1ab912667c787b7fbffcd6d8c7b92a2","impliedFormat":1},{"version":"1678b04557dca52feab73cc67610918a7f5e25bfdba3e7fa081acd625d93106d","impliedFormat":1},{"version":"7db737262597ae2e35daa8cc1748f482cf4b0914e00a3d5a32cf6c4fc869a375","impliedFormat":1},{"version":"9c90f502816bd0179556bb875e86c944af3f6b995cde63199edbe4e0b1219aba","impliedFormat":1},{"version":"97581dc7099ef3d844c83706d53a7ecf895c0e867fbf6b9dc035bb3080f677bd","impliedFormat":1},{"version":"e494b286c8e27c52f8c7f945aa80ff223f2a3cd4f7a2619fa8991f1459e26f07","impliedFormat":1},{"version":"f54f5f9e10bbceba7515dfad0ffc89dffdb8d749d0604594c57a725cf6d79c20","impliedFormat":1},{"version":"41d17e1ad9a002feb11c8cdd2777e5bbc0cdb1e3f595d237e4dded0b6949983b","impliedFormat":1},{"version":"8c7e618c2a91ea7f6b5cca272a295864e92c16413be8fc56a943e8c7d5320011","affectsGlobalScope":true,"impliedFormat":1},{"version":"13f487e411f9657df0e76572e500c1209b8fe95ee3b4cc6e6e7913c15f56207d","impliedFormat":1},{"version":"9d37b8a9678efbcdf38238b59ce8e6f7db70aba1a516f3a4a671a301dbacfb3d","impliedFormat":1},{"version":"a47a792b8cff71443be8dfb199f2b77e102a7bf9d4f90c18059f05d9af2d7413","impliedFormat":1},{"version":"ad50512520720d10294c629cb4e2df23891c3fcbeaca00fbfb9e6bbea65f3dd6","impliedFormat":1},{"version":"189769511b45c93b23ba76069f7701d3b631cfbedc1eb94c7753486c78736f78","impliedFormat":1},{"version":"2c2bdaa1d8ead9f68628d6d9d250e46ee8e81aa4898b4769a36956ae15e060fe","impliedFormat":1},{"version":"ba389fd3d7fba6670e97bc82eb12469dcb371d22f24e63859c1df5a083c823ed","impliedFormat":1},{"version":"5ff4433a2deae4f85ab1377e90a7554ce6b47ae51c69a84ca30a6e22fae85834","impliedFormat":1},{"version":"82b91e4e42e6c41bc7fc1b6c2dc5eba6a2ba98375eb1f210e6ff6bba2d54177e","impliedFormat":1},{"version":"97234c5303866576f913d0ccae7d58d6322d9e803c7bf1228a3fda46ab8087b2","affectsGlobalScope":true,"impliedFormat":1},{"version":"961dec547748827cb6b45f6fdc66273f7bacd9c73103c6779f070f2fd07f23f9","impliedFormat":1},{"version":"8e9c23ba78aabc2e0a27033f18737a6df754067731e69dc5f52823957d60a4b6","impliedFormat":1},{"version":"73eeb740dacc45adc607a4f59f90fa9dbe2717d93d82f115f45f34e18f8d644a","impliedFormat":1},{"version":"ec501101c2a96133a6c695f934c8f6642149cc728571b29cbb7b770984c1088e","impliedFormat":1},{"version":"b214ebcf76c51b115453f69729ee8aa7b7f8eccdae2a922b568a45c2d7ff52f7","impliedFormat":1},{"version":"429c9cdfa7d126255779efd7e6d9057ced2d69c81859bbab32073bad52e9ba76","impliedFormat":1},{"version":"d251cda16f3f6a3e07f07c9e6e823ef6c583c63f653eb8777dafa749a78298e3","impliedFormat":1},{"version":"361939136b496a38b3e6b7be750bbb6998ef289bb8dd304c673138542ca16137","affectsGlobalScope":true,"impliedFormat":1},{"version":"230763250f20449fa7b3c9273e1967adb0023dc890d4be1553faca658ee65971","impliedFormat":1},{"version":"c3e9078b60cb329d1221f5878e88cecfa3e74460550e605a58fcfb41a66029ff","impliedFormat":1},{"version":"89e2568ebc2ec1e4149384b105e80e8bbf41eb4d711547f1121f4f628028de96","impliedFormat":1},{"version":"441b9bb09013654aa3d050e68b06464d8959b473e85868249d9d18f692acd35b","impliedFormat":1},{"version":"bc18a1991ba681f03e13285fa1d7b99b03b67ee671b7bc936254467177543890","impliedFormat":1},{"version":"55246f15e33ff1e2e9e679b25fa9790a48db55dc63d567fe25fac8b6a0efe911","impliedFormat":1},{"version":"fa94bbf532b7af8f394b95fa310980d6e20bd2d4c871c6a6cb9f70f03750a44b","impliedFormat":1},{"version":"925734f303b7f0cc111d42aeb21781d38a79e6d5ac05b2b1400cd1861a75d27b","impliedFormat":1},{"version":"5b26c4dd672d88336bb929787c9bfb55119e80ba89ec6dc923da1c063892843e","affectsGlobalScope":true,"impliedFormat":1},{"version":"7fa2214bb0d64701bc6f9ce8cde2fd2ff8c571e0b23065fa04a8a5a6beb91511","impliedFormat":1},{"version":"7286e4e5f80c0b1ab16addbdbbc9dd47fbae1c42034189261177b84d745cde3b","impliedFormat":1},{"version":"f12624a4a8d042b68914eac1b0a16571fc1c523173fcdf2517c65d191bd5a86c","impliedFormat":1},{"version":"cd2a656ba1d250c2002190b683e3826bf4362b6919450bc0f9bbf5612ebad837","impliedFormat":1},{"version":"841983e39bd4cbb463be385e92fda11057cab368bf27100a801c492f1d86cbaa","impliedFormat":1},{"version":"3e221ff0522e6ff95aa74a5211126aaf4d7e85ed8c8ff19290d591ad4bef988f","impliedFormat":1},{"version":"7da83f6429c6298ebf2be43d296b56ecfc94c9c28f5471b2f23b87545b914cea","impliedFormat":1},{"version":"e4156ddb25aa0e3b5303d372f26957b36778f0f6bbd4326359269873295e3058","affectsGlobalScope":true,"impliedFormat":1},{"version":"cc1b433a84cae05ddc5672d4823170af78606ad21ecef60dbc4570190cbf1357","impliedFormat":1},{"version":"751048d4aa67e20e5ecd2692340ea0d19bae42a20cc651d6f56d095e411ce3ac","impliedFormat":1},{"version":"7f78cfb2b343838612c192cb251746e3a7c62ac7675726a47e130d9b213f6580","impliedFormat":1},{"version":"aed8f3e5c7e53462565eedf34a9bcb700393cb2c1ab0c768602b929c3ed3145d","impliedFormat":1},{"version":"8e2577e7262051fd3c5bd6ca2b2056d358ff8853565720f92455860824c25188","impliedFormat":1},{"version":"7ec8d7d483f7394f9da611b10d3a0e402f76ff5c991261e6ce43a15f81ca4258","impliedFormat":1},{"version":"bb9dbb4b2ad81e3e71ec5ba4314973718555b9d04ba2a17dfbf875efecb8e2c0","impliedFormat":1},{"version":"9021dc5be8f3a87af5cede29221188a6497e2092b6889e0be212ef6b6b7153e9","impliedFormat":1},{"version":"4a8c8fd951d9fd9e0775f0aae8ed1f8b528204e24a2600bea3a1228ea83de52c","impliedFormat":1},{"version":"5b9cc0c724a8ebc7a873ab8e73c20b2416cef04b9e9d7f95ef1fa0fdcd4e0ec8","impliedFormat":1},{"version":"99ab6d0d660ce4d21efb52288a39fd35bb3f556980ec5463b1ae8f304a3bbc85","impliedFormat":1},{"version":"80a4b7023a2cc9f14d3f2e4635d6615ab3eff4b5b3630f62a8e73992fdd8cdb9","impliedFormat":1},{"version":"ec62d16f95636123624a69191a35b5df44b4b0a6428977e856c5739c0a787471","impliedFormat":1},{"version":"afa1c49f8e559e413d57343339db857d2a8159435cf9cf7d4deb41718fff1b88","impliedFormat":1},{"version":"c46f111af647c4134ae869653130610d62da321f90ebf19e186a3ea4bed79350","impliedFormat":1},{"version":"cdcc132f207d097d7d3aa75615ab9a2e71d6a478162dde8b67f88ea19f3e54de","impliedFormat":1},{"version":"0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","impliedFormat":1},{"version":"e1028394c1cf96d5d057ecc647e31e457b919092f882ed0c7092152b077fed9d","impliedFormat":1},{"version":"f315e1e65a1f80992f0509e84e4ae2df15ecd9ef73df975f7c98813b71e4c8da","impliedFormat":1},{"version":"5b9586e9b0b6322e5bfbd2c29bd3b8e21ab9d871f82346cb71020e3d84bae73e","impliedFormat":1},{"version":"3e70a7e67c2cb16f8cd49097360c0309fe9d1e3210ff9222e9dac1f8df9d4fb6","impliedFormat":1},{"version":"ab68d2a3e3e8767c3fba8f80de099a1cfc18c0de79e42cb02ae66e22dfe14a66","impliedFormat":1},{"version":"d96cc6598148bf1a98fb2e8dcf01c63a4b3558bdaec6ef35e087fd0562eb40ec","impliedFormat":1},{"version":"f8db4fea512ab759b2223b90ecbbe7dae919c02f8ce95ec03f7fb1cf757cfbeb","affectsGlobalScope":true,"impliedFormat":1}],"root":[[50,54]],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"esModuleInterop":true,"experimentalDecorators":true,"importHelpers":true,"inlineSources":true,"module":99,"noEmitOnError":true,"outDir":"./","rootDir":"..","skipLibCheck":true,"sourceMap":true,"strict":true,"target":99,"useDefineForClassFields":true},"referencedMap":[[183,1],[186,2],[185,1],[191,3],[118,4],[119,4],[120,5],[56,6],[121,7],[122,8],[123,9],[124,10],[125,11],[126,12],[127,13],[128,14],[129,15],[130,15],[131,16],[132,17],[133,1],[134,18],[135,19],[57,1],[55,1],[136,20],[137,21],[138,22],[182,23],[139,24],[140,25],[141,24],[142,26],[143,27],[145,28],[146,29],[147,29],[148,29],[149,30],[150,31],[151,32],[152,33],[153,34],[154,35],[155,35],[156,36],[157,1],[158,1],[159,37],[160,38],[161,39],[162,40],[163,41],[164,42],[165,43],[166,44],[167,45],[168,46],[169,47],[170,48],[171,49],[172,50],[173,51],[174,52],[175,53],[176,54],[177,55],[178,56],[58,24],[59,1],[60,57],[61,58],[62,1],[63,59],[64,1],[109,60],[110,61],[111,62],[112,62],[113,63],[114,1],[115,7],[116,64],[117,61],[179,65],[180,66],[181,67],[144,1],[184,1],[190,68],[188,69],[189,70],[187,71],[49,1],[47,1],[48,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[19,1],[20,1],[4,1],[21,1],[25,1],[22,1],[23,1],[24,1],[26,1],[27,1],[28,1],[5,1],[29,1],[30,1],[31,1],[32,1],[6,1],[36,1],[33,1],[34,1],[35,1],[37,1],[7,1],[38,1],[43,1],[44,1],[39,1],[40,1],[41,1],[42,1],[1,1],[45,1],[46,1],[83,72],[97,73],[80,74],[98,75],[107,76],[71,77],[72,78],[70,79],[106,80],[101,81],[105,82],[74,83],[84,84],[94,85],[73,86],[104,87],[68,88],[69,81],[75,84],[76,1],[82,89],[79,84],[66,90],[108,91],[99,92],[87,93],[86,84],[88,94],[91,95],[85,96],[89,97],[102,80],[77,98],[78,99],[92,100],[67,75],[96,101],[95,84],[81,99],[90,102],[93,103],[100,1],[65,1],[103,104],[52,105],[53,106],[54,107],[50,108],[51,109]],"version":"5.9.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/scene-ops",
3
- "version": "10.16.2",
3
+ "version": "10.27.1",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/src/index.js",
@@ -46,5 +46,5 @@
46
46
  },
47
47
  "./package.json": "./package.json"
48
48
  },
49
- "gitHead": "e96eb052293f2cc271e40293bf00a0d953b411fb"
49
+ "gitHead": "06c50a310ec85d2a156048fa4e8c9932f88d4bb7"
50
50
  }
@@ -95,7 +95,7 @@ export function dispatchSceneEditOp(
95
95
  if (!target) return NOOP_RESULT
96
96
  const oldValues = captureOldKeys(target.model, op.patch as any)
97
97
  const merged = mergeComponent(target.model, op.patch as any)
98
- target.set(merged)
98
+ target.set(withClearedKeys(merged, op.patch as any))
99
99
  /* `set` does not push a snapshot by itself — ask the commander for one. */
100
100
  scene.commander?.execute(null, false)
101
101
  return {
@@ -111,7 +111,7 @@ export function dispatchSceneEditOp(
111
111
  delete cleanPatch.components /* children move by add/remove/modify */
112
112
  const oldValues = captureOldKeys(root.model, cleanPatch)
113
113
  const merged = mergeComponent(root.model, cleanPatch)
114
- root.set(merged)
114
+ root.set(withClearedKeys(merged, cleanPatch))
115
115
  scene.commander?.execute(null, false)
116
116
  return { applied: true, inverseOps: [{ op: 'modifyScene', patch: oldValues }] }
117
117
  }
@@ -387,6 +387,23 @@ export function collectAllRefids(scene: any): number[] {
387
387
  * This is the patch of the inverse `modify`. A key the model did not have is kept as null,
388
388
  * which the mergers read as "remove it" — so undoing an added key removes it again.
389
389
  */
390
+ /**
391
+ * `null` in a patch means "this key should not be there" - it is how an inverse restores a
392
+ * property the component did not have before the edit (see `captureOldKeys`).
393
+ *
394
+ * `mergeComponent` deletes such a key from the merged model, but a component's `set()` only writes
395
+ * the keys it is given, so the old value stayed: an AI edit that added a first binding or a first
396
+ * fill colour could not be reverted - the chat said "reverted" and the property was still there.
397
+ * Handing the key over as `undefined` makes `set()` clear it.
398
+ */
399
+ function withClearedKeys(merged: any, patch: any): any {
400
+ const out = { ...merged }
401
+ for (const k of Object.keys(patch || {})) {
402
+ if (patch[k] === null) out[k] = undefined
403
+ }
404
+ return out
405
+ }
406
+
390
407
  export function captureOldKeys(model: any, patch: any): any {
391
408
  const out: any = {}
392
409
  for (const k of Object.keys(patch || {})) {