@sebastianwessel/isostate 0.6.0 → 0.6.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/dist/animation/controller.d.ts +5 -0
- package/dist/animation/controller.d.ts.map +1 -1
- package/dist/browser/isostate.runtime.js +2 -2
- package/dist/browser/isostate.runtime.js.map +4 -4
- package/dist/chunks/{index-WmsNtuaZ.js → index-C_7KbR4v.js} +18 -2
- package/dist/chunks/index-C_7KbR4v.js.map +1 -0
- package/dist/chunks/{scene-parser-BNXXIAqj.js → scene-parser-D_0OCHLL.js} +2 -2
- package/dist/chunks/{scene-parser-BNXXIAqj.js.map → scene-parser-D_0OCHLL.js.map} +1 -1
- package/dist/dsl/browser.js +1 -1
- package/dist/dsl/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/runtime/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/index-WmsNtuaZ.js.map +0 -1
|
@@ -100,8 +100,13 @@ export declare class AnimationController {
|
|
|
100
100
|
init(bundle: RuntimeBundle, config?: ControllerConfig, runtime?: ControllerRuntime): void;
|
|
101
101
|
/**
|
|
102
102
|
* Set scroll progress (0–1, clamped) and trigger frame update.
|
|
103
|
+
*
|
|
104
|
+
* The current scene index follows the seek: it becomes the last scene stop
|
|
105
|
+
* at or before the new progress, so `nextScene()`/`prevScene()` continue
|
|
106
|
+
* from where scroll or a slider left the timeline.
|
|
103
107
|
*/
|
|
104
108
|
setProgress(progress: number): void;
|
|
109
|
+
private _syncSceneIndex;
|
|
105
110
|
private _setProgress;
|
|
106
111
|
/**
|
|
107
112
|
* Navigate to next scene (wraps to 0 if at end).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/animation/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAYN,KAAK,WAAW,EAChB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EACX,cAAc,EACd,iBAAiB,EAGjB,mBAAmB,EAGnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,oDAAoD;AACpD,MAAM,WAAW,gBAAgB;IAChC,6DAA6D;IAC7D,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,iDAAiD;IACjD,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,6DAA6D;IAC7D,eAAe,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,4DAA4D;IAC5D,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,KAAK,QAAQ,GAAG,MAAM,gBAAgB,CAAC;AAevC,MAAM,WAAW,gBAAgB;IAChC,gGAAgG;IAChG,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,kHAAkH;IAClH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,mEAAmE;IACnE,eAAe,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IAC5C,wFAAwF;IACxF,YAAY,CAAC,EAAE;QACd,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gEAAgE;IAChE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0EAA0E;IAC1E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,0FAA0F;IAC1F,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,sFAAsF;IACtF,gBAAgB,CAAC,EAAE,QAAQ,GAAG,aAAa,GAAG,UAAU,CAAC;CACzD;AAED,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC;AAElD,qGAAqG;AACrG,MAAM,WAAW,WAAW;IAC3B,2BAA2B;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,EAAE,OAAO,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/animation/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAYN,KAAK,WAAW,EAChB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EACX,cAAc,EACd,iBAAiB,EAGjB,mBAAmB,EAGnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,oDAAoD;AACpD,MAAM,WAAW,gBAAgB;IAChC,6DAA6D;IAC7D,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,iDAAiD;IACjD,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,6DAA6D;IAC7D,eAAe,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,4DAA4D;IAC5D,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,KAAK,QAAQ,GAAG,MAAM,gBAAgB,CAAC;AAevC,MAAM,WAAW,gBAAgB;IAChC,gGAAgG;IAChG,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,kHAAkH;IAClH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,mEAAmE;IACnE,eAAe,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IAC5C,wFAAwF;IACxF,YAAY,CAAC,EAAE;QACd,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gEAAgE;IAChE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0EAA0E;IAC1E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,0FAA0F;IAC1F,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,sFAAsF;IACtF,gBAAgB,CAAC,EAAE,QAAQ,GAAG,aAAa,GAAG,UAAU,CAAC;CACzD;AAED,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC;AAElD,qGAAqG;AACrG,MAAM,WAAW,WAAW;IAC3B,2BAA2B;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,EAAE,OAAO,CAAC;CAClB;AAsBD,UAAU,iBAAiB;IAC1B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,YAAY,CAAC,EAAE,aAAa,CAAC;CAC7B;AAID;;;GAGG;AACH,qBAAa,mBAAmB;IAC/B,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAA4C;IAC3D,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAmD;IACrE,OAAO,CAAC,WAAW,CAAyD;IAC5E,OAAO,CAAC,YAAY,CAA4B;IAGhD,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,WAAW,CAAS;IAG5B,OAAO,CAAC,eAAe,CAAyD;IAChF,OAAO,CAAC,SAAS,CAAS;IAE1B,IAAI,MAAM,IAAI,eAAe,CAE5B;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,WAAW,IAAI,MAAM,CAGpB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,aAAa,IAAI,MAAM,CAGtB;IAED,IAAI,MAAM,IAAI,aAAa,CAAC,QAAQ,CAAC,CAEpC;IAED,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,YAAY,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,CAE9D;IAED;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,GAAE,gBAAqB,EAAE,OAAO,GAAE,iBAAsB,GAAG,IAAI,CAuBhG;IAED;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAQlC;IAED,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,YAAY;IAYpB;;OAEG;IACH,SAAS,IAAI,IAAI,CAMhB;IAED;;OAEG;IACH,SAAS,IAAI,IAAI,CAMhB;IAED;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CASjC;IAED;;OAEG;IACH,KAAK,IAAI,IAAI,CASZ;IAED;;OAEG;IACH,MAAM,IAAI,IAAI,CAQb;IAED;;OAEG;IACH,QAAQ,IAAI,OAAO,CAGlB;IAED,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,IAAI,CAsB/D;IAED,UAAU,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,GAAE,iBAAsB,GAAG,IAAI,CAgBtE;IAED,SAAS,CAAC,OAAO,GAAE,iBAAsB,GAAG,IAAI,CAM/C;IAED,cAAc,IAAI,WAAW,CAM5B;IAED;;OAEG;IACH,OAAO,IAAI,IAAI,CAcd;IAID,EAAE,CAAC,CAAC,SAAS,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAKpE;IAED,GAAG,CAAC,CAAC,SAAS,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAMrE;IAED,OAAO,CAAC,KAAK;IAiBb,OAAO,CAAC,wBAAwB;IAgBhC,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,iBAAiB;IA4CzB,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,qBAAqB;IA6B7B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,qCAAqC;IA4B7C,OAAO,CAAC,uBAAuB;IAwB/B,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,sBAAsB;IA2C9B,OAAO,CAAC,+BAA+B;IAuDvC,OAAO,CAAC,oBAAoB;IAkB5B,OAAO,CAAC,mBAAmB;IAqB3B,OAAO,CAAC,6BAA6B;IAqBrC,OAAO,CAAC,4BAA4B;IA0BpC,OAAO,CAAC,kBAAkB;IAuB1B,OAAO,CAAC,gBAAgB;IA4BxB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,WAAW;IAyBnB,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,SAAS,CAsBf;IAEF,OAAO,CAAC,SAAS,CAGf;IAEF,OAAO,CAAC,UAAU,CAShB;IAEF,OAAO,CAAC,aAAa,CASnB;IAEF,OAAO,CAAC,YAAY,CAkBlB;IAEF,OAAO,CAAC,WAAW,CAGjB;IAIF,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,mBAAmB;CAI3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class W extends Error{code;details;constructor(e,t,n){super(t);this.code=e;this.details=n;this.name=this.constructor.name}}class d extends W{}class oe extends W{}class f extends W{}class F{_bundle=null;_progress=0;_paused=!1;_prevFrameMap=new Map;_elementFrameMap=new Map;_prevConnectorFrameMap=new Map;_connectorFrameMap=new Map;get bundle(){return this._bundle}get progress(){return this._progress}getProgress(){return this._progress}get paused(){return this._paused}isPaused(){return this._paused}get elementsCount(){return this._elementFrameMap.size}get connectorsCount(){return this._connectorFrameMap.size}init(e){this._bundle=e,this._progress=0,this._paused=!1,this._prevFrameMap.clear(),this._elementFrameMap.clear(),this._prevConnectorFrameMap.clear(),this._connectorFrameMap.clear();let t=Re(e,0);this._elementFrameMap=t,this._prevFrameMap=Le(t);let n=Te(e,0);this._connectorFrameMap=n,this._prevConnectorFrameMap=Be(n)}setProgress(e){if(!Number.isFinite(e))throw new oe("INVALID_PROGRESS","setProgress() requires a finite progress value");let t=Math.max(0,Math.min(1,e));if(this._paused)return;if(this._progress=t,!this._bundle)return;this._prevFrameMap=Le(this._elementFrameMap),this._elementFrameMap=Re(this._bundle,t),this._prevConnectorFrameMap=Be(this._connectorFrameMap),this._connectorFrameMap=Te(this._bundle,t)}getElementUpdate(e){let t=typeof e==="string"?e:e.id,n=this._elementFrameMap.get(t);if(!n)return{id:t,asset:"",lifecycle:"removed",ambient:[],pos:[0,0],size:1,layer:""};return Ge(n)}getFrameUpdates(){return[...this._elementFrameMap.values()].map(Ge)}getConnectorUpdate(e){let t=typeof e==="string"?e:e.id,n=this._connectorFrameMap.get(t);if(!n)return se(Ne(t));return se(n)}getConnectorFrameUpdates(){return[...this._connectorFrameMap.values()].map(se)}getLifecycleTransition(e){let t=this._prevFrameMap.get(e),n=this._elementFrameMap.get(e),i=t?.lifecycle??"removed",r=n?.lifecycle??"removed";if(i===r)return null;return{from:i,to:r}}getConnectorLifecycleTransition(e){let t=this._prevConnectorFrameMap.get(e),n=this._connectorFrameMap.get(e),i=t?.lifecycle??"removed",r=n?.lifecycle??"removed";if(i===r)return null;return{from:i,to:r}}getCurrentState(){let e=this._bundle;if(!e)return null;return ce(e.scenes,this._progress)?.nextStop??e.scenes[0]??null}pause(){this._paused=!0}resume(){this._paused=!1}destroy(){this._bundle=null,this._progress=0,this._paused=!1,this._elementFrameMap.clear(),this._prevFrameMap.clear(),this._connectorFrameMap.clear(),this._prevConnectorFrameMap.clear()}}function Re(e,t){let n=ce(e.scenes,t),i=new Map;if(!n)return i;let r=new Set;for(let o of e.scenes)for(let s of o.elements??[])r.add(s.id);for(let o of n.prevStop.elements??[])r.add(o.id);for(let o of n.nextStop.elements??[])r.add(o.id);for(let o of r){let s=Gt(Vt(o,n.prevStop,n.nextStop,n.t),e.scenes,o,t);i.set(o,s)}return i}function Te(e,t){let n=ce(e.scenes,t),i=new Map;if(!n)return i;let r=new Set;for(let o of e.scenes)for(let s of o.connectors??[])r.add(s.id);for(let o of n.prevStop.connectors??[])r.add(o.id);for(let o of n.nextStop.connectors??[])r.add(o.id);for(let o of r){let s=kt(o,n.prevStop,n.nextStop,n.t),a=s.lifecycle==="removed"?Ie(e.scenes,o,t,(l)=>l.connectors??[]):void 0;i.set(o,a?ae(a,"removed"):s)}return i}function ce(e,t){if(e.length===0)return null;let n=[...e].sort((r,o)=>r.progress-o.progress);if(n.length===1||t<=n[0].progress)return{prevStop:n[0],nextStop:n[0],t:0,nextIndex:0};let i=n.length-1;if(t>=n[i].progress)return{prevStop:n[i-1]??n[i],nextStop:n[i],t:1,nextIndex:i};for(let r=1;r<n.length;r++){let o=n[r];if(o.progress>=t){let s=n[r-1],a=o.progress-s.progress,l=a>0?(t-s.progress)/a:0;return{prevStop:s,nextStop:o,t:l,nextIndex:r}}}return null}function Vt(e,t,n,i){let r=Me(t,e),o=Me(n,e),s=o??r;if(!s)return Lt(e);if(!r||r.presence==="removed")return ke(s,s.presence==="removed"||i<1?"removed":s.presence);if(!o||o.presence==="removed")return ke(r,i<1?r.presence:"removed");let a=i<1?r.presence:o.presence;return{id:e,asset:i<1?r.asset:o.asset,pos:Pe(r.pos,o.pos,i),size:r.size+(o.size-r.size)*i,lifecycle:a,ambient:T(i<1?r.ambient:o.ambient),layer:i<1?r.layer:o.layer,entry:o.enter??r.enter,exit:o.exit??r.exit,text:z(o.text??r.text),primitive:U(o.primitive??r.primitive),activity:k(i<1?r.activity:o.activity)}}function kt(e,t,n,i){let r=Ve(t,e),o=Ve(n,e),s=o??r;if(!s)return Ne(e);if(!r||r.presence==="removed")return ae(s,s.presence==="removed"||i<1?"removed":s.presence);if(!o||o.presence==="removed")return ae(r,i<1?r.presence:"removed");let a=i<1?r.presence:o.presence;return{id:e,route:Bt(r.route,o.route,i),layer:i<1?r.layer:o.layer,lifecycle:a,style:Z(i<1?r.style:o.style),start:i<1?r.start:o.start,end:i<1?r.end:o.end,direction:i<1?r.direction:o.direction,message:k(i<1?r.message:o.message),ambient:T(i<1?r.ambient:o.ambient),entry:o.enter??r.enter,exit:o.exit??r.exit}}function Me(e,t){return(e.elements??[]).find((n)=>n.id===t)}function Ve(e,t){return(e.connectors??[]).find((n)=>n.id===t)}function Gt(e,t,n,i){if(e.lifecycle!=="removed")return e;let r=Ie(t,n,i,(o)=>o.elements??[]);if(!r)return e;return{...e,asset:r.asset,pos:[...r.pos],size:r.size,ambient:T(r.ambient),layer:r.layer,entry:r.enter,exit:r.exit,text:z(r.text),primitive:U(r.primitive),activity:k(r.activity)}}function Ie(e,t,n,i){let r=[...e].sort((s,a)=>s.progress-a.progress),o=r.filter((s)=>s.progress>=n).flatMap(i).find((s)=>s.id===t&&s.presence!=="removed");if(o)return o;for(let s=r.length-1;s>=0;s-=1){if(r[s].progress>n)continue;let a=i(r[s]).find((l)=>l.id===t&&l.presence!=="removed");if(a)return a}return}function ke(e,t=e.presence){return{id:e.id,asset:e.asset,pos:[...e.pos],size:e.size,lifecycle:t,ambient:T(e.ambient),layer:e.layer,entry:e.enter,exit:e.exit,text:z(e.text),primitive:U(e.primitive),activity:k(e.activity)}}function ae(e,t=e.presence){return{id:e.id,route:P(e.route),layer:e.layer,lifecycle:t,style:Z(e.style),start:e.start,end:e.end,direction:e.direction,message:k(e.message),ambient:T(e.ambient),entry:e.enter,exit:e.exit}}function Lt(e){return{id:e,asset:"",pos:[0,0],size:1,lifecycle:"removed",ambient:[],layer:""}}function Ne(e){return{id:e,route:[],layer:"",lifecycle:"removed",style:{variant:"line",pattern:"solid",stroke:"#2563eb",strokeWidth:3,opacity:1,outlineWidth:0,lane:"none"},start:"none",end:"none",direction:"route",ambient:[]}}function Pe(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function Bt(e,t,n){if(e.length!==t.length)return P(n<1?e:t);return e.map((i,r)=>Pe(i,t[r],n))}function P(e){return e.map((t)=>[t[0],t[1]])}function Z(e){return{...e,...e.dash?{dash:[...e.dash]}:{}}}function T(e){return(e??[]).map((t)=>({...t}))}function Ge(e){return{id:e.id,asset:e.asset,lifecycle:e.lifecycle,ambient:T(e.ambient),pos:[...e.pos],size:e.size,layer:e.layer,entry:e.entry,exit:e.exit,text:z(e.text),primitive:U(e.primitive),activity:k(e.activity)}}function se(e){return{id:e.id,route:P(e.route),layer:e.layer,lifecycle:e.lifecycle,style:Z(e.style),start:e.start,end:e.end,direction:e.direction,message:k(e.message),ambient:T(e.ambient),entry:e.entry,exit:e.exit}}function Le(e){let t=new Map;for(let[n,i]of e)t.set(n,{...i,pos:[...i.pos],ambient:T(i.ambient),text:z(i.text),primitive:U(i.primitive),activity:k(i.activity)});return t}function z(e){return e?{...e}:void 0}function U(e){if(!e)return;return{...e.rectangle?{rectangle:{...e.rectangle,dash:q(e.rectangle.dash)}}:{},...e.circle?{circle:{...e.circle,dash:q(e.circle.dash)}}:{},...e.polygon?{polygon:{...e.polygon,dash:q(e.polygon.dash),points:P(e.polygon.points)}}:{},...e.line?{line:{...e.line,dash:q(e.line.dash),points:P(e.line.points)}}:{}}}function q(e){return e?[e[0],e[1]]:void 0}function Be(e){let t=new Map;for(let[n,i]of e)t.set(n,{...i,route:P(i.route),style:Z(i.style),ambient:T(i.ambient)});return t}function k(e){return e?{...e}:void 0}var Fe={light:{"--color-top":"#e2e8f0","--color-front":"#94a3b8","--color-side":"#64748b","--color-back":"#475569","--color-leaf":"#15803d","--color-trunk":"#78350f","--color-accent":"#3b82f6"},dark:{"--color-top":"#334155","--color-front":"#1e293b","--color-side":"#0f172a","--color-back":"#020617","--color-leaf":"#166534","--color-trunk":"#451a03","--color-accent":"#60a5fa"},brand:{"--color-top":"#c7d2fe","--color-front":"#818cf8","--color-side":"#6366f1","--color-back":"#4338ca","--color-leaf":"#22c55e","--color-trunk":"#854d0e","--color-accent":"#f59e0b"}};function J(e){return Object.hasOwn(Fe,e)?Fe[e]:void 0}function G(e,t,n){return{rawX:n*(e-t)*0.5,rawY:n*(e+t)*0.25}}function M(e,t,n,i=0,r=0,o=0,s=0){let{rawX:a,rawY:l}=G(e,t,n);return{screenX:a-i+o,screenY:l-r+s}}function D(e,t){return t*e}function De(){return["@keyframes iso-anim-fade-in{from{opacity:0}to{opacity:1}}","@keyframes iso-anim-fade-in-grow{from{opacity:0;scale:.01}to{opacity:1;scale:1}}","@keyframes iso-anim-fall-in{from{opacity:0;translate:0 -40px}to{opacity:1;translate:0 0}}","@keyframes iso-anim-rise-from-ground{from{opacity:0;translate:0 40px}to{opacity:1;translate:0 0}}","@keyframes iso-anim-slide-in-left{from{opacity:0;translate:-60px 0}to{opacity:1;translate:0 0}}","@keyframes iso-anim-slide-in-right{from{opacity:0;translate:60px 0}to{opacity:1;translate:0 0}}","@keyframes iso-anim-flip-in{from{opacity:1;scale:0 1}to{opacity:1;scale:1 1}}","@keyframes iso-anim-fade-out{from{opacity:1}to{opacity:0}}","@keyframes iso-anim-fade-out-shrink{from{opacity:1;scale:1}to{opacity:0;scale:.01}}","@keyframes iso-anim-fall-through-ground{from{opacity:1;translate:0 0}to{opacity:0;translate:0 40px}}","@keyframes iso-anim-rise-away{from{opacity:1;translate:0 0}to{opacity:0;translate:0 -40px}}","@keyframes iso-anim-slide-out-left{from{opacity:1;translate:0 0}to{opacity:0;translate:-60px 0}}","@keyframes iso-anim-slide-out-right{from{opacity:1;translate:0 0}to{opacity:0;translate:60px 0}}","@keyframes iso-anim-flip-out{from{opacity:1;scale:1 1}to{opacity:0;scale:0 1}}","@keyframes iso-anim-pulse{0%,100%{opacity:.7}50%{opacity:1}}","@keyframes iso-anim-float{0%,100%{translate:0 0}50%{translate:0 -6px}}","@keyframes iso-anim-shake{0%,25%,75%,100%{translate:0 0}50%{translate:3px 0}}","@keyframes iso-anim-glow{0%,100%{filter:drop-shadow(0 0 2px rgba(255,255,255,.5))}50%{filter:drop-shadow(0 0 8px rgba(255,255,255,.9))}}","@keyframes iso-anim-spin{from{rotate:0deg}to{rotate:360deg}}","@keyframes iso-anim-blink{0%,49%{opacity:1}50%,100%{opacity:0}}",".iso-ambient-pulse{animation:iso-anim-pulse 2s ease-in-out infinite}",".iso-ambient-float{animation:iso-anim-float 3s ease-in-out infinite}",".iso-ambient-shake{animation:iso-anim-shake 0.5s ease-in-out infinite}",".iso-ambient-glow{animation:iso-anim-glow 2s ease-in-out infinite}",".iso-ambient-spin{animation:iso-anim-spin 4s linear infinite}",".iso-ambient-blink{animation:iso-anim-blink 1.5s step-end infinite}","@keyframes iso-connector-flow-route{from{stroke-dashoffset:0}to{stroke-dashoffset:calc(-1px * var(--iso-flow-distance,20))}}","@keyframes iso-connector-flow-reverse{from{stroke-dashoffset:0}to{stroke-dashoffset:calc(1px * var(--iso-flow-distance,20))}}",".iso-connector-pattern-dashed .iso-connector-shaft,.iso-connector-pattern-dotted .iso-connector-shaft{--iso-flow-distance:20}",".iso-connector-direction-route .iso-connector-shaft.iso-ambient-flow{animation:iso-connector-flow-route 900ms linear infinite}",".iso-connector-direction-reverse .iso-connector-shaft.iso-ambient-flow{animation:iso-connector-flow-reverse 900ms linear infinite}","@media (prefers-reduced-motion: reduce){.iso-element,.iso-connector{animation-duration:1ms!important}.iso-ambient-pulse,.iso-ambient-float,.iso-ambient-shake,.iso-ambient-glow,.iso-ambient-spin,.iso-ambient-blink,.iso-ambient-flow{animation:none!important}}","@keyframes iso-message-travel{from{offset-distance:0%}to{offset-distance:100%}}",".iso-message{offset-anchor:0px 0px;offset-rotate:0deg;animation:iso-message-travel 1800ms linear infinite;pointer-events:none}","@keyframes iso-activity-breathe{0%,100%{opacity:.45}50%{opacity:1}}",".iso-activity-processing .iso-activity-ring{animation:iso-activity-breathe 1800ms ease-in-out infinite}",".iso-activity-waiting .iso-activity-badge{animation:iso-activity-breathe 2600ms ease-in-out infinite}",".iso-motion-paused *{animation-play-state:paused!important}.iso-motion-stopped *{animation:none!important}","@media (prefers-reduced-motion:reduce){.iso-message{animation:none!important;offset-distance:50%}.iso-activity *{animation:none!important}}",".iso-interactive g[data-id]{cursor:pointer}"].join(`
|
|
2
2
|
`)}var x="http://www.w3.org/2000/svg";function le(e){let t=new Map,n=e?.assets;if(n&&typeof n==="object"){for(let[i,r]of Object.entries(n))if(r&&typeof r==="object"&&typeof r.url==="string")t.set(i,{url:r.url,anchor:r.anchor,sprite:r.sprite})}return(i)=>t.get(i)}function Ye(e,t,n){if(e.sprite)return Xt(e.url,t,n,e.sprite,e.anchor);return Yt(e.url,t,n,e.anchor)}function ue(e,t,n){if(!e?.value)throw new d("TEXT_CONTENT_MISSING",`Text content is missing for built-in asset: ${t}`,{asset:t});let i=document.createElementNS(x,"g"),r=document.createElementNS(x,"text"),o=e.align??"middle",s=e.placement??"cell",a=e.fontSize??12,l=e.lineHeight??1.2,c=It(o,n),u=Nt(s,n);r.setAttribute("x",String(c)),r.setAttribute("y",String(u.y)),r.setAttribute("text-anchor",o),r.setAttribute("dominant-baseline",u.baseline),r.setAttribute("font-family","Arial, Helvetica, sans-serif"),r.setAttribute("font-size",String(a)),r.setAttribute("font-weight",String(e.fontWeight??700)),r.setAttribute("fill",e.fill??"currentColor");let h=Pt(e.value);for(let[S,_]of h.entries()){let y=document.createElementNS(x,"tspan");y.setAttribute("x",String(c)),y.setAttribute("dy",S===0?"0":String(a*l)),y.textContent=_,r.appendChild(y)}return i.appendChild(r),i}function me(e,t,n){let i=document.createElementNS(x,"g");switch(e){case"rectangle":return Oe(i,Ft(),t?.rectangle,n),i;case"polygon":return Oe(i,t?.polygon?.points,t?.polygon,n),i;case"line":return Dt(i,t?.line,t?.line,n),i;case"circle":return Ot(i,t?.circle,n),i;default:throw new d("PRIMITIVE_ASSET_UNKNOWN",`Unknown built-in primitive asset: ${e}`,{asset:e})}}function It(e,t){if(e==="start")return-t/2;if(e==="end")return t/2;return 0}function Nt(e,t){if(e==="caption")return{y:-t,baseline:"text-before-edge"};return{y:-t/2,baseline:"middle"}}function Pt(e){return e.replace(/\r\n?/g,`
|
|
3
3
|
`).replace(/\n$/,"").split(`
|
|
4
|
-
`)}function Ft(){return[[0,0],[1,0],[1,1],[0,1]]}function Oe(e,t,n,i){if(!t)return;let r=document.createElementNS(x,"polygon");r.setAttribute("points",t.map((o)=>de(o,i)).join(" ")),pe(r,n,{fill:"currentColor",stroke:"none"}),e.appendChild(r)}function Dt(e,t,n,i){if(!t?.points)return;let r=document.createElementNS(x,"polyline");r.setAttribute("points",t.points.map((o)=>de(o,i)).join(" ")),r.setAttribute("fill","none"),r.setAttribute("stroke-linecap",t.lineCap??"round"),r.setAttribute("stroke-linejoin",t.lineJoin??"round"),pe(r,n,{fill:"none",stroke:"currentColor"}),e.appendChild(r)}function Ot(e,t,n){let i=de([0.5,0.5],n),r=document.createElementNS(x,"circle"),[o,s]=i.split(",").map(Number);r.setAttribute("cx",String(o)),r.setAttribute("cy",String(s)),r.setAttribute("r",String(n*0.2)),pe(r,t,{fill:"currentColor",stroke:"none"}),e.appendChild(r)}function de(e,t){let n=G(e[0],e[1],t),i=G(1,1,t);return`${n.rawX-i.rawX},${n.rawY-i.rawY}`}function pe(e,t,n){if(e.setAttribute("fill",t?.fill??n.fill),e.setAttribute("stroke",t?.stroke??n.stroke),e.setAttribute("stroke-width",String(t?.strokeWidth??0)),e.setAttribute("opacity",String(t?.opacity??1)),t?.dash)e.setAttribute("stroke-dasharray",t.dash.join(" "))}function Yt(e,t,n,i){if(!ze(e))throw new d("INVALID_ASSET_URL",`Asset URL is unsafe: ${t}`,{asset:t});let r=document.createElementNS(x,"g"),o=document.createElementNS(x,"image"),s=Xe(e),[a,l]=i??[0.5,1];return o.setAttribute("href",s),o.setAttributeNS("http://www.w3.org/1999/xlink","href",s),o.setAttribute("x",String(-n*a)),o.setAttribute("y",String(-n*l)),o.setAttribute("width",String(n)),o.setAttribute("height",String(n)),o.setAttribute("preserveAspectRatio","xMidYMax meet"),r.appendChild(o),r}function Xt(e,t,n,i,r){if(!ze(e))throw new d("INVALID_ASSET_URL",`Asset URL is unsafe: ${t}`,{asset:t});let o=document.createElementNS(x,"g"),s=document.createElementNS(x,"svg"),a=document.createElementNS(x,"image"),l=Xe(e),[c,u]=r??[0.5,1],[h,S,_,y]=i.rect;return s.setAttribute("x",String(-n*c)),s.setAttribute("y",String(-n*u)),s.setAttribute("width",String(n)),s.setAttribute("height",String(n)),s.setAttribute("viewBox",`${h} ${S} ${_} ${y}`),s.setAttribute("preserveAspectRatio","xMidYMax meet"),a.setAttribute("href",l),a.setAttributeNS("http://www.w3.org/1999/xlink","href",l),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("width",String(i.sheetSize[0])),a.setAttribute("height",String(i.sheetSize[1])),s.appendChild(a),o.appendChild(s),o}function Xe(e){try{let t=document.baseURI;return typeof t==="string"?new URL(e,t).href:e}catch{return e}}function ze(e){let t=e.trim().toLowerCase();return t.length>0&&!t.startsWith("javascript:")}function $e(e,t){if(!e.length)return"";let n=`M ${e[0].x} ${e[0].y}`;for(let i=1;i<e.length;i++){let r=e[i],o=e[i-1],s=e[i+1],a=Math.hypot(r.x-o.x,r.y-o.y),l=s?Math.hypot(s.x-r.x,s.y-r.y):0,c=Math.min(t,a/2,l/2);if(!s||!c){n+=` L ${r.x} ${r.y}`;continue}let u={x:r.x+(o.x-r.x)*c/a,y:r.y+(o.y-r.y)*c/a},h={x:r.x+(s.x-r.x)*c/l,y:r.y+(s.y-r.y)*c/l};n+=` L ${u.x} ${u.y} Q ${r.x} ${r.y} ${h.x} ${h.y}`}return n}function g(e,t){let n=document.createElementNS("http://www.w3.org/2000/svg",e);for(let[i,r]of Object.entries(t))n.setAttribute(i,String(r));return n}function Ue(e,t,n,i){for(let s of e.querySelectorAll(".iso-track-effect"))e.removeChild(s);let{style:r}=n;if(r.glow){let s=g("path",{d:i,fill:"none",stroke:r.glow,"stroke-width":r.strokeWidth+(r.glowWidth??8),opacity:r.opacity*0.16,"stroke-linecap":"round","stroke-linejoin":"round",class:"iso-track-effect iso-connector-glow"});e.insertBefore(s,e.firstChild)}if(r.variant!=="beam")return;let o=g("path",{d:i,fill:"none",stroke:"#efffff","stroke-width":Math.max(0.6,r.strokeWidth*0.23),opacity:r.opacity*0.7,"stroke-linecap":"round","stroke-linejoin":"round",class:"iso-track-effect iso-connector-highlight"});e.insertBefore(o,t.nextSibling)}function zt(e,t,n){let i=g("g",{transform:`scale(${t/16})`,fill:n});if(i.appendChild(g("ellipse",{cx:1,cy:5,rx:9,ry:3.5,fill:"#07131f",opacity:0.35})),e==="orb")i.appendChild(g("circle",{r:7,fill:"#173343"})),i.appendChild(g("circle",{cx:-1,cy:-1.5,r:5.6})),i.appendChild(g("ellipse",{cx:-2,cy:-3.5,rx:2.5,ry:1.6,fill:"#fff",opacity:0.85}));else if(e==="envelope")i.appendChild(g("path",{d:"M-8-5 8-2 8 6-8 3Z",fill:"#142e3c",stroke:n,"stroke-width":1})),i.appendChild(g("path",{d:"M-8-5 8-2 0 2Z"})),i.appendChild(g("path",{d:"M-7-4 0 1 7-1",fill:"none",stroke:"#f0ffff","stroke-width":0.8,opacity:0.8}));else i.appendChild(g("path",{d:"M-8-2 0-6 8-2 0 2Z"})),i.appendChild(g("path",{d:"M-8-2 0 2 0 7-8 3Z",fill:"#183544",stroke:n,"stroke-width":0.6})),i.appendChild(g("path",{d:"M0 2 8-2 8 3 0 7Z",opacity:0.65})),i.appendChild(g("path",{d:"M-6-2 0-5 6-2",fill:"none",stroke:"#fff","stroke-width":0.9,opacity:0.85}));return i}function je(e,t,n,i){if(i)for(let o of e.querySelectorAll(".iso-message"))e.removeChild(o);let r=t.message;if(!r||r.enabled===!1)return;if(i){let o=r.count??1,s=r.duration??1800;for(let a=0;a<o;a++){let l=g("g",{class:"iso-message","aria-hidden":"true","data-kind":r.kind??"packet"});l.style.animationDuration=`${s}ms`,l.style.animationDelay=`${-s*a/o}ms`,l.appendChild(zt(r.kind??"packet",r.size??10,r.color??t.style.stroke)),e.appendChild(l)}}for(let o of e.querySelectorAll(".iso-message"))o.style.offsetPath=`path("${n}")`,o.style.opacity=String(t.style.opacity),o.style.animationDirection=t.direction==="reverse"?"reverse":"normal",o.style.display=t.presence==="removed"?"none":""}function fe(e,t,n){for(let u of e.querySelectorAll(".iso-activity"))e.removeChild(u);if(e.setAttribute("data-activity",t?.state??"idle"),!t||t.state==="idle")return;let i=t.state,r=t.color??{processing:"#67e8f9",waiting:"#fbbf24",complete:"#6ee7b7",error:"#fb7185"}[i],o=g("g",{class:`iso-activity iso-activity-${i}`,color:r,"aria-label":i,"pointer-events":"none"}),s=n*0.36,a=g("ellipse",{cx:0,cy:-2,rx:s,ry:s*0.42,fill:r,"fill-opacity":0.08,stroke:r,"stroke-opacity":0.6,"stroke-width":1.3,class:"iso-activity-ring"});o.appendChild(a);let l=g("g",{transform:`translate(${n*0.29} ${-n*0.6})`,class:"iso-activity-badge"});l.appendChild(g("circle",{r:6,fill:"#102330",stroke:r,"stroke-width":1}));let c={processing:"M-2 0h4M0-2v4",waiting:"M-2-2v4M2-2v4",complete:"M-3 0-1 2 3-2",error:"M0-3v3M0 2v.5"}[i];l.appendChild(g("path",{d:c,fill:"none",stroke:r,"stroke-width":1.5,"stroke-linecap":"round","stroke-linejoin":"round"})),o.appendChild(l),e.appendChild(o)}var $t=/^--[a-zA-Z0-9-_]+$/;function Ke(e,t){for(let[n,i]of Object.entries(t)){if(!$t.test(n))throw new d("INVALID_THEME_VAR",`Invalid CSS custom property name: ${n}`);e.style.setProperty(n,i)}}var v="http://www.w3.org/2000/svg",et="text",Ut=new Set(["rectangle","circle","polygon","line"]),jt={dashed:[12,8],dotted:[0,8]},ye=0.14,ge=0.35,Kt=0.28,tt=0.4;function nt(e,t,n){let i=te(t),r=t.scenes[0],o=an(t),s=cn(t),a=new Map((r?.elements??[]).map((p)=>[p.id,p])),l=new Map((r?.connectors??[]).map((p)=>[p.id,p])),c=en(i,n?.label,t.className),u=le(t);c._assetResolver=u,c.appendChild(tn()),Ke(c,{...J(t.theme)??{},...t.themeVars??{},...n?.themeVars??{}});let h=on(t.layers),S=rn(h);if(t.floor.visible)c.appendChild(nn(t,i));let _=new Map;for(let p of s){let N=l.get(p.id)??{...p,presence:"removed"},E=mn(N,i);if(N.presence==="removed")E.isHidden=!0,V(E.node);yt(E,N.ambient??[]),c.appendChild(E.node),_.set(p.id,E)}let y=document.createElementNS(v,"g");y.classList.add("iso-depth-layer"),y.setAttribute("data-layer","depth"),c.appendChild(y);let m=document.createElementNS(v,"g");m.classList.add("iso-layer","iso-layer-labels"),m.setAttribute("data-layer","labels"),c.appendChild(m);let A=new Map,X=mt(o);for(let p of X){if(!S.get(p.layer))throw new d("MISSING_LAYER",`Unknown layer for "${p.id}": ${p.layer}`);let E=a.get(p.id)??{...p,presence:"removed"},w=ln(E,i,u);if(w.anchor=ct(t,E),w.node.classList.add(`iso-layer-${p.layer}`),w.node.setAttribute("data-layer",p.layer),E.presence==="removed")w.isHidden=!0,V(w.node);gt(w,E.ambient??[]),(K(p.asset)?m:y).appendChild(w.node),A.set(p.id,w)}return c._layerMap=S,c._elementMap=A,c._connectorMap=_,c._depthGroup=y,e.appendChild(c),c}function it(e,t,n=[]){let i=e._layout;if(!i)return;let r=e._elementMap;if(r){for(let s of t){let a=r.get(s.id);if(!a)continue;let l=a.current;if(a.current=s,!qe(l,s))un(a.node,s,i,e._assetResolver),a.anchor=e._assetResolver?.(s.asset)?.anchor??[0.5,1];if(!qe(l,s)||!Y(l.activity,s.activity))fe(a.node,s.activity,i.cellSize);ht(a.node,s,i),gt(a,s.ambient??[])}if(e._depthGroup)sn(e._depthGroup,r)}let o=e._connectorMap;if(!o)return;for(let s of n){let a=o.get(s.id);if(!a)continue;pt(a,s,i)}}function B(e,t){return e._elementMap?.get(t)}function rt(e,t){return e._connectorMap?.get(t)}function L(e){return te(e).viewBox}function ot(e){let t=te(e);return{cellSize:t.cellSize,padding:t.padding,selectedBounds:t.selectedBounds}}function ee(e,t){let n=e._layout,i=e._elementMap?.get(t);if(!n||!i||i.current.presence==="removed")return;return ut(qt(i.current,n,i.anchor))}function ve(e,t){let n=te(e),[i,r]=t.at,[o,s]=t.size,a=ne();for(let l of[[i,r],[i+o,r],[i,r+s],[i+o,r+s]]){let c=M(l[0],l[1],n.cellSize,n.selectedBounds.minX,n.selectedBounds.minY,n.padding.x,n.padding.y);a=be(a,c.screenX,c.screenY)}return ut(a)}function st(e,t){e.setAttribute("viewBox",`${t.minX} ${t.minY} ${t.width} ${t.height}`)}function V(e){e.classList.add("iso-motion-paused"),e.style.visibility="hidden",e.style.pointerEvents="none"}function H(e){e.classList.remove("iso-motion-paused"),e.style.visibility="visible",e.style.pointerEvents="auto"}function te(e){let t=e.grid.cellSize,n=e.layout.padding,i=Ht(e,t),r=Jt(e,t),o=Qt(e.layout.bounds,i,r),s=o.maxX-o.minX+n.x*2,a=o.maxY-o.minY+n.y*2,l={minX:0,minY:0,width:O(s||t),height:O(a||t)};return{cellSize:t,padding:n,contentBounds:i,floorBounds:r,selectedBounds:o,viewBox:l}}function Ht(e,t){let n=ne();for(let i of e.scenes){for(let r of i.elements??[]){if(r.presence==="removed")continue;n=Q(n,Wt(e,r,t))}for(let r of i.connectors??[]){if(r.presence==="removed")continue;n=Q(n,Zt(r,t))}}return lt(n,t)}function Wt(e,t,n){let{rawX:i,rawY:r}=G(t.pos[0]+t.size,t.pos[1]+t.size,n),o=D(t.size,n),[s,a]=ct(e,t);return at({minX:i-o*s,minY:r-o*a,maxX:i+o*(1-s),maxY:r+o*(1-a)},t,i,r,o)}function qt(e,t,n){let i=M(e.pos[0]+e.size,e.pos[1]+e.size,t.cellSize,t.selectedBounds.minX,t.selectedBounds.minY,t.padding.x,t.padding.y),r=D(e.size,t.cellSize);return at({minX:i.screenX-r*n[0],minY:i.screenY-r*n[1],maxX:i.screenX+r*(1-n[0]),maxY:i.screenY+r*(1-n[1])},e,i.screenX,i.screenY,r)}function at(e,t,n,i,r){if(!t.activity||t.activity.state==="idle")return e;return Q(e,{minX:n-r*0.4,maxX:n+r*0.4,minY:i-r*0.72,maxY:i+r*0.18})}function ct(e,t){return e.assets?.[t.asset]?.anchor??[0.5,1]}function Zt(e,t){let n=ne();for(let[s,a]of e.route){let{rawX:l,rawY:c}=G(s,a,t);n=be(n,l,c)}let i=Math.max(ge,tt,ye*2)*t,r=e.style.strokeWidth/2+(e.style.outlineWidth??0),o=i+r+(e.style.glow?(e.style.glowWidth??8)/2:0)+(e.message?.size??0)/2;return{minX:n.minX-o,minY:n.minY-o,maxX:n.maxX+o,maxY:n.maxY+o}}function Jt(e,t){let n=e.floor.origin,[i,r]=e.floor.size,o=[n,[n[0]+i,n[1]],[n[0],n[1]+r],[n[0]+i,n[1]+r]],s=ne();for(let[a,l]of o){let{rawX:c,rawY:u}=G(a,l,t);s=be(s,c,u)}return lt(s,t)}function Qt(e,t,n){if(e==="content")return t;if(e==="floor")return n;return Q(t,n)}function ne(){return{minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY}}function lt(e,t){if(Number.isFinite(e.minX))return e;return{minX:0,minY:0,maxX:t,maxY:t}}function ut(e){let t=(e.minX+e.maxX)/2,n=(e.minY+e.maxY)/2,i=Math.max(1,e.maxX-e.minX),r=Math.max(1,e.maxY-e.minY);return{minX:O(t-i/2),minY:O(n-r/2),width:O(i),height:O(r)}}function be(e,t,n){return{minX:Math.min(e.minX,t),minY:Math.min(e.minY,n),maxX:Math.max(e.maxX,t),maxY:Math.max(e.maxY,n)}}function Q(e,t){return{minX:Math.min(e.minX,t.minX),minY:Math.min(e.minY,t.minY),maxX:Math.max(e.maxX,t.maxX),maxY:Math.max(e.maxY,t.maxY)}}function O(e){return Math.round(e*1000)/1000}function en(e,t,n){let i=document.createElementNS(v,"svg");i.classList.add("iso-scene");for(let r of n?.trim().split(/\s+/)??[])if(r)i.classList.add(r);if(i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("viewBox",`${e.viewBox.minX} ${e.viewBox.minY} ${e.viewBox.width} ${e.viewBox.height}`),i.setAttribute("preserveAspectRatio","xMidYMid meet"),i.style.width="100%",i.style.height="100%",i.style.display="block",t)i.setAttribute("role","img"),i.setAttribute("aria-label",t);else i.setAttribute("aria-hidden","true");return i._layout=e,i._viewBoxW=e.viewBox.width,i._viewBoxH=e.viewBox.height,i}function tn(){let e=document.createElementNS(v,"style");return e.textContent=De(),e}function nn(e,t){let n=document.createElementNS(v,"g");n.classList.add("iso-floor-grid",`iso-layer-${e.floor.layer}`),n.setAttribute("data-layer",e.floor.layer);let[i,r]=e.floor.origin,[o,s]=e.floor.size,a=[b(i,r,t),b(i+o,r,t),b(i+o,r+s,t),b(i,r+s,t)],l=document.createElementNS(v,"polygon");l.classList.add("iso-floor-slab"),l.setAttribute("points",a.map(Se).join(" ")),l.setAttribute("fill","#dbe6f4"),l.setAttribute("fill-opacity","0.22"),l.setAttribute("stroke","#b9c9df"),l.setAttribute("stroke-width","1"),n.appendChild(l);for(let c=0;c<=o;c++)n.appendChild(He(b(i+c,r,t),b(i+c,r+s,t)));for(let c=0;c<=s;c++)n.appendChild(He(b(i,r+c,t),b(i+o,r+c,t)));return n}function He(e,t){let n=document.createElementNS(v,"line");return n.setAttribute("x1",String(e.x)),n.setAttribute("y1",String(e.y)),n.setAttribute("x2",String(t.x)),n.setAttribute("y2",String(t.y)),n.setAttribute("stroke","#2563eb"),n.setAttribute("stroke-width","1"),n.setAttribute("stroke-dasharray","5 5"),n.setAttribute("stroke-opacity","0.2"),n}function b(e,t,n){let i=M(e,t,n.cellSize,n.selectedBounds.minX,n.selectedBounds.minY,n.padding.x,n.padding.y);return{x:i.screenX,y:i.screenY}}function Se(e){return`${e.x},${e.y}`}function rn(e){return new Map(e.map((t)=>[t.name,t]))}function on(e){return[...e].map((t,n)=>({name:t.name,order:t.order??n})).sort((t,n)=>t.order-n.order||t.name.localeCompare(n.name))}function mt(e){return e.slice().sort((t,n)=>{let i=We(t)-We(n);if(i!==0)return i;let r=t.pos[0]+t.pos[1]-(n.pos[0]+n.pos[1]);if(r!==0)return r;return t.id.localeCompare(n.id)})}function We(e){if(K(e.asset))return 1;return 0}function sn(e,t){let n=[];for(let s of t.values()){if(s.node.parentElement!==e)continue;n.push(s.current)}if(n.length<2)return;let i=mt(n),r=[...e.childNodes],o=r.length===i.length;if(o)for(let s=0;s<i.length;s++){let a=i[s]?.id;if(r[s]?.getAttribute("data-id")!==a){o=!1;break}}if(o)return;for(let s of i){let a=t.get(s.id);if(a)e.appendChild(a.node)}}function an(e){let t=new Map;for(let n of e.scenes)for(let i of n.elements??[])if(!t.has(i.id)||t.get(i.id)?.presence==="removed")t.set(i.id,i);return[...t.values()]}function cn(e){let t=new Map;for(let n of e.scenes)for(let i of n.connectors??[])if(!t.has(i.id)||t.get(i.id)?.presence==="removed")t.set(i.id,i);return[...t.values()]}function ln(e,t,n){let i=e.asset===et?ue(e.text,e.asset,t.cellSize):_e(e.asset)?me(e.asset,e.primitive,t.cellSize):dt(e,n,t.cellSize);i.classList.add("iso-element",`iso-element-${e.id}`),i.setAttribute("data-id",e.id),i.setAttribute("data-asset",e.asset),i.style.overflow="visible",i.style.pointerEvents="auto",ht(i,e,t),fe(i,e.activity,t.cellSize);let r=e.enter;if(r&&r!=="none"&&e.presence!=="removed"){let o=`iso-anim-${r}`;I(i,o,"enter");let s=i.style.animation;return i.addEventListener("animationend",()=>{if(i.style.animation===s)i.style.animation=""},{once:!0}),{node:i,current:e,anchor:[0.5,1],isHidden:!1,entryKey:r,ambient:new Set}}return{node:i,current:e,anchor:[0.5,1],isHidden:!1,ambient:new Set}}function K(e){return e===et}function _e(e){return Ut.has(e)}function dt(e,t,n){let i=t(e.asset);if(!i)throw new d("ASSET_NOT_FOUND",`Asset not found: ${e.asset}`,{asset:e.asset,elementId:e.id});return Ye(i,e.asset,n)}function un(e,t,n,i){let r=K(t.asset)?ue(t.text,t.asset,n.cellSize):_e(t.asset)?me(t.asset,t.primitive,n.cellSize):dt(t,i??le(),n.cellSize);e.setAttribute("data-asset",t.asset),dn(e);while(r.firstChild){let o=r.firstChild;r.removeChild(o),e.appendChild(o)}}function qe(e,t){if(!e)return!1;if(e.asset!==t.asset)return!1;if(!K(t.asset)&&!_e(t.asset))return!0;if(K(t.asset))return Y(e.text,t.text);return Y(e.primitive,t.primitive)}function Y(e,t){if(e===t)return!0;if(typeof e!==typeof t)return!1;if(e===null||t===null||typeof e!=="object"||typeof t!=="object")return!1;if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;return e.every((r,o)=>Y(r,t[o]))}let n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;return n.every((r)=>Y(e[r],t[r]))}function mn(e,t){let n=document.createElementNS(v,"g"),i=document.createElementNS(v,"path");n.appendChild(i);let r={node:n,shaft:i,isHidden:!1,ambient:new Set};pt(r,e,t);let o=e.enter;if(o&&o!=="none"&&e.presence!=="removed"){I(n,`iso-anim-${o}`,"enter");let s=n.style.animation;n.addEventListener("animationend",()=>{if(n.style.animation===s)n.style.animation=""},{once:!0})}return r}function pt(e,t,n){let i=e.previous,r=!i||!pn(i.route,t.route),o=!i||!fn(i.style,t.style),s=!i||he(i)!==he(t)||i.style.variant!==t.style.variant||i.style.lane!==t.style.lane||i.start!==t.start||i.end!==t.end||i.route.length!==t.route.length;hn(e.node,t,i);let a=r||s||o,l=a?gn(t.route,n,t.style.cornerRadius??0):e.shaft.getAttribute("d")??"";if(s){if(e.outline)e.node.removeChild(e.outline);if(e.outline=void 0,he(t)){let c=document.createElementNS(v,"path");c.classList.add("iso-connector-outline"),j(c,t,l,{stroke:t.style.outline??t.style.stroke,strokeWidth:t.style.strokeWidth+t.style.outlineWidth*2,includeDash:!1}),e.node.insertBefore(c,e.shaft),e.outline=c}}else if(e.outline&&a)j(e.outline,t,l,{stroke:t.style.outline??t.style.stroke,strokeWidth:t.style.strokeWidth+t.style.outlineWidth*2,includeDash:!1});if(!e.shaft.parentNode)e.node.appendChild(e.shaft);if(e.shaft.classList.add("iso-connector-shaft"),a)j(e.shaft,t,l,{stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,includeDash:!0});if(s){if(e.lane)e.node.removeChild(e.lane);if(e.lane=void 0,t.style.variant==="road"&&t.style.lane==="center-dashed"){let c=document.createElementNS(v,"path");c.classList.add("iso-connector-lane"),j(c,t,l,{stroke:"#ffffff",strokeWidth:Math.max(1,t.style.strokeWidth*0.12),includeDash:!1}),c.setAttribute("stroke-dasharray","8 8"),e.node.appendChild(c),e.lane=c}}else if(e.lane&&a)j(e.lane,t,l,{stroke:"#ffffff",strokeWidth:Math.max(1,t.style.strokeWidth*0.12),includeDash:!1}),e.lane.setAttribute("stroke-dasharray","8 8");if(a){if(e.startEndpoint)e.node.removeChild(e.startEndpoint);if(e.endEndpoint)e.node.removeChild(e.endEndpoint);e.startEndpoint=Ze(e.node,t,"start",n),e.endEndpoint=Ze(e.node,t,"end",n)}if(a)Ue(e.node,e.shaft,t,l);je(e.node,t,l,!i||!Y(i.message,t.message)||i.style.stroke!==t.style.stroke),yt(e,t.ambient??[]),e.previous=t}function dn(e){while(e.firstChild)e.removeChild(e.firstChild)}function pn(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;return e.every((n,i)=>{let r=t[i];return r!==void 0&&n[0]===r[0]&&n[1]===r[1]})}function fn(e,t){if(e===t)return!0;return e.variant===t.variant&&e.pattern===t.pattern&&e.stroke===t.stroke&&e.strokeWidth===t.strokeWidth&&e.opacity===t.opacity&&e.outline===t.outline&&e.outlineWidth===t.outlineWidth&&e.lane===t.lane&&e.cornerRadius===t.cornerRadius&&e.glow===t.glow&&e.glowWidth===t.glowWidth&&(e.dash??[]).join(",")===(t.dash??[]).join(",")}function hn(e,t,n){let i=["iso-connector",`iso-connector-${t.id}`,`iso-connector-variant-${t.style.variant}`,`iso-connector-pattern-${t.style.pattern}`,`iso-connector-direction-${t.direction}`,`iso-layer-${t.layer}`];if(!n)e.classList.add(...i);else{let r=["iso-connector",`iso-connector-${n.id}`,`iso-connector-variant-${n.style.variant}`,`iso-connector-pattern-${n.style.pattern}`,`iso-connector-direction-${n.direction}`,`iso-layer-${n.layer}`];for(let o of r)if(!i.includes(o))e.classList.remove(o);for(let o of i)if(!r.includes(o))e.classList.add(o)}e.setAttribute("data-id",t.id),e.setAttribute("data-layer",t.layer),e.style.overflow="visible",e.style.pointerEvents="auto"}function he(e){return Boolean(e.style.outline&&e.style.outlineWidth>0)}function j(e,t,n,i){if(e.setAttribute("d",n),e.setAttribute("fill","none"),e.setAttribute("stroke",i.stroke),e.setAttribute("stroke-width",String(i.strokeWidth)),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("opacity",String(t.style.opacity)),i.includeDash&&t.style.pattern!=="solid"){let r=t.style.dash??jt[t.style.pattern];e.setAttribute("stroke-dasharray",r.join(" "))}else e.setAttribute("stroke-dasharray","none")}function gn(e,t,n){return $e(e.map(([i,r])=>b(i,r,t)),n)}function Ze(e,t,n,i){let r=t[n];if(r==="none"||t.route.length<2)return;let o=yn(r,t,n,i);return o.classList.add(`iso-connector-${n}`),e.appendChild(o),o}function yn(e,t,n,i){switch(e){case"arrow":return vn(t,n,i);case"dot":return Je(t,n,i,!0);case"circle":return Je(t,n,i,!1);case"diamond":return bn(t,n,i);case"bar":return Sn(t,n,i);case"none":throw new d("CONNECTOR_ENDPOINT_NONE","Cannot create geometry for endpoint none")}}function vn(e,t,n){let i=ie(e,t),r=ft(e,t),o=[-r[1],r[0]],s=[i[0]-r[0]*ge,i[1]-r[1]*ge],a=Kt/2,l=[i,[s[0]+o[0]*a,s[1]+o[1]*a],[s[0]-o[0]*a,s[1]-o[1]*a]].map((u)=>b(u[0],u[1],n)),c=document.createElementNS(v,"polygon");return c.setAttribute("points",l.map(Se).join(" ")),c.setAttribute("fill",e.style.stroke),c.setAttribute("opacity",String(e.style.opacity)),c}function Je(e,t,n,i){let r=ie(e,t),o=b(r[0],r[1],n),s=document.createElementNS(v,"circle");return s.setAttribute("cx",String(o.x)),s.setAttribute("cy",String(o.y)),s.setAttribute("r",String(ye*n.cellSize)),s.setAttribute("stroke",e.style.stroke),s.setAttribute("stroke-width",String(Math.max(1,e.style.strokeWidth))),s.setAttribute("opacity",String(e.style.opacity)),s.setAttribute("fill",i?e.style.stroke:"none"),s}function bn(e,t,n){let i=ie(e,t),r=ye,o=[[i[0],i[1]-r],[i[0]+r,i[1]],[i[0],i[1]+r],[i[0]-r,i[1]]],s=document.createElementNS(v,"polygon");return s.setAttribute("points",o.map((a)=>b(a[0],a[1],n)).map(Se).join(" ")),s.setAttribute("fill",e.style.stroke),s.setAttribute("opacity",String(e.style.opacity)),s}function Sn(e,t,n){let i=ie(e,t),r=ft(e,t),o=[-r[1],r[0]],s=tt/2,a=b(i[0]+o[0]*s,i[1]+o[1]*s,n),l=b(i[0]-o[0]*s,i[1]-o[1]*s,n),c=document.createElementNS(v,"line");return c.setAttribute("x1",String(a.x)),c.setAttribute("y1",String(a.y)),c.setAttribute("x2",String(l.x)),c.setAttribute("y2",String(l.y)),c.setAttribute("stroke",e.style.stroke),c.setAttribute("stroke-width",String(Math.max(1,e.style.strokeWidth))),c.setAttribute("stroke-linecap","round"),c.setAttribute("opacity",String(e.style.opacity)),c}function ie(e,t){return t==="start"?e.route[0]:e.route[e.route.length-1]}function ft(e,t){let n=t==="start"?Qe(e.route[0],e.route[1]):Qe(e.route[e.route.length-2],e.route[e.route.length-1]),i=e.direction==="reverse"?[-n[0],-n[1]]:n;return _n(i)}function Qe(e,t){return[t[0]-e[0],t[1]-e[1]]}function _n(e){let t=Math.hypot(e[0],e[1]);if(t===0)return[1,0];return[e[0]/t,e[1]/t]}function ht(e,t,n){let i=M(t.pos[0]+t.size,t.pos[1]+t.size,n.cellSize,n.selectedBounds.minX,n.selectedBounds.minY,n.padding.x,n.padding.y),o=D(t.size,n.cellSize)/n.cellSize;e.setAttribute("transform",`translate(${i.screenX} ${i.screenY}) scale(${o})`)}function gt(e,t){let n=new Set((t??[]).map((i)=>i.name));for(let i of e.ambient)if(!n.has(i))e.node.classList.remove(`iso-ambient-${i}`);for(let i of n)if(!e.ambient.has(i))e.node.classList.add(`iso-ambient-${i}`);e.ambient=n}function yt(e,t){let n=new Set((t??[]).map((i)=>i.name));for(let i of e.ambient)if(!n.has(i))e.shaft.classList.remove(`iso-ambient-${i}`);for(let i of n)e.shaft.classList.add(`iso-ambient-${i}`);e.ambient=n}function I(e,t,n="enter"){e.style.opacity="1",e.style.animation="none",e.getBoundingClientRect();let i=n==="exit"?"var(--iso-anim-duration-exit, 300ms)":"var(--iso-anim-duration-enter, 400ms)",r=n==="exit"?"var(--iso-anim-easing-exit, ease-in)":"var(--iso-anim-easing-enter, ease-out)";e.style.animation=`${t} ${i} ${r} forwards`}function En(e){return e}function xn(e){return e*e*e}function Cn(e){return 1-(1-e)**3}function An(e){return e<0.5?4*e*e*e:1-(-2*e+2)**3/2}function Ee(e){switch(e){case"linear":return En;case"easeInCubic":return xn;case"easeOutCubic":return Cn;case"easeInOutCubic":return An}}var vt={scrollDirection:"vertical",scrollOffset:{},minProgress:0,maxProgress:1,keyboardControls:!1,touchControls:!1,scrollSensitivity:1,transitionDuration:600,transitionEasing:"ease-in-out"};class xe{_engine=new F;_bundle=null;_sceneIndex=0;_progress=0;_paused=!1;_config=vt;_container=null;_sceneElement=null;_ownsEngine=!0;_rafId=null;_pendingProgress=null;_destroyed=!1;_listeners=new Map;_cameraAnim=null;_cameraState=null;_minScroll=0;_maxScroll=0;_lastTouchY=0;_lastTouchX=0;_isDragging=!1;_transitionAnim=null;_backward=!1;get engine(){return this._engine}get progress(){return this._progress}getProgress(){return this._assertNotDestroyed(),this._progress}get sceneIndex(){return this._sceneIndex}getSceneIndex(){return this._assertNotDestroyed(),this._sceneIndex}get scenes(){return this._bundle?.scenes??[]}get paused(){return this._paused}get currentScene(){return this.scenes[this._sceneIndex]}init(e,t={},n={}){if(this._assertNotDestroyed(),!e.scenes||e.scenes.length===0)throw new f("CONTROLLER_NO_SCENES","init() requires at least one compiled scene stop");this._cancelFrame(),this._bundle=e,this._engine=n.engine??new F,this._ownsEngine=!n.engine,this._sceneIndex=0,this._progress=0,this._paused=!1,this._config={...vt,...t},this._sceneElement=n.sceneElement??t.sceneElement??null,this._cameraState={viewBox:L(e),target:{type:"reset"},isZoomed:!1},this._engine.init(e),this._bindScroll()}setProgress(e){if(this._assertNotDestroyed(),!Number.isFinite(e))throw new f("CONTROLLER_PROGRESS_OUT_OF_RANGE","setProgress() requires a finite progress value");this._cancelTransition(),this._setProgress(e)}_setProgress(e){let t=Math.max(0,Math.min(1,e));if(t===this._progress&&!this._paused&&this._rafId!==null)return;if(this._progress=t,this._cancelCameraAnimation(),this._paused)return;this._scheduleProgressForward(t)}nextScene(){if(this._assertNotDestroyed(),this.scenes.length<=1)return;let e=(this._sceneIndex+1)%this.scenes.length;this._transitionToScene(e)}prevScene(){if(this._assertNotDestroyed(),this.scenes.length<=1)return;let e=(this._sceneIndex-1+this.scenes.length)%this.scenes.length;this._transitionToScene(e)}setSceneIndex(e){if(this._assertNotDestroyed(),e<0||e>=this.scenes.length)throw new f("CONTROLLER_SCENE_INDEX_OUT_OF_RANGE",`Scene index ${e} is out of bounds [0, ${this.scenes.length-1}]`);this._transitionToScene(e)}pause(){if(this._assertNotDestroyed(),this._paused)return;this._paused=!0,this._cancelFrame(),this._cancelTransition(),this._engine.pause(),this._applyPauseState(!0),this._emit("paused")}resume(){if(this._assertNotDestroyed(),!this._paused)return;this._paused=!1,this._engine.resume(),this._applyPauseState(!1),this._scheduleProgressForward(this._progress),this._emit("resumed")}isPaused(){return this._assertNotDestroyed(),this._paused}zoomToElement(e,t={}){this._assertNotDestroyed();let n=this._getSceneSvg();if(!this._bundle||!n)throw new f("CAMERA_NOT_INITIALIZED","zoomToElement() requires an initialized scene SVG");let i=ee(n,e);if(!i){if(B(n,e))throw new f("CAMERA_TARGET_NOT_VISIBLE",`Camera target element "${e}" is currently removed`,{elementId:e});throw new f("CAMERA_TARGET_NOT_FOUND",`Camera target element "${e}" was not found`,{elementId:e})}this._applyCameraDestination(re(i,this._resolveCameraPadding(t)),{type:"element",id:e},t)}zoomToArea(e,t={}){if(this._assertNotDestroyed(),!this._bundle||!this._getSceneSvg())throw new f("CAMERA_NOT_INITIALIZED","zoomToArea() requires an initialized scene SVG");this._assertValidCameraArea(e);let n=ve(this._bundle,e);this._applyCameraDestination(re(n,this._resolveCameraPadding(t)),{type:"area",at:[...e.at],size:[...e.size]},t)}resetZoom(e={}){if(this._assertNotDestroyed(),!this._bundle||!this._getSceneSvg())throw new f("CAMERA_NOT_INITIALIZED","resetZoom() requires an initialized scene SVG");this._applyCameraDestination(L(this._bundle),{type:"reset"},e)}getCameraState(){if(this._assertNotDestroyed(),!this._cameraState)throw new f("CAMERA_NOT_INITIALIZED","Camera state is not initialized");return Mn(this._cameraState)}destroy(){if(this._assertNotDestroyed(),this._unbindScroll(),this._cancelFrame(),this._cancelTransition(),this._cancelCameraAnimation(),this._getSceneSvg()?.classList.add("iso-motion-stopped"),this._ownsEngine)this._engine.destroy();this._listeners.clear(),this._bundle=null,this._container=null,this._pendingProgress=null,this._cameraState=null,this._destroyed=!0}on(e,t){this._assertNotDestroyed();let n=this._listeners.get(e)??new Set;n.add(t),this._listeners.set(e,n)}off(e,t){this._assertNotDestroyed();let n=this._listeners.get(e);if(n)n.delete(t)}_emit(e,...t){let n=this._listeners.get(e);if(n)for(let i of n)try{i(...t)}catch(r){queueMicrotask(()=>{throw r})}}_scheduleProgressForward(e){if(this._pendingProgress=e,this._rafId!==null)return;this._rafId=requestAnimationFrame(()=>{this._rafId=null;let t=this._pendingProgress;if(this._pendingProgress=null,t===null||this._paused||this._destroyed)return;this._backward=t<this._engine.getProgress(),this._engine.setProgress(t),this._applyFrameUpdate(),this._emit("progress-change",t)})}_cancelFrame(){if(this._rafId!==null)cancelAnimationFrame(this._rafId),this._rafId=null;this._pendingProgress=null}_applyFrameUpdate(){if(!this._bundle)return;let e=this._sceneElement??this._container?.querySelector("svg")??null;if(!e)return;let t=this._engine.getFrameUpdates().map((i)=>({id:i.id,asset:i.asset,pos:i.pos,size:i.size,layer:i.layer,presence:i.lifecycle,enter:i.entry,exit:i.exit,ambient:i.ambient,text:i.text,primitive:i.primitive,activity:i.activity})),n=this._engine.getConnectorFrameUpdates().map((i)=>({id:i.id,route:i.route,layer:i.layer,presence:i.lifecycle,style:i.style,start:i.start,end:i.end,direction:i.direction,message:i.message,enter:i.entry,exit:i.exit,ambient:i.ambient}));it(e,t,n),this._applyLifecycleChanges(t),this._applyConnectorLifecycleChanges(n),this._applyCameraForProgress(this._progress)}_applyCameraForProgress(e){let t=this._getSceneSvg();if(!this._bundle||!t)return;let n=this.scenes;if(n.length===0)return;let{previous:i,next:r}=wn(n,e),o=this._effectiveCameraAt(i.index),s=this._effectiveCameraAt(r.index),a=this._resolveCameraViewBox(o,{forInterpolation:!0}),l=this._resolveCameraViewBox(s,{forInterpolation:!0}),c=r.scene.progress-i.scene.progress,u=c<=0?0:(e-i.scene.progress)/c,h=wt(s.easing)(Math.max(0,Math.min(1,u))),S=At(a,l,h),_=h<1?o.target:s.target;this._setCameraViewBox(t,S,_)}_effectiveCameraAt(e){for(let t=e;t>=0;t--){let n=this.scenes[t]?.camera;if(n)return{target:n.target,padding:n.padding,duration:n.duration,easing:n.easing}}return{target:{type:"reset"}}}_resolveCameraViewBox(e,t={}){if(!this._bundle)throw new f("CAMERA_NOT_INITIALIZED","Camera requires an initialized bundle");if(e.target.type==="reset")return L(this._bundle);if(e.target.type==="area")return re(ve(this._bundle,{at:e.target.at,size:e.target.size}),e.padding??32);let n=this._getSceneSvg();if(!n)throw new f("CAMERA_NOT_INITIALIZED","Camera requires an initialized scene SVG");let i=t.forInterpolation?this._resolveElementBoundsForInterpolation(n,e.target.id):ee(n,e.target.id);if(!i)throw new f("CAMERA_TARGET_NOT_FOUND",`Camera target element "${e.target.id}" was not found`,{elementId:e.target.id});return re(i,e.padding??32)}_resolveElementBoundsForInterpolation(e,t){let n=ee(e,t);if(n)return n;let i=B(e,t);if(!i||!this._bundle)return;let r=ot(this._bundle),o=i.current,s=M(o.pos[0]+o.size,o.pos[1]+o.size,r.cellSize,r.selectedBounds.minX,r.selectedBounds.minY,r.padding.x,r.padding.y),a=D(o.size,r.cellSize),[l,c]=i.anchor;return{minX:C(s.screenX-a*l),minY:C(s.screenY-a*c),width:C(Math.max(1,a)),height:C(Math.max(1,a))}}_applyCameraDestination(e,t,n){let i=this._getSceneSvg();if(!i)throw new f("CAMERA_NOT_INITIALIZED","Camera requires an initialized scene SVG");this._cancelCameraAnimation();let r=this._resolveCameraDuration(n);if(r===0){this._setCameraViewBox(i,e,t);return}let o=Tn(i)??this._cameraState?.viewBox??e,s=wt(n.easing??this._config.transitionEasing),a=performance.now(),l=(c)=>{let u=Math.min((c-a)/r,1);if(this._setCameraViewBox(i,At(o,e,s(u)),t),u<1)this._cameraAnim=requestAnimationFrame(l);else this._cameraAnim=null};this._cameraAnim=requestAnimationFrame(l)}_setCameraViewBox(e,t,n){st(e,t);let i=this._bundle?L(this._bundle):t;this._cameraState={viewBox:t,target:n,isZoomed:!Rn(t,i)},this._emit("camera-change",this.getCameraState())}_getSceneSvg(){return this._sceneElement??this._container?.querySelector("svg")??null}_resolveCameraPadding(e){let t=e.padding??32;if(!Number.isFinite(t)||t<0||t>2048)throw new f("INVALID_CAMERA_OPTIONS","Camera padding must be between 0 and 2048");return t}_resolveCameraDuration(e){let t=e.duration??this._config.transitionDuration;if(!Number.isInteger(t)||t<0||t>1e4)throw new f("INVALID_CAMERA_OPTIONS","Camera duration must be an integer from 0 to 10000");return t}_assertValidCameraArea(e){if(!Array.isArray(e.at)||e.at.length!==2||!e.at.every((t)=>Number.isFinite(t)&&t>=0)||!Array.isArray(e.size)||e.size.length!==2||!e.size.every((t)=>Number.isFinite(t)&&t>0))throw new f("INVALID_CAMERA_OPTIONS","Camera area must use non-negative at and positive size")}_applyLifecycleChanges(e){for(let t of e){let n=this._engine.getLifecycleTransition(t.id);if(!n)continue;let i=this._sceneElement??this._container?.querySelector("svg");if(!i)continue;let r=B(i,t.id);if(!r)continue;if(n.to==="entering"||n.to==="present")r.isHidden=!1,H(r.node);if(bt(n,this._backward))this._applyEntryAnimation(t,r);if(_t(n,this._backward)){this._applyExitAnimation({...t,exit:xt(t.enter??"fade-in")},r);continue}if(St(n,this._backward)){this._applyExitAnimation(t,r);continue}if(Et(n,this._backward)){r.isHidden=!1,H(r.node),this._applyEntryAnimation({...t,enter:Ct(t.exit??"fade-out")},r);continue}if(n.to==="removed")r.isHidden=!0,V(r.node)}}_applyConnectorLifecycleChanges(e){for(let t of e){let n=this._engine.getConnectorLifecycleTransition(t.id);if(!n)continue;let i=this._sceneElement??this._container?.querySelector("svg");if(!i)continue;let r=rt(i,t.id);if(!r)continue;if(n.to==="entering"||n.to==="present")r.isHidden=!1,H(r.node);if(bt(n,this._backward))this._applyConnectorEntryAnimation(t,r);if(_t(n,this._backward)){this._applyConnectorExitAnimation({...t,exit:xt(t.enter??"fade-in")},r);continue}if(St(n,this._backward)){this._applyConnectorExitAnimation(t,r);continue}if(Et(n,this._backward)){r.isHidden=!1,H(r.node),this._applyConnectorEntryAnimation({...t,enter:Ct(t.exit??"fade-out")},r);continue}if(n.to==="removed")r.isHidden=!0,V(r.node)}}_applyEntryAnimation(e,t){let n=e.enter??"fade-in";if(n==="none")return;I(t.node,`iso-anim-${n}`,"enter");let i=t.node.style.animation;t.node.addEventListener("animationend",()=>{if(t.node.style.animation===i)t.node.style.animation=""},{once:!0})}_applyExitAnimation(e,t){let n=e.exit??"fade-out";if(n==="none"){V(t.node);return}I(t.node,`iso-anim-${n}`,"exit");let i=t.node.style.animation;t.node.addEventListener("animationend",()=>{if(t.node.style.animation===i)V(t.node)},{once:!0})}_applyConnectorEntryAnimation(e,t){let n=e.enter??"fade-in";if(n==="none")return;I(t.node,`iso-anim-${n}`,"enter");let i=t.node.style.animation;t.node.addEventListener("animationend",()=>{if(t.node.style.animation===i)t.node.style.animation=""},{once:!0})}_applyConnectorExitAnimation(e,t){let n=e.exit??"fade-out";if(n==="none"){V(t.node);return}I(t.node,`iso-anim-${n}`,"exit");let i=t.node.style.animation;t.node.addEventListener("animationend",()=>{if(t.node.style.animation===i)V(t.node)},{once:!0})}_transitionToScene(e){this._cancelTransition();let t=this.scenes[e],n=this._progress,i=t.progress;if(e===this._sceneIndex&&n===i)return;this._sceneIndex=e,this._emit("scene-change",e);let r=this._config.transitionDuration;if(r>0&&n!==i){this._animateProgress(n,i,r);return}this._progress=i,this._cancelCameraAnimation(),this._scheduleProgressForward(i)}_animateProgress(e,t,n){let i=Ee(this._config.transitionEasing==="ease-in-out"?"easeInOutCubic":this._config.transitionEasing==="ease-out"?"easeOutCubic":"linear"),r=performance.now(),o=(s)=>{let a=s-r,l=Math.min(a/n,1),c=i(l),u=e+(t-e)*c;if(this._setProgress(u),l<1)this._transitionAnim=requestAnimationFrame(o);else this._transitionAnim=null};this._transitionAnim=requestAnimationFrame(o)}_cancelTransition(){if(this._transitionAnim!==null)cancelAnimationFrame(this._transitionAnim),this._transitionAnim=null}_cancelCameraAnimation(){if(this._cameraAnim!==null)cancelAnimationFrame(this._cameraAnim),this._cameraAnim=null}_bindScroll(){if(this._config.keyboardControls)document.addEventListener("keydown",this._onKeyDown);let e=this._config.container;if(!e)return;if(this._container=e,this._calculateScrollBounds(),e.addEventListener("scroll",this._onScroll,{passive:!0}),window.addEventListener("resize",this._onResize,{passive:!0}),this._config.touchControls)e.addEventListener("touchstart",this._onTouchStart,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!1}),e.addEventListener("touchend",this._onTouchEnd)}_unbindScroll(){document.removeEventListener("keydown",this._onKeyDown);let e=this._config.container;if(!e)return;e.removeEventListener("scroll",this._onScroll),window.removeEventListener("resize",this._onResize),e.removeEventListener("touchstart",this._onTouchStart),e.removeEventListener("touchmove",this._onTouchMove),e.removeEventListener("touchend",this._onTouchEnd)}_calculateScrollBounds(){let e=this._config.container;if(!e)return;let t=this._config.scrollOffset??{};if(this._config.scrollDirection==="horizontal"){this._minScroll=t.left??0,this._maxScroll=e.scrollWidth-e.clientWidth-(t.right??0);return}this._minScroll=t.top??0,this._maxScroll=e.scrollHeight-e.clientHeight-(t.bottom??0)}_onScroll=()=>{if(this._paused||this._destroyed)return;let e=this._config.container;if(!e)return;let t=this._config.scrollDirection==="horizontal"?e.scrollLeft:e.scrollTop,n=this._maxScroll-this._minScroll;if(n<=0)return;let i=(t-this._minScroll)/n,r=this._config.scrollSensitivity??1,o=i*r,s=Math.max(this._config.minProgress??0,Math.min(this._config.maxProgress??1,o));if(s!==this._progress)this.setProgress(s)};_onResize=()=>{if(this._destroyed)return;this._calculateScrollBounds()};_onKeyDown=(e)=>{if(this._destroyed)return;if(e.key==="ArrowRight"||e.key==="ArrowDown"||e.key===" ")e.preventDefault(),this.nextScene();else if(e.key==="ArrowLeft"||e.key==="ArrowUp")e.preventDefault(),this.prevScene()};_onTouchStart=(e)=>{if(this._destroyed)return;this._isDragging=!0;let t=e.touches[0];if(this._config.scrollDirection==="horizontal")this._lastTouchX=t.clientX;else this._lastTouchY=t.clientY};_onTouchMove=(e)=>{if(this._destroyed)return;if(!this._isDragging)return;let t=e.touches[0],n=this._config.scrollDirection==="horizontal",i=n?this._lastTouchX-t.clientX:this._lastTouchY-t.clientY;if(n)this._lastTouchX=t.clientX;else this._lastTouchY=t.clientY;let r=this._config.scrollSensitivity??1,o=i/300*r,s=Math.max(0,Math.min(1,this._progress+o));this.setProgress(s)};_onTouchEnd=()=>{if(this._destroyed)return;this._isDragging=!1};_applyPauseState(e){let t=this._getSceneSvg();if(!t)return;if(e)t.classList.add("iso-motion-paused");else t.classList.remove("iso-motion-paused");let n=e?"paused":"running",i=t.querySelectorAll('[class*="iso-ambient-"]');for(let r=0;r<i.length;r++){let o=i[r];o.style.animationPlayState=n}}_assertNotDestroyed(){if(!this._destroyed)return;throw new f("CONTROLLER_DESTROYED","AnimationController has been destroyed")}}function bt(e,t){return!t&&(e.from==="removed"||e.from==="exiting")&&(e.to==="entering"||e.to==="present")}function St(e,t){return!t&&(e.to==="exiting"||e.to==="removed"&&e.from!=="exiting")}function _t(e,t){return t&&(e.to==="removed"||e.to==="exiting")&&(e.from==="entering"||e.from==="present")}function Et(e,t){return t&&(e.from==="exiting"||e.from==="removed")&&(e.to==="present"||e.to==="entering")}function xt(e){switch(e){case"fade-in":return"fade-out";case"fade-in-grow":return"fade-out-shrink";case"fall-in":return"rise-away";case"rise-from-ground":return"fall-through-ground";case"slide-in-left":return"slide-out-left";case"slide-in-right":return"slide-out-right";case"flip-in":return"flip-out";case"none":return"none"}}function Ct(e){switch(e){case"fade-out":return"fade-in";case"fade-out-shrink":return"fade-in-grow";case"fall-through-ground":return"rise-from-ground";case"rise-away":return"fall-in";case"slide-out-left":return"slide-in-left";case"slide-out-right":return"slide-in-right";case"flip-out":return"flip-in";case"none":return"none"}}function wn(e,t){let n=0,i=e.length-1;for(let r=0;r<e.length;r++){if(e[r].progress<=t)n=r;if(e[r].progress>=t){i=r;break}}return{previous:{scene:e[n],index:n},next:{scene:e[i],index:i}}}function re(e,t){return{minX:C(e.minX-t),minY:C(e.minY-t),width:C(Math.max(1,e.width+t*2)),height:C(Math.max(1,e.height+t*2))}}function At(e,t,n){return{minX:C(e.minX+(t.minX-e.minX)*n),minY:C(e.minY+(t.minY-e.minY)*n),width:C(e.width+(t.width-e.width)*n),height:C(e.height+(t.height-e.height)*n)}}function Rn(e,t){return e.minX===t.minX&&e.minY===t.minY&&e.width===t.width&&e.height===t.height}function Tn(e){let t=e.getAttribute("viewBox");if(!t)return;let n=t.trim().split(/\s+/).map(Number);if(n.length!==4||n.some((i)=>!Number.isFinite(i)))return;return{minX:n[0],minY:n[1],width:n[2],height:n[3]}}function wt(e){return Ee(e==="ease-in-out"?"easeInOutCubic":e==="ease-out"?"easeOutCubic":"linear")}function Mn(e){return{viewBox:{...e.viewBox},target:e.target?.type==="area"?{type:"area",at:[...e.target.at],size:[...e.target.size]}:e.target?{...e.target}:void 0,isZoomed:e.isZoomed}}function C(e){return Math.round(e*1000)/1000}function Rt(e){let t=Vn(e),n=t.length*8;t.push(128);while(t.length%64!==56)t.push(0);for(let s=7;s>=0;s--)t.push(Math.floor(n/2**(s*8))&255);let i=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],r=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],o=Array(64);for(let s=0;s<t.length;s+=64){for(let m=0;m<16;m++){let A=s+m*4;o[m]=(t[A]<<24|t[A+1]<<16|t[A+2]<<8|t[A+3])>>>0}for(let m=16;m<64;m++){let A=R(o[m-15],7)^R(o[m-15],18)^o[m-15]>>>3,X=R(o[m-2],17)^R(o[m-2],19)^o[m-2]>>>10;o[m]=o[m-16]+A+o[m-7]+X>>>0}let[a,l,c,u,h,S,_,y]=i;for(let m=0;m<64;m++){let A=R(h,6)^R(h,11)^R(h,25),X=h&S^~h&_,p=y+A+X+r[m]+o[m]>>>0,N=R(a,2)^R(a,13)^R(a,22),E=a&l^a&c^l&c,w=N+E>>>0;y=_,_=S,S=h,h=u+p>>>0,u=c,c=l,l=a,a=p+w>>>0}i[0]=i[0]+a>>>0,i[1]=i[1]+l>>>0,i[2]=i[2]+c>>>0,i[3]=i[3]+u>>>0,i[4]=i[4]+h>>>0,i[5]=i[5]+S>>>0,i[6]=i[6]+_>>>0,i[7]=i[7]+y>>>0}return i.map((s)=>s.toString(16).padStart(8,"0")).join("")}function Vn(e){return Array.from(new TextEncoder().encode(e))}function R(e,t){return e>>>t|e<<32-t}var kn="iso-interactive",Gn="iso-hover";class Ce{svg;listeners=new Map;destroyed=!1;attached=!1;onClick=(e)=>this.handleClick(e);onPointerOver=(e)=>this.handlePointerOver(e);onPointerOut=(e)=>this.handlePointerOut(e);constructor(e,t){if(this.svg=e,t)e.classList.add(kn),e.addEventListener("click",this.onClick),e.addEventListener("pointerover",this.onPointerOver),e.addEventListener("pointerout",this.onPointerOut),this.attached=!0}on(e,t){if(this.destroyed)throw new d("MOUNT_DESTROYED","Cannot call on() after destroy()");let n=this.listeners.get(e)??new Set;return n.add(t),this.listeners.set(e,n),()=>{n.delete(t)}}destroy(){if(this.destroyed)return;if(this.destroyed=!0,this.attached)this.svg.removeEventListener("click",this.onClick),this.svg.removeEventListener("pointerover",this.onPointerOver),this.svg.removeEventListener("pointerout",this.onPointerOut),this.attached=!1;this.listeners.clear()}handleClick(e){let t=this.resolveVisibleElementId(e.target);if(!t)return;this.emit("element-click",{id:t,originalEvent:e})}handlePointerOver(e){let t=this.resolveVisibleElementId(e.target);if(!t)return;let n=this.resolveVisibleElementId(e.relatedTarget);if(t===n)return;this.toggleHoverClass(t,!0),this.emit("element-enter",{id:t,originalEvent:e})}handlePointerOut(e){let t=this.resolveVisibleElementId(e.target);if(!t)return;let n=this.resolveVisibleElementId(e.relatedTarget);if(t===n)return;this.toggleHoverClass(t,!1),this.emit("element-leave",{id:t,originalEvent:e})}toggleHoverClass(e,t){let n=B(this.svg,e);if(!n)return;n.node.classList.toggle(Gn,t)}resolveVisibleElementId(e){let t=e;while(t&&t!==this.svg){let n=t.getAttribute?.("data-id");if(n){let i=B(this.svg,n);if(i&&i.current.presence!=="removed")return n;return}t=t.parentNode}return}emit(e,t){let n=this.listeners.get(e);if(!n)return;for(let i of n)try{i(t)}catch(r){queueMicrotask(()=>{throw r})}}}var Tt="isostate-runtime-bundle",Ae="0.6.0",Ln=/^[a-f0-9]{64}$/;function Bn(e,t,n={}){Nn(e),Pn(t);let i=new F;i.init(t);let r=nt(e,t,{label:n.label,themeVars:n.themeVars}),o;if(n.controller!==void 0&&n.controller!==!1)o=new xe,o.init(t,{...n.controller,container:n.controller.container??e,sceneElement:r},{engine:i,sceneElement:r});let s=new Ce(r,n.interactive===!0),a=!1;return{svg:r,engine:i,controller:o,getResolvedConfig:()=>Fn(t,n,o),on:(l,c)=>s.on(l,c),destroy:()=>{if(a)return;if(a=!0,s.destroy(),In(o),i.destroy(),r.parentNode===e)e.removeChild(r);else r.parentNode?.removeChild(r)}}}function In(e){if(!e)return;try{e.destroy()}catch(t){if(t instanceof f&&t.code==="CONTROLLER_DESTROYED")return;throw t}}function Nn(e){if(!e||typeof e.appendChild!=="function"||typeof e.removeChild!=="function")throw new d("INVALID_MOUNT_TARGET","mountScene() requires a DOM HTMLElement target")}function Pn(e){if(!e||typeof e!=="object")throw new d("BUNDLE_FORMAT_MISSING","Runtime bundle must be a plain object");if(e._format!==Tt)throw new d("BUNDLE_FORMAT_MISSING","Runtime bundle format is missing or unsupported",{expected:Tt});if(!Array.isArray(e.scenes)||e.scenes.length===0)throw new d("BUNDLE_FORMAT_MISSING","Runtime bundle must include compiled scenes[]");if(Mt(e._version)!==Mt(Ae))throw new d("BUNDLE_VERSION_MISMATCH",`Runtime bundle version ${e._version} is not compatible with runtime ${Ae}`,{bundleVersion:e._version,runtimeVersion:Ae});if(!e._digest)throw new d("BUNDLE_DIGEST_MISSING","Runtime bundle digest is missing");if(typeof e._digest!=="string"||!Ln.test(e._digest))throw new d("BUNDLE_DIGEST_MISMATCH","Runtime bundle digest is malformed");let{_digest:t,...n}=e,i=Rt(Xn(n));if(i!==t)throw new d("BUNDLE_DIGEST_MISMATCH","Runtime bundle digest does not match bundle content",{expected:t,actual:i})}function Fn(e,t={},n){return{grid:{cellSize:e.grid.cellSize},floor:{...e.floor,size:[...e.floor.size],origin:[...e.floor.origin]},layout:{...e.layout,padding:{...e.layout.padding},align:[...e.layout.align]},viewBox:L(e),camera:Dn(e,n),theme:e.theme,themeVars:Yn(e,t.themeVars),scenes:e.scenes.map((i)=>({id:i.id,progress:i.progress})),layerOrder:e.layers.map((i)=>({name:i.name,order:i.order})).sort((i,r)=>i.order-r.order||On(i.name,r.name))}}function Dn(e,t){if(t)try{return t.getCameraState()}catch(n){if(!(n instanceof f))throw n}return{viewBox:L(e),isZoomed:!1}}function On(e,t){return e<t?-1:e>t?1:0}function Yn(e,t={}){return{...J(e.theme)??{},...e.themeVars??{},...t}}function Mt(e){let t=Number.parseInt(String(e).split(".")[0]??"",10);return Number.isFinite(t)?t:Number.NaN}function Xn(e){return JSON.stringify(we(e))}function we(e){if(Array.isArray(e))return e.map((n)=>n===void 0?null:we(n));if(!zn(e))return e;let t={};for(let n of Object.keys(e).sort()){let i=e[n];if(i!==void 0)t[n]=we(i)}return t}function zn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Gi(e,t,n,i,r,o,s){return M(e,t,n,i,r,o,s)}export{Bn as mountScene,Gi as projectToScreen};
|
|
4
|
+
`)}function Ft(){return[[0,0],[1,0],[1,1],[0,1]]}function Oe(e,t,n,i){if(!t)return;let r=document.createElementNS(x,"polygon");r.setAttribute("points",t.map((o)=>de(o,i)).join(" ")),pe(r,n,{fill:"currentColor",stroke:"none"}),e.appendChild(r)}function Dt(e,t,n,i){if(!t?.points)return;let r=document.createElementNS(x,"polyline");r.setAttribute("points",t.points.map((o)=>de(o,i)).join(" ")),r.setAttribute("fill","none"),r.setAttribute("stroke-linecap",t.lineCap??"round"),r.setAttribute("stroke-linejoin",t.lineJoin??"round"),pe(r,n,{fill:"none",stroke:"currentColor"}),e.appendChild(r)}function Ot(e,t,n){let i=de([0.5,0.5],n),r=document.createElementNS(x,"circle"),[o,s]=i.split(",").map(Number);r.setAttribute("cx",String(o)),r.setAttribute("cy",String(s)),r.setAttribute("r",String(n*0.2)),pe(r,t,{fill:"currentColor",stroke:"none"}),e.appendChild(r)}function de(e,t){let n=G(e[0],e[1],t),i=G(1,1,t);return`${n.rawX-i.rawX},${n.rawY-i.rawY}`}function pe(e,t,n){if(e.setAttribute("fill",t?.fill??n.fill),e.setAttribute("stroke",t?.stroke??n.stroke),e.setAttribute("stroke-width",String(t?.strokeWidth??0)),e.setAttribute("opacity",String(t?.opacity??1)),t?.dash)e.setAttribute("stroke-dasharray",t.dash.join(" "))}function Yt(e,t,n,i){if(!ze(e))throw new d("INVALID_ASSET_URL",`Asset URL is unsafe: ${t}`,{asset:t});let r=document.createElementNS(x,"g"),o=document.createElementNS(x,"image"),s=Xe(e),[a,l]=i??[0.5,1];return o.setAttribute("href",s),o.setAttributeNS("http://www.w3.org/1999/xlink","href",s),o.setAttribute("x",String(-n*a)),o.setAttribute("y",String(-n*l)),o.setAttribute("width",String(n)),o.setAttribute("height",String(n)),o.setAttribute("preserveAspectRatio","xMidYMax meet"),r.appendChild(o),r}function Xt(e,t,n,i,r){if(!ze(e))throw new d("INVALID_ASSET_URL",`Asset URL is unsafe: ${t}`,{asset:t});let o=document.createElementNS(x,"g"),s=document.createElementNS(x,"svg"),a=document.createElementNS(x,"image"),l=Xe(e),[c,u]=r??[0.5,1],[h,S,_,y]=i.rect;return s.setAttribute("x",String(-n*c)),s.setAttribute("y",String(-n*u)),s.setAttribute("width",String(n)),s.setAttribute("height",String(n)),s.setAttribute("viewBox",`${h} ${S} ${_} ${y}`),s.setAttribute("preserveAspectRatio","xMidYMax meet"),a.setAttribute("href",l),a.setAttributeNS("http://www.w3.org/1999/xlink","href",l),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("width",String(i.sheetSize[0])),a.setAttribute("height",String(i.sheetSize[1])),s.appendChild(a),o.appendChild(s),o}function Xe(e){try{let t=document.baseURI;return typeof t==="string"?new URL(e,t).href:e}catch{return e}}function ze(e){let t=e.trim().toLowerCase();return t.length>0&&!t.startsWith("javascript:")}function $e(e,t){if(!e.length)return"";let n=`M ${e[0].x} ${e[0].y}`;for(let i=1;i<e.length;i++){let r=e[i],o=e[i-1],s=e[i+1],a=Math.hypot(r.x-o.x,r.y-o.y),l=s?Math.hypot(s.x-r.x,s.y-r.y):0,c=Math.min(t,a/2,l/2);if(!s||!c){n+=` L ${r.x} ${r.y}`;continue}let u={x:r.x+(o.x-r.x)*c/a,y:r.y+(o.y-r.y)*c/a},h={x:r.x+(s.x-r.x)*c/l,y:r.y+(s.y-r.y)*c/l};n+=` L ${u.x} ${u.y} Q ${r.x} ${r.y} ${h.x} ${h.y}`}return n}function g(e,t){let n=document.createElementNS("http://www.w3.org/2000/svg",e);for(let[i,r]of Object.entries(t))n.setAttribute(i,String(r));return n}function Ue(e,t,n,i){for(let s of e.querySelectorAll(".iso-track-effect"))e.removeChild(s);let{style:r}=n;if(r.glow){let s=g("path",{d:i,fill:"none",stroke:r.glow,"stroke-width":r.strokeWidth+(r.glowWidth??8),opacity:r.opacity*0.16,"stroke-linecap":"round","stroke-linejoin":"round",class:"iso-track-effect iso-connector-glow"});e.insertBefore(s,e.firstChild)}if(r.variant!=="beam")return;let o=g("path",{d:i,fill:"none",stroke:"#efffff","stroke-width":Math.max(0.6,r.strokeWidth*0.23),opacity:r.opacity*0.7,"stroke-linecap":"round","stroke-linejoin":"round",class:"iso-track-effect iso-connector-highlight"});e.insertBefore(o,t.nextSibling)}function zt(e,t,n){let i=g("g",{transform:`scale(${t/16})`,fill:n});if(i.appendChild(g("ellipse",{cx:1,cy:5,rx:9,ry:3.5,fill:"#07131f",opacity:0.35})),e==="orb")i.appendChild(g("circle",{r:7,fill:"#173343"})),i.appendChild(g("circle",{cx:-1,cy:-1.5,r:5.6})),i.appendChild(g("ellipse",{cx:-2,cy:-3.5,rx:2.5,ry:1.6,fill:"#fff",opacity:0.85}));else if(e==="envelope")i.appendChild(g("path",{d:"M-8-5 8-2 8 6-8 3Z",fill:"#142e3c",stroke:n,"stroke-width":1})),i.appendChild(g("path",{d:"M-8-5 8-2 0 2Z"})),i.appendChild(g("path",{d:"M-7-4 0 1 7-1",fill:"none",stroke:"#f0ffff","stroke-width":0.8,opacity:0.8}));else i.appendChild(g("path",{d:"M-8-2 0-6 8-2 0 2Z"})),i.appendChild(g("path",{d:"M-8-2 0 2 0 7-8 3Z",fill:"#183544",stroke:n,"stroke-width":0.6})),i.appendChild(g("path",{d:"M0 2 8-2 8 3 0 7Z",opacity:0.65})),i.appendChild(g("path",{d:"M-6-2 0-5 6-2",fill:"none",stroke:"#fff","stroke-width":0.9,opacity:0.85}));return i}function je(e,t,n,i){if(i)for(let o of e.querySelectorAll(".iso-message"))e.removeChild(o);let r=t.message;if(!r||r.enabled===!1)return;if(i){let o=r.count??1,s=r.duration??1800;for(let a=0;a<o;a++){let l=g("g",{class:"iso-message","aria-hidden":"true","data-kind":r.kind??"packet"});l.style.animationDuration=`${s}ms`,l.style.animationDelay=`${-s*a/o}ms`,l.appendChild(zt(r.kind??"packet",r.size??10,r.color??t.style.stroke)),e.appendChild(l)}}for(let o of e.querySelectorAll(".iso-message"))o.style.offsetPath=`path("${n}")`,o.style.opacity=String(t.style.opacity),o.style.animationDirection=t.direction==="reverse"?"reverse":"normal",o.style.display=t.presence==="removed"?"none":""}function fe(e,t,n){for(let u of e.querySelectorAll(".iso-activity"))e.removeChild(u);if(e.setAttribute("data-activity",t?.state??"idle"),!t||t.state==="idle")return;let i=t.state,r=t.color??{processing:"#67e8f9",waiting:"#fbbf24",complete:"#6ee7b7",error:"#fb7185"}[i],o=g("g",{class:`iso-activity iso-activity-${i}`,color:r,"aria-label":i,"pointer-events":"none"}),s=n*0.36,a=g("ellipse",{cx:0,cy:-2,rx:s,ry:s*0.42,fill:r,"fill-opacity":0.08,stroke:r,"stroke-opacity":0.6,"stroke-width":1.3,class:"iso-activity-ring"});o.appendChild(a);let l=g("g",{transform:`translate(${n*0.29} ${-n*0.6})`,class:"iso-activity-badge"});l.appendChild(g("circle",{r:6,fill:"#102330",stroke:r,"stroke-width":1}));let c={processing:"M-2 0h4M0-2v4",waiting:"M-2-2v4M2-2v4",complete:"M-3 0-1 2 3-2",error:"M0-3v3M0 2v.5"}[i];l.appendChild(g("path",{d:c,fill:"none",stroke:r,"stroke-width":1.5,"stroke-linecap":"round","stroke-linejoin":"round"})),o.appendChild(l),e.appendChild(o)}var $t=/^--[a-zA-Z0-9-_]+$/;function Ke(e,t){for(let[n,i]of Object.entries(t)){if(!$t.test(n))throw new d("INVALID_THEME_VAR",`Invalid CSS custom property name: ${n}`);e.style.setProperty(n,i)}}var v="http://www.w3.org/2000/svg",et="text",Ut=new Set(["rectangle","circle","polygon","line"]),jt={dashed:[12,8],dotted:[0,8]},ye=0.14,ge=0.35,Kt=0.28,tt=0.4;function nt(e,t,n){let i=te(t),r=t.scenes[0],o=an(t),s=cn(t),a=new Map((r?.elements??[]).map((p)=>[p.id,p])),l=new Map((r?.connectors??[]).map((p)=>[p.id,p])),c=en(i,n?.label,t.className),u=le(t);c._assetResolver=u,c.appendChild(tn()),Ke(c,{...J(t.theme)??{},...t.themeVars??{},...n?.themeVars??{}});let h=on(t.layers),S=rn(h);if(t.floor.visible)c.appendChild(nn(t,i));let _=new Map;for(let p of s){let N=l.get(p.id)??{...p,presence:"removed"},E=mn(N,i);if(N.presence==="removed")E.isHidden=!0,V(E.node);yt(E,N.ambient??[]),c.appendChild(E.node),_.set(p.id,E)}let y=document.createElementNS(v,"g");y.classList.add("iso-depth-layer"),y.setAttribute("data-layer","depth"),c.appendChild(y);let m=document.createElementNS(v,"g");m.classList.add("iso-layer","iso-layer-labels"),m.setAttribute("data-layer","labels"),c.appendChild(m);let A=new Map,X=mt(o);for(let p of X){if(!S.get(p.layer))throw new d("MISSING_LAYER",`Unknown layer for "${p.id}": ${p.layer}`);let E=a.get(p.id)??{...p,presence:"removed"},w=ln(E,i,u);if(w.anchor=ct(t,E),w.node.classList.add(`iso-layer-${p.layer}`),w.node.setAttribute("data-layer",p.layer),E.presence==="removed")w.isHidden=!0,V(w.node);gt(w,E.ambient??[]),(K(p.asset)?m:y).appendChild(w.node),A.set(p.id,w)}return c._layerMap=S,c._elementMap=A,c._connectorMap=_,c._depthGroup=y,e.appendChild(c),c}function it(e,t,n=[]){let i=e._layout;if(!i)return;let r=e._elementMap;if(r){for(let s of t){let a=r.get(s.id);if(!a)continue;let l=a.current;if(a.current=s,!qe(l,s))un(a.node,s,i,e._assetResolver),a.anchor=e._assetResolver?.(s.asset)?.anchor??[0.5,1];if(!qe(l,s)||!Y(l.activity,s.activity))fe(a.node,s.activity,i.cellSize);ht(a.node,s,i),gt(a,s.ambient??[])}if(e._depthGroup)sn(e._depthGroup,r)}let o=e._connectorMap;if(!o)return;for(let s of n){let a=o.get(s.id);if(!a)continue;pt(a,s,i)}}function B(e,t){return e._elementMap?.get(t)}function rt(e,t){return e._connectorMap?.get(t)}function L(e){return te(e).viewBox}function ot(e){let t=te(e);return{cellSize:t.cellSize,padding:t.padding,selectedBounds:t.selectedBounds}}function ee(e,t){let n=e._layout,i=e._elementMap?.get(t);if(!n||!i||i.current.presence==="removed")return;return ut(qt(i.current,n,i.anchor))}function ve(e,t){let n=te(e),[i,r]=t.at,[o,s]=t.size,a=ne();for(let l of[[i,r],[i+o,r],[i,r+s],[i+o,r+s]]){let c=M(l[0],l[1],n.cellSize,n.selectedBounds.minX,n.selectedBounds.minY,n.padding.x,n.padding.y);a=be(a,c.screenX,c.screenY)}return ut(a)}function st(e,t){e.setAttribute("viewBox",`${t.minX} ${t.minY} ${t.width} ${t.height}`)}function V(e){e.classList.add("iso-motion-paused"),e.style.visibility="hidden",e.style.pointerEvents="none"}function H(e){e.classList.remove("iso-motion-paused"),e.style.visibility="visible",e.style.pointerEvents="auto"}function te(e){let t=e.grid.cellSize,n=e.layout.padding,i=Ht(e,t),r=Jt(e,t),o=Qt(e.layout.bounds,i,r),s=o.maxX-o.minX+n.x*2,a=o.maxY-o.minY+n.y*2,l={minX:0,minY:0,width:O(s||t),height:O(a||t)};return{cellSize:t,padding:n,contentBounds:i,floorBounds:r,selectedBounds:o,viewBox:l}}function Ht(e,t){let n=ne();for(let i of e.scenes){for(let r of i.elements??[]){if(r.presence==="removed")continue;n=Q(n,Wt(e,r,t))}for(let r of i.connectors??[]){if(r.presence==="removed")continue;n=Q(n,Zt(r,t))}}return lt(n,t)}function Wt(e,t,n){let{rawX:i,rawY:r}=G(t.pos[0]+t.size,t.pos[1]+t.size,n),o=D(t.size,n),[s,a]=ct(e,t);return at({minX:i-o*s,minY:r-o*a,maxX:i+o*(1-s),maxY:r+o*(1-a)},t,i,r,o)}function qt(e,t,n){let i=M(e.pos[0]+e.size,e.pos[1]+e.size,t.cellSize,t.selectedBounds.minX,t.selectedBounds.minY,t.padding.x,t.padding.y),r=D(e.size,t.cellSize);return at({minX:i.screenX-r*n[0],minY:i.screenY-r*n[1],maxX:i.screenX+r*(1-n[0]),maxY:i.screenY+r*(1-n[1])},e,i.screenX,i.screenY,r)}function at(e,t,n,i,r){if(!t.activity||t.activity.state==="idle")return e;return Q(e,{minX:n-r*0.4,maxX:n+r*0.4,minY:i-r*0.72,maxY:i+r*0.18})}function ct(e,t){return e.assets?.[t.asset]?.anchor??[0.5,1]}function Zt(e,t){let n=ne();for(let[s,a]of e.route){let{rawX:l,rawY:c}=G(s,a,t);n=be(n,l,c)}let i=Math.max(ge,tt,ye*2)*t,r=e.style.strokeWidth/2+(e.style.outlineWidth??0),o=i+r+(e.style.glow?(e.style.glowWidth??8)/2:0)+(e.message?.size??0)/2;return{minX:n.minX-o,minY:n.minY-o,maxX:n.maxX+o,maxY:n.maxY+o}}function Jt(e,t){let n=e.floor.origin,[i,r]=e.floor.size,o=[n,[n[0]+i,n[1]],[n[0],n[1]+r],[n[0]+i,n[1]+r]],s=ne();for(let[a,l]of o){let{rawX:c,rawY:u}=G(a,l,t);s=be(s,c,u)}return lt(s,t)}function Qt(e,t,n){if(e==="content")return t;if(e==="floor")return n;return Q(t,n)}function ne(){return{minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY}}function lt(e,t){if(Number.isFinite(e.minX))return e;return{minX:0,minY:0,maxX:t,maxY:t}}function ut(e){let t=(e.minX+e.maxX)/2,n=(e.minY+e.maxY)/2,i=Math.max(1,e.maxX-e.minX),r=Math.max(1,e.maxY-e.minY);return{minX:O(t-i/2),minY:O(n-r/2),width:O(i),height:O(r)}}function be(e,t,n){return{minX:Math.min(e.minX,t),minY:Math.min(e.minY,n),maxX:Math.max(e.maxX,t),maxY:Math.max(e.maxY,n)}}function Q(e,t){return{minX:Math.min(e.minX,t.minX),minY:Math.min(e.minY,t.minY),maxX:Math.max(e.maxX,t.maxX),maxY:Math.max(e.maxY,t.maxY)}}function O(e){return Math.round(e*1000)/1000}function en(e,t,n){let i=document.createElementNS(v,"svg");i.classList.add("iso-scene");for(let r of n?.trim().split(/\s+/)??[])if(r)i.classList.add(r);if(i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("viewBox",`${e.viewBox.minX} ${e.viewBox.minY} ${e.viewBox.width} ${e.viewBox.height}`),i.setAttribute("preserveAspectRatio","xMidYMid meet"),i.style.width="100%",i.style.height="100%",i.style.display="block",t)i.setAttribute("role","img"),i.setAttribute("aria-label",t);else i.setAttribute("aria-hidden","true");return i._layout=e,i._viewBoxW=e.viewBox.width,i._viewBoxH=e.viewBox.height,i}function tn(){let e=document.createElementNS(v,"style");return e.textContent=De(),e}function nn(e,t){let n=document.createElementNS(v,"g");n.classList.add("iso-floor-grid",`iso-layer-${e.floor.layer}`),n.setAttribute("data-layer",e.floor.layer);let[i,r]=e.floor.origin,[o,s]=e.floor.size,a=[b(i,r,t),b(i+o,r,t),b(i+o,r+s,t),b(i,r+s,t)],l=document.createElementNS(v,"polygon");l.classList.add("iso-floor-slab"),l.setAttribute("points",a.map(Se).join(" ")),l.setAttribute("fill","#dbe6f4"),l.setAttribute("fill-opacity","0.22"),l.setAttribute("stroke","#b9c9df"),l.setAttribute("stroke-width","1"),n.appendChild(l);for(let c=0;c<=o;c++)n.appendChild(He(b(i+c,r,t),b(i+c,r+s,t)));for(let c=0;c<=s;c++)n.appendChild(He(b(i,r+c,t),b(i+o,r+c,t)));return n}function He(e,t){let n=document.createElementNS(v,"line");return n.setAttribute("x1",String(e.x)),n.setAttribute("y1",String(e.y)),n.setAttribute("x2",String(t.x)),n.setAttribute("y2",String(t.y)),n.setAttribute("stroke","#2563eb"),n.setAttribute("stroke-width","1"),n.setAttribute("stroke-dasharray","5 5"),n.setAttribute("stroke-opacity","0.2"),n}function b(e,t,n){let i=M(e,t,n.cellSize,n.selectedBounds.minX,n.selectedBounds.minY,n.padding.x,n.padding.y);return{x:i.screenX,y:i.screenY}}function Se(e){return`${e.x},${e.y}`}function rn(e){return new Map(e.map((t)=>[t.name,t]))}function on(e){return[...e].map((t,n)=>({name:t.name,order:t.order??n})).sort((t,n)=>t.order-n.order||t.name.localeCompare(n.name))}function mt(e){return e.slice().sort((t,n)=>{let i=We(t)-We(n);if(i!==0)return i;let r=t.pos[0]+t.pos[1]-(n.pos[0]+n.pos[1]);if(r!==0)return r;return t.id.localeCompare(n.id)})}function We(e){if(K(e.asset))return 1;return 0}function sn(e,t){let n=[];for(let s of t.values()){if(s.node.parentElement!==e)continue;n.push(s.current)}if(n.length<2)return;let i=mt(n),r=[...e.childNodes],o=r.length===i.length;if(o)for(let s=0;s<i.length;s++){let a=i[s]?.id;if(r[s]?.getAttribute("data-id")!==a){o=!1;break}}if(o)return;for(let s of i){let a=t.get(s.id);if(a)e.appendChild(a.node)}}function an(e){let t=new Map;for(let n of e.scenes)for(let i of n.elements??[])if(!t.has(i.id)||t.get(i.id)?.presence==="removed")t.set(i.id,i);return[...t.values()]}function cn(e){let t=new Map;for(let n of e.scenes)for(let i of n.connectors??[])if(!t.has(i.id)||t.get(i.id)?.presence==="removed")t.set(i.id,i);return[...t.values()]}function ln(e,t,n){let i=e.asset===et?ue(e.text,e.asset,t.cellSize):_e(e.asset)?me(e.asset,e.primitive,t.cellSize):dt(e,n,t.cellSize);i.classList.add("iso-element",`iso-element-${e.id}`),i.setAttribute("data-id",e.id),i.setAttribute("data-asset",e.asset),i.style.overflow="visible",i.style.pointerEvents="auto",ht(i,e,t),fe(i,e.activity,t.cellSize);let r=e.enter;if(r&&r!=="none"&&e.presence!=="removed"){let o=`iso-anim-${r}`;I(i,o,"enter");let s=i.style.animation;return i.addEventListener("animationend",()=>{if(i.style.animation===s)i.style.animation=""},{once:!0}),{node:i,current:e,anchor:[0.5,1],isHidden:!1,entryKey:r,ambient:new Set}}return{node:i,current:e,anchor:[0.5,1],isHidden:!1,ambient:new Set}}function K(e){return e===et}function _e(e){return Ut.has(e)}function dt(e,t,n){let i=t(e.asset);if(!i)throw new d("ASSET_NOT_FOUND",`Asset not found: ${e.asset}`,{asset:e.asset,elementId:e.id});return Ye(i,e.asset,n)}function un(e,t,n,i){let r=K(t.asset)?ue(t.text,t.asset,n.cellSize):_e(t.asset)?me(t.asset,t.primitive,n.cellSize):dt(t,i??le(),n.cellSize);e.setAttribute("data-asset",t.asset),dn(e);while(r.firstChild){let o=r.firstChild;r.removeChild(o),e.appendChild(o)}}function qe(e,t){if(!e)return!1;if(e.asset!==t.asset)return!1;if(!K(t.asset)&&!_e(t.asset))return!0;if(K(t.asset))return Y(e.text,t.text);return Y(e.primitive,t.primitive)}function Y(e,t){if(e===t)return!0;if(typeof e!==typeof t)return!1;if(e===null||t===null||typeof e!=="object"||typeof t!=="object")return!1;if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;return e.every((r,o)=>Y(r,t[o]))}let n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;return n.every((r)=>Y(e[r],t[r]))}function mn(e,t){let n=document.createElementNS(v,"g"),i=document.createElementNS(v,"path");n.appendChild(i);let r={node:n,shaft:i,isHidden:!1,ambient:new Set};pt(r,e,t);let o=e.enter;if(o&&o!=="none"&&e.presence!=="removed"){I(n,`iso-anim-${o}`,"enter");let s=n.style.animation;n.addEventListener("animationend",()=>{if(n.style.animation===s)n.style.animation=""},{once:!0})}return r}function pt(e,t,n){let i=e.previous,r=!i||!pn(i.route,t.route),o=!i||!fn(i.style,t.style),s=!i||he(i)!==he(t)||i.style.variant!==t.style.variant||i.style.lane!==t.style.lane||i.start!==t.start||i.end!==t.end||i.route.length!==t.route.length;hn(e.node,t,i);let a=r||s||o,l=a?gn(t.route,n,t.style.cornerRadius??0):e.shaft.getAttribute("d")??"";if(s){if(e.outline)e.node.removeChild(e.outline);if(e.outline=void 0,he(t)){let c=document.createElementNS(v,"path");c.classList.add("iso-connector-outline"),j(c,t,l,{stroke:t.style.outline??t.style.stroke,strokeWidth:t.style.strokeWidth+t.style.outlineWidth*2,includeDash:!1}),e.node.insertBefore(c,e.shaft),e.outline=c}}else if(e.outline&&a)j(e.outline,t,l,{stroke:t.style.outline??t.style.stroke,strokeWidth:t.style.strokeWidth+t.style.outlineWidth*2,includeDash:!1});if(!e.shaft.parentNode)e.node.appendChild(e.shaft);if(e.shaft.classList.add("iso-connector-shaft"),a)j(e.shaft,t,l,{stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,includeDash:!0});if(s){if(e.lane)e.node.removeChild(e.lane);if(e.lane=void 0,t.style.variant==="road"&&t.style.lane==="center-dashed"){let c=document.createElementNS(v,"path");c.classList.add("iso-connector-lane"),j(c,t,l,{stroke:"#ffffff",strokeWidth:Math.max(1,t.style.strokeWidth*0.12),includeDash:!1}),c.setAttribute("stroke-dasharray","8 8"),e.node.appendChild(c),e.lane=c}}else if(e.lane&&a)j(e.lane,t,l,{stroke:"#ffffff",strokeWidth:Math.max(1,t.style.strokeWidth*0.12),includeDash:!1}),e.lane.setAttribute("stroke-dasharray","8 8");if(a){if(e.startEndpoint)e.node.removeChild(e.startEndpoint);if(e.endEndpoint)e.node.removeChild(e.endEndpoint);e.startEndpoint=Ze(e.node,t,"start",n),e.endEndpoint=Ze(e.node,t,"end",n)}if(a)Ue(e.node,e.shaft,t,l);je(e.node,t,l,!i||!Y(i.message,t.message)||i.style.stroke!==t.style.stroke),yt(e,t.ambient??[]),e.previous=t}function dn(e){while(e.firstChild)e.removeChild(e.firstChild)}function pn(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;return e.every((n,i)=>{let r=t[i];return r!==void 0&&n[0]===r[0]&&n[1]===r[1]})}function fn(e,t){if(e===t)return!0;return e.variant===t.variant&&e.pattern===t.pattern&&e.stroke===t.stroke&&e.strokeWidth===t.strokeWidth&&e.opacity===t.opacity&&e.outline===t.outline&&e.outlineWidth===t.outlineWidth&&e.lane===t.lane&&e.cornerRadius===t.cornerRadius&&e.glow===t.glow&&e.glowWidth===t.glowWidth&&(e.dash??[]).join(",")===(t.dash??[]).join(",")}function hn(e,t,n){let i=["iso-connector",`iso-connector-${t.id}`,`iso-connector-variant-${t.style.variant}`,`iso-connector-pattern-${t.style.pattern}`,`iso-connector-direction-${t.direction}`,`iso-layer-${t.layer}`];if(!n)e.classList.add(...i);else{let r=["iso-connector",`iso-connector-${n.id}`,`iso-connector-variant-${n.style.variant}`,`iso-connector-pattern-${n.style.pattern}`,`iso-connector-direction-${n.direction}`,`iso-layer-${n.layer}`];for(let o of r)if(!i.includes(o))e.classList.remove(o);for(let o of i)if(!r.includes(o))e.classList.add(o)}e.setAttribute("data-id",t.id),e.setAttribute("data-layer",t.layer),e.style.overflow="visible",e.style.pointerEvents="auto"}function he(e){return Boolean(e.style.outline&&e.style.outlineWidth>0)}function j(e,t,n,i){if(e.setAttribute("d",n),e.setAttribute("fill","none"),e.setAttribute("stroke",i.stroke),e.setAttribute("stroke-width",String(i.strokeWidth)),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("opacity",String(t.style.opacity)),i.includeDash&&t.style.pattern!=="solid"){let r=t.style.dash??jt[t.style.pattern];e.setAttribute("stroke-dasharray",r.join(" "))}else e.setAttribute("stroke-dasharray","none")}function gn(e,t,n){return $e(e.map(([i,r])=>b(i,r,t)),n)}function Ze(e,t,n,i){let r=t[n];if(r==="none"||t.route.length<2)return;let o=yn(r,t,n,i);return o.classList.add(`iso-connector-${n}`),e.appendChild(o),o}function yn(e,t,n,i){switch(e){case"arrow":return vn(t,n,i);case"dot":return Je(t,n,i,!0);case"circle":return Je(t,n,i,!1);case"diamond":return bn(t,n,i);case"bar":return Sn(t,n,i);case"none":throw new d("CONNECTOR_ENDPOINT_NONE","Cannot create geometry for endpoint none")}}function vn(e,t,n){let i=ie(e,t),r=ft(e,t),o=[-r[1],r[0]],s=[i[0]-r[0]*ge,i[1]-r[1]*ge],a=Kt/2,l=[i,[s[0]+o[0]*a,s[1]+o[1]*a],[s[0]-o[0]*a,s[1]-o[1]*a]].map((u)=>b(u[0],u[1],n)),c=document.createElementNS(v,"polygon");return c.setAttribute("points",l.map(Se).join(" ")),c.setAttribute("fill",e.style.stroke),c.setAttribute("opacity",String(e.style.opacity)),c}function Je(e,t,n,i){let r=ie(e,t),o=b(r[0],r[1],n),s=document.createElementNS(v,"circle");return s.setAttribute("cx",String(o.x)),s.setAttribute("cy",String(o.y)),s.setAttribute("r",String(ye*n.cellSize)),s.setAttribute("stroke",e.style.stroke),s.setAttribute("stroke-width",String(Math.max(1,e.style.strokeWidth))),s.setAttribute("opacity",String(e.style.opacity)),s.setAttribute("fill",i?e.style.stroke:"none"),s}function bn(e,t,n){let i=ie(e,t),r=ye,o=[[i[0],i[1]-r],[i[0]+r,i[1]],[i[0],i[1]+r],[i[0]-r,i[1]]],s=document.createElementNS(v,"polygon");return s.setAttribute("points",o.map((a)=>b(a[0],a[1],n)).map(Se).join(" ")),s.setAttribute("fill",e.style.stroke),s.setAttribute("opacity",String(e.style.opacity)),s}function Sn(e,t,n){let i=ie(e,t),r=ft(e,t),o=[-r[1],r[0]],s=tt/2,a=b(i[0]+o[0]*s,i[1]+o[1]*s,n),l=b(i[0]-o[0]*s,i[1]-o[1]*s,n),c=document.createElementNS(v,"line");return c.setAttribute("x1",String(a.x)),c.setAttribute("y1",String(a.y)),c.setAttribute("x2",String(l.x)),c.setAttribute("y2",String(l.y)),c.setAttribute("stroke",e.style.stroke),c.setAttribute("stroke-width",String(Math.max(1,e.style.strokeWidth))),c.setAttribute("stroke-linecap","round"),c.setAttribute("opacity",String(e.style.opacity)),c}function ie(e,t){return t==="start"?e.route[0]:e.route[e.route.length-1]}function ft(e,t){let n=t==="start"?Qe(e.route[0],e.route[1]):Qe(e.route[e.route.length-2],e.route[e.route.length-1]),i=e.direction==="reverse"?[-n[0],-n[1]]:n;return _n(i)}function Qe(e,t){return[t[0]-e[0],t[1]-e[1]]}function _n(e){let t=Math.hypot(e[0],e[1]);if(t===0)return[1,0];return[e[0]/t,e[1]/t]}function ht(e,t,n){let i=M(t.pos[0]+t.size,t.pos[1]+t.size,n.cellSize,n.selectedBounds.minX,n.selectedBounds.minY,n.padding.x,n.padding.y),o=D(t.size,n.cellSize)/n.cellSize;e.setAttribute("transform",`translate(${i.screenX} ${i.screenY}) scale(${o})`)}function gt(e,t){let n=new Set((t??[]).map((i)=>i.name));for(let i of e.ambient)if(!n.has(i))e.node.classList.remove(`iso-ambient-${i}`);for(let i of n)if(!e.ambient.has(i))e.node.classList.add(`iso-ambient-${i}`);e.ambient=n}function yt(e,t){let n=new Set((t??[]).map((i)=>i.name));for(let i of e.ambient)if(!n.has(i))e.shaft.classList.remove(`iso-ambient-${i}`);for(let i of n)e.shaft.classList.add(`iso-ambient-${i}`);e.ambient=n}function I(e,t,n="enter"){e.style.opacity="1",e.style.animation="none",e.getBoundingClientRect();let i=n==="exit"?"var(--iso-anim-duration-exit, 300ms)":"var(--iso-anim-duration-enter, 400ms)",r=n==="exit"?"var(--iso-anim-easing-exit, ease-in)":"var(--iso-anim-easing-enter, ease-out)";e.style.animation=`${t} ${i} ${r} forwards`}function En(e){return e}function xn(e){return e*e*e}function Cn(e){return 1-(1-e)**3}function An(e){return e<0.5?4*e*e*e:1-(-2*e+2)**3/2}function Ee(e){switch(e){case"linear":return En;case"easeInCubic":return xn;case"easeOutCubic":return Cn;case"easeInOutCubic":return An}}var wn=0.000000001,vt={scrollDirection:"vertical",scrollOffset:{},minProgress:0,maxProgress:1,keyboardControls:!1,touchControls:!1,scrollSensitivity:1,transitionDuration:600,transitionEasing:"ease-in-out"};class xe{_engine=new F;_bundle=null;_sceneIndex=0;_progress=0;_paused=!1;_config=vt;_container=null;_sceneElement=null;_ownsEngine=!0;_rafId=null;_pendingProgress=null;_destroyed=!1;_listeners=new Map;_cameraAnim=null;_cameraState=null;_minScroll=0;_maxScroll=0;_lastTouchY=0;_lastTouchX=0;_isDragging=!1;_transitionAnim=null;_backward=!1;get engine(){return this._engine}get progress(){return this._progress}getProgress(){return this._assertNotDestroyed(),this._progress}get sceneIndex(){return this._sceneIndex}getSceneIndex(){return this._assertNotDestroyed(),this._sceneIndex}get scenes(){return this._bundle?.scenes??[]}get paused(){return this._paused}get currentScene(){return this.scenes[this._sceneIndex]}init(e,t={},n={}){if(this._assertNotDestroyed(),!e.scenes||e.scenes.length===0)throw new f("CONTROLLER_NO_SCENES","init() requires at least one compiled scene stop");this._cancelFrame(),this._bundle=e,this._engine=n.engine??new F,this._ownsEngine=!n.engine,this._sceneIndex=0,this._progress=0,this._paused=!1,this._config={...vt,...t},this._sceneElement=n.sceneElement??t.sceneElement??null,this._cameraState={viewBox:L(e),target:{type:"reset"},isZoomed:!1},this._engine.init(e),this._bindScroll()}setProgress(e){if(this._assertNotDestroyed(),!Number.isFinite(e))throw new f("CONTROLLER_PROGRESS_OUT_OF_RANGE","setProgress() requires a finite progress value");this._cancelTransition(),this._setProgress(e),this._syncSceneIndex(this._progress)}_syncSceneIndex(e){let t=this.scenes,n=0;for(let i=0;i<t.length;i++)if(t[i].progress<=e+wn)n=i;if(n===this._sceneIndex)return;this._sceneIndex=n,this._emit("scene-change",n)}_setProgress(e){let t=Math.max(0,Math.min(1,e));if(t===this._progress&&!this._paused&&this._rafId!==null)return;if(this._progress=t,this._cancelCameraAnimation(),this._paused)return;this._scheduleProgressForward(t)}nextScene(){if(this._assertNotDestroyed(),this.scenes.length<=1)return;let e=(this._sceneIndex+1)%this.scenes.length;this._transitionToScene(e)}prevScene(){if(this._assertNotDestroyed(),this.scenes.length<=1)return;let e=(this._sceneIndex-1+this.scenes.length)%this.scenes.length;this._transitionToScene(e)}setSceneIndex(e){if(this._assertNotDestroyed(),e<0||e>=this.scenes.length)throw new f("CONTROLLER_SCENE_INDEX_OUT_OF_RANGE",`Scene index ${e} is out of bounds [0, ${this.scenes.length-1}]`);this._transitionToScene(e)}pause(){if(this._assertNotDestroyed(),this._paused)return;this._paused=!0,this._cancelFrame(),this._cancelTransition(),this._engine.pause(),this._applyPauseState(!0),this._emit("paused")}resume(){if(this._assertNotDestroyed(),!this._paused)return;this._paused=!1,this._engine.resume(),this._applyPauseState(!1),this._scheduleProgressForward(this._progress),this._emit("resumed")}isPaused(){return this._assertNotDestroyed(),this._paused}zoomToElement(e,t={}){this._assertNotDestroyed();let n=this._getSceneSvg();if(!this._bundle||!n)throw new f("CAMERA_NOT_INITIALIZED","zoomToElement() requires an initialized scene SVG");let i=ee(n,e);if(!i){if(B(n,e))throw new f("CAMERA_TARGET_NOT_VISIBLE",`Camera target element "${e}" is currently removed`,{elementId:e});throw new f("CAMERA_TARGET_NOT_FOUND",`Camera target element "${e}" was not found`,{elementId:e})}this._applyCameraDestination(re(i,this._resolveCameraPadding(t)),{type:"element",id:e},t)}zoomToArea(e,t={}){if(this._assertNotDestroyed(),!this._bundle||!this._getSceneSvg())throw new f("CAMERA_NOT_INITIALIZED","zoomToArea() requires an initialized scene SVG");this._assertValidCameraArea(e);let n=ve(this._bundle,e);this._applyCameraDestination(re(n,this._resolveCameraPadding(t)),{type:"area",at:[...e.at],size:[...e.size]},t)}resetZoom(e={}){if(this._assertNotDestroyed(),!this._bundle||!this._getSceneSvg())throw new f("CAMERA_NOT_INITIALIZED","resetZoom() requires an initialized scene SVG");this._applyCameraDestination(L(this._bundle),{type:"reset"},e)}getCameraState(){if(this._assertNotDestroyed(),!this._cameraState)throw new f("CAMERA_NOT_INITIALIZED","Camera state is not initialized");return Vn(this._cameraState)}destroy(){if(this._assertNotDestroyed(),this._unbindScroll(),this._cancelFrame(),this._cancelTransition(),this._cancelCameraAnimation(),this._getSceneSvg()?.classList.add("iso-motion-stopped"),this._ownsEngine)this._engine.destroy();this._listeners.clear(),this._bundle=null,this._container=null,this._pendingProgress=null,this._cameraState=null,this._destroyed=!0}on(e,t){this._assertNotDestroyed();let n=this._listeners.get(e)??new Set;n.add(t),this._listeners.set(e,n)}off(e,t){this._assertNotDestroyed();let n=this._listeners.get(e);if(n)n.delete(t)}_emit(e,...t){let n=this._listeners.get(e);if(n)for(let i of n)try{i(...t)}catch(r){queueMicrotask(()=>{throw r})}}_scheduleProgressForward(e){if(this._pendingProgress=e,this._rafId!==null)return;this._rafId=requestAnimationFrame(()=>{this._rafId=null;let t=this._pendingProgress;if(this._pendingProgress=null,t===null||this._paused||this._destroyed)return;this._backward=t<this._engine.getProgress(),this._engine.setProgress(t),this._applyFrameUpdate(),this._emit("progress-change",t)})}_cancelFrame(){if(this._rafId!==null)cancelAnimationFrame(this._rafId),this._rafId=null;this._pendingProgress=null}_applyFrameUpdate(){if(!this._bundle)return;let e=this._sceneElement??this._container?.querySelector("svg")??null;if(!e)return;let t=this._engine.getFrameUpdates().map((i)=>({id:i.id,asset:i.asset,pos:i.pos,size:i.size,layer:i.layer,presence:i.lifecycle,enter:i.entry,exit:i.exit,ambient:i.ambient,text:i.text,primitive:i.primitive,activity:i.activity})),n=this._engine.getConnectorFrameUpdates().map((i)=>({id:i.id,route:i.route,layer:i.layer,presence:i.lifecycle,style:i.style,start:i.start,end:i.end,direction:i.direction,message:i.message,enter:i.entry,exit:i.exit,ambient:i.ambient}));it(e,t,n),this._applyLifecycleChanges(t),this._applyConnectorLifecycleChanges(n),this._applyCameraForProgress(this._progress)}_applyCameraForProgress(e){let t=this._getSceneSvg();if(!this._bundle||!t)return;let n=this.scenes;if(n.length===0)return;let{previous:i,next:r}=Rn(n,e),o=this._effectiveCameraAt(i.index),s=this._effectiveCameraAt(r.index),a=this._resolveCameraViewBox(o,{forInterpolation:!0}),l=this._resolveCameraViewBox(s,{forInterpolation:!0}),c=r.scene.progress-i.scene.progress,u=c<=0?0:(e-i.scene.progress)/c,h=wt(s.easing)(Math.max(0,Math.min(1,u))),S=At(a,l,h),_=h<1?o.target:s.target;this._setCameraViewBox(t,S,_)}_effectiveCameraAt(e){for(let t=e;t>=0;t--){let n=this.scenes[t]?.camera;if(n)return{target:n.target,padding:n.padding,duration:n.duration,easing:n.easing}}return{target:{type:"reset"}}}_resolveCameraViewBox(e,t={}){if(!this._bundle)throw new f("CAMERA_NOT_INITIALIZED","Camera requires an initialized bundle");if(e.target.type==="reset")return L(this._bundle);if(e.target.type==="area")return re(ve(this._bundle,{at:e.target.at,size:e.target.size}),e.padding??32);let n=this._getSceneSvg();if(!n)throw new f("CAMERA_NOT_INITIALIZED","Camera requires an initialized scene SVG");let i=t.forInterpolation?this._resolveElementBoundsForInterpolation(n,e.target.id):ee(n,e.target.id);if(!i)throw new f("CAMERA_TARGET_NOT_FOUND",`Camera target element "${e.target.id}" was not found`,{elementId:e.target.id});return re(i,e.padding??32)}_resolveElementBoundsForInterpolation(e,t){let n=ee(e,t);if(n)return n;let i=B(e,t);if(!i||!this._bundle)return;let r=ot(this._bundle),o=i.current,s=M(o.pos[0]+o.size,o.pos[1]+o.size,r.cellSize,r.selectedBounds.minX,r.selectedBounds.minY,r.padding.x,r.padding.y),a=D(o.size,r.cellSize),[l,c]=i.anchor;return{minX:C(s.screenX-a*l),minY:C(s.screenY-a*c),width:C(Math.max(1,a)),height:C(Math.max(1,a))}}_applyCameraDestination(e,t,n){let i=this._getSceneSvg();if(!i)throw new f("CAMERA_NOT_INITIALIZED","Camera requires an initialized scene SVG");this._cancelCameraAnimation();let r=this._resolveCameraDuration(n);if(r===0){this._setCameraViewBox(i,e,t);return}let o=Mn(i)??this._cameraState?.viewBox??e,s=wt(n.easing??this._config.transitionEasing),a=performance.now(),l=(c)=>{let u=Math.min((c-a)/r,1);if(this._setCameraViewBox(i,At(o,e,s(u)),t),u<1)this._cameraAnim=requestAnimationFrame(l);else this._cameraAnim=null};this._cameraAnim=requestAnimationFrame(l)}_setCameraViewBox(e,t,n){st(e,t);let i=this._bundle?L(this._bundle):t;this._cameraState={viewBox:t,target:n,isZoomed:!Tn(t,i)},this._emit("camera-change",this.getCameraState())}_getSceneSvg(){return this._sceneElement??this._container?.querySelector("svg")??null}_resolveCameraPadding(e){let t=e.padding??32;if(!Number.isFinite(t)||t<0||t>2048)throw new f("INVALID_CAMERA_OPTIONS","Camera padding must be between 0 and 2048");return t}_resolveCameraDuration(e){let t=e.duration??this._config.transitionDuration;if(!Number.isInteger(t)||t<0||t>1e4)throw new f("INVALID_CAMERA_OPTIONS","Camera duration must be an integer from 0 to 10000");return t}_assertValidCameraArea(e){if(!Array.isArray(e.at)||e.at.length!==2||!e.at.every((t)=>Number.isFinite(t)&&t>=0)||!Array.isArray(e.size)||e.size.length!==2||!e.size.every((t)=>Number.isFinite(t)&&t>0))throw new f("INVALID_CAMERA_OPTIONS","Camera area must use non-negative at and positive size")}_applyLifecycleChanges(e){for(let t of e){let n=this._engine.getLifecycleTransition(t.id);if(!n)continue;let i=this._sceneElement??this._container?.querySelector("svg");if(!i)continue;let r=B(i,t.id);if(!r)continue;if(n.to==="entering"||n.to==="present")r.isHidden=!1,H(r.node);if(bt(n,this._backward))this._applyEntryAnimation(t,r);if(_t(n,this._backward)){this._applyExitAnimation({...t,exit:xt(t.enter??"fade-in")},r);continue}if(St(n,this._backward)){this._applyExitAnimation(t,r);continue}if(Et(n,this._backward)){r.isHidden=!1,H(r.node),this._applyEntryAnimation({...t,enter:Ct(t.exit??"fade-out")},r);continue}if(n.to==="removed")r.isHidden=!0,V(r.node)}}_applyConnectorLifecycleChanges(e){for(let t of e){let n=this._engine.getConnectorLifecycleTransition(t.id);if(!n)continue;let i=this._sceneElement??this._container?.querySelector("svg");if(!i)continue;let r=rt(i,t.id);if(!r)continue;if(n.to==="entering"||n.to==="present")r.isHidden=!1,H(r.node);if(bt(n,this._backward))this._applyConnectorEntryAnimation(t,r);if(_t(n,this._backward)){this._applyConnectorExitAnimation({...t,exit:xt(t.enter??"fade-in")},r);continue}if(St(n,this._backward)){this._applyConnectorExitAnimation(t,r);continue}if(Et(n,this._backward)){r.isHidden=!1,H(r.node),this._applyConnectorEntryAnimation({...t,enter:Ct(t.exit??"fade-out")},r);continue}if(n.to==="removed")r.isHidden=!0,V(r.node)}}_applyEntryAnimation(e,t){let n=e.enter??"fade-in";if(n==="none")return;I(t.node,`iso-anim-${n}`,"enter");let i=t.node.style.animation;t.node.addEventListener("animationend",()=>{if(t.node.style.animation===i)t.node.style.animation=""},{once:!0})}_applyExitAnimation(e,t){let n=e.exit??"fade-out";if(n==="none"){V(t.node);return}I(t.node,`iso-anim-${n}`,"exit");let i=t.node.style.animation;t.node.addEventListener("animationend",()=>{if(t.node.style.animation===i)V(t.node)},{once:!0})}_applyConnectorEntryAnimation(e,t){let n=e.enter??"fade-in";if(n==="none")return;I(t.node,`iso-anim-${n}`,"enter");let i=t.node.style.animation;t.node.addEventListener("animationend",()=>{if(t.node.style.animation===i)t.node.style.animation=""},{once:!0})}_applyConnectorExitAnimation(e,t){let n=e.exit??"fade-out";if(n==="none"){V(t.node);return}I(t.node,`iso-anim-${n}`,"exit");let i=t.node.style.animation;t.node.addEventListener("animationend",()=>{if(t.node.style.animation===i)V(t.node)},{once:!0})}_transitionToScene(e){this._cancelTransition();let t=this.scenes[e],n=this._progress,i=t.progress;if(e===this._sceneIndex&&n===i)return;this._sceneIndex=e,this._emit("scene-change",e);let r=this._config.transitionDuration;if(r>0&&n!==i){this._animateProgress(n,i,r);return}this._progress=i,this._cancelCameraAnimation(),this._scheduleProgressForward(i)}_animateProgress(e,t,n){let i=Ee(this._config.transitionEasing==="ease-in-out"?"easeInOutCubic":this._config.transitionEasing==="ease-out"?"easeOutCubic":"linear"),r=performance.now(),o=(s)=>{let a=s-r,l=Math.min(a/n,1),c=i(l),u=e+(t-e)*c;if(this._setProgress(u),l<1)this._transitionAnim=requestAnimationFrame(o);else this._transitionAnim=null};this._transitionAnim=requestAnimationFrame(o)}_cancelTransition(){if(this._transitionAnim!==null)cancelAnimationFrame(this._transitionAnim),this._transitionAnim=null}_cancelCameraAnimation(){if(this._cameraAnim!==null)cancelAnimationFrame(this._cameraAnim),this._cameraAnim=null}_bindScroll(){if(this._config.keyboardControls)document.addEventListener("keydown",this._onKeyDown);let e=this._config.container;if(!e)return;if(this._container=e,this._calculateScrollBounds(),e.addEventListener("scroll",this._onScroll,{passive:!0}),window.addEventListener("resize",this._onResize,{passive:!0}),this._config.touchControls)e.addEventListener("touchstart",this._onTouchStart,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!1}),e.addEventListener("touchend",this._onTouchEnd)}_unbindScroll(){document.removeEventListener("keydown",this._onKeyDown);let e=this._config.container;if(!e)return;e.removeEventListener("scroll",this._onScroll),window.removeEventListener("resize",this._onResize),e.removeEventListener("touchstart",this._onTouchStart),e.removeEventListener("touchmove",this._onTouchMove),e.removeEventListener("touchend",this._onTouchEnd)}_calculateScrollBounds(){let e=this._config.container;if(!e)return;let t=this._config.scrollOffset??{};if(this._config.scrollDirection==="horizontal"){this._minScroll=t.left??0,this._maxScroll=e.scrollWidth-e.clientWidth-(t.right??0);return}this._minScroll=t.top??0,this._maxScroll=e.scrollHeight-e.clientHeight-(t.bottom??0)}_onScroll=()=>{if(this._paused||this._destroyed)return;let e=this._config.container;if(!e)return;let t=this._config.scrollDirection==="horizontal"?e.scrollLeft:e.scrollTop,n=this._maxScroll-this._minScroll;if(n<=0)return;let i=(t-this._minScroll)/n,r=this._config.scrollSensitivity??1,o=i*r,s=Math.max(this._config.minProgress??0,Math.min(this._config.maxProgress??1,o));if(s!==this._progress)this.setProgress(s)};_onResize=()=>{if(this._destroyed)return;this._calculateScrollBounds()};_onKeyDown=(e)=>{if(this._destroyed)return;if(e.key==="ArrowRight"||e.key==="ArrowDown"||e.key===" ")e.preventDefault(),this.nextScene();else if(e.key==="ArrowLeft"||e.key==="ArrowUp")e.preventDefault(),this.prevScene()};_onTouchStart=(e)=>{if(this._destroyed)return;this._isDragging=!0;let t=e.touches[0];if(this._config.scrollDirection==="horizontal")this._lastTouchX=t.clientX;else this._lastTouchY=t.clientY};_onTouchMove=(e)=>{if(this._destroyed)return;if(!this._isDragging)return;let t=e.touches[0],n=this._config.scrollDirection==="horizontal",i=n?this._lastTouchX-t.clientX:this._lastTouchY-t.clientY;if(n)this._lastTouchX=t.clientX;else this._lastTouchY=t.clientY;let r=this._config.scrollSensitivity??1,o=i/300*r,s=Math.max(0,Math.min(1,this._progress+o));this.setProgress(s)};_onTouchEnd=()=>{if(this._destroyed)return;this._isDragging=!1};_applyPauseState(e){let t=this._getSceneSvg();if(!t)return;if(e)t.classList.add("iso-motion-paused");else t.classList.remove("iso-motion-paused");let n=e?"paused":"running",i=t.querySelectorAll('[class*="iso-ambient-"]');for(let r=0;r<i.length;r++){let o=i[r];o.style.animationPlayState=n}}_assertNotDestroyed(){if(!this._destroyed)return;throw new f("CONTROLLER_DESTROYED","AnimationController has been destroyed")}}function bt(e,t){return!t&&(e.from==="removed"||e.from==="exiting")&&(e.to==="entering"||e.to==="present")}function St(e,t){return!t&&(e.to==="exiting"||e.to==="removed"&&e.from!=="exiting")}function _t(e,t){return t&&(e.to==="removed"||e.to==="exiting")&&(e.from==="entering"||e.from==="present")}function Et(e,t){return t&&(e.from==="exiting"||e.from==="removed")&&(e.to==="present"||e.to==="entering")}function xt(e){switch(e){case"fade-in":return"fade-out";case"fade-in-grow":return"fade-out-shrink";case"fall-in":return"rise-away";case"rise-from-ground":return"fall-through-ground";case"slide-in-left":return"slide-out-left";case"slide-in-right":return"slide-out-right";case"flip-in":return"flip-out";case"none":return"none"}}function Ct(e){switch(e){case"fade-out":return"fade-in";case"fade-out-shrink":return"fade-in-grow";case"fall-through-ground":return"rise-from-ground";case"rise-away":return"fall-in";case"slide-out-left":return"slide-in-left";case"slide-out-right":return"slide-in-right";case"flip-out":return"flip-in";case"none":return"none"}}function Rn(e,t){let n=0,i=e.length-1;for(let r=0;r<e.length;r++){if(e[r].progress<=t)n=r;if(e[r].progress>=t){i=r;break}}return{previous:{scene:e[n],index:n},next:{scene:e[i],index:i}}}function re(e,t){return{minX:C(e.minX-t),minY:C(e.minY-t),width:C(Math.max(1,e.width+t*2)),height:C(Math.max(1,e.height+t*2))}}function At(e,t,n){return{minX:C(e.minX+(t.minX-e.minX)*n),minY:C(e.minY+(t.minY-e.minY)*n),width:C(e.width+(t.width-e.width)*n),height:C(e.height+(t.height-e.height)*n)}}function Tn(e,t){return e.minX===t.minX&&e.minY===t.minY&&e.width===t.width&&e.height===t.height}function Mn(e){let t=e.getAttribute("viewBox");if(!t)return;let n=t.trim().split(/\s+/).map(Number);if(n.length!==4||n.some((i)=>!Number.isFinite(i)))return;return{minX:n[0],minY:n[1],width:n[2],height:n[3]}}function wt(e){return Ee(e==="ease-in-out"?"easeInOutCubic":e==="ease-out"?"easeOutCubic":"linear")}function Vn(e){return{viewBox:{...e.viewBox},target:e.target?.type==="area"?{type:"area",at:[...e.target.at],size:[...e.target.size]}:e.target?{...e.target}:void 0,isZoomed:e.isZoomed}}function C(e){return Math.round(e*1000)/1000}function Rt(e){let t=kn(e),n=t.length*8;t.push(128);while(t.length%64!==56)t.push(0);for(let s=7;s>=0;s--)t.push(Math.floor(n/2**(s*8))&255);let i=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],r=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],o=Array(64);for(let s=0;s<t.length;s+=64){for(let m=0;m<16;m++){let A=s+m*4;o[m]=(t[A]<<24|t[A+1]<<16|t[A+2]<<8|t[A+3])>>>0}for(let m=16;m<64;m++){let A=R(o[m-15],7)^R(o[m-15],18)^o[m-15]>>>3,X=R(o[m-2],17)^R(o[m-2],19)^o[m-2]>>>10;o[m]=o[m-16]+A+o[m-7]+X>>>0}let[a,l,c,u,h,S,_,y]=i;for(let m=0;m<64;m++){let A=R(h,6)^R(h,11)^R(h,25),X=h&S^~h&_,p=y+A+X+r[m]+o[m]>>>0,N=R(a,2)^R(a,13)^R(a,22),E=a&l^a&c^l&c,w=N+E>>>0;y=_,_=S,S=h,h=u+p>>>0,u=c,c=l,l=a,a=p+w>>>0}i[0]=i[0]+a>>>0,i[1]=i[1]+l>>>0,i[2]=i[2]+c>>>0,i[3]=i[3]+u>>>0,i[4]=i[4]+h>>>0,i[5]=i[5]+S>>>0,i[6]=i[6]+_>>>0,i[7]=i[7]+y>>>0}return i.map((s)=>s.toString(16).padStart(8,"0")).join("")}function kn(e){return Array.from(new TextEncoder().encode(e))}function R(e,t){return e>>>t|e<<32-t}var Gn="iso-interactive",Ln="iso-hover";class Ce{svg;listeners=new Map;destroyed=!1;attached=!1;onClick=(e)=>this.handleClick(e);onPointerOver=(e)=>this.handlePointerOver(e);onPointerOut=(e)=>this.handlePointerOut(e);constructor(e,t){if(this.svg=e,t)e.classList.add(Gn),e.addEventListener("click",this.onClick),e.addEventListener("pointerover",this.onPointerOver),e.addEventListener("pointerout",this.onPointerOut),this.attached=!0}on(e,t){if(this.destroyed)throw new d("MOUNT_DESTROYED","Cannot call on() after destroy()");let n=this.listeners.get(e)??new Set;return n.add(t),this.listeners.set(e,n),()=>{n.delete(t)}}destroy(){if(this.destroyed)return;if(this.destroyed=!0,this.attached)this.svg.removeEventListener("click",this.onClick),this.svg.removeEventListener("pointerover",this.onPointerOver),this.svg.removeEventListener("pointerout",this.onPointerOut),this.attached=!1;this.listeners.clear()}handleClick(e){let t=this.resolveVisibleElementId(e.target);if(!t)return;this.emit("element-click",{id:t,originalEvent:e})}handlePointerOver(e){let t=this.resolveVisibleElementId(e.target);if(!t)return;let n=this.resolveVisibleElementId(e.relatedTarget);if(t===n)return;this.toggleHoverClass(t,!0),this.emit("element-enter",{id:t,originalEvent:e})}handlePointerOut(e){let t=this.resolveVisibleElementId(e.target);if(!t)return;let n=this.resolveVisibleElementId(e.relatedTarget);if(t===n)return;this.toggleHoverClass(t,!1),this.emit("element-leave",{id:t,originalEvent:e})}toggleHoverClass(e,t){let n=B(this.svg,e);if(!n)return;n.node.classList.toggle(Ln,t)}resolveVisibleElementId(e){let t=e;while(t&&t!==this.svg){let n=t.getAttribute?.("data-id");if(n){let i=B(this.svg,n);if(i&&i.current.presence!=="removed")return n;return}t=t.parentNode}return}emit(e,t){let n=this.listeners.get(e);if(!n)return;for(let i of n)try{i(t)}catch(r){queueMicrotask(()=>{throw r})}}}var Tt="isostate-runtime-bundle",Ae="0.6.1",Bn=/^[a-f0-9]{64}$/;function In(e,t,n={}){Pn(e),Fn(t);let i=new F;i.init(t);let r=nt(e,t,{label:n.label,themeVars:n.themeVars}),o;if(n.controller!==void 0&&n.controller!==!1)o=new xe,o.init(t,{...n.controller,container:n.controller.container??e,sceneElement:r},{engine:i,sceneElement:r});let s=new Ce(r,n.interactive===!0),a=!1;return{svg:r,engine:i,controller:o,getResolvedConfig:()=>Dn(t,n,o),on:(l,c)=>s.on(l,c),destroy:()=>{if(a)return;if(a=!0,s.destroy(),Nn(o),i.destroy(),r.parentNode===e)e.removeChild(r);else r.parentNode?.removeChild(r)}}}function Nn(e){if(!e)return;try{e.destroy()}catch(t){if(t instanceof f&&t.code==="CONTROLLER_DESTROYED")return;throw t}}function Pn(e){if(!e||typeof e.appendChild!=="function"||typeof e.removeChild!=="function")throw new d("INVALID_MOUNT_TARGET","mountScene() requires a DOM HTMLElement target")}function Fn(e){if(!e||typeof e!=="object")throw new d("BUNDLE_FORMAT_MISSING","Runtime bundle must be a plain object");if(e._format!==Tt)throw new d("BUNDLE_FORMAT_MISSING","Runtime bundle format is missing or unsupported",{expected:Tt});if(!Array.isArray(e.scenes)||e.scenes.length===0)throw new d("BUNDLE_FORMAT_MISSING","Runtime bundle must include compiled scenes[]");if(Mt(e._version)!==Mt(Ae))throw new d("BUNDLE_VERSION_MISMATCH",`Runtime bundle version ${e._version} is not compatible with runtime ${Ae}`,{bundleVersion:e._version,runtimeVersion:Ae});if(!e._digest)throw new d("BUNDLE_DIGEST_MISSING","Runtime bundle digest is missing");if(typeof e._digest!=="string"||!Bn.test(e._digest))throw new d("BUNDLE_DIGEST_MISMATCH","Runtime bundle digest is malformed");let{_digest:t,...n}=e,i=Rt(zn(n));if(i!==t)throw new d("BUNDLE_DIGEST_MISMATCH","Runtime bundle digest does not match bundle content",{expected:t,actual:i})}function Dn(e,t={},n){return{grid:{cellSize:e.grid.cellSize},floor:{...e.floor,size:[...e.floor.size],origin:[...e.floor.origin]},layout:{...e.layout,padding:{...e.layout.padding},align:[...e.layout.align]},viewBox:L(e),camera:On(e,n),theme:e.theme,themeVars:Xn(e,t.themeVars),scenes:e.scenes.map((i)=>({id:i.id,progress:i.progress})),layerOrder:e.layers.map((i)=>({name:i.name,order:i.order})).sort((i,r)=>i.order-r.order||Yn(i.name,r.name))}}function On(e,t){if(t)try{return t.getCameraState()}catch(n){if(!(n instanceof f))throw n}return{viewBox:L(e),isZoomed:!1}}function Yn(e,t){return e<t?-1:e>t?1:0}function Xn(e,t={}){return{...J(e.theme)??{},...e.themeVars??{},...t}}function Mt(e){let t=Number.parseInt(String(e).split(".")[0]??"",10);return Number.isFinite(t)?t:Number.NaN}function zn(e){return JSON.stringify(we(e))}function we(e){if(Array.isArray(e))return e.map((n)=>n===void 0?null:we(n));if(!$n(e))return e;let t={};for(let n of Object.keys(e).sort()){let i=e[n];if(i!==void 0)t[n]=we(i)}return t}function $n(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Li(e,t,n,i,r,o,s){return M(e,t,n,i,r,o,s)}export{In as mountScene,Li as projectToScreen};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
6
|
+
//# debugId=62F8965A168E73D264756E2164756E21
|