cozyclay 2.1.0 → 2.1.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.
- package/CHANGELOG.md +5 -0
- package/bin/live/cli.mjs +21 -5
- package/dist/app/index.html +5 -5
- package/dist/assets/analytics-C9pMpW7s.js +1 -0
- package/dist/assets/{app-Do-Og5Pu.css → app-B_2XB9rw.css} +1 -1
- package/dist/assets/app-DAuvKPP8.js +4920 -0
- package/dist/assets/{demo-Dt0qZfS7.js → demo-CvKuBgy5.js} +1 -1
- package/dist/assets/{first-shot-handoff-BlT33CGf.js → first-shot-handoff-msLI71g1.js} +1 -1
- package/dist/assets/{landing-BSesrCpL.js → landing-ChUvB_zL.js} +1 -1
- package/dist/assets/{scene-asset-sync-BCWDJB1d.js → scene-asset-sync-DKkpjKBV.js} +1 -1
- package/dist/assets/{ticket-jqMhqL88.js → ticket-BPk2Ni95.js} +1 -1
- package/dist/assets/{workflow-Br-K7Srs.js → workflow-jJRBR94Z.js} +1 -1
- package/dist/cozyclay-package.json +1 -1
- package/dist/index.html +3 -3
- package/dist/llms.txt +14 -0
- package/dist/workflow/index.html +3 -3
- package/package.json +1 -1
- package/src/App.jsx +24 -15
- package/src/ardy/timeline.jsx +8 -8
- package/src/panels/PoseImagePanel.jsx +1 -1
- package/src/shell/BottomDock.jsx +2 -2
- package/src/shell/CompositionGuideButton.jsx +20 -0
- package/src/shell/ShotPreviewHeader.jsx +17 -0
- package/src/shell/TopBar.jsx +1 -0
- package/src/shell/ViewportToolbar.jsx +18 -28
- package/src/shell/viewport.css +12 -0
- package/src/studio-agent-commands.js +27 -0
- package/src/studio-agent-protocol.js +5 -2
- package/src/studio-app-binding.js +5 -1
- package/tools/ardy/__pycache__/cclay_gvhmr_worker.cpython-313.pyc +0 -0
- package/tools/gt-render/browser.mjs +23 -0
- package/tools/headless-studio.mjs +85 -0
- package/tools/loc-baseline.json +6 -6
- package/tools/run-tests.mjs +1 -0
- package/dist/assets/analytics-B41FmPYI.js +0 -1
- package/dist/assets/app-DwP-tl2x.js +0 -4920
package/tools/loc-baseline.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"bin/agent/supervisor.mjs": 283,
|
|
8
8
|
"bin/agent/video-adapters.mjs": 334,
|
|
9
9
|
"bin/cozyclay.mjs": 527,
|
|
10
|
-
"bin/live/cli.mjs":
|
|
10
|
+
"bin/live/cli.mjs": 456,
|
|
11
11
|
"mcp/live-hub.mjs": 534,
|
|
12
12
|
"mcp/tool-handlers.mjs": 1890,
|
|
13
13
|
"mcp/verify-live-batch.mjs": 490,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"mcp/verify-live-p0.mjs": 287,
|
|
18
18
|
"mcp/verify-live.mjs": 455,
|
|
19
19
|
"src/analytics.js": 1181,
|
|
20
|
-
"src/App.jsx":
|
|
20
|
+
"src/App.jsx": 6644,
|
|
21
21
|
"src/ardy/auto-physics.js": 1094,
|
|
22
22
|
"src/ardy/collision-blockers.js": 273,
|
|
23
23
|
"src/ardy/convert.js": 285,
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"src/shot-authoring.js": 348,
|
|
81
81
|
"src/stage-canvas-rigs.jsx": 352,
|
|
82
82
|
"src/stage-editor-gizmos.jsx": 1116,
|
|
83
|
-
"src/studio-agent-commands.js":
|
|
84
|
-
"src/studio-agent-protocol.js":
|
|
85
|
-
"src/studio-app-binding.js":
|
|
83
|
+
"src/studio-agent-commands.js": 492,
|
|
84
|
+
"src/studio-agent-protocol.js": 521,
|
|
85
|
+
"src/studio-app-binding.js": 364,
|
|
86
86
|
"src/ui.jsx": 393,
|
|
87
87
|
"src/workflow/agent-client.js": 1386,
|
|
88
88
|
"src/workflow/AgentPanel.jsx": 894,
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"tools/projflow/replay.mjs": 397,
|
|
118
118
|
"tools/projflow/service.mjs": 651,
|
|
119
119
|
"tools/qa/css-rule-usage.mjs": 251,
|
|
120
|
-
"tools/run-tests.mjs":
|
|
120
|
+
"tools/run-tests.mjs": 564,
|
|
121
121
|
"tools/track/gate.mjs": 325,
|
|
122
122
|
"tools/track/masks.mjs": 297,
|
|
123
123
|
"tools/track/study-2d.mjs": 663,
|
package/tools/run-tests.mjs
CHANGED
|
@@ -127,6 +127,7 @@ const NODE_FILES = [
|
|
|
127
127
|
"test/verify-agent-context-budget.mjs",
|
|
128
128
|
"test/verify-agent-supervisor.mjs",
|
|
129
129
|
"test/verify-studio-agent-protocol.mjs",
|
|
130
|
+
"test/verify-studio-agent-sampled-framing.mjs",
|
|
130
131
|
"test/verify-studio-agent-tokens.mjs",
|
|
131
132
|
"test/verify-studio-agent-jobs.mjs",
|
|
132
133
|
"test/verify-agent-execution.mjs",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=.02,t=(e,t,n)=>Math.min(n,Math.max(t,e)),n=(e,t=0)=>typeof e==`number`&&Number.isFinite(e)?e:t;function r(e){let t=0;for(let n=0;n<e.length-1;n+=1)t+=(e[n]+e[n+1])/2;return t}function i(e,n){let r=t(n,0,1)*(e.length-1),i=Math.min(e.length-2,Math.floor(r)),a=r-i;return e[i]*(1-a)+e[i+1]*a}function a(e,t=24){if(!e.length)return Array(t).fill(1);if(e.length===1)return Array(t).fill(e[0]);let n=Array(t);for(let r=0;r<t;r+=1)n[r]=i(e,r/(t-1));return n}function o(e){let t=e.map(e=>Math.max(0,n(e,0))),i=r(t)/(t.length-1);return i<=1e-9?t.map(()=>1):t.map(e=>e/i)}function s(e){return e.every(e=>Math.abs(e-1)<1e-6)}function c(){return{cuts:[],envelopes:[Array(24).fill(1)]}}function l(e){return!e||e.cuts.length===0&&e.envelopes.every(s)}function u(e){if(!e||typeof e!=`object`)return null;let t=Array.isArray(e.cuts)?e.cuts:[],r=[];for(let e of t){let t=n(e?.t,NaN),i=n(e?.d,NaN);if(!(t>0&&t<1&&i>0&&i<1))continue;let a=r[r.length-1];a&&(t<=a.t+1e-6||i<=a.d+1e-6)||r.push({t,d:i})}let i=Array.isArray(e.envelopes)?e.envelopes:[],s=[];for(let e=0;e<=r.length;e+=1){let t=Array.isArray(i[e])?i[e].map(e=>n(e,1)):[];s.push(o(a(t.length>=2?t:[1,1])))}return{cuts:r,envelopes:s}}function d(e,r,i,a=.18){let o=e.length,s=Math.max(0,n(i,0)),c=t(n(r,0),0,1),l=a/3,u=Array(o);for(let e=0;e<o;e+=1){let t=Math.abs(e/(o-1)-c);u[e]=t<=l?1:t>=a?0:.5*(1+Math.cos((t-l)/(a-l)*Math.PI))}let d=e.map((e,t)=>Math.max(0,e*(1-u[t])+s*u[t])),f=e=>e===0||e===o-1?.5:1,p=o-1,m=0,h=0;for(let e=0;e<o;e+=1)u[e]>1e-9?m+=f(e)*d[e]:h+=f(e)*d[e];if(h>1e-9){let e=Math.max(0,(p-m)/h);for(let t=0;t<o;t+=1)u[t]<=1e-9&&(d[t]*=e);if(p-m<0){let e=p/m;for(let t=0;t<o;t+=1)u[t]>1e-9&&(d[t]*=e)}}else if(m>1e-9){let e=p/m;for(let t=0;t<o;t+=1)d[t]*=e}else return Array(o).fill(1);return d}function f(e,n){let i=e.length,a=r(e);if(a<=1e-9)return t(n,0,1);let o=t(n,0,1)*(i-1),s=Math.min(i-2,Math.floor(o)),c=o-s,l=0;for(let t=0;t<s;t+=1)l+=(e[t]+e[t+1])/2;let u=e[s]*(1-c)+e[s+1]*c;return l+=(e[s]+u)/2*c,l/a}function p(e,r){let i=t(n(r,0),0,1);if(!e)return i;let a=[{t:0,d:0},...e.cuts,{t:1,d:1}],o=0;for(;o<a.length-2&&i>a[o+1].t;)o+=1;let s=a[o],c=a[o+1],l=c.t-s.t,u=l>1e-9?(i-s.t)/l:1;return s.d+(c.d-s.d)*f(e.envelopes[o],u)}function m(e,t,n){let r=Array(24);for(let a=0;a<24;a+=1)r[a]=i(e,t+(n-t)*(a/23));return r}function h(e,t){let r=e??c(),i=n(t,NaN);if(!(i>.02&&i<.98))return e;for(let t of r.cuts)if(Math.abs(t.t-i)<.02)return e;let a=p(r,i);if(!(a>1e-6&&a<1-1e-6))return e;let s=0;for(;s<r.cuts.length&&i>r.cuts[s].t;)s+=1;let l=s===0?{t:0}:r.cuts[s-1],u=s===r.cuts.length?{t:1}:r.cuts[s],d=(i-l.t)/(u.t-l.t),f=r.envelopes[s];return{cuts:[...r.cuts.slice(0,s),{t:i,d:a},...r.cuts.slice(s)],envelopes:[...r.envelopes.slice(0,s),o(m(f,0,d)),o(m(f,d,1)),...r.envelopes.slice(s+1)]}}function g(e,t){if(!e||!e.cuts[t])return e;let n=[{t:0,d:0},...e.cuts,{t:1,d:1}],r=n[t],a=n[t+1],s=n[t+2],c=(a.t-r.t)/(s.t-r.t),l=(a.d-r.d)/(s.d-r.d),u=1-c,d=1-l,f=e.envelopes[t],p=e.envelopes[t+1],m=Array(24);for(let e=0;e<24;e+=1){let t=e/23;if(t<=c){let n=i(f,c>1e-9?t/c:0);m[e]=l/Math.max(1e-9,c)*n}else{let n=i(p,u>1e-9?(t-c)/u:0);m[e]=d/Math.max(1e-9,u)*n}}return{cuts:[...e.cuts.slice(0,t),...e.cuts.slice(t+1)],envelopes:[...e.envelopes.slice(0,t),o(m),...e.envelopes.slice(t+2)]}}var _=Object.freeze([`keys`,`follow`,`rail`]),ee=Object.freeze({distance:3,height:1.6,response:.7,lead:.25,railStartMode:`head`,maxDollySpeed:4,pitchOffsetDeg:0,orbitOffsetDeg:0});function v(e){return Array.isArray(e)?e.map(e=>({x:e.x,z:e.z})):null}function te(e){if(!e||typeof e!=`object`)return null;let t=Array.isArray(e.points)?e.points:Number.isFinite(e.start)&&Number.isFinite(e.end)?[{t:0,height:e.start},{t:1,height:e.end}]:null;if(!t)return null;let n=t.filter(e=>e&&Number.isFinite(e.t)&&Number.isFinite(e.height)).map(e=>({t:Math.max(0,Math.min(1,e.t)),height:Math.max(.1,e.height)})).sort((e,t)=>e.t-t.t).filter((e,t,n)=>t===n.length-1||n[t+1].t-e.t>1e-6).slice(0,8);return n.length<2?null:(n[0]={...n[0],t:0},n[n.length-1]={...n[n.length-1],t:1},{points:n})}function ne(e){return!e||typeof e!=`object`?null:e.mode===`off`?{mode:`off`}:e.mode===`range`?{mode:`range`,startFrame:e.startFrame,endFrame:e.endFrame}:null}function y(e={}){let t=e&&typeof e==`object`?e:{},n=_.includes(t.mode)?t.mode:`keys`,r={...ee,...t.followCam??{}},i=v(t.cameraRail),a=te(t.craneHeight)??(n===`rail`&&i?{points:[{t:0,height:r.height},{t:1,height:r.height}]}:null),o=u(t.dollyTiming);return{mode:n,followCam:r,cameraRail:i,railFollow:ne(t.railFollow),craneHeight:a,dollyTiming:l(o)?null:o}}function re(e){return y(e)}function ie(e,t={}){let n=y(e),r=t&&typeof t==`object`?t:{};return y({...n,...r,followCam:r.followCam?{...n.followCam,...r.followCam}:n.followCam,cameraRail:Object.hasOwn(r,`cameraRail`)?r.cameraRail:n.cameraRail,railFollow:Object.hasOwn(r,`railFollow`)?r.railFollow:n.railFollow,craneHeight:Object.hasOwn(r,`craneHeight`)?r.craneHeight:n.craneHeight,dollyTiming:Object.hasOwn(r,`dollyTiming`)?r.dollyTiming:n.dollyTiming})}function ae(e){let t=y(e);return ie(t,{mode:t.mode===`rail`?`follow`:t.mode,cameraRail:null,railFollow:null,craneHeight:null})}var b=e=>e&&typeof e==`object`?Object.freeze({...e}):e,oe=Object.freeze([{path:`character.position`,type:`vec3`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,min:{x:-240,y:0,z:-240},max:{x:240,y:240,z:240},gizmo:{min:{x:-4,y:0,z:-4},max:{x:4,y:240,z:4}},note:`y is the feet`},{path:`character.rot`,type:`number`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,min:-180,max:180,angle:!0,note:`yaw degrees, wrapped at the upper bound`},{path:`character.scale`,type:`number`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,min:.2,max:3},{path:`character.subject`,type:`string`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`},{path:`character.hidden`,type:`boolean`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`},{path:`character.parent`,type:`id`,nullable:!0,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,note:`scene object id the character is grouped under and rides; null stands in the world`},{path:`character.model`,type:`enum`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,enum:[`y-bot-tpose`,`x-bot-tpose`,`proxy-figure`]},{path:`character.posture`,type:`enum`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,enum:[`stand`,`sit`,`lie`]},{path:`character.tint`,type:`color`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`},{path:`character.identityImage`,type:`image`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,note:`data:image only`},{path:`character.pose`,type:`id`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`},{path:`character.waypoints`,type:`array`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,actions:[`character.addWaypoint`,`character.moveWaypoint`,`character.removeWaypoint`,`character.clearWaypoints`],note:`root path pins, addressed by frame`},{path:`character.promptBlocks`,type:`array`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,note:`stored at layer.promptClips`},{path:`character.motionRef.url`,type:`string`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`},{path:`character.motionRef.motionId`,type:`id`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`},{path:`character.sessionMotion`,type:`array`,persisted:!1,undoDomain:`cast`,normalizer:`createCharacterEntry`,note:`dropped by createCharacterEntry`},{path:`character.ikKeys`,type:`array`,persisted:!1,undoDomain:`cast`,normalizer:`createCharacterEntry`,actions:[`character.setIkKey`,`character.removeIkKey`,`character.clearIkKeys`],note:`dropped by createCharacterEntry; keys travel as JSON quaternions/positions`},{path:`object.renderer`,type:`enum`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,enum:[`cube`,`sphere`,`capsule`,`cylinder`,`cone`,`plane`,`chair`,`car`,`small-plane`,`empty`]},{path:`object.position`,type:`vec3`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,min:{x:-240,y:0,z:-240},max:{x:240,y:240,z:240},note:`y is the object's base: y=0 rests on the floor; height/supportY rise from it`},{path:`object.rotation`,type:`vec3`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,min:{x:-180,y:-180,z:-180},max:{x:180,y:180,z:180},note:`rot/rotX/rotZ degrees, wrapped at the upper bound`},{path:`object.scale`,type:`vec3`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,min:{x:.1,y:.1,z:.1},max:{x:100,y:100,z:100}},{path:`object.name`,type:`string`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`},{path:`object.color`,type:`color`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`},{path:`object.opacity`,type:`number`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,min:.05,max:1,note:`1 is solid; lower is see-through, e.g. 0.3 for clear glass`},{path:`object.parent`,type:`id`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`},{path:`object.attach`,type:`id`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,actions:[`object.attach`,`object.detach`],note:`carried by a character's root or bone; channels convert so the prop stays put`},{path:`object.path`,type:`array`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`},{path:`object.remove`,type:`boolean`,persisted:!0,undoDomain:`objects`,normalizer:null,note:`lifecycle operation, not a document field`},{path:`object.cutout`,type:`image`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,actions:[`asset.import`],note:`assetId-backed cutout record; imported pictures and models are placed by asset.import`},{path:`stage.keyLight.x`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:-30,max:30},{path:`stage.keyLight.y`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:.5,max:30},{path:`stage.keyLight.z`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:-30,max:30},{path:`stage.keyLight.intensity`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:0,max:4},{path:`stage.keyLight.warmth`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:0,max:1},{path:`stage.environmentImage`,type:`image`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`data:image only`},{path:`stage.environment`,type:`string`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`location description every shot prompt is built from`},{path:`stage.style`,type:`string`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`look / style line for shot prompts`},{path:`stage.hasEnvSheet`,type:`boolean`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`author supplies an environment sheet instead of a description`},{path:`stage.camera`,documentPath:`shotAspect`,type:`enum`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,enum:[`16:9`,`2.39:1`,`9:16`,`1:1`,`4:3`,`12:7`,`fal 480P`],note:`output aspect ratio`},{path:`stage.cameraPresetId`,type:`id`,nullable:!0,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`},{path:`stage.sensorId`,type:`enum`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,enum:[`super16`,`super35`,`fullFrame`,`65mm`]},{path:`shot.crud`,type:`array`,persisted:!0,undoDomain:`shot`,normalizer:null,actions:[`shot.create`,`shot.split`,`shot.duplicate`,`shot.remove`,`shot.setRange`,`shot.reorder`],note:`create/split/duplicate/reorder/remove/range through the shared action registry`},{path:`shot.cameraKeys`,type:`array`,persisted:!0,undoDomain:`shot`,normalizer:null,frameMin:0},{path:`shot.cameraRail`,type:`array`,persisted:!0,undoDomain:`shot`,normalizer:`repairCamera`,actions:[`shot.setCameraRail`,`shot.clearCameraRail`],note:`rail points; crane/dolly timing follow the shot's camera block`},{path:`shot.targetModel`,type:`id`,persisted:!0,undoDomain:`shot`,normalizer:`repairCamera`},{path:`shot.kind`,type:`enum`,persisted:!0,undoDomain:`shot`,normalizer:null,readOnly:!0,enum:[`clip`,`still`],note:`clip or still; a still holds one picture for endFrame - startFrame + 1 frames`},{path:`shot.caption`,type:`string`,persisted:!0,undoDomain:`shot`,normalizer:null,readOnly:!0,note:`trimmed, at most 500 characters`},{path:`shot.cast`,type:`array`,persisted:!0,undoDomain:`shot`,normalizer:null,readOnly:!0,note:`per-shot placement overrides keyed by character id: { x, z, rot, posture?, pose? }`},{path:`shot.stylizedAssetId`,type:`id`,nullable:!0,persisted:!0,undoDomain:`shot`,normalizer:null,readOnly:!0,note:`image asset id only`},{path:`shot.freeCamera`,type:`vec3`,persisted:!1,undoDomain:`shot`,normalizer:null,note:`transient until keyed`},{path:`scenes`,type:`array`,persisted:!0,undoDomain:null,normalizer:null,actions:[`scene.create`,`scene.duplicate`,`scene.rename`,`scene.delete`,`scene.switch`],note:`the project's scene list and the open scene; outside the undo history`},{path:`project`,type:`string`,persisted:!0,undoDomain:null,normalizer:null,actions:[`project.save`],note:`save to the current project file; opening one needs the user's file picker`},{path:`selection`,type:`id`,persisted:!1,undoDomain:null,normalizer:null},{path:`timeline`,type:`number`,persisted:!1,undoDomain:null,normalizer:null},{path:`view.mode`,type:`enum`,persisted:!1,undoDomain:null,normalizer:null,enum:[`scene`,`pose`,`camera`,`motion`]},{path:`view.partColoursGuideModeInset`,type:`array`,persisted:!1,undoDomain:null,normalizer:null,actions:[`view.setPartColours`,`view.setGuideMode`,`view.setInset`],note:`partColours/guideMode/inset; viewer settings, not document fields`},{path:`read.sceneDescription`,type:`string`,persisted:!1,undoDomain:null,normalizer:null},{path:`read.captureFrame`,type:`image`,persisted:!1,undoDomain:null,normalizer:null},{path:`undo`,type:`boolean`,persisted:!1,undoDomain:null,normalizer:null}].map(e=>Object.freeze({...e,...e.enum?{enum:Object.freeze([...e.enum])}:{},...e.actions?{actions:Object.freeze([...e.actions])}:{},...e.min&&typeof e.min==`object`?{min:b(e.min)}:{},...e.max&&typeof e.max==`object`?{max:b(e.max)}:{},...e.gizmo?{gizmo:Object.freeze({min:b(e.gizmo.min),max:b(e.gizmo.max)})}:{}})));function se(e){return oe.find(t=>t.path===e)}var x=e=>e.persisted!==!1&&!e.actions&&!e.readOnly,ce=[`storyboard`,`animation`],le=[`stand`,`sit`,`lie`],ue=65536,de=Object.freeze({entities:24,entityIndex:400,shots:8,assets:48,recentReceipts:3,jobs:8}),fe=Object.freeze([`inspect_studio`,`run_action`,`verify_result`]);Object.freeze([`operate_studio`,`arrange_objects`,`arrange_characters`,`patch_elements`,`frame_shot`,`generate_motion`,`undo_edit`]);var S=Object.freeze({inspect_studio:`Read the scene`,operate_studio:`Selection and view`,arrange_objects:`Arrange objects`,arrange_characters:`Arrange characters`,patch_elements:`Edit properties`,frame_shot:`Frame the shot`,generate_motion:`Generate motion`,verify_result:`Verify the result`,undo_edit:`Undo an edit`,run_action:`Run an editor action`}),C=Object.freeze(Object.keys(S)),pe=Object.freeze([`character`,`object`,`shot`,`stage`]);Object.freeze({character:`cast`,object:`objects`,shot:`shot`,stage:`stage`});var me=Object.freeze(`INVALID_ARGUMENT.INVALID_CONTEXT.INVALID_IDENTITY.INVALID_TURN_ID.INVALID_SESSION_ID.INVALID_RECEIPT.INVALID_RANGE.INVALID_REQUEST.UNKNOWN_TOOL.UNKNOWN_VARIANT.DUPLICATE_NAME.CONTEXT_LIMIT.CONTEXT_TOO_LARGE.AMBIGUOUS_TARGET.AMBIGUOUS_BASIS.TARGET_NOT_READY.TARGET_BUSY.STALE_TARGET.STALE_SCENE.STALE_ENVIRONMENT.STALE_CURSOR.CAPABILITY_MISSING.LIVE_HUB_UNAVAILABLE.AUTH_REQUIRED.GENERATION_LIMIT.RATE_LIMITED.BACKEND_UNAVAILABLE.VERIFICATION_FAILED.REPAIR_REGRESSED.CANCELLED.UNCERTAIN_APPLY.UNDO_CONFLICT.CONFIRMATION_REQUIRED.TIMEOUT.UNDO_EXPIRED`.split(`.`)),w=D({selectionKinds:[`scene`,`object`,`character`,`rig`,`camera`],modes:[`scene`,`pose`,`camera`,`motion`],shotModes:[`keys`,`follow`,`rail`],framingSizes:[`extreme close-up`,`close-up`,`medium close-up`,`medium shot`,`medium-wide shot`,`wide shot`,`extreme wide shot`],framingViews:[`front`,`front three-quarter`,`profile`,`rear three-quarter`,`back`],framingLevels:[`ground`,`low`,`hip`,`eye`,`high`,`overhead`],framingSides:[`left`,`right`],positionSides:[`left`,`right`,`front`,`behind`],positionBases:[`world`,`subject`,`shot_camera`],collisionPolicies:[`report`,`avoid`],objectOps:[`create`,`update`,`remove`,`group`,`ungroup`],characterOps:[`create`,`update`,`remove`],inspectionScopes:[`selection`,`scene`,`entities`,`shot`,`motion`,`catalogue`,`actions`,`document`],receiptStatuses:[`applied`,`partial`,`noop`,`transient`,`installed`,`undone`],opStatuses:[`applied`,`partial`,`noop`],jobStates:[`queued`,`generating`,`preparing`,`verifying`,`repairing`,`committing`,`reconciling`,`installed`,`review_required`,`failed`,`cancelled`,`stale_target`,`stale_environment`]}),T=class extends Error{constructor(e,t,n={}){super(t),this.name=`StudioProtocolError`,this.code=e,this.details=n}toJSON(){return{code:this.code,message:this.message,...Object.keys(this.details).length?{details:this.details}:{}}}},E=e=>new TextEncoder().encode(e).byteLength;function D(e){if(e&&typeof e==`object`&&!Object.isFrozen(e)){for(let t of Object.values(e))D(t);Object.freeze(e)}return e}var O=(e,t,n=`$`,r={})=>{throw new T(e,t,{path:n,...r})},k=e=>typeof e==`object`&&!!e&&!Array.isArray(e),A=(e=120)=>({type:`string`,minLength:1,maxLength:e}),j=(e,t)=>({type:`number`,...e===void 0?{}:{minimum:e},...t===void 0?{}:{maximum:t}}),M=(e=0,t=2**53-1)=>({...j(e,t),type:`integer`}),N={type:`boolean`},P=e=>({const:e}),F=e=>({type:`string`,enum:e}),I=e=>({oneOf:[e,{type:`null`}]}),L=(e,t,n=0,r=!1)=>({type:`array`,items:e,minItems:n,maxItems:t,...r?{uniqueItems:r}:{}}),R=(e,t={})=>({type:`object`,properties:{...e,...t},required:Object.keys(e),additionalProperties:!1}),z=(...e)=>({oneOf:e}),he={type:`object`,properties:{},required:[],additionalProperties:!0},B={...A(),pattern:`^[A-Za-z0-9][A-Za-z0-9._:-]*$`},ge={...A(36),pattern:`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`},V=R({x:j(),y:j(),z:j()}),H={type:`number`,exclusiveMinimum:0},_e=R({x:H,y:H,z:H}),ve={...R({startFrame:M(),endFrameExclusive:M(1)}),"x-studio-range":!0},U=(e=100,t=1)=>L(B,e,t,!0),W=A(120),G={...A(120),description:`Object id, or the name of a part created EARLIER in this ops list (create it first).`},ye={workspaceId:B,documentEpoch:B,sceneId:B,sceneEpoch:B},be=R(ye),xe=R({surface:P(`studio`),...ye,workspaceHandle:I(B)}),Se=R({scene:M(),physics:M(),view:M()}),Ce=I(R({kind:F(w.selectionKinds),id:B},{hierarchyId:B})),we=R({mode:F(w.modes),frame:M(),playing:N,lookThrough:N,grid:N,autoColor:N}),Te=z(R({world:V}),R({relativeTo:G,basis:F(w.positionBases),side:F(w.positionSides),gapM:j(0),support:z(P(`floor`),R({objectId:G}))}),R({between:L(G,2,2,!0),fraction:j(0,1),support:P(`floor`)}),R({onObject:G},{offsetXZ:R({x:j(),z:j()})})),Ee=z(R({yawDeg:j()}),R({towardId:G}),R({sameAsId:G}),R({awayFromId:G})),De=z(R({intent:R({size:F(w.framingSizes),view:F(w.framingViews),level:F(w.framingLevels),side:F(w.framingSides)},{focalMm:H})}),R({exact:R({position:V,lookAt:V,focalMm:H})})),Oe={...F([`parent`]),description:`"parent" reads position.world, rotationDeg and facing.yawDeg in the parent's local frame (its pivot and rotation, not its scale); omit for world space.`},ke=z(R({op:P(`create`),source:R({kind:B}),position:Te},{name:W,facing:Ee,scale:_e,rotationDeg:{...V,description:`Euler XYZ degrees (x pitch, y yaw, z roll), as in update. Exclusive with facing. A pitched/rolled part rests its lowest corner on its support.`},parent:{...W,description:`Group this new object under a parent: an existing object id, or the name of an object created earlier in this same ops list. Moving the parent then moves it too.`},space:Oe}),R({op:P(`update`),id:B},{position:Te,facing:Ee,rotationDeg:V,scale:_e,color:A(32),name:W,hidden:N,space:Oe}),R({op:P(`remove`),id:B}),R({op:P(`group`),parentId:B,childIds:U()}),R({op:P(`ungroup`),childIds:U()})),Ae=z(R({op:P(`create`),name:W,position:Te},{facing:Ee,scale:H}),R({op:P(`update`),characterId:B},{position:Te,facing:Ee,scale:H,name:W,hidden:N}),R({op:P(`remove`),characterId:B})),je=R({kind:P(`generate`),beats:L(R({text:{...A(500),description:`An English description of the body movement starting with "A person". The editor refuses prompts over 500 characters.`}},{seconds:j(.5,60)}),8,1)},{durationSeconds:j(2,60),seed:M(-2147483648,2147483647)}),Me=z(je,R({kind:P(`reuse`),artifactId:B})),Ne={...A(2097152),pattern:`^data:image/[A-Za-z0-9.+-]+[;,]`},Pe=R({startFrame:M(),endFrame:M(1),text:A(2e3)},{id:B}),Fe=R({frame:M(),framing:R({pos:V,yaw:j(),pitch:j(),fovDeg:j(1,179)})},{id:B}),Ie=z(j(0,1),R({t:j(0,1)},{bank:j(-90,90),pitch:j(-90,90)})),Le=I(R({points:L(V,64,2)},{speed:j(0,50),faceTravel:N,loop:N,extend:N,marks:L(Ie,6)})),Re={"character.pose":I(B),"character.identityImage":I(Ne),"character.promptBlocks":L(Pe,64),"object.parent":I(B),"object.path":Le,"stage.environmentImage":I(Ne),"shot.cameraKeys":L(Fe,64),"shot.targetModel":I(B)};function ze(e){if(Object.hasOwn(Re,e.path))return Re[e.path];if(e.type===`number`)return j(e.min,e.max);if(e.type===`boolean`)return N;if(e.type===`enum`)return F([...e.enum]);if(e.type===`id`)return B;if(e.type===`color`)return{...A(32),pattern:`^#[0-9a-fA-F]{6}$`};if(e.type===`image`)return I(Ne);if(e.type===`vec3`){let t=e.gizmo??e;return t.min&&typeof t.min==`object`&&t.max&&typeof t.max==`object`?R({x:j(t.min.x,t.max.x),y:j(t.min.y,t.max.y),z:j(t.min.z,t.max.z)}):V}return e.type===`string`?A(240):null}function Be(e){return e.filter(x).map(({path:e,type:t,min:n,max:r,enum:i,gizmo:a,note:o})=>({path:e,type:t,...a?.min===void 0?n===void 0?{}:{min:n&&typeof n==`object`?{...n}:n}:{min:{...a.min}},...a?.max===void 0?r===void 0?{}:{max:r&&typeof r==`object`?{...r}:r}:{max:{...a.max}},...i?{enum:[...i]}:{},...o?{note:o}:{}}))}var Ve=D(Be(oe));function He(e){let t={};for(let n of pe){let r={};for(let t of e){if(!x(t)||!t.path.startsWith(`${n}.`))continue;let e=ze(t);e&&(r[t.path.slice(n.length+1)]=e)}t[n]={type:`object`,properties:r,required:[],additionalProperties:!1}}return t}var Ue=D(He(oe)),We=D(Object.fromEntries(pe.map(e=>[e,Object.keys(Ue[e].properties).map(t=>`${e}.${t}`)]))),Ge=z(R({target:R({kind:P(`character`),id:B}),set:Ue.character}),R({target:R({kind:P(`object`),id:B}),set:Ue.object}),R({target:R({kind:P(`shot`)},{id:B}),set:Ue.shot}),R({target:R({kind:P(`stage`)}),set:Ue.stage})),Ke={inspect_studio:R({scope:F(w.inspectionScopes)},{ids:U(32),select:U(32),query:W,cursor:A(512),limit:{...M(1,32),default:12}}),operate_studio:R({},{selection:Ce,shotId:B,frame:M(),playing:N,mode:F(w.modes),view:R({},{lookThrough:N,grid:N,autoColor:N})}),arrange_objects:R({ops:{...L(ke,100,1),description:`Applied in order, as one undo step. Each op sees the parts created by earlier ops, so build an assembly in one call: create the main part, then place the rest with position.onObject / relativeTo(+side,gapM) / between naming earlier parts (e.g. relativeTo "Hood"). Reference parts created in this call by name, never by id.`}},{collisionPolicy:{...F(w.collisionPolicies),default:`report`}}),arrange_characters:R({ops:L(Ae,8,1)}),patch_elements:R({ops:L(Ge,32,1)}),frame_shot:R({subjectIds:U(1),framing:De},{shotId:B,caption:{type:`string`,maxLength:500},keyAtFrame:M()}),generate_motion:R({characterId:B,source:Me},{repair:{...F([`bounded`,`none`]),default:`bounded`}}),verify_result:R({checks:L(F([`placement`,`framing`,`motion`]),3,1,!0)},{receiptId:B,targets:U(),range:z(P(`whole_clip`),ve),visual:{...F([`none`,`frame`,`contact_sheet`,`plan`]),default:`none`}}),undo_edit:R({receiptId:B}),run_action:R({action:B},{args:he,confirmationToken:B})},qe=D(Ke),Je=D(C.map(e=>({name:e,slice:1,parameters:Ke[e]}))),Ye=R({min:V,max:V}),Xe=R({id:B,kind:F([`object`,`character`,`rig`]),token:B},{name:W,detailsOmitted:N,position:V,yawDeg:j(),rotationDeg:V,scale:z(H,_e),bounds:I(Ye),libraryKind:B,renderer:B,color:I(A(32)),tint:I(A(32)),modelId:I(A(120)),assetId:B,parentId:I(B),attachment:I(R({characterId:B,bone:I(B)})),pathPointCount:M(0,64),pathMarks:L(z(j(0,1),R({t:j(0,1)},{bank:j(-90,90),pitch:j(-90,90)})),6),local:R({position:V,rotationDeg:V}),motion:R({takeId:I(B),frames:M(),ikKeyCount:M(),promptBlockCount:M()},{poseId:I(B),keyIds:U(8,0)}),capabilities:R({rigReady:N,ik:N,measuredFeet:N}),characterKind:F([`rig`,`proxy`]),posture:F(le)}),Ze=R({id:B,kind:F([`object`,`character`,`rig`])},{name:W,position:V}),Qe=R({id:B},{label:W,generation:P(`motion`),timeoutMs:M(1,3e5)}),$e=R({id:B,name:W,range:ve,keyCount:M()},{subjectIds:U(24,0),kind:F([`clip`,`still`]),caption:A(500)}),et=R({id:B,name:W,range:ve,mode:F(w.shotModes)},{subjectIds:U(24,0),kind:F([`clip`,`still`]),caption:A(500)}),tt=R({position:V,lookAt:V,focalMm:H,sensorId:B,slate:W}),nt=F([`primitive`,`set-piece`,`image`,`mesh`]),rt=z(R({kind:B,name:W,type:nt}),R({id:B,name:W,type:nt})),it=R({id:B,characterId:B,state:F(w.jobStates)},{targetIds:U(24,0),progress:I(j(0,1)),phase:W}),at=R({schema:P(`studio-context-v1`),host:xe,revision:Se,units:R({distance:P(`m`),angle:P(`deg`),up:P(`+Y`),yawZero:P(`+Z`),yawPositiveToward:P(`+X`),pivot:P(`base`),fps:P(24),rangeEnd:P(`exclusive`)}),scene:R({name:W,aspect:A(40),floorY:j(),frameCount:M(),objectCount:M(),characterCount:M()},{previsMode:F(ce)}),selection:Ce,activeCharacterId:I(B),view:we,shot:I(et),camera:I(tt),entities:L(Xe,24),entityPage:R({returned:M(0,24),total:M(),truncated:N,nextCursor:I(A(512))}),shots:L($e,8),shotsTruncated:N,assets:L(rt,de.assets),recentReceipts:L(R({id:B,summary:W,canUndoDirect:N}),3),jobs:L(it,8),capabilities:R({profile:P(`studio-slice-1`),tools:L(F(C),C.length,0,!0)},{rigReady:N,cameraReady:N,bridgeReady:N,storyboard:N})},{entityIndex:L(Ze,de.entityIndex),actionIndex:L(Qe,512)}),ot=R({...ye,targetId:B,token:B}),st=[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`],ct=R({dataUrl:{...A(6e6),pattern:`^data:image/(png|jpeg|webp);base64,`}},{name:A(120)}),lt=R({surface:P(`studio`),sessionId:ge,turnId:ge,text:A(16e3),context:at},{model:A(120),effort:F(st),attachFrame:N,attachments:L(ct,4,1),supervisor:N}),ut=R({surface:P(`studio`),sessionId:ge,turnId:ge},{jobId:B}),dt=R({before:M(),after:M()}),ft=R({historyEntryId:B,entries:P(1),canUndoDirect:N}),pt=R({characterId:B,beforeTakeId:I(B),takeId:B,targetToken:B,frameCount:M(1),fps:P(24),durationSeconds:H,blocks:L(R({sourceBeat:M(0,7),startFrame:M(),endFrameExclusive:M(1)}),120,1),selectionChanged:P(!1)}),mt=R({id:B,status:F([`verified`,`unverified`]),profile:P(`studio-motion-v1`),range:ve,evaluatedFrames:M(),physicsRevision:M(),limitations:L(W,12)},{surfaceMeasured:N,maxFloorPenetrationM:j(0),maxContactSlipM:j(0),maxContactFloatM:j(0),unsupportedFrames:M(),supportedCollisionFrames:M(),continuityRegressed:N,semanticStatus:F([`pending_image_review`,`passed`,`failed`,`unavailable`])}),ht=R({path:A(120)},{number:j(),text:I(A(512)),flag:N,vec:V,count:M(),bytes:M()}),gt=R({},{position:V,yawDeg:j(),rotationDeg:V,scale:z(H,_e),name:W,color:A(32),hidden:N,modelId:B,renderer:B,parentId:I(B),childIds:U(100,0),childCount:M(0),bounds:I(Ye),removed:N,range:ve,camera:tt,keyId:B,frame:M(),subjectIds:U(24,0),selection:Ce,activeCharacterId:I(B),shotId:I(B),view:we,token:B,takeId:I(B),statureM:H,patched:L(ht,32,1)}),_t=[`left`,`right`,`on-axis`],vt=R({coverage:W},{relationSatisfied:N,overlapIds:U(100,0),actualGapM:j(),requestedGapM:j(0),maximumFootprintOverlapM:j(0),basis:F(w.positionBases),clipped:N,occluded:N,behindCamera:N,screenFraction:j(0),derivedSize:F(w.framingSizes),support:W,baseY:j(),facesTargetId:B,cameraSide:F(_t),axisConsistent:N}),yt=R({subjects:L(R({id:B,position:V,yawDeg:j()}),24),pairs:L(R({a:B,b:B,distanceM:j(0)}),24),shots:L(R({shotId:B,subjectIds:U(2,0),camera:I(R({position:V,lookAt:V})),cameraSide:I(F(_t)),occluders:L(R({subjectId:B,byObjectId:B}),8)}),8),axisConsistent:I(N)}),bt=R({code:B},{id:B,message:W,suggestedOutwardDeltaM:j(),count:M()}),xt={ok:P(!0),commandId:B,receiptId:B,host:be,status:F(w.receiptStatuses),authored:N,revision:dt,affectedIds:U(100,0),delta:L(R({id:B,after:gt}),8),checks:vt,undo:I(ft),warnings:L(bt,12)},St={counts:R({created:M(),updated:M(),deleted:M()}),detailCursor:I(A(512))},Ct=L(R({index:M(),status:F(w.opStatuses)},{droppedPaths:L(A(120),32,1)}),32,1),wt={...xt,authored:P(!0),undo:ft},Tt={action:B,summary:A(240)},Et={completed:R({...xt,status:P(`completed`),kind:F([`job`,`document`,`transaction`,`mutation`])},{...Tt,...St,output:he,jobId:B,txId:B,nextHost:be}),started:R({...xt,status:P(`started`),kind:P(`job`),jobId:B,authored:P(!1),undo:P(null)},{...Tt}),applied:R({...wt,status:P(`applied`)},{mutated:P(!0),ops:Ct,...St,...Tt}),partial:R({...wt,status:P(`partial`),ops:Ct},{mutated:P(!0),...St}),noop:R({...xt,status:P(`noop`),authored:P(!1),mutated:P(!1),undo:P(null)},{ops:Ct,...Tt}),transient:R({...xt,status:P(`transient`),authored:P(!1),view:dt,undo:P(null)},{mutated:N,...Tt}),installed:R({...wt,status:P(`installed`),jobId:B,artifactId:B,installed:pt,verification:mt},{mutated:P(!0),explicitUnverifiedAcceptance:N,acceptance:P(`advisory-policy`),repairs:R({autoPhysicsInvocations:M(0,1),fixCollisionsInvocations:M(0,1),remaining:M(0,2)}),...St}),undone:R({...wt,status:P(`undone`),undoneReceiptId:B,restoredTargets:L(ot,100,1)},{mutated:P(!0),...St})},Dt=z(...Object.values(Et)),Ot=R({ok:P(!1),commandId:B,host:be,code:F(me),phase:F([`admission`,`execution`,`prepare`,`verify`,`repair`,`commit`,`reconcile`,`undo`]),affectedIds:U(100,0),expectedTargets:L(ot,24),currentTargets:L(ot,24),mutated:z(N,P(`unknown`)),preserved:R({authoredState:F([`unchanged`,`changed`,`unknown`])}),recovery:R({action:F([`none`,`inspect`,`retry`,`new_intent`,`reconcile`,`sign_in`])},{retryAllowed:N})},{message:A(500),jobId:B,txId:B,candidates:L(R({id:B,kind:F([`object`,`character`,`rig`]),position:I(V)}),5)}),kt=D({catalogue:Je,variants:w,Vec3:V,FrameRange:ve,PositionSpec:Te,FacingSpec:Ee,ObjectOp:ke,CharacterOp:Ae,Framing:De,GenerateSource:je,Source:Me,Identity:be,Host:xe,TargetGuard:ot,Entity:Xe,ShotSummary:$e,StudioContextV1:at,StudioTurn:lt,StudioStop:ut,Receipt:Dt,ReceiptVariants:Et,Failure:Ot,GeometryFacts:yt});function K(e,t,n=`INVALID_ARGUMENT`,r=`$`){if(e.oneOf){let i=[],a=[];for(let o of e.oneOf)try{i.push(K(o,t,n,r))}catch(e){if(!(e instanceof T))throw e;a.push({branch:o,error:e})}if(i.length===0&&a.length){let e=k(t)&&k(t.target)?t.target.kind:void 0;throw(e!==void 0&&a.find(({branch:t})=>t.properties?.target?.properties?.kind?.const===e)||a.reduce((e,t)=>t.error.details.path.length>e.error.details.path.length?t:e)).error}return i.length!==1&&O(n,`Expected exactly one supported variant.`,r),i[0]}if(Object.hasOwn(e,`const`))return t!==e.const&&O(n,`Invalid constant.`,r),t;if(e.type===`null`)return t!==null&&O(n,`Expected null.`,r),null;if(e.type===`object`){k(t)||O(n,`Expected object.`,r);let i=e.additionalProperties===!0;for(let a of Object.keys(t))!Object.hasOwn(e.properties,a)&&!i&&O(n,`Unexpected field.`,r);let a={};if(i)for(let n of Object.keys(t))Object.hasOwn(e.properties,n)||(a[n]=structuredClone(t[n]));for(let[i,o]of Object.entries(e.properties))Object.hasOwn(t,i)?a[i]=K(o,t[i],n,`${r}.${i}`):e.required.includes(i)?O(n,`Required field missing.`,`${r}.${i}`):Object.hasOwn(o,`default`)&&(a[i]=structuredClone(o.default));return e[`x-studio-range`]&&a.endFrameExclusive<=a.startFrame&&O(n,`Frame range must be nonempty and half-open.`,r),a}if(e.type===`array`){(!Array.isArray(t)||t.length<e.minItems||t.length>e.maxItems)&&O(n,`Array outside supported bounds.`,r);let i=t.map((t,i)=>K(e.items,t,n,`${r}[${i}]`));return e.uniqueItems&&new Set(i.map(e=>JSON.stringify(e))).size!==i.length&&O(n,`Duplicate array member.`,r),i}if(e.type===`string`)return(typeof t!=`string`||!t.trim()||e.maxLength!==void 0&&[...t].length>e.maxLength||e.pattern&&!new RegExp(e.pattern).test(t))&&O(n,typeof t==`string`&&e.description&&[...t].length>e.maxLength?`Over ${e.maxLength} characters. ${e.description}`:`Invalid or oversized string.`,r),e.enum&&!e.enum.includes(t)&&O(n,`Unsupported enum value.`,r),t;if(e.type===`boolean`)return typeof t!=`boolean`&&O(n,`Expected boolean.`,r),t;if(e.type===`number`||e.type===`integer`)return(typeof t!=`number`||!Number.isFinite(t)||e.type===`integer`&&!Number.isSafeInteger(t)||e.exclusiveMinimum!==void 0&&t<=e.exclusiveMinimum)&&O(n,`Number outside supported bounds.`,r),(e.minimum!==void 0&&t<e.minimum||e.maximum!==void 0&&t>e.maximum)&&O(n,`${r}: Expected a number within [${[e.minimum,e.maximum].filter(e=>e!==void 0).join(`, `)}].`,r),t;throw Error(`Unsupported internal Studio schema.`)}var At=e=>K(be,e,`INVALID_IDENTITY`);function jt(e){return[...new Set([...[`object`,`character`,`rig`].includes(e.selection?.kind)?[e.selection.id]:[],...e.activeCharacterId?[e.activeCharacterId]:[],...e.shot?.subjectIds??[],...e.jobs.flatMap(e=>[e.characterId,...e.targetIds??[]])])]}function Mt(e){let t=E(JSON.stringify(e)??``);t>65536&&O(`CONTEXT_TOO_LARGE`,`Studio context exceeds ${ue/1024} KiB.`,`$`,{bytes:t,maxBytes:ue});let n=K(at,e,`INVALID_CONTEXT`),r=new Set(n.entities.map(e=>e.id));r.size!==n.entities.length&&O(`INVALID_CONTEXT`,`Duplicate entity ID.`);for(let e of jt(n))r.has(e)||O(`TARGET_NOT_READY`,`Mandatory target is absent from context.`);n.activeCharacterId&&!n.entities.some(e=>e.id===n.activeCharacterId&&e.kind===`character`)&&O(`INVALID_CONTEXT`,`Active target is not a character.`),[`object`,`character`,`rig`].includes(n.selection?.kind)&&!n.entities.some(e=>e.id===n.selection.id&&e.kind===n.selection.kind)&&O(`INVALID_CONTEXT`,`Selection kind disagrees with the selected entity.`),n.selection?.kind===`scene`&&n.selection.id!==n.host.sceneId&&O(`INVALID_CONTEXT`,`Selected scene is not the bound scene.`);for(let e of n.entities)e.bounds&&[`x`,`y`,`z`].some(t=>e.bounds.min[t]>e.bounds.max[t])&&O(`INVALID_CONTEXT`,`Inverted entity bounds.`),e.kind===`object`&&typeof e.scale==`number`&&O(`INVALID_CONTEXT`,`Objects use three-axis scale.`),e.kind!==`object`&&k(e.scale)&&O(`INVALID_CONTEXT`,`Cast uses scalar scale.`);let i=n.entityPage;if((i.returned!==n.entities.length||i.total<i.returned||i.truncated!==i.total>i.returned||(i.truncated?i.nextCursor===null:i.nextCursor!==null))&&O(`INVALID_CONTEXT`,`Entity pagination is inconsistent.`),n.entityIndex){let e=new Set(n.entityIndex.map(e=>e.id));e.size!==n.entityIndex.length&&O(`INVALID_CONTEXT`,`Duplicate entity index ID.`),(n.entityIndex.length>i.total||n.entities.some(t=>!e.has(t.id)))&&O(`INVALID_CONTEXT`,`Entity index must cover every detailed entity and no more than the total.`)}n.view.frame>=Math.max(1,n.scene.frameCount)&&O(`INVALID_CONTEXT`,`Playhead is outside the scene.`),new Set(n.shots.map(e=>e.id)).size!==n.shots.length&&O(`INVALID_CONTEXT`,`Duplicate shot ID.`);for(let e of[...n.shots,...n.shot?[n.shot]:[]])e.range.endFrameExclusive>n.scene.frameCount&&O(`INVALID_CONTEXT`,`Shot is outside the scene.`);return n.shot&&!n.shots.some(e=>e.id===n.shot.id&&e.range.startFrame===n.shot.range.startFrame&&e.range.endFrameExclusive===n.shot.range.endFrameExclusive)&&O(`INVALID_CONTEXT`,`Current shot and range must survive projection.`),n}function Nt(e){let t=e.beats.filter(e=>e.seconds!==void 0).length;(e.durationSeconds!==void 0&&t!==0||e.durationSeconds===void 0&&t!==e.beats.length)&&O(`INVALID_ARGUMENT`,`Use total duration or a duration for every beat, not mixed timing.`);let n=e.durationSeconds??e.beats.reduce((e,t)=>e+t.seconds,0);return(n<2||n>60||n/e.beats.length<.5)&&O(`INVALID_ARGUMENT`,`Generation must be 2-60 seconds with at least 0.5 seconds per beat.`),n}function Pt(e){let t=new Set;for(let n of Array.isArray(e?.ops)?e.ops:[]){let e=k(n)?n.target?.kind:void 0;if(pe.includes(e)){t.add(e);for(let t of k(n.set)?Object.keys(n.set):[])Object.hasOwn(Ue[e].properties,t)||O(`INVALID_ARGUMENT`,`Unknown ${e} path "${e}.${t}". Valid ${e} paths: ${We[e].join(`, `)}.`)}}t.size>1&&O(`INVALID_ARGUMENT`,`One domain per patch: split character, object, shot and stage edits into separate commands.`)}function Ft(e){(!k(e)||!C.includes(e.name))&&O(`UNKNOWN_TOOL`,`Unsupported Studio tool.`),e.name===`patch_elements`&&Pt(e.args);let{args:t}=K(R({name:F(C),args:Ke[e.name]}),e);if(e.name===`inspect_studio`&&t.ids&&t.query!==void 0&&O(`INVALID_ARGUMENT`,`IDs and query are exclusive.`),e.name===`operate_studio`&&(!Object.keys(t).length||t.view&&!Object.keys(t.view).length)&&O(`INVALID_ARGUMENT`,`Transient operation must specify an action.`),t.ops){let e=t.ops.filter(e=>e.op===`create`&&e.name!==void 0).map(e=>e.name.normalize(`NFC`).trim());new Set(e).size!==e.length&&O(`DUPLICATE_NAME`,`Create names must be unique; resolve existing targets by ID.`);for(let e of t.ops)e.op===`update`&&Object.keys(e).length===2&&O(`INVALID_ARGUMENT`,`Update has no fields.`),e.facing&&e.rotationDeg&&O(`INVALID_ARGUMENT`,`Facing and rotationDeg are exclusive: facing sets yaw only (toward/away/same-as/yawDeg); rotationDeg {x,y,z} sets the full rotation, with y as the yaw.`),e.op===`group`&&e.childIds.includes(e.parentId)&&O(`INVALID_ARGUMENT`,`Cannot group an object under itself.`),e.op===`create`&&e.parent!==void 0&&e.name!==void 0&&e.parent.normalize(`NFC`).trim()===e.name.normalize(`NFC`).trim()&&O(`INVALID_ARGUMENT`,`Cannot group an object under itself.`);t.collisionPolicy===`avoid`&&!t.ops.some(e=>[`create`,`update`].includes(e.op)&&e.position?.relativeTo)&&O(`INVALID_ARGUMENT`,`collisionPolicy avoid needs at least one op with position.relativeTo (it nudges outward from that reference); other ops are placed as given.`)}if(e.name===`generate_motion`&&t.source.kind===`generate`&&(t.source.beats=t.source.beats.map(e=>({...e,text:e.text.trim().replace(/\s+/g,` `)})),Nt(t.source)),e.name===`frame_shot`&&t.framing.exact&&JSON.stringify(t.framing.exact.position)===JSON.stringify(t.framing.exact.lookAt)&&O(`INVALID_ARGUMENT`,`Camera position and aim cannot coincide.`),e.name===`patch_elements`)for(let e of t.ops)Object.keys(e.set).length||O(`INVALID_ARGUMENT`,`Patch has no fields.`);return e.name===`verify_result`&&(!!t.receiptId==!!t.targets&&O(`INVALID_ARGUMENT`,`Exactly one of receiptId or targets is required.`),t.checks.includes(`motion`)&&t.range===void 0&&(t.range=`whole_clip`)),{name:e.name,args:t}}function It(e){let t=K(je,e),n=Nt(t),r=Math.round(n*24),i=[],a=0,o=0;for(let[e,s]of t.beats.entries()){a+=s.seconds??n/t.beats.length;let c=e===t.beats.length-1?r:Math.round(a*24),l=Math.ceil((c-o)/120),u=o;for(let t=0;t<l;t++){let n=u+Math.round((c-u)*(t+1)/l);i.push({sourceBeat:e,text:s.text.trim().replace(/\s+/g,` `),startFrame:o,endFrameExclusive:n}),o=n}}return D({fps:24,frameCount:r,durationSeconds:r/24,blocks:i})}function q(e){if(e?.ok===!1){let t=K(Ot,e,`INVALID_RECEIPT`);return E(JSON.stringify(t))>8192&&O(`INVALID_RECEIPT`,`Failure receipt exceeds 8 KiB.`),(t.mutated===!1&&t.preserved.authoredState!==`unchanged`||t.mutated===!0&&t.preserved.authoredState!==`changed`||t.mutated===`unknown`&&(t.preserved.authoredState!==`unknown`||t.recovery.action!==`reconcile`||t.recovery.retryAllowed===!0))&&O(`INVALID_RECEIPT`,`Failure must preserve uncertainty and actual state evidence.`),D(t)}let t=K(Dt,e,`INVALID_RECEIPT`);if(E(JSON.stringify(t))>8192&&O(`INVALID_RECEIPT`,`Receipt exceeds 8 KiB; use a detail cursor.`),t.delta.some(e=>!t.affectedIds.includes(e.id)||!Object.keys(e.after).length)&&O(`INVALID_RECEIPT`,`Readback must identify affected targets and actual state.`),t.ops){let e=t.ops.some(e=>e.status===`partial`);t.ops.some((e,t)=>e.index!==t)&&O(`INVALID_RECEIPT`,`Operation results must report every operation in order.`),t.ops.some(e=>e.status===`partial`!=!!e.droppedPaths?.length)&&O(`INVALID_RECEIPT`,`A partial operation must name the paths the domain dropped, and only a partial one may.`),t.status===`applied`&&e&&O(`INVALID_RECEIPT`,`Applied status cannot hide a dropped path.`),t.status===`partial`&&!e&&O(`INVALID_RECEIPT`,`Partial status requires at least one dropped path.`),t.status===`noop`&&t.ops.some(e=>e.status===`applied`)&&O(`INVALID_RECEIPT`,`A noop cannot report an applied operation.`)}if(t.status===`started`||t.status===`completed`?(t.revision.after<t.revision.before&&!t.nextHost&&O(`INVALID_RECEIPT`,`Completion revisions must not move backwards in one document.`),t.status===`started`&&(t.authored||t.undo||t.revision.before!==t.revision.after)&&O(`INVALID_RECEIPT`,`Started jobs cannot claim an authored commit.`),t.kind===`mutation`&&(!t.authored||!t.undo||t.revision.after<=t.revision.before||!t.delta.length)&&O(`INVALID_RECEIPT`,`A completed composite mutation needs retained undo and advancing revision evidence.`),t.undo&&(!t.authored||!t.affectedIds.length)&&O(`INVALID_RECEIPT`,`An undo entry requires an authored result and affected targets.`)):t.status===`noop`||t.status===`transient`?((t.authored||t.undo!==null||t.revision.before!==t.revision.after)&&O(`INVALID_RECEIPT`,`Non-authored operations cannot create history or advance authored revision.`),t.status===`noop`&&(t.mutated!==!1||t.delta.length)&&O(`INVALID_RECEIPT`,`Noop must prove no mutation.`),t.status===`transient`&&(!t.view||t.view.after<t.view.before||!t.delta.length)&&O(`INVALID_RECEIPT`,`Transient receipt requires view revisions and actual readback.`)):((!t.authored||!t.undo||t.revision.after!==t.revision.before+1||!t.affectedIds.length||!t.delta.length||t.mutated===!1)&&O(`INVALID_RECEIPT`,`Authored mutation requires one revision and one undo entry with actual readback.`),t.delta.length<t.affectedIds.length&&!t.detailCursor&&O(`INVALID_RECEIPT`,`Omitted batch readback requires a detail cursor.`)),t.status===`undone`&&(new Set(t.restoredTargets.map(e=>e.targetId)).size!==t.affectedIds.length||t.restoredTargets.some(e=>!t.affectedIds.includes(e.targetId)||Object.keys(ye).some(n=>e[n]!==t.host[n])))&&O(`INVALID_RECEIPT`,`Undo must identify every restored target and its new token in the bound host.`),t.status===`installed`){(!t.jobId||!t.artifactId||!t.installed||!t.verification||!t.affectedIds.includes(t.installed.characterId))&&O(`INVALID_RECEIPT`,`Installation requires correlated target, artifact and verification evidence.`);let{frameCount:e,blocks:n}=t.installed,r=0;for(let e of n)(e.startFrame!==r||e.endFrameExclusive<=r||e.endFrameExclusive-r>120)&&O(`INVALID_RECEIPT`,`Installed schedule is not contiguous or bounded.`),r=e.endFrameExclusive;(r!==e||t.installed.durationSeconds!==e/24||t.verification.range.startFrame!==0||t.verification.range.endFrameExclusive!==e||t.verification.evaluatedFrames>e)&&O(`INVALID_RECEIPT`,`Installed schedule and verification coverage disagree.`),t.verification.status===`verified`&&t.verification.evaluatedFrames!==e&&O(`INVALID_RECEIPT`,`Verified motion requires whole-clip coverage.`),t.verification.status===`unverified`&&t.explicitUnverifiedAcceptance!==!0&&t.acceptance!==`advisory-policy`&&O(`INVALID_RECEIPT`,`Unverified installation requires explicit user or advisory-policy acceptance.`)}else(t.installed||t.verification||t.jobId&&![`started`,`completed`].includes(t.status)||t.artifactId||t.repairs||t.explicitUnverifiedAcceptance!==void 0)&&O(`INVALID_RECEIPT`,`Installation evidence is exclusive to installed receipts.`);return D(t)}var J=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Y=(e,t)=>{throw new T(e,t)},Lt=(e,t,n)=>e?.then?e.then(t,n):t(e),Rt=e=>e.slice(-12).map(e=>({code:`STUDIO_TOAST`,message:[...e.message].slice(0,120).join(``)})),zt=0;function Bt({registry:e,ports:t}){let n=new Map,r=new Map,i=new Map,a=new Set,o=new Map,s=new Map,c=null;function l(n,r,i){if(i.origin===`ui`)return;if(n.exposure===`ui-only`&&Y(`CAPABILITY_MISSING`,n.uiOnlyHint??`This command is available only from the Studio UI.`),n.id===`load_scenes`){let t=e=>[...new Set(e.map(e=>e.id))].sort();if(J(t(r.document.scenes),t(e.state().scenes)))return}else if(n.exposure!==`confirm`||n.requiresConfirmation?.(e.state(),r)===!1)return;let a=o.get(i.confirmationToken);(!a||a.id!==n.id||!J(a.args,r)||!J(a.host,t.read().host)||a.expires<(t.now??Date.now)())&&Y(`CONFIRMATION_REQUIRED`,n.confirmationReason??`This command needs user confirmation.`),o.delete(i.confirmationToken)}let u=e=>{for(let t of a)t(e);t.emit?.(e)},d=kt.TargetGuard.properties.targetId,f=e=>({type:`object`,properties:e,required:Object.keys(e),additionalProperties:!1}),p={type:`object`,properties:{},required:[],additionalProperties:!0},m={"agent.turn.begin":f({turnId:d}),"agent.turn.finish":f({turnId:d}),"agent.turn.cancel":f({turnId:d}),"run.begin":f({id:d,args:p}),"run.update":f({txId:d,args:p}),"run.commit":f({txId:d}),"run.cancel":f({txId:d}),"job.await":{...f({jobId:d}),properties:{jobId:d,timeoutMs:{type:`integer`,minimum:1,maximum:3e5,default:3e4}}},"job.cancel":f({jobId:d}),"edit.undo":{...f({receiptId:d}),required:[]},"edit.redo":{...f({receiptId:d}),required:[]}},h=e=>(t.clearTimeout??clearTimeout)(e);function g(e,n=!1,i=new T(`CANCELLED`,`Transaction was cancelled.`)){r.delete(e.txId),h(e.timer),e.workTimer!==void 0&&h(e.workTimer),e.controller.abort(i),e.session.cancel({restore:J(e.before.host,t.read().host)}),u({type:`transaction.cancelled`,txId:e.txId,expired:n})}function _(e){e.timer!==void 0&&h(e.timer),e.timer=(t.setTimeout??setTimeout)(()=>g(e,!0),t.transactionIdleMs??3e4)}function ee(n,a,o,u){if(n.startsWith(`agent.turn.`)){if((o.origin!==`agent`||o.turnId!==a.turnId)&&Y(`CAPABILITY_MISSING`,`Only the owning agent turn can control this transaction.`),n===`agent.turn.begin`)return(c||r.size)&&Y(`TARGET_BUSY`,`Finish the open transaction first.`),c={txId:a.turnId,before:u,affectedIds:new Set,toasts:[],session:null},v(n,c,o,u);c?.txId!==a.turnId&&Y(`STALE_TARGET`,`The agent turn is no longer open.`);let e=c;if(n===`agent.turn.cancel`)return c=null,e.session?.cancel(),v(n,e,o,u);try{e.historyEntryId=e.session?.commit().historyEntryId}catch(t){throw e.session?.cancel(),t}finally{c=null}return v(n,e,o,e.before)}let d=n===`edit.undo`||n===`edit.redo`;if(c&&!n.startsWith(`job.`)&&!(d&&!c.session)&&Y(`TARGET_BUSY`,`Finish the agent turn before traversing history or opening another transaction.`),d){let e=n===`edit.redo`,r=t.history?.(e),i=a.receiptId?t.receipt(a.receiptId):s.get(r)??(r?{receiptId:r,host:u.host,affectedIds:[u.host.sceneId],undo:{historyEntryId:r,entries:1,canUndoDirect:!0}}:null);if(!a.receiptId&&!i)return q({ok:!0,status:`noop`,action:n,commandId:o.commandId,receiptId:crypto.randomUUID(),host:u.host,authored:!1,mutated:!1,revision:{before:u.revision,after:u.revision},affectedIds:[],delta:[],checks:{coverage:`native-history-restoration`},undo:null,warnings:[]});(!i?.undo||!t.isRetained(i))&&Y(`UNDO_EXPIRED`,`The receipt no longer has a retained history entry.`),J(i.host,u.host)||Y(`STALE_SCENE`,`The receipt belongs to another document.`),(e?r!==i.undo.historyEntryId:!t.canUndo(i))&&Y(`UNDO_CONFLICT`,`Another edit owns the history boundary.`),(e?t.redo:t.undo)();let c=t.read(),l=i.affectedIds,d=l.map(e=>({...u.host,targetId:e,token:t.readTarget?.(e)??`removed-${crypto.randomUUID()}`}));return q({ok:!0,status:e?`applied`:`undone`,commandId:o.commandId,receiptId:crypto.randomUUID(),host:u.host,authored:!0,revision:{before:u.revision,after:c.revision},affectedIds:l,delta:l.slice(0,8).map(e=>({id:e,after:{token:d.find(t=>t.targetId===e).token}})),checks:{coverage:`native-history-restoration`},undo:{...i.undo,canUndoDirect:e},warnings:[],...e?{action:n,mutated:!0}:{undoneReceiptId:i.receiptId,restoredTargets:d},...l.length>8?{detailCursor:o.commandId}:{}})}if(n.startsWith(`job.`)){let e=i.get(a.jobId);(!e||!J(e.host,u.host))&&Y(`STALE_TARGET`,`Job is not in this document.`),n===`job.cancel`&&!e.outcome&&e.controller.abort(new T(`CANCELLED`,`Job was cancelled.`));let r;return(n===`job.await`&&!e.outcome?Promise.race([e.completion,new Promise((e,n)=>{r=(t.setTimeout??setTimeout)(()=>n(new T(`TIMEOUT`,`Job is still running.`)),a.timeoutMs)})]):e.completion).then(t=>q({...t,commandId:o.commandId,...t.ok?{receiptId:crypto.randomUUID()}:{},jobId:e.id})).finally(()=>{r!==void 0&&h(r)})}let f;if(n===`run.begin`){r.size&&Y(`TARGET_BUSY`,`Finish or cancel the open command transaction first.`);let n=e.prepare(a.id,a.args);l(n.entry,n.args,o),n.entry.kind!==`mutation`&&Y(`INVALID_ARGUMENT`,`Only mutations can open a transaction.`),f={txId:crypto.randomUUID(),entry:n.entry,before:u,origin:o.origin,targetId:n.args.characterId??null,controller:new AbortController,session:t.beginAction(n.entry.undoDomain,n.args.characterId??null),affectedIds:new Set,toasts:[]},r.set(f.txId,f),_(f)}else{if(f=r.get(a.txId),(!f||!J(f.before.host,u.host))&&Y(`STALE_TARGET`,`Transaction is no longer open in this document.`),o.origin!==f.origin&&Y(`TARGET_BUSY`,`This transaction belongs to another origin.`),f.updating&&n!==`run.cancel`&&Y(`TARGET_BUSY`,`A transaction update is still running.`),n===`run.update`){let i=e.prepare(f.entry.id,a.args);f.entry.undoDomain===`motion`&&i.args.characterId!==f.targetId&&Y(`INVALID_ARGUMENT`,`A motion transaction keeps its original target.`);let s=[],c=t.captureToasts?.(e=>s.push(typeof e==`string`?{message:e}:e)),l={origin:o.origin,signal:f.controller.signal,check(){f.controller.signal.throwIfAborted(),(!r.has(f.txId)||!J(f.before.host,t.read().host))&&Y(`STALE_TARGET`,`Transaction is no longer current.`)}},d=e=>{c?.(),h(f.workTimer),f.updating=!1,l.check(),s.length&&t.read().revision===u.revision&&Y(`TARGET_NOT_READY`,s.at(-1).message);for(let t of e.affectedIds)f.affectedIds.add(t);return f.toasts.push(...s),_(f),v(n,f,o,u)},p=e=>{throw c?.(),h(f.workTimer),f.updating=!1,!(e instanceof T)&&s.length&&t.read().revision===u.revision&&(e=new T(`TARGET_NOT_READY`,s.at(-1).message)),r.has(f.txId)&&g(f),e};try{f.updating=!0,h(f.timer),f.workTimer=(t.setTimeout??setTimeout)(()=>g(f,!0,new T(`TIMEOUT`,`${f.entry.id} exceeded its deadline.`)),f.entry.timeoutMs??3e4);let n=f.session.run(()=>e.invoke(f.entry,i.args,l));if(!n?.then)return d(n);let r=new Promise((e,t)=>f.controller.signal.addEventListener(`abort`,()=>t(f.controller.signal.reason),{once:!0}));return Promise.race([n,r]).then(d,p)}catch(e){return p(e)}}if(n===`run.cancel`&&g(f),n===`run.commit`){r.delete(f.txId),h(f.timer);try{f.historyEntryId=f.session.commit().historyEntryId}catch(e){throw f.session.cancel({restore:!1}),e}}}return v(n,f,o,n===`run.commit`?f.before:u)}function v(e,n,r,i){let a=t.read();return q({ok:!0,status:`completed`,kind:`transaction`,commandId:r.commandId,receiptId:crypto.randomUUID(),host:i.host,action:e,txId:n.txId,authored:!!n.historyEntryId,revision:{before:i.revision,after:a.revision},affectedIds:[...n.affectedIds],delta:[],checks:{coverage:`wire-transaction`},warnings:Rt(n.toasts),undo:n.historyEntryId?{historyEntryId:n.historyEntryId,entries:1,canUndoDirect:!0}:null})}function te(e,n,r,i){let a=i??t.read().revision!==n.revision;return q({ok:!1,commandId:e.commandId,host:n.host,code:r.code??`INVALID_ARGUMENT`,phase:a?`commit`:`admission`,affectedIds:[],expectedTargets:[],currentTargets:[],mutated:a,preserved:{authoredState:a?`changed`:`unchanged`},recovery:{action:`inspect`,retryAllowed:!1},message:[...String(r.message||r)].slice(0,500).join(``)})}let ne=(e=[],t=[],n=0,r=12)=>{let i=[...n?[{code:`READBACK_TRUNCATED`,count:n,message:`Readback lists 8 of ${8+n} affected ids; inspect_studio scope entities with ids for the rest.`}]:[],...e,...Rt(t)];return i.length<=r?i:[...i.slice(0,r-1),{code:`WARNINGS_TRUNCATED`,count:i.length-r+1,message:`${i.length-r+1} more warnings omitted.`}]};function y(e,n,r,i,a,o=[],s=null){let c=t.read(),l=c.revision!==r.revision,u=a??(l?s?.txId:null)??null;e.kind===`mutation`&&l&&!a&&!s&&Y(`UNCERTAIN_APPLY`,`${e.id} changed the scene without one undoable entry.`);let d=e.kind===`job`||e.kind===`document`||e.kind===`mutation`&&l&&(s||c.revision>r.revision+1),f=d||l?i.affectedIds:e.kind===`transient`?[r.host.sceneId]:[];if(s&&l)for(let e of f)s.affectedIds.add(e);let p=a=>q({ok:!0,commandId:n.commandId,receiptId:crypto.randomUUID(),host:r.host,action:e.id,summary:i.summary,status:d?`completed`:e.kind===`transient`?`transient`:l?`applied`:`noop`,authored:l,...d?{kind:e.kind,...i.output===void 0?{}:{output:i.output},...J(r.host,c.host)?{}:{nextHost:c.host}}:e.kind===`transient`?{view:{before:r.viewRevision??0,after:c.viewRevision??0}}:{mutated:l},revision:{before:r.revision,after:c.revision},affectedIds:f,delta:f.slice(0,8).map(e=>({id:e,after:t.readback?.(e,c,a>0)??{removed:!0}})),checks:{coverage:`studio-action:${e.id}`,...i.checks},warnings:ne(i.warnings,o,Math.max(0,f.length-8),a>1?4:12),undo:u?{historyEntryId:u,entries:1,canUndoDirect:!s}:null,...f.length>8?{detailCursor:n.commandId}:{}});for(let e=0;;e++)try{return p(e)}catch(t){if(e>=2||t?.code!==`INVALID_RECEIPT`||!/8 KiB/.test(t.message))throw t}}function re(a,o={},d={}){let f={origin:`ui`,commandId:crypto.randomUUID(),...d};f.origin===`ui`&&(a===`edit.undo`||a===`edit.redo`)&&t.finishHistoryGesture?.();let p=t.read(),g=t.journal();c&&!J(c.before.host,p.host)&&(c.session?.cancel({restore:!1}),c=null);let _=f.origin===`agent`&&f.turnId===c?.txId?c:null,v=(e,n,r,i=!1)=>_?(_.session??=t.beginAction(e,r),{result:_.session.run(()=>t.beginAction(e,r).run(n)),historyEntryId:null}):t.recordAction(e,n,r,i),ne=!1,re,ie,ae,b,oe=!1,se,x=new AbortController,ce=()=>{ie!==void 0&&h(ie),ae!==void 0&&h(ae)},le=[],ue=()=>le.length&&t.read().revision===p.revision?new T(`TARGET_NOT_READY`,le.at(-1).message):null,de=e=>{if(b?.background){let t=b.completionCommandId??=crypto.randomUUID();g.begin(t),e=q({...e,commandId:t,jobId:b.id})}let n=g.record(e);n.undo?.canUndoDirect&&!a.startsWith(`edit.`)&&s.set(n.undo.historyEntryId,n);for(let[e,n]of s)t.isRetained?.(n)===!1&&s.delete(e);return t.remember?.(n),n},fe=e=>{ce(),re?.(),re=null,e instanceof T||(e=ue()??e),f.origin===`ui`&&e.uiMessage&&t.showRefusal?.(e.uiMessage);let n=te(f,p,e,b?oe:void 0),r=ne?de(n):n;return b&&!b.completion&&(b.outcome=r,b.completion=Promise.resolve(r),u({type:`job.completed`,jobId:b.id,receipt:r})),r};try{f.origin!==`ui`&&!J(At(f.host),p.host)&&Y(`STALE_SCENE`,`The live document changed.`),f.turnId&&!_&&a!==`agent.turn.begin`&&Y(`STALE_TARGET`,`The agent turn is no longer open.`);let s=JSON.stringify({id:a,args:o,...f});if(!g.begin(f.commandId,s))return g.get(f.commandId)??n.get(f.commandId)??te(f,p,new T(`UNCERTAIN_APPLY`,`Command is still executing.`));ne=!0;let{entry:c,args:d}=m[a]?{args:K(m[a],o)}:e.prepare(a,o);if(f.origin!==`ui`&&(![`job.await`,`job.cancel`,`agent.turn.finish`,`agent.turn.cancel`].includes(a)&&f.expectedRevision!==p.revision&&Y(`STALE_SCENE`,`Authored state changed; obtain fresh intent.`),p.busy&&!_&&!r.has(d.txId)&&!a.startsWith(`job.`)&&Y(`TARGET_BUSY`,`Finish the current editor gesture first.`)),m[a])return Lt(ee(a,d,f,p),de,fe);r.size&&Y(`TARGET_BUSY`,`Finish or cancel the open command transaction first.`),_&&c.kind===`document`&&Y(`TARGET_BUSY`,`Finish the agent turn before changing documents.`),l(c,d,f),re=t.captureToasts?.(e=>le.push(typeof e==`string`?{message:e}:e));let h=c.domain??c.undoDomain,S=c.target?.(d,p)??d.characterId??d.shotId??d.objectId,C=S?t.readTarget?.(S):null,pe=h?p.domainRevisions?.[h]:null,me=()=>{let e=t.read();C=S?t.readTarget?.(S):null,pe=h?e.domainRevisions?.[h]:null},w=new Set,E={origin:f.origin,signal:x.signal,check(){x.signal.throwIfAborted();let e=t.read();J(e.host,p.host)||Y(`STALE_TARGET`,`The open document or scene changed while the job was running.`),h&&e.domainRevisions?.[h]!==pe&&Y(`STALE_TARGET`,`The ${h} data changed while the job was running (revision ${pe} to ${e.domainRevisions?.[h]}); an edit landed between the request and its result.`),S&&t.readTarget?.(S)!==C&&Y(`STALE_TARGET`,`${S} changed while the job was running.`)},commit(e){E.check(),h||Y(`INVALID_ARGUMENT`,`A committing job must declare its domain.`);let t=v(h,e,S??null);return t?.then&&Y(`INVALID_ARGUMENT`,`Job publication must be synchronous; prepare before commit.`),se=t.historyEntryId,oe||=!!se,b&&me(),t.result},run(t,n={}){b?E.check():x.signal.throwIfAborted();let r=e.prepare(t,n);l(r.entry,r.args,f);let i=()=>e.invoke(r.entry,r.args,E),a=r.entry.kind===`mutation`?v(r.entry.undoDomain,i,r.args.characterId??null,!0):{result:i()};return b&&me(),Lt(a,e=>Lt(e.result,t=>{b&&(E.check(),me(),oe||=!!e.historyEntryId);for(let e of t.affectedIds)w.add(e);return t}))}};c.kind===`job`&&(b={id:crypto.randomUUID(),host:p.host,controller:x,background:!1},i.set(b.id,b)),ie=(t.setTimeout??setTimeout)(()=>{let e=new T(`TIMEOUT`,`${c.id} exceeded its deadline.`);x.abort(e)},b&&c.background===!0?3e5:c.timeoutMs??3e4);let D=()=>{let t=e.invoke(c,d,E);if(!t?.then)return t;let n=new Promise((e,t)=>x.signal.addEventListener(`abort`,()=>t(x.signal.reason),{once:!0}));return Promise.race([t,n])},O=c.kind===`mutation`?v(c.undoDomain,D,d.characterId??null):{result:D(),historyEntryId:null},k=({result:e,historyEntryId:t})=>Lt(e,e=>{ce(),re?.(),re=null;let n=ue();if(n)throw n;return de(y(c,f,p,{...e,affectedIds:[...new Set([...e.affectedIds,...w])]},t??se,le,_))}),A=O?.then?O.then(k):k(O),j=A?.then?A.catch(fe):A;if(b){b.completion=Promise.resolve(j).then(e=>(b.outcome=e,u({type:`job.completed`,jobId:b.id,receipt:e}),e));let e=()=>{b.background=!0;let e=t.read();return g.record(q({ok:!0,commandId:f.commandId,receiptId:crypto.randomUUID(),host:p.host,action:c.id,status:`started`,kind:`job`,jobId:b.id,authored:!1,revision:{before:e.revision,after:e.revision},affectedIds:[],delta:[],checks:{coverage:`studio-action:${c.id}`},warnings:[],undo:null}))};if(j?.then&&f.wait===!1)return e();if(j?.then&&c.background===!0){let r=Promise.race([b.completion,new Promise(n=>{ae=(t.setTimeout??setTimeout)(()=>n(e()),c.timeoutMs??3e4)})]).finally(()=>n.delete(f.commandId));return n.set(f.commandId,r),r}}if(j?.then){let e=(b?.completion??j).finally(()=>n.delete(f.commandId));return n.set(f.commandId,e),e}return j}catch(e){return fe(e)}}function ie(...e){zt++;try{let t=re(...e);return t?.then?t.finally(()=>{zt--}):(zt--,t)}catch(e){throw zt--,e}}return{run:ie,confirm(n,r={}){let i=e.prepare(n,r),a=crypto.randomUUID();return o.set(a,{id:n,args:i.args,host:t.read().host,expires:(t.now??Date.now)()+3e5}),a},subscribe(e){return a.add(e),()=>a.delete(e)},dispose(){c?.session?.cancel(),c=null;for(let e of r.values())g(e);for(let e of i.values())e.outcome||e.controller.abort(new T(`CANCELLED`,`Studio closed.`));a.clear()}}}var Vt=Object.freeze([`pose_edit`,`object_insert`,`cutout_insert`,`object_transform`,`shot_add`,`shot_edit`,`camera_key_record`,`rail_edit`,`prompt_block_add`,`prompt_block_edit`]);function X(e,t){if(e===t)return!0;if(typeof e==`number`&&typeof t==`number`)return Math.abs(e-t)<1e-8;if(!e||!t||typeof e!=`object`||typeof t!=`object`)return!1;if(e instanceof Map||t instanceof Map)return e instanceof Map&&t instanceof Map&&e.size===t.size&&[...e].every(([e,n])=>t.has(e)&&X(n,t.get(e)));let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&X(e[n],t[n]))}var Ht=e=>({bones:e?.bones??{},rootY:e?.rootY??0}),Ut=e=>e.map(({id:e,...t})=>t),Wt=(e=[])=>e.map(({frame:e,framing:t})=>({frame:e,framing:t})),Gt=e=>({...e,camera:y(e.camera),cameraKeys:Wt(e.cameraKeys)});function Kt(e,t,n){if(t===n)return null;if(e===`pose`)return X(t,n)?null:`pose_edit`;if(e===`promptClips`)return X(Ut(t),Ut(n))?null:n.length>t.length?`prompt_block_add`:`prompt_block_edit`;if(e===`objects`){let e=n.find(e=>!t.some(t=>t.id===e.id));return e?e.renderer===`cutout`?`cutout_insert`:`object_insert`:X(t,n)?null:`object_transform`}if(e===`characters`){if(n.some(e=>!t.some(t=>t.id===e.id)))return`object_insert`;for(let e of n){let n=t.find(t=>t.id===e.id);if(n&&!X(Ht(n.pose),Ht(e.pose)))return`pose_edit`}let e=e=>e.map(({id:e,x:t,y:n=0,z:r,rot:i,scale:a=1,hidden:o=!1,model:s,tint:c,subject:l,identityImage:u})=>({id:e,x:t,y:n,z:r,rot:i,scale:a,hidden:o,model:s,tint:c,subject:l,identityImage:u}));return X(e(t),e(n))?null:`object_transform`}if(e===`shots`){if(n.some(e=>!t.some(t=>t.id===e.id)))return`shot_add`;for(let e of n){let n=t.find(t=>t.id===e.id);if(!n)continue;let r=y(e.camera),i=y(n.camera);if([`cameraRail`,`craneHeight`,`railFollow`,`dollyTiming`].some(e=>!X(r[e],i[e])))return`rail_edit`;let a=e.cameraKeys??[],o=n.cameraKeys??[];if(a.length>o.length||a.some(e=>{let t=o.find(t=>t.frame===e.frame);return t&&!X(t.framing,e.framing)}))return`camera_key_record`}return X(t.map(Gt),n.map(Gt))?null:`shot_edit`}return null}function qt(e){let t=new Set;return(n,r,i,a)=>{if(![`craft`,`playground`].includes(n)||t.has(n))return!1;let o=Kt(r,i,a);return o?(t.add(n),e(`${n}:first_edit`,{edit_kind:o,definition_version:1}),!0):!1}}var Jt=`modulepreload`,Yt=function(e){return`/`+e},Xt={},Zt=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Yt(t,n),t=s(t),t in Xt)return;Xt[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Jt,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Qt=Object.freeze([`read`,`camera`,`scene_write`,`prompt_authoring`,`frame_capture`,`motion_generate`,`motion_apply`,`project_io`,`other`]),$t=Object.freeze([`workflow_read`,`workflow_write`,`workflow_run`,`frame_capture`,`image_generate`,`scene_write`,`other`]),en=Object.freeze([`workflow:run_requested`,`workflow:run_succeeded`,`workflow:run_failed`,`workflow:run_cancelled`,`workflow:result_applied`,`agent:turn_requested`,`agent:tool_executed`,`agent:turn_succeeded`,`agent:turn_failed`,`agent:turn_cancelled`,`agent:result_applied`,`mcp:tool_requested`,`mcp:tool_executed`,`mcp:result_applied`]),tn=Object.freeze({"workflow:run_requested":[`surface`,`run_id`,`node_count_bucket`],"workflow:run_succeeded":[`run_id`,`duration_bucket`],"workflow:run_failed":[`run_id`,`duration_bucket`,`failure_code`],"workflow:run_cancelled":[`run_id`,`duration_bucket`,`failure_code`],"workflow:result_applied":[`run_id`],"agent:turn_requested":[`surface`,`turn_id`],"agent:tool_executed":[`turn_id`,`tool_category`,`outcome`,`duration_bucket`],"agent:turn_succeeded":[`turn_id`,`duration_bucket`],"agent:turn_failed":[`turn_id`,`duration_bucket`,`failure_code`],"agent:turn_cancelled":[`turn_id`,`duration_bucket`,`failure_code`],"agent:result_applied":[`turn_id`],"mcp:tool_requested":[`tool_category`,`request_id`],"mcp:tool_executed":[`tool_category`,`outcome`,`duration_bucket`,`request_id`],"mcp:result_applied":[`request_id`]}),nn=Object.freeze({surface:new Set([`studio`,`workflow`]),node_count_bucket:new Set([`0`,`1-3`,`4-10`,`gte11`]),duration_bucket:new Set([`lt1s`,`1-3s`,`3-10s`,`10-30s`,`gte30s`]),tool_category:new Set([...Qt,...$t]),outcome:new Set([`succeeded`,`failed`,`uncertain`,`cancelled`])}),rn=Object.freeze({source:new Set([`agent`,`manual`]),outcome:new Set([`ok`,`error`]),surface:new Set([`assets`,`agent`,`mcp`])}),an=`cozyclay.analyticsOptOut`,on=`cozyclay.internalQa`,sn=`cozyclay.analyticsActivation`,cn=`cozyclay.useCaseAsked`,ln=Object.freeze({pose:Object.freeze([`pose_edit`]),camera:Object.freeze([`camera_key_record`,`rail_edit`]),object:Object.freeze([`object_insert`,`cutout_insert`,`object_transform`]),shot:Object.freeze([`shot_add`,`shot_edit`]),prompt:Object.freeze([`prompt_block_add`,`prompt_block_edit`])}),un=Object.freeze(Object.keys(ln).map(e=>`${e}_edit_bucket`)),dn=Object.freeze([`animation`,`film`,`game`,`ad_mv`,`personal`,`other`,`skip`]),fn=Object.freeze([`team`,`solo`,`skip`]),pn=new Set([`storyboard`,`animation`]),mn=Object.freeze([`latest`,`outdated`,`unknown`]),hn=Object.freeze([`https://cozyclay.org`,`https://www.cozyclay.org`]),gn=Object.freeze({"install:first_launch":[`heard_from`],"app:session_started":[],"app:session_ended":[`duration_bucket`,`action_count_bucket`,`scenes_touched`,...un],"app:error":[`error_kind`,`error_type`,`error_source`,`error_file`,`error_line`,`error_col`],"device:profile":[`gpu_vendor`,`gpu_class`,`webgl`,`cpu_bucket`,`memory_bucket`,`frame_rate_bucket`],"survey:use_case":[`use_case`,`team`],"feature:used":[`name`],"hosted:composer_viewed":[],"hosted:login_started":[],"hosted:ticket_created":[],"hosted:result_opened":[],"hosted:opened_in_studio":[],"scene:created":[`scene_source`,`previs_mode`],"storyboard:panel_created":[`source`],"storyboard:panel_stylized":[`outcome`],"cast:proxy_added":[`surface`],"scene:loaded":[`scene_source`],"project:saved":[`object_count_bucket`,`shot_count_bucket`],"project:opened":[`age_bucket`],"craft:first_action":[`action_kind`],"craft:first_edit":[`edit_kind`,`definition_version`],"motion:backend_state":[`backend`,`host_configured`],"motion:generate_requested":[`surface`,`input_mode`,`request_id`],"motion:preflight_blocked":[`reason`,`surface`,`request_id`],"motion:preflight_passed":[`backend`,`surface`,`request_id`],"motion:job_started":[`backend`,`input_mode`,`request_id`],"motion:job_succeeded":[`backend`,`duration_bucket`,`input_mode`,`request_id`],"motion:job_failed":[`backend`,`duration_bucket`,`input_mode`,`error_code`,`request_id`],"motion:result_applied":[`request_id`,`backend`],"export:blocking_frame_succeeded":[`format`],"export:video_succeeded":[`format`],"export:keyframe_pack":[`entries`,`source`],"export:attempt_started":[`attempt_id`,`export_kind`,`format`,`surface`],"export:attempt_succeeded":[`attempt_id`,`export_kind`,`format`,`surface`,`duration_bucket`],"export:attempt_failed":[`attempt_id`,`export_kind`,`format`,`surface`,`duration_bucket`,`failure_code`],"export:attempt_cancelled":[`attempt_id`,`export_kind`,`format`,`surface`,`duration_bucket`,`failure_code`],"sample:played":[`from`],"playground:opened":[],"playground:first_action":[`action_kind`],"playground:first_edit":[`edit_kind`,`definition_version`],"activation:completed":[`activation_path`],"tutorial:started":[`surface`,`tutorial_version`,`start_source`],"tutorial:step_entered":[`surface`,`tutorial_version`,`step_kind`],"tutorial:step_completed":[`surface`,`tutorial_version`,`step_kind`,`elapsed_bucket`],"tutorial:completed":[`surface`,`tutorial_version`,`elapsed_bucket`],"tutorial:dismissed":[`surface`,`tutorial_version`,`step_kind`],sculpt_run:[`outcome`,`rounds`,`final_iou`,`duration_ms`,`had_target`],...tn}),_n=new Set([`pose_edit`,`pose_save`,`camera_fly`,`orbit`,`dolly_rail`,`crane_graph`,`timeline_scrub`,`prompt_block_add`,`shot_add`,`shot_cut`,`export_pose`,`export_frame`,`export_video`,`export_depth_video`,`export_keyframe_pack`,`fal_motion_open`,`mcp_connected`,`auto_color`,`plan_view`,`camera_tutorial`]),vn=Object.freeze([`x`,`hn`,`reddit`,`github`,`friend`,`other`,`site`,`playground`]),yn=new Set(vn),bn=new Set([`prompt`,`text`,`url`,`path`,`file`]),xn=new Set([`aborted`,`unsupported_route`,`generation_failed`,`quota`,`unknown`]),Sn=Object.freeze({backend:new Set([`none`,`local_kimodo`,`hosted`,`fal`]),host_configured:new Set([!0,!1]),surface:new Set([`timeline`,`line_edit`,`trail`,`mcp`,`fal_card`,`agent`]),input_mode:new Set([`prompt`,`pose`,`edit`,`a_to_b`,`still`]),reason:new Set([`unconfigured`,`unreachable`,`unsupported_route`,`locked`,`missing_input`]),error_code:xn,duration_bucket:new Set([`lt1s`,`1-3s`,`3-10s`,`10-30s`,`gte30s`])}),Cn=new Set([`unsupported_codec`,`encode_failed`,`render_failed`,`aborted`,`unknown`]),wn=Object.freeze({export_kind:new Set([`video`,`depth_video`,`frame`,`keyframe_pack`,`workflow_send`,`animation_project`,`contact_sheet`,`panel_pack`,`animatic`]),format:new Set([`mp4`,`png`,`zip`,`cclayproject`]),surface:new Set([`studio`,`workflow`,`embed`]),duration_bucket:new Set([`lt1s`,`1-3s`,`3-10s`,`10-30s`,`gte30s`]),failure_code:Cn}),Tn=Object.freeze({surface:new Set([`studio`,`playground`]),tutorial_version:new Set([1]),start_source:new Set([`query`,`settings`,`landing`]),step_kind:new Set([`fly`,`walk`,`dolly`,`orbit`,`shot`,`rail`,`play`]),elapsed_bucket:new Set([`lt1s`,`1-3s`,`3-10s`,`10-30s`,`gte30s`])}),En=Object.freeze([`done`,`cancelled`,`failed`]),Dn=10,On=864e5,kn=Object.freeze({workflow:new Set([`aborted`,`capture_failed`,`generation_failed`,`unknown`]),agent:new Set([`aborted`,`auth`,`rate_limited`,`tool_failed`,`upstream`,`unknown`])}),An=Object.freeze({error_kind:new Set([`error`,`unhandled_rejection`]),error_type:new Set([`Error`,`TypeError`,`RangeError`,`ReferenceError`,`SyntaxError`,`EvalError`,`URIError`,`AggregateError`,`AbortError`,`TimeoutError`,`NotAllowedError`,`NotSupportedError`,`NotFoundError`,`NotReadableError`,`InvalidStateError`,`QuotaExceededError`,`SecurityError`,`NetworkError`,`DataCloneError`,`OperationError`,`EncodingError`,`UnknownError`,`DOMException`,`non_error`,`other`]),error_source:new Set([`app`,`extension`,`external`,`unknown`])}),jn=/^[A-Za-z0-9_.-]{1,80}\.(?:m?js|jsx|ts|tsx)$/,Mn=Object.freeze({gpu_vendor:new Set([`nvidia`,`amd`,`intel`,`apple`,`qualcomm`,`arm`,`software`,`other`,`unknown`]),gpu_class:new Set([`discrete`,`integrated`,`software`,`unknown`]),webgl:new Set([`webgl2`,`webgl1`,`none`]),cpu_bucket:new Set([`1-4`,`5-8`,`9-16`,`gte17`,`unknown`]),memory_bucket:new Set([`lt4`,`4-7`,`gte8`,`unknown`]),frame_rate_bucket:new Set([`lt20`,`20-40`,`40-55`,`gte55`,`unknown`])}),Z=null,Nn=!1,Q=!1,Pn=!1,Fn=null,In=!1,Ln=!1,Rn=0,zn=0,Bn=0,Vn=!1,Hn=!1,Un=new Set,Wn=new Map(Object.entries(ln).flatMap(([e,t])=>t.map(t=>[t,e]))),Gn=1e3,Kn=Object.fromEntries(Object.keys(ln).map(e=>[e,0])),qn=null,Jn=-1/0,Yn=10,Xn=new Set,Zn=!1,Qn=!1,$n=new Set([`app:session_started`,`app:session_ended`,`install:first_launch`,`motion:backend_state`,`app:error`,`device:profile`]);function er(){try{return globalThis.localStorage??null}catch{return null}}function tr(e){try{return er()?.getItem(e)??null}catch{return null}}function nr(e,t){try{er()?.setItem(e,t)}catch{}}function rr(e){return typeof e==`string`?e.trim().toLowerCase().replace(/[/.]+$/g,``):``}function ir(e){return e===void 0?[...hn]:e.split(`,`).map(rr).filter(Boolean)}function ar(e,t){let n=rr(e);return Array.isArray(t)&&t.some(e=>n===rr(e))}var or=e=>typeof e==`boolean`?!0:typeof e==`number`?Number.isFinite(e):typeof e==`string`&&e.length<=32&&!/\s/.test(e);function sr(e,t){let n=gn[e]??[];if(!t||typeof t!=`object`||Array.isArray(t))return{};let r={};for(let i of n)if(!(bn.has(i)||!Object.hasOwn(t,i))&&!(e===`feature:used`&&(i!==`name`||!_n.has(t[i])))&&!(e===`install:first_launch`&&(i!==`heard_from`||!yn.has(t[i])))){if(e.startsWith(`export:attempt_`)){if(i===`attempt_id`){if(typeof t[i]!=`string`||!/^[a-f0-9]{32}$/.test(t[i]))continue}else if(!wn[i]?.has(t[i]))continue}if(!(e===`export:keyframe_pack`&&(i===`source`&&t[i]!==`workflow`||i===`entries`&&(!Number.isFinite(t[i])||t[i]<0)))&&!((e===`craft:first_edit`||e===`playground:first_edit`)&&(i===`edit_kind`&&!Vt.includes(t[i])||i===`definition_version`&&t[i]!==1))){if(e.startsWith(`motion:`)){if(i===`request_id`){if(typeof t[i]!=`string`||!/^[a-f0-9]{32}$/.test(t[i]))continue}else if(!Sn[i]?.has(t[i]))continue}if(!(e.startsWith(`tutorial:`)&&!Tn[i]?.has(t[i]))){if(e.startsWith(`workflow:`)||e.startsWith(`agent:`)||e.startsWith(`mcp:`)){if(i===`run_id`||i===`turn_id`||i===`request_id`){if(typeof t[i]!=`string`||!/^[a-f0-9]{32}$/.test(t[i]))continue}else if(i===`surface`){if(!nn.surface.has(t[i])||e.startsWith(`workflow:`)&&t[i]!==`workflow`)continue}else if(i===`node_count_bucket`&&!nn.node_count_bucket.has(t[i]))continue;else if(i===`duration_bucket`&&!nn.duration_bucket.has(t[i]))continue;else if(i===`tool_category`){if(!(e.startsWith(`agent:`)?$t:Qt).includes(t[i]))continue}else if(i===`outcome`){if(!(e===`mcp:tool_executed`?[`succeeded`,`failed`,`uncertain`,`cancelled`]:[`succeeded`,`failed`,`cancelled`]).includes(t[i]))continue}else if(i===`failure_code`&&!kn[e.startsWith(`agent:`)?`agent`:`workflow`].has(t[i]))continue}if(e===`app:error`){if(i===`error_file`){typeof t[i]==`string`&&jn.test(t[i])&&(r[i]=t[i]);continue}if(i===`error_line`||i===`error_col`){Number.isInteger(t[i])&&t[i]>=0&&t[i]<=1e7&&(r[i]=t[i]);continue}if(!An[i]?.has(t[i]))continue}if(!(e===`device:profile`&&!Mn[i]?.has(t[i]))){if(e===`sculpt_run`){let e=t[i];i===`outcome`&&En.includes(e)||i===`rounds`&&Number.isInteger(e)&&e>=0&&e<=Dn?r[i]=e:i===`final_iou`&&typeof e==`number`&&e>=0&&e<=1?r[i]=Math.round(e*100)/100:i===`duration_ms`&&typeof e==`number`&&e>=0&&e<=On?r[i]=Math.round(e):i===`had_target`&&typeof e==`boolean`&&(r[i]=e);continue}i===`previs_mode`&&!pn.has(t[i])||(e.startsWith(`storyboard:`)||e.startsWith(`cast:`))&&!rn[i]?.has(t[i])||e===`survey:use_case`&&(i===`use_case`&&!dn.includes(t[i])||i===`team`&&!fn.includes(t[i]))||or(t[i])&&(r[i]=t[i])}}}}return r}function cr(e){return!e||e.ok!==!0?{backend:`none`,host_configured:!1}:typeof e.backend==`string`&&[`none`,`local_kimodo`,`hosted`].includes(e.backend)?{backend:e.backend,host_configured:e.host_configured===!0||typeof e.host==`string`&&e.host.trim().length>0}:{backend:`local_kimodo`,host_configured:!!(typeof e.host==`string`&&e.host.trim())}}function lr(e,{body:t={},lineEditSupported:n=!1}={}){return!e||e.backend===`none`||e.ok!==!0&&(e.host_configured===!1||e.reason===`unconfigured`)?`unconfigured`:e.ok===!0?(t.lineEdit||t.replay?.length)&&!n||!t.lineEdit&&e.host===`local`&&e.device===`local`&&(t.segments?.length>1||t.posePin||t.waypoints?.length||t.motionEdit||t.preserve)?`unsupported_route`:null:`unreachable`}function ur(e,t){try{if(e?.name===`AbortError`)return`aborted`;if(xn.has(t))return t;if(e instanceof Error)return`generation_failed`}catch{}return`unknown`}function dr(e,t={}){let n=`requested`,r=null,i=NaN,a=()=>performance.now(),o=$,s=()=>{try{return a()}catch{return NaN}},c=(e,t={})=>{if(r)try{Promise.resolve(o(e,sr(e,{...r,...t}))).catch(()=>{})}catch{}};try{a=t.now??a,o=t.capture??o;let n=[...globalThis.crypto.getRandomValues(new Uint8Array(16))].map(e=>e.toString(16).padStart(2,`0`)).join(``);r={...sr(`motion:generate_requested`,e),request_id:n},c(`motion:generate_requested`)}catch{r=null}return{preflight(e,t){if(n===`requested`)try{let i=lr(e,t);n=i?`blocked`:`passed`,r&&(r.backend=cr(e).backend),c(i?`motion:preflight_blocked`:`motion:preflight_passed`,i?{reason:i}:{})}catch{}},block(e){n===`requested`&&(n=`blocked`,c(`motion:preflight_blocked`,{reason:e}))},pass(e){n===`requested`&&(n=`passed`,r&&(r.backend=e),c(`motion:preflight_passed`))},start(){n===`passed`&&(n=`started`,i=s(),c(`motion:job_started`))},succeed(){n===`started`&&(n=`succeeded`,c(`motion:job_succeeded`,{duration_bucket:gr(s()-i)}))},fail(e,t){n===`started`&&(n=`failed`,c(`motion:job_failed`,{duration_bucket:gr(s()-i),error_code:ur(e,t)}))},apply(){n===`succeeded`&&(n=`applied`,c(`motion:result_applied`))}}}Object.freeze([..._n]);function fr(e){let t=Number.isFinite(e)?Math.max(0,Math.floor(e)):0;return t===0?`0`:t<=3?`1-3`:t<=10?`4-10`:`gte11`}function pr(e){return!Number.isFinite(e)||e<6e4?`lt1m`:e<3e5?`1-5m`:e<9e5?`5-15m`:e<18e5?`15-30m`:`gte30m`}function mr(e){return!Number.isFinite(e)||e<0||e<36e5?`lt1h`:e<864e5?`1-24h`:e<6048e5?`1-7d`:e<2592e6?`7-30d`:`gte30d`}function hr(){let e=String(globalThis.navigator?.userAgentData?.platform||globalThis.navigator?.platform||``).toLowerCase();return e.includes(`mac`)?`macos`:e.includes(`win`)?`windows`:e.includes(`linux`)?`linux`:e.includes(`android`)?`android`:e.includes(`iphone`)||e.includes(`ipad`)||e.includes(`ios`)?`ios`:`unknown`}function gr(e){return!Number.isFinite(e)||e<1e3?`lt1s`:e<3e3?`1-3s`:e<1e4?`3-10s`:e<3e4?`10-30s`:`gte30s`}function _r(e){return!Number.isFinite(e)||e<=0?`unknown`:e<=4?`1-4`:e<=8?`5-8`:e<=16?`9-16`:`gte17`}function vr(e){return!Number.isFinite(e)||e<=0?`unknown`:e<4?`lt4`:e<8?`4-7`:`gte8`}function yr(e){return!Number.isFinite(e)||e<=0?`unknown`:e<20?`lt20`:e<40?`20-40`:e<55?`40-55`:`gte55`}function br(e){let t=String(e??``).toLowerCase();return t.trim()?/swiftshader|llvmpipe|softpipe|software|basic render driver/.test(t)?{gpu_vendor:`software`,gpu_class:`software`}:/nvidia|geforce|quadro|\brtx\b|\bgtx\b|tesla/.test(t)?{gpu_vendor:`nvidia`,gpu_class:`discrete`}:/\bamd\b|radeon|\bati\b/.test(t)?{gpu_vendor:`amd`,gpu_class:/radeon\(tm\) graphics|radeon graphics|vega \d+ graphics|\b(?:610|660|680|740|760|780|880|890)m\b/.test(t)?`integrated`:`discrete`}:/intel|iris|uhd graphics|hd graphics/.test(t)?{gpu_vendor:`intel`,gpu_class:/arc(?:\(tm\))? [ab]\d{3}/.test(t)?`discrete`:`integrated`}:/apple|\bm[1-9](?: pro| max| ultra)?\b/.test(t)?{gpu_vendor:`apple`,gpu_class:`integrated`}:/adreno|qualcomm/.test(t)?{gpu_vendor:`qualcomm`,gpu_class:`integrated`}:/\bmali\b|\barm\b|powervr/.test(t)?{gpu_vendor:`arm`,gpu_class:`integrated`}:{gpu_vendor:`other`,gpu_class:`unknown`}:{gpu_vendor:`unknown`,gpu_class:`unknown`}}var xr=/((?:https?|chrome-extension|moz-extension|safari-extension|safari-web-extension):\/\/[^\s()]+?):(\d+):(\d+)/g;function Sr(e,t){if(typeof e!=`string`||!e)return`unknown`;if(/^(?:chrome|moz|safari|safari-web)-extension:/.test(e))return`extension`;try{return t&&new URL(e).origin===t?`app`:`external`}catch{return`unknown`}}function Cr(e){try{let t=new URL(e).pathname.split(`/`).pop()??``;return jn.test(t)?t:null}catch{return null}}function wr(e){try{if(e===null||typeof e!=`object`&&typeof e!=`function`)return`non_error`;let t=typeof e.name==`string`?e.name:``;return t&&t!==`non_error`&&t!==`other`&&An.error_type.has(t)?t:typeof DOMException<`u`&&e instanceof DOMException?`DOMException`:e instanceof Error?`other`:`non_error`}catch{return`other`}}function Tr({error:e,filename:t,lineno:n,colno:r,kind:i=`error`}={},a=globalThis.location?.origin??``){let o={error_kind:i===`unhandled_rejection`?`unhandled_rejection`:`error`,error_type:wr(e),error_source:`unknown`},s=typeof t==`string`&&t?{url:t,line:n,col:r}:null;if(!s||Sr(s.url,a)!==`app`){let t=``;try{t=typeof e?.stack==`string`?e.stack.slice(0,4e3):``}catch{t=``}let n=[...t.matchAll(xr)].map(e=>({url:e[1],line:Number(e[2]),col:Number(e[3])}));s=n.find(e=>Sr(e.url,a)===`app`)??s??n[0]??null}if(!s||(o.error_source=Sr(s.url,a),o.error_source!==`app`))return o;let c=Cr(s.url);return c&&(o.error_file=c),Number.isInteger(s.line)&&s.line>=0&&(o.error_line=s.line),Number.isInteger(s.col)&&s.col>=0&&(o.error_col=s.col),o}function Er(e,t=Date.now()){let n=Wn.get(e);if(!n)return!1;let r=n===qn&&t-Jn<Gn;return qn=n,Jn=t,r||(Kn[n]+=1),e===`pose_edit`&&Jr(`pose_edit`),!r}function Dr(){return Object.fromEntries(Object.entries(Kn).map(([e,t])=>[`${e}_edit_bucket`,fr(t)]))}function Or(e,t=`unknown`){try{if(e?.name===`AbortError`)return`aborted`;if(Cn.has(e?.exportFailureCode))return e.exportFailureCode}catch{}return Cn.has(t)?t:`unknown`}function kr(e,t={}){let n=!1,r=null,i=NaN,a=()=>performance.now(),o=$,s=()=>{try{return a()}catch{return NaN}},c=(e,t)=>{try{Promise.resolve(o(e,sr(e,t))).catch(()=>{})}catch{}};try{a=t.now??a,o=t.capture??o;let n=[...globalThis.crypto.getRandomValues(new Uint8Array(16))].map(e=>e.toString(16).padStart(2,`0`)).join(``);r={...sr(`export:attempt_started`,e),attempt_id:n},i=s(),c(`export:attempt_started`,r)}catch{r=null}let l=(e,t,a)=>{if(!n&&(n=!0,r))try{let n={...r,duration_bucket:gr(s()-i)};e===`failed`&&(n.failure_code=Or(t,a),n.failure_code===`aborted`&&(e=`cancelled`)),c(`export:attempt_${e}`,n)}catch{}};return{succeed(){l(`succeeded`)},fail(e,t=`unknown`){l(`failed`,e,t)}}}var Ar=[`$current_url`,`$initial_current_url`,`$referrer`,`$initial_referrer`],jr=[`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`,`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`,`ph_keyword`];function Mr(e){return typeof e==`string`?e.split(`#`)[0].split(`?`)[0]:e}function Nr(e){if(!e||typeof e!=`object`||!e.properties)return e;let t=[e.properties,e.properties.$set,e.properties.$set_once,e.$set,e.$set_once].filter(e=>e&&typeof e==`object`&&!Array.isArray(e));for(let e of t){for(let t of Ar)typeof e[t]==`string`&&(e[t]=Mr(e[t]));for(let t of jr)delete e[t],delete e[`$initial_${t}`];for(let t of Object.keys(e))t.startsWith(`$session_entry_`)&&delete e[t]}return e}function Pr(e){return e?.activationTracked!==!0}function Fr(){return Pn?!0:Br()?.distribution===`npm`?Br()?.telemetryEnabled!==!0:tr(an)===`1`}function Ir(){try{let e=er();if(!e)return;let t=[];for(let n=0;n<e.length;n+=1){let r=e.key(n);r&&r.startsWith(`ph_`)&&r.endsWith(`_posthog`)&&t.push(r)}for(let n of t)e.removeItem(n)}catch{}}async function Lr(e){if(Br()?.distribution!==`npm`)return{ok:!0,enabled:e};try{let t=await fetch(`/__cozyclay/telemetry`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:e})});if(!t.ok)return{ok:!1,enabled:!e};let n=await t.json();return globalThis.__COZYCLAY_RUNTIME__=n,{ok:!0,enabled:n.telemetryEnabled===!0}}catch{return{ok:!1,enabled:!e}}}async function Rr(e){let t=e===!0,n=Br()?.distribution===`npm`;Pn=t;let r=await Lr(!t);if(Pn=!1,!r.ok)return Fr();let i=!r.enabled;if(nr(an,i?`1`:`0`),i&&Ir(),n&&!i)return globalThis.location?.reload(),!1;if(!Z&&!i&&await Gr(),!Z)return i;try{i?(Q=!1,Z.opt_out_capturing()):(Z.opt_in_capturing(),Q=Nn)}catch{Q=!1}return i}function zr(){return{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_COZYCLAY_LIVE_PORT:`5184`,VITE_DEMO_PROMPT_MAX_CHARS:`500`}}function Br(){let e=globalThis.__COZYCLAY_RUNTIME__;return!e||typeof e!=`object`||Array.isArray(e)?null:e}function Vr(e){try{let t=new URL(e);return t.protocol===`http:`&&t.hostname===`127.0.0.1`}catch{return!1}}function Hr({env:e=zr(),origin:t=globalThis.location?.origin??``,runtime:n=Br()}={}){return e.PROD?n?.distribution===`npm`?n.telemetryEnabled===!0?Vr(t)?typeof n.apiKey!=`string`||n.apiKey.length===0?{kind:`disabled`,reason:`no key`}:typeof n.installationId!=`string`||!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n.installationId)?{kind:`disabled`,reason:`invalid anonymous identity`}:{kind:`enabled`,distribution:`npm`,apiKey:n.apiKey,apiHost:n.apiHost||`https://t.cozyclay.org`,appVersion:n.appVersion||null,installationId:n.installationId,firstLaunch:n.firstLaunch===!0,firstLaunchHeardFrom:yn.has(n.firstLaunchHeardFrom)?n.firstLaunchHeardFrom:null,installKind:[`npx`,`global`,`clone`].includes(n.installKind)?n.installKind:`npx`,originKind:`local`,internalQa:n.internalQa===!0,updateStatus:mn.includes(n.updateStatus)?n.updateStatus:`unknown`}:{kind:`disabled`,reason:`unapproved origin`}:{kind:`disabled`,reason:`opted out`}:e.VITE_POSTHOG_KEY?ar(t,ir(e.VITE_POSTHOG_ALLOWED_ORIGINS))?{kind:`enabled`,distribution:`hosted`,apiKey:e.VITE_POSTHOG_KEY,apiHost:e.VITE_POSTHOG_HOST||`https://us.i.posthog.com`,appVersion:e.VITE_APP_VERSION||null,installationId:null,firstLaunch:!1,firstLaunchHeardFrom:null,installKind:null,originKind:`hosted`,internalQa:tr(on)===`1`,updateStatus:null}:{kind:`disabled`,reason:`unapproved origin`}:{kind:`disabled`,reason:`no key`}:{kind:`disabled`,reason:`not production`}}function Ur(e){return{distribution:e.distribution,...e.appVersion?{app_version:e.appVersion}:{},origin_kind:e.originKind,os:hr(),...e.installKind?{install_kind:e.installKind}:{},...e.updateStatus?{update_status:e.updateStatus}:{},internal_qa:e.internalQa}}function Wr(e){let t=Hr({env:e});return t.kind===`disabled`?t.reason:Fr()?`opted out`:null}async function Gr(){if(Nn||Fn)return Fn;if(Br()?.distribution!==`npm`){let e=new URLSearchParams(globalThis.location?.search??``).getAll(`internal_qa`);e.length===1&&(e[0]===`1`||e[0]===`0`)&&nr(on,e[0])}let e=zr(),t=Wr(e);if(t){Ln||=(console.info(`[analytics] disabled: `+t),!0);return}Fn=(async()=>{try{let t=await Zt(()=>import(`./module-MzlRiBjI.js`),[]);if(Fr())return;let n=Hr({env:e});if(n.kind===`disabled`)return;Z=t.default??t,Z.init(n.apiKey,{api_host:n.apiHost,defaults:`2025-05-24`,autocapture:!1,capture_pageview:!1,capture_pageleave:!1,person_profiles:`never`,persistence:n.distribution===`npm`?`memory`:`localStorage`,respect_dnt:!0,disable_session_recording:!0,capture_dead_clicks:!1,capture_performance:!1,disable_capture_url_hashes:!0,save_campaign_params:!1,save_referrer:!1,mask_personal_data_properties:!0,request_batching:!1,advanced_disable_feature_flags:!0,disable_external_dependency_loading:!0,disable_surveys:!0,ui_host:`https://us.posthog.com`,bootstrap:n.installationId?{distinctID:n.installationId,isIdentifiedID:!1}:void 0,before_send:Nr}),Nn=!0,Q=!0;let r=Ur(n);if(Z.register(r),globalThis.__cozyclayAnalytics={instance:Z},Z.capture(`$pageview`),Rn=Date.now(),ai(n,r),Qr(),ii(),n.distribution===`npm`){if($(`app:session_started`),Kr(),n.firstLaunch){let e=n.firstLaunchHeardFrom;$(`install:first_launch`,e?{heard_from:e}:{})}}else Kr()}catch{console.info(`[analytics] initialization failed`)}})(),await Fn}async function Kr(){let e=null;try{let t=await fetch(`/ardy/health`,{signal:AbortSignal.timeout(5e3)});t.ok&&(e=await t.json())}catch{}$(`motion:backend_state`,cr(e))}function $(e,t={}){if(!(!Nn||!Q||!Z))try{if(Fr())return;let n=sr(e,t);$n.has(e)||(zn+=1,(e===`scene:created`||e===`scene:loaded`)&&(Bn+=1)),Z.capture(e,n)}catch{}}function qr(e,{hadTarget:t=!1}={}){return En.includes(e?.stage)?{outcome:e.stage,rounds:e.round,...Number.isFinite(e.iou)?{final_iou:Math.round(e.iou*100)/100}:{},duration_ms:Math.round(e.elapsedMs),had_target:!!t}:null}function Jr(e){return!Nn||!Q||!Z||!_n.has(e)||Un.has(e)?!1:(Un.add(e),$(`feature:used`,{name:e}),!0)}function Yr(){try{return Nn&&Q&&!!Z&&!Fr()}catch{return!1}}function Xr(){return Yr()&&tr(cn)!==`1`}function Zr(e,t){nr(cn,`1`),$(`survey:use_case`,{use_case:dn.includes(e)?e:`skip`,team:fn.includes(t)?t:`skip`})}function Qr(){if(Zn||typeof window>`u`||typeof window.addEventListener!=`function`)return;Zn=!0;let e=e=>{try{let t=Tr(e),n=[t.error_kind,t.error_type,t.error_source,t.error_file,t.error_line,t.error_col].join(`|`);if(Xn.has(n)||Xn.size>=Yn)return;Xn.add(n),$(`app:error`,t)}catch{}};window.addEventListener(`error`,t=>{try{if(typeof t?.message==`string`&&t.message.startsWith(`ResizeObserver loop`)||!t?.error&&!t?.filename)return;e({error:t?.error,filename:t?.filename,lineno:t?.lineno,colno:t?.colno,kind:`error`})}catch{}}),window.addEventListener(`unhandledrejection`,t=>{e({error:t?.reason,kind:`unhandled_rejection`})})}function $r(){try{let e=globalThis.document?.createElement?.(`canvas`);if(!e?.getContext)return{webgl:`none`,renderer:``};let t=e.getContext(`webgl2`),n=t?`webgl2`:`none`;if(t||(t=e.getContext(`webgl`),t&&(n=`webgl1`)),!t)return{webgl:n,renderer:``};let r=``;try{let e=t.getExtension(`WEBGL_debug_renderer_info`);r=String(t.getParameter(e?e.UNMASKED_RENDERER_WEBGL:t.RENDERER)??``)}catch{r=``}try{t.getExtension(`WEBGL_lose_context`)?.loseContext()}catch{}return{webgl:n,renderer:r}}catch{return{webgl:`none`,renderer:``}}}var ei=8e3,ti=3e3,ni=6e4;function ri(){return new Promise(e=>{let t=globalThis.requestAnimationFrame;if(typeof t!=`function`){e(null);return}let n=()=>globalThis.document?.visibilityState===`hidden`,r=Date.now(),i=()=>{if(Date.now()-r>ni){e(null);return}if(n()){setTimeout(i,2e3);return}let a=0,o=0,s=r=>{if(n()){setTimeout(i,2e3);return}if(o||=r,a+=1,r-o>=ti){e((a-1)*1e3/(r-o));return}t(s)};t(s)};setTimeout(i,ei)})}async function ii(){if(!(Qn||globalThis.document===void 0||typeof globalThis.requestAnimationFrame!=`function`)){Qn=!0;try{let{webgl:e,renderer:t}=$r(),n=br(t),r=await ri();$(`device:profile`,{...n,webgl:e,cpu_bucket:_r(globalThis.navigator?.hardwareConcurrency),memory_bucket:vr(globalThis.navigator?.deviceMemory),frame_rate_bucket:yr(r)})}catch{}}}function ai(e,t){if(Hn||typeof window>`u`)return;Hn=!0;let n=()=>{if(!(Vn||!Rn)){Vn=!0;try{if(!Q||!Z||Fr()||Z.has_opted_out_capturing())return;let n={api_key:e.apiKey,event:`app:session_ended`,properties:{...t,distinct_id:Z.get_distinct_id(),duration_bucket:pr(Date.now()-Rn),action_count_bucket:fr(zn),scenes_touched:Math.min(20,Bn),...Dr()}},r=JSON.stringify(n),i=`${e.apiHost.replace(/\/$/,``)}/e/`;typeof globalThis.navigator?.sendBeacon==`function`?globalThis.navigator.sendBeacon(i,new Blob([r],{type:`application/json`})):fetch(i,{method:`POST`,body:r,keepalive:!0,headers:{"content-type":`application/json`}})}catch{}}};window.addEventListener(`pagehide`,n,{once:!0}),window.addEventListener(`beforeunload`,n,{once:!0})}function oi(e){if(!(!Nn||!Q||In)){if(!Pr({activationTracked:tr(sn)===`1`})){In=!0;return}In=!0,nr(sn,`1`),$(`activation:completed`,{activation_path:e})}}export{e as $,pe as A,E as B,Jr as C,de as D,Bt as E,kt as F,K as G,Ft as H,It as I,x as J,oe as K,D as L,qe as M,w as N,ue as O,T as P,ie as Q,jt as R,oi as S,Kt as T,Mt as U,q as V,At as W,y as X,re as Y,ae as Z,Rr as _,Yr as a,l as at,dr as b,mr as c,Gr as d,u as et,lr as f,qr as g,sr as h,nn as i,g as it,fe as j,Ve as k,Or as l,Zr as m,en as n,c as nt,fr as o,p as ot,Er as p,se as q,tn as r,h as rt,gr as s,$t as t,d as tt,Fr as u,Xr as v,qt as w,$ as x,kr as y,ze as z};
|