@splinetool/viewer 2.0.12 → 2.0.13
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.
|
@@ -4159,14 +4159,14 @@ void main() {
|
|
|
4159
4159
|
}
|
|
4160
4160
|
post({ kind: 'ready' });
|
|
4161
4161
|
}, 250);
|
|
4162
|
-
})();`}),xN=k(()=>{uC=class{constructor(t,e,i){this.deps=t,this.onConsole=e,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let i=this.deps;switch(t){case"setVariable":{let n=i.setVariable(String(e[0]),e[1]);return n.warning&&this.onConsole("warn",n.warning),n.ok}case"setVariables":{let n=e[0]??{},r=!0;for(let[a,s]of Object.entries(n)){let o=i.setVariable(a,s);o.warning&&this.onConsole("warn",o.warning),r=r&&o.ok}return r}case"getVariable":return i.getVariable(String(e[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(e[0]));case"getGeometry":{let n=i.getGeometry(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.data}case"updateObject":return i.updateObject(String(e[0]),e[1]??{});case"createObject":return i.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":if(i.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.createCustomMaterial(e[0]);case"setMaterial":if(i.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.setMaterial(String(e[0]),e[1]);case"cloneObject":return i.cloneObject(String(e[0]),e[1]??{});case"removeObject":return i.removeObject(String(e[0]));case"spawnObject":{let n=i.spawnObject(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.object}case"destroyObject":return i.destroyObject(String(e[0]));case"setInstanceTransforms":{let n=e[1]===null||e[1]===void 0?null:e[1],r=i.setInstanceTransforms(String(e[0]),n);return r<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),r}case"emitEvent":case"emitEventReverse":{let n=i.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return n.warning&&this.onConsole("warn",n.warning),n.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let n=String(e[0]);return n==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(n)||this.eventUnsubs.set(n,i.addSplineEventListener(n,r=>{this.onEvent(n,r)})),!0}case"unlistenEvent":{let n=String(e[0]);return n==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(n)?.(),this.eventUnsubs.delete(n)),!0}default:throw new Error(`Unknown spline bridge method: ${t}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=function(i,n){let r=[];for(let a of Object.keys(n))i[a]!==n[a]&&r.push({name:a,value:n[a]});return r}(this.lastVariables??{},t);this.lastVariables=t;for(let i of e)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function _X(t,e,i,n){return[t[0]*e+t[4]*i+t[8]*n+t[12],t[1]*e+t[5]*i+t[9]*n+t[13],t[2]*e+t[6]*i+t[10]*n+t[14]]}var bX=k(()=>{}),wN,xX=k(()=>{}),wX=k(()=>{pC(),xN(),wN=class{constructor(t,e,i){this.iframe=t,this.deps=e,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=n=>{if(this.disposed||n.source!==this.iframe.contentWindow)return;let r=n.data;var a;typeof(a=r)!="object"||a===null||a[Vl]!==!0||typeof a.kind!="string"||this.handleMessage(r)},this.host=new uC(e,i,(n,r)=>{this.sendEvent(n,r)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Vl]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[Vl]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(i){e=Promise.reject(i)}e.then(i=>{this.send({[Vl]:!0,kind:"result",id:t.id,ok:!0,value:i,error:void 0})},i=>{let n=i instanceof Error?i.message:String(i);this.send({[Vl]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:n}),this.onConsole("error",n)});break}case"input":this.dispatchInput(t.event)}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[Vl]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let i=this.iframe.getBoundingClientRect(),n={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":e.dispatchEvent(new PointerEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break;case"click":case"dblclick":e.dispatchEvent(new MouseEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons}));break;case"wheel":{let r=new WheelEvent("wheel",{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(r,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(r,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(r);break}case"keydown":case"keyup":e.dispatchEvent(new KeyboardEvent(t.type,{...n,key:t.key,code:t.code,repeat:t.repeat}))}}}}),ti=k(()=>{dC(),rX(),aX(),sX(),lX(),hX(),cX(),dX(),uX(),pX(),fX(),vX(),pC(),yX(),xN(),bX(),xX(),wX()}),SX=k(()=>{});function SN(t){return Array.isArray(t)?t:[t]}function u_(t,e){let i=0;for(;i<t.length&&i<e.length;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i+=1}return i!==e.length?-1:i!==t.length?1:0}var MX=k(()=>{});function ea(t,e){return Object.setPrototypeOf(t,e),t}function Hw(t){let e={...t};return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}function Kl(t,e,i){if(t===void 0?e===void 0?(t=0,e=10):t=e-10:e===void 0&&(e=t+10),t>e){let a=t;t=e,e=a}let n=[],r=1/(i+1);for(let a=0;a<i;a++){let s=t+(e-t)*(a+.75+.5*Math.random())*r;n.push(s)}return n}function fC(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array}var EX=k(()=>{});function mC(t){if(t.deepFreeze!==void 0)return void t.deepFreeze(t);let e=Object.getOwnPropertyNames(t);for(let i of e){let n=t[i];n&&typeof n=="object"&&mC(n)}return Object.freeze(t)}function MN(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var Ww,p_,EE,$t,gC,AX=k(()=>{}),sr=k(()=>{SX(),MX(),EX(),AX()}),vC=k(()=>{Ww=class{},p_=class extends Ww{constructor(t){super(),this.id=t}},EE=class extends Ww{constructor(t){super(),this.data=t}}}),TX=k(()=>{}),zb=k(()=>{$t=class{modifyById(t,e){let i=this;if(i[t]===void 0)throw new Error("not expected");{let n={...i,[t]:e};return Object.setPrototypeOf(n,$t.prototype),n}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let i,n=e[t.id];i=n===void 0?{type:2,id:t.id}:{type:1,id:t.id,data:n};let{id:r,data:a}=t,s={...e,[r]:a};return Object.setPrototypeOf(s,$t.prototype),{data:s,actual:t,reverse:i}}if(t.type===2){let{id:i}=t,n=e[i];if(n===void 0)return null;{let r={...e};return Object.setPrototypeOf(r,$t.prototype),delete r[i],{data:r,actual:t,reverse:{type:1,id:i,data:n}}}}return null}}}),yC=k(()=>{gC=class extends Error{}});function EN(t,e){for(let i of t)e(i.id,i.data)!==!0&&EN(i.children,e)}function AN(t,e){if(e(t.id,t.data)!==!0)for(let i of t.children)AN(i,e)}var Xn,ev,dp,Vt,Zc=k(()=>{sr(),yC(),sr(),Xn=class extends Array{constructor(...t){super(...t),Js(this,"partialObjectCaches"),Js(this,"objCaches"),Js(this,"parentCaches"),Object.setPrototypeOf(this,Xn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)mC(this[t]),t++}fillCaches0(t,e){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,e);for(let i of t.children)this.fillCaches0(i,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}nonExistOrDescendantOf(t,e){if(!this.has(t))return!0;for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}rootAcestor(t){for(;t;){let e=this.parent(t);if(!e)return t;t=e}return t}isDescendantOf(t,e){for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}data(t){return this.get(t)?.data}has(t){return this.childrenOf(t)!==void 0}partialCache(t){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let e=this.get(t);e!==void 0&&this.partialObjectCaches.set(t,e)}get(t){if(this.partialObjectCaches!==void 0){let e=this.partialObjectCaches.get(t);if(e!==void 0)return e}return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){return t===null?this:this.get(t)?.children}traverseFrom(t,e){if(t===null)this.traverse(e);else{let i=this.get(t);i&&AN(i,e)}}traverse(t){EN(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this.parent(t),n=this.childrenArray(i),r=n.findIndex(o=>o.id===t);if(r<0)throw new Error("not expected");let a=n[r];n=[...n],n[r]={...a,data:e};let s=new Map;return s.set(t,n[r]),this.modifyArrayBy(i,n,s)}}modifyArrayBy(t,e,i=void 0){let n=t,r=e;for(;n!==null;){let s=r,o=n;if(n=this.parent(n),n===void 0)throw new Error;r=this.childrenArray(n);let l=r.findIndex(c=>c.id===o);if(l<0)throw new Error;r=[...r],r[l]={...r[l],children:s},i&&i.set(o,r[l])}Object.setPrototypeOf(r,Xn.prototype);let a=r;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){a.objCaches=this.objCaches;for(let[s,o]of i)a.objCaches.set(s,o);a.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else a.fillCaches();return a}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}return null}checkDuplicatedIdRec({id:t,children:e}){if(this.get(t)!==void 0)return!0;for(let i of e)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(t){let{parent:e,fi:i,id:n,data:r,children:a}=t;if(e!==null&&this.get(e)===void 0||this.checkDuplicatedIdRec(t))return null;{let s=e,o=this.childrenArray(s),l={fi:i,id:n,data:r,children:a};return o=[...o,l],o.sort((c,h)=>c.fi-h.fi),t.localIndex=o.indexOf(l),{data:this.modifyArrayBy(s,o),actual:t,reverse:{type:8,id:n}}}}deleteOp(t){let{id:e}=t;if(this.get(e)===null)return null;{let i=this.parent(e);if(i===void 0)return null;let n=this.childrenArray(i),r=n.findIndex(s=>s.id===e);t.localIndex=r,n=[...n];let a=n.splice(r,1)[0];return{data:this.modifyArrayBy(i,n),actual:t,reverse:{type:7,...a,parent:i}}}}moveOp(t){let{parent:e,fi:i,id:n}=t;if(e!==null&&this.get(e)===void 0)return this.deleteOp({type:8,id:n});if(e!==null){let d=e;for(;d!==null;){if(d===void 0)throw new Error;if(d===n)throw new gC("cyclic tree");d=this.parent(d)}}let r=this.parent(n);if(r===void 0)return null;let a=r,s=this.childrenArray(r),o=s.findIndex(d=>d.id===n);s=[...s];let l=s.splice(o,1)[0],c=this.modifyArrayBy(r,s);r=e,s=c.childrenArray(r);let h=l.fi;return l={...l,fi:i},s=[...s,l],s.sort((d,u)=>d.fi-u.fi),t.localIndex=s.indexOf(l),c=c.modifyArrayBy(r,s),{data:c,actual:t,reverse:{type:9,parent:a,fi:h,id:n}}}previous(t,e){if(e===null){let n=this.childrenArray(t);return n.length===0?null:n[n.length-1].id}let i=null;for(let n of this.childrenArray(t)){if(n.id===e)return i;i=n.id}return null}traverseSortNext(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)+1;if(n<i.length)return i[n].id;if(e)return this.traverseSortNext(e)}}sortNext(t){let e=this.childrenArray(t);return e.length>0?e[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let e=this.childrenArray(t);return e.length>0?this.traverseSortPrevious(e[e.length-1].id):t}sortPrevious(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)-1;return n>=0?this.traverseSortPrevious(i[n].id):e}}getAllSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i.id);n!==void 0&&e.push({...i,...n})}e.sort((i,n)=>u_(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e}getAllIdSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i);n!==void 0&&e.push(n)}e.sort((i,n)=>u_(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e.map(i=>i.id)}getWithSortKey(t){let e=t,i=[],n=this.get(e),r=n;if(n!==void 0){for(;e;)i.splice(0,0,n.fi),e=this.parent(e),e!==null&&(n=this.get(e));return{...r,sortKey:i}}}insertBeforeHelper(t,e,i){return this.insertAfterHelper(t,this.previous(t,e),i)}insertAfterHelper(t,e,i){let n=this.childrenArray(t);if(e===null){if(n.length===0)return Kl(0,i,i);{let r=n[0].fi;return Kl(r-i,r,i)}}{let r=this.get(e);if(r===void 0||this.parent(e)!==t)throw new Error("illegal args");let a=n.find(s=>s.fi>r.fi);if(a===void 0){let s=n[n.length-1].fi;return Kl(s,s+i,i)}return Kl(r.fi,a.fi,i)}}}}),_C=k(()=>{var t;ev=null,(t=dp||(dp={})).setPreservePrototype=function(e){ev=e},t.tryPreservePrototype=function(e,i){return Object.getPrototypeOf(e)===ev&&Object.setPrototypeOf(i,ev),i},t.runOp=function(e,i){if(i.type!==0)return null;if(Array.isArray(e)){let n=i.props,r={},a=[...e],s=!1;if(n)for(let o of Object.keys(n)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");r[o]=a[l],a[l]=n[o],s=!0}return s?{data:a,actual:i,reverse:{type:0,props:r}}:null}{let n=i.props,r={},a={...e},s=!1;if(n)for(let o of Object.keys(n)){r[o]=a[o];let l=n[o];l===void 0?delete a[o]:a[o]=l,s=!0}return s?{data:t.tryPreservePrototype(e,a),actual:i,reverse:{type:0,props:r}}:null}}}),Kc=k(()=>{sr(),sr(),Vt=class extends Array{constructor(...t){super(...t),Js(this,"objCaches"),Object.setPrototypeOf(this,Vt.prototype)}deepFreeze(){let t=0;for(;t<this.length;)mC(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){return this.get(t)?.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this,n=i.findIndex(a=>a.id===t);if(n<0)throw new Error("not expected");let r=i[n];return i=[...i],i[n]={...r,data:e},this.modifyArrayBy(i)}}modifyArrayBy(t){Object.setPrototypeOf(t,Vt.prototype);let e=t;return typeof process<"u"||e.fillCaches(),e}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}return null}addOp(t){let{fi:e,id:i,data:n}=t,r=this,a={fi:e,id:i,data:n};return r=[...r,a],r.sort((s,o)=>s.fi-o.fi),t.localIndex=r.indexOf(a),{data:this.modifyArrayBy(r),actual:t,reverse:{type:5,id:i}}}deleteOp(t){let{id:e}=t,i=this,n=i.findIndex(a=>a.id===e);if(n===-1)return null;t.localIndex=n,i=[...i];let r=i.splice(n,1)[0];return{data:this.modifyArrayBy(i),actual:t,reverse:{type:4,...r}}}moveOp(t){let{fi:e,id:i}=t,n=this;n=[...n];let r=n.findIndex(o=>o.id===i);if(r===-1)return null;let a=n[r].fi,s={...n[r],fi:e};return n[r]=s,n.sort((o,l)=>o.fi-l.fi),t.localIndex=n.indexOf(s),{data:this.modifyArrayBy(n),actual:t,reverse:{type:6,fi:a,id:i}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let e=null;for(let i of this){if(i.id===t)return e;e=i.id}return null}insertBeforeHelper(t,e){return this.insertAfterHelper(this.previous(t),e)}insertAfterHelper(t,e){let i=this;if(t===null){if(i.length===0)return Kl(0,e,e);{let n=i[0].fi;return Kl(n-e,n,e)}}{let n=this.get(t);if(n===void 0)throw new Error("illegal args");let r=i.find(a=>a.fi>n.fi);if(r===void 0){let a=i[i.length-1].fi;return Kl(a,a+e,e)}return Kl(n.fi,r.fi,e)}}}});function CX(t,e){let i={cur:[],result:[],len:0};return[t=Hu(t,e,i)??t,i.result]}function Jy(t,e){return t===null?null:(t.cur[t.len]=e,t.len+=1,t)}function t1(t){t&&(t.len-=1)}function TN(t,e,i){let n=!1,r=t.map(a=>{let s=a.id,o=e[s];if(o!==void 0&&typeof o=="string"&&(n=!0,s=o,i!==null))throw new Error("not supported");let l=Hu(a.data,e,Jy(i,s));t1(i),n=n||l!==void 0,l===void 0&&(l=a.data);let c=TN(a.children,e,i);return c!==void 0?n=!0:c=a.children,{...a,id:s,data:l,children:c}});if(n)return r}function Hu(t,e,i){if(t instanceof Xn){let n=TN(t,e,i);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}if(t instanceof Vt)return function(n,r,a){let s=!1,o=n.map(l=>{let c=l.id,h=r[c];if(h!==void 0&&typeof h=="string"&&(s=!0,c=h,a!==null))throw new Error("not supported");let d=Hu(l.data,r,Jy(a,c));return t1(a),s=s||d!==void 0,d===void 0&&(d=l.data),{...l,id:c,data:d}});if(s)return Object.setPrototypeOf(o,Object.getPrototypeOf(n)),o}(t,e,i);if(Array.isArray(t)){let n=!1,r=t.map((a,s)=>{let o=Hu(a,e,Jy(i,s));return t1(i),n=n||o!==void 0,o===void 0&&(o=a),o});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}if(t&&typeof t=="object"&&!fC(t)){let n={},r=!1;for(let[a,s]of Object.entries(t))if(a!=="name"&&a!=="variableId"){let o=e[a];if(typeof o=="string"){if(i!==null)throw new Error("not supported");r=!0,a=o}let l=Hu(s,e,Jy(i,a));t1(i),r=r||l!==void 0,l===void 0&&(l=s),n[a]=l}else n[a]=s;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(typeof t=="string"){let n=e[t];return n!==void 0&&function(r){if(r===null)return null;r.result.push(r.cur.slice(0,r.len))}(i),n}}var CN=k(()=>{Zc(),Kc(),sr()});function Wu(t){return t&&typeof t=="object"&&t instanceof gn}function bC(t,e){if(e===void 0)return;let i=!1,n=t.map(r=>{let a=r.id,s=eg(r.data,e[a]);if(i=i||s!==void 0,s===void 0&&(s=r.data),r.children){let o=bC(r.children,e);return o!==void 0?i=!0:o=r.children,{...r,id:a,data:s,children:o}}return{...r,id:a,data:s}});return i?n:void 0}function eg(t,e){if(!Wu(e))return e;if(t instanceof Xn){let i=bC(t,e);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}if(t instanceof Vt)return function(i,n){if(n===void 0)return;let r=!1,a=i.map(s=>{let o=s.id,l=eg(s.data,n[o]);return r=r||l!==void 0,l===void 0&&(l=s.data),{...s,id:o,data:l}});return r?(Object.setPrototypeOf(a,Object.getPrototypeOf(i)),a):void 0}(t,e);if(Array.isArray(t)){let i=!1,n=t.map((r,a)=>{let s=eg(r,e[a]);return i=i||s!==void 0,s===void 0&&(s=r),s});return i?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(t instanceof gn)return xC(t,e);if(t&&typeof t=="object"){let i={},n=!1;for(let[r,a]of Object.entries(t)){let s=eg(a,e[r]);n=n||s!==void 0,s===void 0&&(s=a),i[r]=s}return n?(Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i):void 0}}function xC(t,e){if(t===void 0)return e;if(e===void 0)return t;if(!Wu(e))return e;if(!Wu(t))return hh.apply(t,e);let i=new Set;for(let r of Object.keys(t))i.add(r);for(let r of Object.keys(e))i.add(r);let n=new gn;for(let r of i){let a=xC(t===void 0?void 0:t[r],e===void 0?void 0:e[r]);n[r]=a}return n}var gn,hh,f_,tr,XR,wC=k(()=>{var t;Zc(),Kc(),kb(),sr(),gn=class{unusedFunOverridesTable(e){}runOp(e){let i=[],n=this,r=0,a={};for(;r<e.path.length;){if(i.push(n),n=n===void 0?void 0:n[e.path[r]],n!==void 0&&!Wu(n))return null;r+=1}n=n?Hw(n):new gn;for(let[s,o]of Object.entries(e.props)){let l=n[s];a[s]=l,o===void 0?delete n[s]:n[s]=o}for(;r>0;){if(Object.keys(n).length===0){let s=i[r-1];s&&(n=Hw(s),delete n[e.path[r-1]])}else{let s=i[r-1];if(s){let o=Hw(s);o[e.path[r-1]]=n,n=o}else{let o=new gn;o[e.path[r-1]]=n,n=o}}r-=1}return{data:Object.setPrototypeOf(n,gn.prototype),actual:e,reverse:{...e,props:a}}}},(t=hh||(hh={})).apply=function(e,i){return eg(e,i)??e},t.merge=function(e,i){return xC(e,i)},t.filterOp=function(e,i){let n=0,r=i.path,a=e;for(;n<r.length&&a!==void 0;){if(a=jn.zoomOnce(a,r[n]),a===void 0)return i;if(!Wu(a))return;n+=1}if(a===void 0)return i;if(Wu(a)){if(i.type===0){let s={...i.props};for(let o of Object.keys(a))delete s[o];return{...i,props:s}}if(i.type===1||i.type===4||i.type===7){let s=bC([i],a);return s?s[0]:i}return i}}}),PX=k(()=>{kb(),zb(),Zc(),yC(),_C(),Kc(),CN(),wC(),(f_||(f_={})).replaceProps=function(t,e){let i=jn.zoom(e,t.path);if(typeof i=="object"){let n={};for(let r of Object.keys(t.props))n[r]=i[r];return{...t,props:n}}return{...t,props:{}}},(t=>{function e(r,a){let s=a.path,o=[];for(;;){let l;if(r instanceof gn&&a.type===0&&(l=r.runOp({...a,path:s.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===s.length&&(l=r instanceof Xn||r instanceof Vt||r instanceof $t?r.runOp(a):dp.runOp(r,a)),l!==void 0){if(l!==null){let d=l.data;for(let u=o.length-1;u>=0;u--){let p=s[u],f=o[u];if(f instanceof Xn){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Vt){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof $t){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof gn){let g={...f,[p]:d};d=Object.setPrototypeOf(g,gn.prototype)}else{if(typeof f!="object")return null;if(Array.isArray(f)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let g=d;d=[...f],d[p]=g}else d=dp.tryPreservePrototype(f,{...f,[p]:d})}}return{data:d,actual:{...l.actual,path:s},reverse:{...l.reverse,path:s}}}return null}let c,h=s[o.length];if(r instanceof Xn){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else if(r instanceof Vt){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else r!==null&&(c=r[h]);if(c===void 0)return null;o.push(r),r=c}}function i(r,a){for(let s=0;s<r.length&&s<a.length;s++)if(r[s]!==a[s])return!0;return!1}function n(r,a){if(r.length!==a.length)return!1;for(let s=0;s<r.length;s++)if(r[s]!==a[s])return!1;return!0}t.drop=function(r,a){return{...r,path:r.path.slice(a)}},t.applySimple=function(r,a){return e(r,a)?.data??r},t.apply=e,t.pathDisjoint=i,t.pathEq=n,t.commutative=function(r,a){return i(r.path,a.path)},t.subsumed=function(r,a){return!(r.type!==0||a.type!==0||!n(r.path,a.path))&&Object.keys(r.props).every(s=>a.props[s]!==void 0)}})(tr||(tr={})),(t=>{function e(i,n){let r=i,a=[],s=[];for(let o of n)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,c,h;if(o.type===3?(l=jn.zoom(r,[...o.path,o.id]),h=tr.apply(r,{...o,type:2})):(l=jn.zoom(r,[...o.path,o.id,"value"]),h=tr.apply(r,o)),h!==null){r=h.data;let[d,u]=CX(r,{[o.id]:l});r=d;for(let p=0;p<u.length;p++){let f=u[p],g=f.pop();if(typeof g=="number"){let m=[g];for(let v=p+1;v<u.length;v++){let _=u[v],b=_[_.length-1];if(typeof b!="number"||!jn.equal(f,_.slice(0,_.length-1)))break;m.push(b),u.splice(v,1)}let y=jn.zoom(r,f);c=y.map((v,_)=>m.includes(_)?o.id:v),l=y,g=f.pop()}else{if(g==="alphaOverride"||g==="alpha"){l/=100;let m=l,y=jn.zoom(r,f.slice(0,f.length-2)),v=y.layers.map(_=>_.id===f[f.length-1]?{..._,data:{..._.data,[g]:m}}:_);Object.setPrototypeOf(v,Object.getPrototypeOf(y.layers)),y.layers=v}c=o.id}a.push({type:0,path:f,props:{[g]:l}}),s.push({type:0,path:f,props:{[g]:c}})}s.push(h.reverse),a.push(h.actual)}}else{let l=tr.apply(r,o);l!==null&&(a.push(l.actual),r=l.data,s.push(l.reverse))}}catch(l){if(l instanceof gC)return null;throw l}return{data:r,actual:a,reverse:s.reverse()}}t.empty=function(){return[]},t.removePrefix=function(i,n){let r=[];for(let a of i){let[s,...o]=a.path;s===n&&r.push({...a,path:o})}return r},t.addPrefix=function(i,n){return i.map(r=>({...r,path:[n,...r.path]}))},t.concat=function(i,n){return[...i,...n]},t.compress=function(i,n){return[...i.filter(r=>!n.some(a=>tr.subsumed(r,a))),...n]},t.commutative=function(i,n){return i.every(r=>n.every(a=>tr.commutative(r,a)))},t.applyAll=function(i,n){for(let r of n){let a=e(i,r);a!==null&&(i=a.data)}return i},t.apply=e})(XR||(XR={}))});function qw(t,e,i){if(t.length>0){let n=t[t.length-1];if(n.type===0&&e.type===0&&jn.equal(n.path,i))return void Object.assign(n.props,e.props)}t.push({...e,path:i})}function e1(t,e,i){return i instanceof Xn?new Nb(t,e,i):i instanceof Vt?new Fb(t,e,i):i instanceof $t?new Proxy(new DN(t,e,i),ON):i!==null&&typeof i=="object"?fC(i)?i:new Proxy(new PN(t,e,i),RN):i}function Em(t){let e=new TE(t);return[e1(e,"",t),e]}function m_(t,e){let[i,n]=Em(t);return e(i),n.result()}function cn(t){return t instanceof Nb||t instanceof Fb?t._current:t!==null&&typeof t=="object"?t[AE]:t}var AE,$R,Pf,Id,PN,DN,Xw,RN,ON,Nb,Fb,TE,jn,IN=k(()=>{zb(),Zc(),_C(),Kc(),sr(),kb(),AE=Symbol(),$R=Symbol(),Pf=Symbol(),Id=class{reportOp(t,e,i=[]){let n=this;if(e===null)return;n._current=e.data;let r=i;for(;!(n instanceof TE);){let a=n._path,s=n._current;if(a!==""&&r.splice(0,0,a),n=n._parent,n===null)return;n.update(a,s)}n.push(r,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let i=e[Pf];i&&i(),delete this._children[t]}}}},PN=class extends Id{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=dp.tryPreservePrototype(this._current,{...this._current,[t]:e})}runOp(t){this.reportOp(t,dp.runOp(this._current,t),t.path)}},DN=class extends Id{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,$t.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},Xw={get(t,e){if(e===Pf)return()=>{t._parent=null};if(e===AE)return t._current;if(e===$R)return t;let{_current:i,_children:n}=t;if(e==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[e];if(r!==void 0)return r;let a=i[e],s=e1(t,e,a);return s!==a?(n===void 0&&(n={},t._children=n),n[e]=s,s):a},has:(t,e)=>e in t._current,ownKeys:t=>Reflect.ownKeys(t._current),defineProperty(){throw Error("not supported")},getPrototypeOf:t=>Object.getPrototypeOf(t._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(t,e){let i=t._current,n=Reflect.getOwnPropertyDescriptor(i,e);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:i[e]}}},RN={...Xw,set(t,e,i){let n={type:0,props:{[e]:cn(i)??i}};return t.deleteChildren(e),t.runOp(n),!0},deleteProperty(t,e){let i={type:0,props:{[e]:void 0}};return t.deleteChildren(e),t.runOp(i),!0}},ON={...Xw,set(t,e,i){return i===void 0?this.deleteProperty(t,e):(t.deleteChildren(e),t.runOp({type:1,id:e,data:i})),!0},deleteProperty:(t,e)=>(t.runOp({type:2,id:e}),!0)},Nb=class extends Id{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Pf]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,i)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,a=e1(this,t,r);return a!==r?(i===void 0&&(i={},this._children=i),i[t]=a,a):r}add(t,e,i,n,r){this.runOp({type:7,parent:t,fi:e,id:i,data:n,children:r})}move(t,e,i){this.runOp({type:9,parent:t,fi:e,id:i})}insertAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let a=i[r];this.add(t,n[r],a.id,a.data,a.children)}}insertBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let a=i[r];this.add(t,n[r],a.id,a.data,a.children)}}moveAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let a=i[r];this.move(t,n[r],a)}}moveBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let a=i[r];this.move(t,n[r],a)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},Fb=class extends Id{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Pf]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id,r=this._current[i].fi;t(this.data(this._current[i].id),n,r,i)}}find(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id;if(t(this.data(n),n))return this.get(n)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:i}=this._current.at(t);return{id:e,fi:i,data:this.data(e)}}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,a=e1(this,t,r);return a!==r?(i===void 0&&(i={},this._children=i),i[t]=a,a):r}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,i){this.runOp({type:4,fi:t,id:e,data:i})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}insertBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}moveAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}moveBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}},TE=class extends Id{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,i,n){qw(this.ts,e,t),qw(this.actual,i,t),qw(this.reverse,n,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),kb=k(()=>{vC(),IN(),Kc(),Zc(),sr(),(t=>{function e(n,r){return(n instanceof Xn||n instanceof Nb)&&typeof r=="string"||(n instanceof Vt||n instanceof Fb)&&typeof r=="string"?n.data(r):typeof r=="number"&&Array.isArray(n)||typeof r=="string"&&typeof n=="object"&&n!==null?n[r]:void 0}function i(n,r,a=0){for(;a<r.length&&n!==void 0;)n=e(n,r[a]),a+=1;return n}t.equal=function(n,r){if(r.length!==n.length)return!1;{let a=0;for(;a<n.length;){if(n[a]!==r[a])return!1;a+=1}}return!0},t.removeOverridden=function(n,r,a){let s=i(a,n);if(s!==void 0&&typeof s=="object"&&s!==null){let o={...r};return Object.keys(s).forEach(l=>{delete o[l]}),o}return r},t.zoomOnce=e,t.zoom=i,t.findPathes=function(n,r){let a=[];return function s(o,l){if(o instanceof p_&&o.id===r.id)a.push(l);else if(o instanceof Vt)for(let c=0;c<o.length;c++)s(o[c].data,[...l,o[c].id]);else if(o instanceof Xn)o.traverse((c,h)=>{s(c,[...l,h])});else if(Array.isArray(o))for(let c=0;c<o.length;c++)s(o[c],[...l,c]);else{if(fC(o))return;if(typeof o=="object"&&o!==null)for(let c in o)s(o[c],[...l,c])}}(n,[]),a}})(jn||(jn={}))}),DX=k(()=>{});function ri(t,e){let i=[];if(!(e.length<=t.length))return null;{let n=0;for(;n<e.length;){if(e[n]==="*")i.push(t[n]);else if(t[n]!==e[n])return null;n+=1}}return i}var RX=k(()=>{});function iv(t){try{if(!xi.trusted&&!Qo){let i=Qe.sharedLength||0;i<Qe.length&&(Qe.length=i)}let e;if(xi.randomAccessStructure&&kt[gt]<64&&kt[gt]>=32&&tO?(e=tO(kt,gt,Va,xi),kt=null,!(t&&t.lazy)&&e&&(e=e.toJSON()),gt=Va):e=mn(),_r&&(gt=_r.postBundlePosition,_r=null),Qo&&(Qe.restoreStructures=null),gt==Va)Qe&&Qe.restoreStructures&&YR(),Qe=null,kt=null,Ko&&(Ko=null);else{if(gt>Va)throw new Error("Unexpected end of MessagePack data");if(!Qo){let i;try{i=JSON.stringify(e,(n,r)=>typeof r=="bigint"?`${r}n`:r).slice(0,100)}catch(n){i="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return e}catch(e){throw Qe&&Qe.restoreStructures&&YR(),PE(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||gt>Va)&&(e.incomplete=!0),e}}function YR(){for(let t in Qe.restoreStructures)Qe[t]=Qe.restoreStructures[t];Qe.restoreStructures=null}function mn(){let t=kt[gt++];if(t<160){if(t<128){if(t<64)return t;{let e=Qe[63&t]||xi.getStructures&&LN()[63&t];return e?(e.read||(e.read=CE(e,63&t)),e.read()):t}}if(t<144){if(t-=128,xi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=UN();n==="__proto__"&&(n="__proto_"),e[n]=mn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(mn(),mn());return e}}{t-=144;let e=new Array(t);for(let i=0;i<t;i++)e[i]=mn();return xi.freezeData?Object.freeze(e):e}}if(t<192){let e=t-160;if(fs>=gt)return Ql.slice(gt-ga,(gt+=e)-ga);if(fs==0&&Va<140){let i=e<16?SC(e):BN(e);if(i!=null)return i}return y_(e)}{let e;switch(t){case 192:return null;case 193:return _r?(e=mn(),e>0?_r[1].slice(_r.position1,_r.position1+=e):_r[0].slice(_r.position0,_r.position0-=e)):FN;case 194:return!1;case 195:return!0;case 196:if(e=kt[gt++],e===void 0)throw new Error("Unexpected end of buffer");return $w(e);case 197:return e=He.getUint16(gt),gt+=2,$w(e);case 198:return e=He.getUint32(gt),gt+=4,$w(e);case 199:return Qh(kt[gt++]);case 200:return e=He.getUint16(gt),gt+=2,Qh(e);case 201:return e=He.getUint32(gt),gt+=4,Qh(e);case 202:if(e=He.getFloat32(gt),xi.useFloat32>2){let i=BE[(127&kt[gt])<<1|kt[gt+1]>>7];return gt+=4,(i*e+(e>0?.5:-.5)|0)/i}return gt+=4,e;case 203:return e=He.getFloat64(gt),gt+=8,e;case 204:return kt[gt++];case 205:return e=He.getUint16(gt),gt+=2,e;case 206:return e=He.getUint32(gt),gt+=4,e;case 207:return xi.int64AsType==="number"?(e=4294967296*He.getUint32(gt),e+=He.getUint32(gt+4)):xi.int64AsType==="string"?e=He.getBigUint64(gt).toString():xi.int64AsType==="auto"?(e=He.getBigUint64(gt),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigUint64(gt),gt+=8,e;case 208:return He.getInt8(gt++);case 209:return e=He.getInt16(gt),gt+=2,e;case 210:return e=He.getInt32(gt),gt+=4,e;case 211:return xi.int64AsType==="number"?(e=4294967296*He.getInt32(gt),e+=He.getUint32(gt+4)):xi.int64AsType==="string"?e=He.getBigInt64(gt).toString():xi.int64AsType==="auto"?(e=He.getBigInt64(gt),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigInt64(gt),gt+=8,e;case 212:if(e=kt[gt++],e==114)return LE(63&kt[gt++]);{let i=gr[e];if(i)return i.read?(gt++,i.read(mn())):i.noBuffer?(gt++,i()):i(kt.subarray(gt,++gt));throw new Error("Unknown extension "+e)}case 213:return e=kt[gt],e==114?(gt++,LE(63&kt[gt++],kt[gt++])):Qh(2);case 214:return Qh(4);case 215:return Qh(8);case 216:return Qh(16);case 217:return e=kt[gt++],fs>=gt?Ql.slice(gt-ga,(gt+=e)-ga):VN(e);case 218:return e=He.getUint16(gt),fs>=(gt+=2)?Ql.slice(gt-ga,(gt+=e)-ga):jN(e);case 219:return e=He.getUint32(gt),fs>=(gt+=4)?Ql.slice(gt-ga,(gt+=e)-ga):GN(e);case 220:return e=He.getUint16(gt),gt+=2,ZR(e);case 221:return e=He.getUint32(gt),gt+=4,ZR(e);case 222:return e=He.getUint16(gt),gt+=2,KR(e);case 223:return e=He.getUint32(gt),gt+=4,KR(e);default:if(t>=224)return t-256;if(t===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+t)}}}function CE(t,e){function i(){if(i.count++>RE){let r;try{r=t.read=new Function("r","return function(){return "+(xi.freezeData?"Object.freeze":"")+"({"+t.map(a=>a==="__proto__"?"__proto_:r()":kN.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(mn)}catch{return RE=1/0,i()}return t.read0=r,t.highByte===0&&(t.read=OE(e,t.read)),r()}let n={};for(let r=0,a=t.length;r<a;r++){let s=t[r];s==="__proto__"&&(s="__proto_"),n[s]=mn()}return xi.freezeData?Object.freeze(n):n}return i.count=0,t.read0=i,t.highByte===0?OE(e,i):i}function LN(){let t=NN(()=>(kt=null,xi.getStructures()));return Qe=xi._mergeStructures(t,Qe)}function Am(t){let e;if(t<16&&(e=SC(t)))return e;if(t>64&&DE)return DE.decode(kt.subarray(gt,gt+=t));let i=gt+t,n=[];for(e="";gt<i;){let r=kt[gt++];if(128&r)if((224&r)==192){let a=(31&r)<<6|63&kt[gt++];a<128?n.push(65533):n.push(a)}else if((240&r)==224){let a=(31&r)<<12|(63&kt[gt++])<<6|63&kt[gt++];a<2048||a>=55296&&a<=57343?n.push(65533):n.push(a)}else if((248&r)==240){let a=(7&r)<<18|(63&kt[gt++])<<12|(63&kt[gt++])<<6|63&kt[gt++];a<65536||a>1114111?n.push(65533):(a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a))}else n.push(65533);else n.push(r);n.length>=4096&&(e+=kn.apply(String,n),n.length=0)}return n.length>0&&(e+=kn.apply(String,n)),e}function ZR(t){let e=new Array(t);for(let i=0;i<t;i++)e[i]=mn();return xi.freezeData?Object.freeze(e):e}function KR(t){if(xi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=UN();n==="__proto__"&&(n="__proto_"),e[n]=mn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(mn(),mn());return e}}function BN(t){let e=gt,i=new Array(t);for(let n=0;n<t;n++){let r=kt[gt++];if((128&r)>0)return void(gt=e);i[n]=r}return kn.apply(String,i)}function SC(t){if(t<4){if(t<2){if(t===0)return"";{let e=kt[gt++];return(128&e)>1?void(gt-=1):kn(e)}}{let e=kt[gt++],i=kt[gt++];if((128&e)>0||(128&i)>0)return void(gt-=2);if(t<3)return kn(e,i);let n=kt[gt++];return(128&n)>0?void(gt-=3):kn(e,i,n)}}{let e=kt[gt++],i=kt[gt++],n=kt[gt++],r=kt[gt++];if((128&e)>0||(128&i)>0||(128&n)>0||(128&r)>0)return void(gt-=4);if(t<6){if(t===4)return kn(e,i,n,r);{let a=kt[gt++];return(128&a)>0?void(gt-=5):kn(e,i,n,r,a)}}if(t<8){let a=kt[gt++],s=kt[gt++];if((128&a)>0||(128&s)>0)return void(gt-=6);if(t<7)return kn(e,i,n,r,a,s);let o=kt[gt++];return(128&o)>0?void(gt-=7):kn(e,i,n,r,a,s,o)}{let a=kt[gt++],s=kt[gt++],o=kt[gt++],l=kt[gt++];if((128&a)>0||(128&s)>0||(128&o)>0||(128&l)>0)return void(gt-=8);if(t<10){if(t===8)return kn(e,i,n,r,a,s,o,l);{let c=kt[gt++];return(128&c)>0?void(gt-=9):kn(e,i,n,r,a,s,o,l,c)}}if(t<12){let c=kt[gt++],h=kt[gt++];if((128&c)>0||(128&h)>0)return void(gt-=10);if(t<11)return kn(e,i,n,r,a,s,o,l,c,h);let d=kt[gt++];return(128&d)>0?void(gt-=11):kn(e,i,n,r,a,s,o,l,c,h,d)}{let c=kt[gt++],h=kt[gt++],d=kt[gt++],u=kt[gt++];if((128&c)>0||(128&h)>0||(128&d)>0||(128&u)>0)return void(gt-=12);if(t<14){if(t===12)return kn(e,i,n,r,a,s,o,l,c,h,d,u);{let p=kt[gt++];return(128&p)>0?void(gt-=13):kn(e,i,n,r,a,s,o,l,c,h,d,u,p)}}{let p=kt[gt++],f=kt[gt++];if((128&p)>0||(128&f)>0)return void(gt-=14);if(t<15)return kn(e,i,n,r,a,s,o,l,c,h,d,u,p,f);let g=kt[gt++];return(128&g)>0?void(gt-=15):kn(e,i,n,r,a,s,o,l,c,h,d,u,p,f,g)}}}}}function QR(){let t,e=kt[gt++];if(e<192)t=e-160;else switch(e){case 217:t=kt[gt++];break;case 218:t=He.getUint16(gt),gt+=2;break;case 219:t=He.getUint32(gt),gt+=4;break;default:throw new Error("Expected string")}return Am(t)}function $w(t){return xi.copyBuffers?Uint8Array.prototype.slice.call(kt,gt,gt+=t):kt.subarray(gt,gt+=t)}function Qh(t){let e=kt[gt++];if(gr[e]){let i;return gr[e](kt.subarray(gt,i=gt+=t),n=>{gt=n;try{return mn()}finally{gt=i}})}throw new Error("Unknown extension type "+e)}function UN(){let t=kt[gt++];if(!(t>=160&&t<192))return gt--,zN(mn());if(t-=160,fs>=gt)return Ql.slice(gt-ga,(gt+=t)-ga);if(!(fs==0&&Va<180))return y_(t);let e,i=4095&(t<<5^(t>1?He.getUint16(gt):t>0?kt[gt]:0)),n=IE[i],r=gt,a=gt+t-3,s=0;if(n&&n.bytes==t){for(;r<a;){if(e=He.getUint32(r),e!=n[s++]){r=1879048192;break}r+=4}for(a+=3;r<a;)if(e=kt[r++],e!=n[s++]){r=1879048192;break}if(r===a)return gt=r,n.string;a-=3,r=gt}for(n=[],IE[i]=n,n.bytes=t;r<a;)e=He.getUint32(r),n.push(e),r+=4;for(a+=3;r<a;)e=kt[r++],n.push(e);let o=t<16?SC(t):BN(t);return n.string=o??y_(t)}function zN(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return t.toString();if(t==null)return t+"";if(xi.allowArraysInMapKeys&&Array.isArray(t)&&t.flat().every(e=>["string","number","boolean","bigint"].includes(typeof e)))return t.flat().toString();throw new Error("Invalid property type for record: "+typeof t)}function NN(t){eO&&eO();let e=Va,i=gt,n=v_,r=ga,a=fs,s=Ql,o=g_,l=Ko,c=_r,h=new Uint8Array(kt.slice(0,Va)),d=Qe,u=Qe.slice(0,Qe.length),p=xi,f=Qo,g=t();return Va=e,gt=i,v_=n,ga=r,fs=a,Ql=s,g_=o,Ko=l,_r=c,kt=h,Qo=f,(Qe=d).splice(0,Qe.length,...u),xi=p,He=new DataView(kt.buffer,kt.byteOffset,kt.byteLength),g}function PE(){kt=null,Ko=null,Qe=null}function OX(t){t.unpack?gr[t.type]=t.unpack:gr[t.type]=t}var DE,kt,Va,gt,JR,g_,v_,xi,Qe,Ql,ga,fs,_r,Ko,gr,He,Yw,FN,Qo,RE,tO,eO,Tm,kN,OE,y_,VN,jN,GN,kn,IE,LE,Zw,iO,nO,rO,BE,nv,aO,sO,oO,UE,Kw,Cg,IX=k(()=>{try{DE=new TextDecoder}catch{}gt=0,g_=JR=[],v_=0,xi={},ga=0,fs=0,gr=[],Yw={useRecords:!1,mapsAsObjects:!0},(FN=new class{}).name="MessagePack 0xC1",Qo=!1,RE=2,Tm=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=0&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(kt)return NN(()=>(PE(),this?this.unpack(t,e):Tm.prototype.unpack.call(Yw,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(Va=e.end||t.length,gt=e.start||0):(gt=0,Va=e>-1?e:t.length),v_=0,fs=0,Ql=null,g_=JR,_r=null,kt=t;try{He=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw kt=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof Tm){if(xi=this,this.structures)return Qe=this.structures,iv(e);(!Qe||Qe.length>0)&&(Qe=[])}else xi=Yw,(!Qe||Qe.length>0)&&(Qe=[]);return iv(e)}unpackMultiple(t,e){let i,n=0;try{Qo=!0;let r=t.length,a=this?this.unpack(t,r):nv.unpack(t,r);if(!e){for(i=[a];gt<r;)n=gt,i.push(iv());return i}if(e(a,n,gt)===!1)return;for(;gt<r;)if(n=gt,e(iv(),n,gt)===!1)return}catch(r){throw r.lastPosition=n,r.values=i,r}finally{Qo=!1,PE()}}_mergeStructures(t,e){t=t||[],Object.isFrozen(t)&&(t=t.map(i=>i.slice(0)));for(let i=0,n=t.length;i<n;i++){let r=t[i];r&&(r.isShared=!0,i>=32&&(r.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in e||[])if(i>=0){let n=t[i],r=e[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,e){return this.unpack(t,e)}},kN=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,OE=(t,e)=>function(){let i=kt[gt++];if(i===0)return e();let n=t<32?-(t+(i<<5)):t+(i<<5),r=Qe[n]||LN()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=CE(r,t)),r.read()},y_=Am,VN=Am,jN=Am,GN=Am,kn=String.fromCharCode,IE=new Array(4096),LE=(t,e)=>{let i=mn().map(zN),n=t;e!==void 0&&(t=t<32?-((e<<5)+t):(e<<5)+t,i.highByte=e);let r=Qe[t];return r&&(r.isShared||Qo)&&((Qe.restoreStructures||(Qe.restoreStructures=[]))[t]=r),Qe[t]=i,i.read=CE(i,n),(i.read0||i.read)()},gr[0]=()=>{},gr[0].noBuffer=!0,gr[66]=t=>{let e=t.byteLength%8||8,i=BigInt(128&t[0]?t[0]-256:t[0]);for(let n=1;n<e;n++)i<<=BigInt(8),i+=BigInt(t[n]);if(t.byteLength!==e){let n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=(a,s)=>{let o=s-a;if(o<=40){let d=n.getBigUint64(a);for(let u=a+8;u<s;u+=8)d<<=BigInt(64),d|=n.getBigUint64(u);return d}let l=a+(o>>4<<3),c=r(a,l),h=r(l,s);return c<<BigInt(8*(s-l))|h};i=i<<BigInt(8*(n.byteLength-e))|r(e,n.byteLength)}return i},Zw={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},gr[101]=()=>{let t=mn();if(!Zw[t[0]]){let e=Error(t[1],{cause:t[2]});return e.name=t[0],e}return Zw[t[0]](t[1],{cause:t[2]})},gr[105]=t=>{if(xi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(gt-4);Ko||(Ko=new Map);let i,n=kt[gt];i=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&kt[gt+1]===115?new Set:{};let r={target:i};Ko.set(e,r);let a=mn();if(!r.used)return r.target=a;if(Object.assign(i,a),i instanceof Map)for(let[s,o]of a.entries())i.set(s,o);if(i instanceof Set)for(let s of Array.from(a))i.add(s);return i},gr[112]=t=>{if(xi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(gt-4),i=Ko.get(e);return i.used=!0,i.target},gr[115]=()=>new Set(mn()),iO=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(t=>t+"Array"),nO=typeof globalThis=="object"?globalThis:window,gr[116]=t=>{let e=t[0],i=Uint8Array.prototype.slice.call(t,1).buffer,n=iO[e];if(!n){if(e===16)return i;if(e===17)return new DataView(i);throw new Error("Could not find typed array for code "+e)}return new nO[n](i)},gr[120]=()=>{let t=mn();return new RegExp(t[0],t[1])},rO=[],gr[98]=t=>{let e=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3],i=gt;return gt+=e-t.length,_r=rO,(_r=[QR(),QR()]).position0=0,_r.position1=0,_r.postBundlePosition=gt,gt=i,mn()},gr[255]=t=>t.length==4?new Date(1e3*(16777216*t[0]+(t[1]<<16)+(t[2]<<8)+t[3])):t.length==8?new Date(((t[0]<<22)+(t[1]<<14)+(t[2]<<6)+(t[3]>>2))/1e6+1e3*(4294967296*(3&t[3])+16777216*t[4]+(t[5]<<16)+(t[6]<<8)+t[7])):t.length==12?new Date(((t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3])/1e6+1e3*((128&t[4]?-281474976710656:0)+1099511627776*t[6]+4294967296*t[7]+16777216*t[8]+(t[9]<<16)+(t[10]<<8)+t[11])):new Date("invalid"),BE=new Array(147);for(let t=0;t<256;t++)BE[t]=+("1e"+Math.floor(45.15-.30103*t));(nv=new Tm({useRecords:!1})).unpack,nv.unpackMultiple,nv.unpack,aO=new Float32Array(1),new Uint8Array(aO.buffer,0,4)}),LX=k(()=>{IX(),vC(),wC(),Kc(),zb(),Zc(),sO=[{Class:$t.prototype.constructor,type:1,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,$t.prototype),t)},{Class:Vt.prototype.constructor,type:2,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Vt.prototype),t)},{Class:Xn.prototype.constructor,type:3,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Xn.prototype),t)},{Class:p_.prototype.constructor,type:4,write:t=>t.id,read:t=>new p_(t)},{Class:EE.prototype.constructor,type:5,write:t=>t.data,read:t=>new EE(t)},{Class:gn.prototype.constructor,type:6,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,gn.prototype),t)}];for(let t of sO)OX(t);oO=new Tm({structuredClone:!0}),(UE||(UE={})).deserialize=function(t){return oO.unpack(t)}}),BX=k(()=>{LX(),Kw=t=>()=>{throw new Error(t+" is not available in the runtime build (decode-only CollabSerialize)")},Cg={deserialize:UE.deserialize,serialize:Kw("CollabSerialize.serialize"),checksum:Kw("CollabSerialize.checksum")}}),Ye=k(()=>{kb(),TX(),yC(),Zc(),zb(),_C(),Kc(),PX(),DX(),IN(),RX(),vC(),BX(),CN(),wC()});function __(t){return t==="MouseDown"||t==="MouseUp"||t==="KeyDown"||t==="KeyUp"||t==="Collision"||t==="Trigger"}var lO,zE,Iu,rv,Qw,hO,cO,dO,NE,FE,uO,pO,fO,mO,gO,kE,VE,vO,yO,_O,bO,HN=k(()=>{var t,e,i;Ye(),rt(),(t=lO||(lO={})).toEventUIType=function(n){return n.type==="Conditional"?n.condition.type==="Distance"?"Distance":"StateChange":n.type},t.fromEventUIType=function(n){return n==="Distance"||n==="StateChange"?"Conditional":n},zE={LookAt:[],Follow:["Create"],DragDrop:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseHover:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Scroll:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Start:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Conditional:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MousePress:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyPress:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],GameControl:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],Collision:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Trigger:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Resize:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],VariableChange:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],API:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],WEBHOOK:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],AIAssistantListener:["SetVariable"],AIAssistantTrigger:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]},(n=>{n.is=function(r){return r.type==="MouseDown"||r.type==="MouseUp"||r.type==="MousePress"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="KeyPress"},n.defaultData=function(r){return r==="MouseDown"||r==="MouseUp"||r==="MousePress"?{type:r,mode:"Object",disabled:!1,name:"",actions:new Vt}:{type:r,disabled:!1,name:"",key:void 0,actions:new Vt}}})(Iu||(Iu={})),(n=>{n.propertyDefaultData=function(r){return{type:"Property",value:[r??null,"position","x"]}},n.valueDefaultData={type:"Literal",value:0}})(rv||(rv={})),(e=Qw||(Qw={})).comparisonDefaultData=function(n){return{type:"Comparison",operator:"==",lOperand:rv.propertyDefaultData(n),rOperand:{...rv.valueDefaultData}}},e.distanceDefaultData=function(n){return{type:"Distance",toObject:n??null,fromObject:n??null,distance:200}},e.stateDefaultData=function(n,r){return{type:"State",object:n??null,state:r??null}},(hO||(hO={})).isConditionalSubActions=function(n){return n.find(r=>r==="ifActions"||r==="elseActions")!==void 0},(n=>{n.is=function(r){return r.type==="Conditional"},n.defaultData=function(r){return{type:"Conditional",disabled:!1,name:"",inActions:new Vt,outActions:new Vt,condition:Qw.distanceDefaultData(r)}}})(cO||(cO={})),(dO||(dO={})).defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new Vt,drop:new Vt}},(NE||(NE={})).defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new Vt},(FE||(FE={})).defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5},(n=>{n.is=function(r){return r.type==="MouseHover"},n.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new Vt}}})(uO||(uO={})),(n=>{n.is=function(r){return r.type==="Scroll"},n.defaultData=function(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new Vt}}})(pO||(pO={})),(n=>{n.is=function(r){return r.type==="Start"},n.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Vt}}})(fO||(fO={})),(n=>{n.is=function(r){return r.type==="Collision"},n.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Vt}}})(mO||(mO={})),(n=>{n.is=function(r){return r.type==="Trigger"},n.defaultData=function(r,a){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Vt,triggerZone:"box",position:a.toArray(),rotation:[0,0,0],size:r.toArray(),radius:r.length()/2,helperVisible:!0}}})(gO||(gO={})),(i=kE||(kE={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},i.is=function(n){return n.type==="Resize"},i.sizeToDevice=function(n){return typeof n=="string"?n:"custom"},i.deviceToSize=function(n){return typeof n=="string"?[...i.defaultSizes[n]]:[...n]},i.defaultData=function(){let n={size:"mobile",operator:"<",actions:new Vt},r={size:"tablet",operator:"<",actions:new Vt},a={size:[...i.defaultSizes.custom],operator:"<>",actions:new Vt},s=new Vt;return s.push({id:It.generateUUID(),fi:0,data:n},{id:It.generateUUID(),fi:1,data:r},{id:It.generateUUID(),fi:2,data:a}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:s}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new Vt}},(n=>{n.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]},n.is=function(r){return r.type==="VariableChange"},n.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new Vt,variableId:"",objectId:null,property:"Position X"}}})(VE||(VE={})),(n=>{n.is=function(r){return r.type==="API"},n.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Vt,errorActions:new Vt,userAPIId:""}}})(vO||(vO={})),(n=>{n.is=function(r){return r.type==="WEBHOOK"},n.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Vt,userWebhookId:""}}})(yO||(yO={})),(n=>{n.is=function(r){return r.type==="AIAssistantListener"},n.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Vt,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(_O||(_O={})),(n=>{n.is=function(r){return r.type==="AIAssistantTrigger"},n.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Vt}}})(bO||(bO={}))});function xO(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function wO(t){return typeof t=="string"&&t.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)}var Qc,qu,WN,Rr,SO,eo,ch,Pg,MO,Nc,Cn,Je,jE,EO,b_,x_,Sc,AO,TO,CO,PO,DO,RO,OO,Jw,IO,LO,tS,BO,UO,zO,eS,NO,iS,FO,kO,VO,jO,GO,HO,WO,qO,XO,Wc,Jo,Jl,GE,HE,w_,S_,M_,E_,A_,WE,qE,T_,XE,Xu,$O,nS,rS,$E,YO,C_,ZO,KO,P_,QO,JO,tI,eI,iI,nI,rI,aI,sI,MC,qN,Qi,Vi,Su,XN,Dg,D_,Mc,YE,EC,R_,O_,ZE,Wo,i1,er,aS,Wl,I_,ig,sS,oS,lS,$u,hS,KE,QE,oI,Ld,$N,En,L_,lI,hI,cI,dI,Ws,ng,B_,U_,tl,Fc,uI,th,z_,el,cS,dS,Ac,up,Tc,rg,JE,pI,br,uS,fI,mI,qo,ka,Yu,tA,N_,F_,xa=k(()=>{var t,e,i,n,r,a,s,o;Qc="personal camera",qu="a218fcc3-276b-49b9-b485-49037fd14f5f",WN=2500134,Rr=5526619,(t=SO||{}).x="x",t.y="y",t.z="z",SO=t,(l=>{function c(u,p){return Math.pow(p[0]-u[0],2)+Math.pow(p[1]-u[1],2)}function h(u,p){return Math.sqrt(c(u,p))}function d(u,p,f){let g=l.sub(p,u),m=l.sub(f,u),y=l.dot(g,m)/l.dot(g,g),v=l.scalarMultiply(g,y);return l.add(u,v)}l.isEqual=function(u,p){return u[0]===p[0]&&u[1]===p[1]},l.lerp=function(u,p,f){return[u[0]+(p[0]-u[0])*f,u[1]+(p[1]-u[1])*f]},l.add=function(u,p){return[u[0]+p[0],u[1]+p[1]]},l.sub=function(u,p){return[u[0]-p[0],u[1]-p[1]]},l.multiply=function(u,p){return[u[0]*p[0],u[1]*p[1]]},l.divide=function(u,p){return[u[0]/p[0],u[1]/p[1]]},l.distanceSquared=c,l.distance=h,l.dot=function(u,p){return u[0]*p[0]+u[1]*p[1]},l.scalarMultiply=function(u,p){return[u[0]*p,u[1]*p]},l.projectionOnto=d,l.projectionOntoDistance=function(u,p,f){return h(u,d(u,p,f))},l.center=function(u,p){return[.5*(u[0]+p[0]),.5*(u[1]+p[1])]}})(eo||(eo={})),(e=ch||(ch={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]},e.add=function(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]},e.sub=function(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]},e.div=function(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]},e.mul=function(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]},e.dist=function(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])},e.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h]},(i=Pg||(Pg={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]&&l[3]===c[3]},i.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h,l[3]+(c[3]-l[3])*h]},(l=>{let c=180/Math.PI,h=Math.PI/180;function d(p){return typeof p=="number"?p*c:p}function u(p){return typeof p=="number"?p*h:p}l.radToDeg=function(p){return[d(p[0]),d(p[1]),d(p[2])]},l.degToRad=function(p){return[u(p[0]),u(p[1]),u(p[2])]}})(MO||(MO={})),(n=Nc||(Nc={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],n.isEqual=function(l,c){for(let h=0;h<16;h++)if(l[h]!==c[h])return!1;return!0},n.simplify=function(l){return l??n.identity},n.applyMatrix4=function(l,c){let h=c.slice(0);for(let d=0,u=c.length;d<u;d+=3){let p=l[3]*c[d]+l[7]*c[d+1]+l[11]*c[d+2]+l[15];h[d]=(l[0]*c[d]+l[4]*c[d+1]+l[8]*c[d+2]+l[12])/p,h[d+1]=(l[1]*c[d]+l[5]*c[d+1]+l[9]*c[d+2]+l[13])/p,h[d+2]=(l[2]*c[d]+l[6]*c[d+1]+l[10]*c[d+2]+l[14])/p}return h},(r=Cn||(Cn={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},r.white={r:1,g:1,b:1},r.red={r:1,g:0,b:0},r.black={r:0,g:0,b:0},r.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},r.clone=function(l){return{r:l.r,g:l.g,b:l.b}},r.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},r.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},r.equals=function(l,c){return l.r===c.r&&l.g===c.g&&l.b===c.b},r.equalsFixed=function(l,c){return l.r.toFixed(2)===c.r.toFixed(2)&&l.g.toFixed(2)===c.g.toFixed(2)&&l.b.toFixed(2)===c.b.toFixed(2)},r.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h}},r.is=function(l){return!!xO(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(a=Je||(Je={})).white={...Cn.white,a:1},a.is=function(l){return!!xO(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},a.transparent={...Cn.white,a:0},a.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},a.fromHexAndA=function(l,c){return{...Cn.fromHex(l),a:c}},a.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:l.a}},a.equals=function(l,c){return Cn.equals(l,c)&&l.a===c.a},a.equalsFixed=function(l,c){return Cn.equalsFixed(l,c)&&l.a.toFixed(2)===c.a.toFixed(2)},a.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h,a:l.a+(c.a-l.a)*h}},a.toStyle=function({r:l,g:c,b:h,a:d}=a.white){return`rgba(${255*l}, ${255*c}, ${255*h}, ${d})`},(jE||(jE={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(s=EO||{})[s.LINEAR=0]="LINEAR",s[s.EASE=1]="EASE",s[s.EASE_IN=2]="EASE_IN",s[s.EASE_OUT=3]="EASE_OUT",s[s.EASE_IN_OUT=4]="EASE_IN_OUT",s[s.CUBIC=5]="CUBIC",s[s.SPRING=6]="SPRING",s[s.ARC=7]="ARC",s[s.NONE=8]="NONE",EO=s,(b_||(b_={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(x_||(x_={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=Sc||(Sc={})).linear=[0,0,1,1],o.ease=[.25,.1,.25,1],o.easeIn=[.42,0,1,1],o.easeOut=[0,0,.58,1],o.easeInOut=[.42,0,.58,1]}),UX=k(()=>{var t,e;Ye(),HN(),(AO||(AO={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(TO||(TO={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(CO||(CO={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(PO||(PO={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(DO||(DO={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(RO||(RO={})).defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"},(OO||(OO={})).defaultData={type:"Reset",name:"",delay:0},(Jw||(Jw={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(t=IO||(IO={})).pauseDefaultData={interaction:"pause",delay:0},t.stopDefaultData={interaction:"stop",delay:0},(e=LO||(LO={})).defaultData={type:"Audio",name:"",...Jw.defaultData},e.hasAudioByActions=i=>i.some(({data:n})=>n.type==="Audio"&&n.interaction==="play"&&n.audio),e.hasAudioByEvents=i=>{for(let{data:n}of i)if(Iu.is(n)||n.type==="Start"||n.type==="Collision"){if(e.hasAudioByActions(n.actions))return!0}else if(n.type==="Conditional"){if(e.hasAudioByActions(n.inActions)||e.hasAudioByActions(n.outActions))return!0}else if(n.type==="GameControl"&&Object.values(n.gameActions).find(r=>e.hasAudioByActions(r)))return!0},e.getAudiosByActions=i=>{let n=[];return i.forEach(r=>{let a=r.data;a.type==="Audio"&&a.interaction==="play"&&a.audio&&n.push(r),a.type==="Conditional"&&(n.push(...e.getAudiosByActions(a.ifActions)),n.push(...e.getAudiosByActions(a.elseActions)))}),n},e.getAudiosByEvents=i=>{let n=[];return i.forEach(({data:r})=>{Iu.is(r)||r.type==="Collision"||r.type==="Start"||r.type==="Trigger"?n.push(...e.getAudiosByActions(r.actions)):r.type==="Conditional"?(n.push(...e.getAudiosByActions(r.inActions)),n.push(...e.getAudiosByActions(r.outActions))):r.type==="GameControl"?Object.values(r.gameActions).forEach(a=>{n.push(...e.getAudiosByActions(a))}):r.type==="DragDrop"&&(n.push(...e.getAudiosByActions(r.dragDropActions.drag)),n.push(...e.getAudiosByActions(r.dragDropActions.drop)))}),n},(tS||(tS={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(BO||(BO={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...tS.defaultData},i.hasVideoByActions=n=>n.some(({data:r})=>r.type==="Video"&&r.interaction==="play"&&r.layerId),i.hasVideoByObject=n=>{if(n.events){for(let{data:r}of n.events)if((Iu.is(r)||r.type==="Start")&&i.hasVideoByActions(r.actions))return!0}},i.getVideosByActions=n=>{let r=[];return n.forEach(a=>{let s=a.data;s.type==="Video"&&s.interaction==="play"&&s.layerId&&r.push(a)}),r},i.getVideosByEvents=n=>{let r=[];return n.forEach(({data:a})=>{(Iu.is(a)||a.type==="Start")&&r.push(...i.getVideosByActions(a.actions))}),r}})(UO||(UO={})),(zO||(zO={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(eS||(eS={})).defaultData=function(){return{tweens:new Vt,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(NO||(NO={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...eS.defaultData()}},(iS||(iS={})).defaultData=function(i){return{interaction:"play",timeline:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(FO||(FO={})),(kO||(kO={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...iS.defaultData(i)}},(VO||(VO={})).defaultData=function(i,n,r){return{type:"Animation",name:"",object:i,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(jO||(jO={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(GO||(GO={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Vt,elseActions:new Vt,condition:[]}),(HO||(HO={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(WO||(WO={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(qO||(qO={})).defaultData={name:"",type:"UserAPI"}}),zX=k(()=>{var t;(t=XO||(XO={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),e=>e.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},t.maxSize=2e6}),YN=k(()=>{var t;(t=Wc||(Wc={})).all=["PerspectiveCamera","OrthographicCamera"],t.is=function(e){return t.all.includes(e)},(e=>{e.DefaultUp=[0,1,0],e.DefaultTargetOffset=1e3,e.MinTargetOffset=.001,e.sanitizeTargetOffset=function(a){return a===void 0||!Number.isFinite(a)||a<e.MinTargetOffset?e.DefaultTargetOffset:a},e.DefaultAzimuth=-24,e.DefaultElevation=15;let i=e.DefaultAzimuth*Math.PI/180,n=e.DefaultElevation*Math.PI/180,r=180/Math.PI;e.DefaultPosition=[e.DefaultTargetOffset*Math.sin(i)*Math.cos(n),e.DefaultTargetOffset*Math.sin(n),e.DefaultTargetOffset*Math.cos(i)*Math.cos(n)],e.DefaultRotation=[Math.atan2(-Math.sin(n),Math.cos(i)*Math.cos(n))*r,Math.asin(Math.sin(i)*Math.cos(n))*r,Math.atan2(Math.sin(i)*Math.sin(n),Math.cos(i))*r],e.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:e.DefaultUp,isUpVectorFlipped:!1,targetOffset:e.DefaultTargetOffset},e.getZoom=function(a){return a.type==="PerspectiveCamera"?a.perspective?.zoom??1:a.orthographic?.zoom??1}})(Jo||(Jo={}))}),ZN=k(()=>{var t;(t=Jl||(Jl={})).defaultData=function(e,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof e[0]=="number"?e[0]:1,typeof e[1]=="number"?e[1]:1),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof e[0]=="number"?e[0]+e[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:e.map(n=>(typeof n=="number"?n:1)*(1+i)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}},t.merge=function(e,i){let n={...e};if(HE.forEach(r=>{Object.assign(n,{[r]:i[r]??e[r]})}),n.radial={...e.radial},i.radial){let r=e.radial,a=i.radial;w_.forEach(s=>{Object.assign(n.radial,{[s]:a[s]??r[s]})})}if(n.linear={...e.linear},i.linear){let r=e.linear,a=i.linear;S_.forEach(s=>{Object.assign(n.linear,{[s]:a[s]??r[s]})})}if(n.grid={...e.grid},i.grid){let r=e.grid,a=i.grid;M_.forEach(s=>{Object.assign(n.grid,{[s]:a[s]??r[s]})})}if(n.toObject={...e.toObject},i.toObject){let r=e.toObject,a=i.toObject;E_.forEach(s=>{Object.assign(n.toObject,{[s]:a[s]??r[s]})})}if(n.randomnessObject={...e.randomnessObject},i.randomnessObject){let r=e.randomnessObject,a=i.randomnessObject;A_.forEach(s=>{Object.assign(n.randomnessObject,{[s]:a[s]??r[s]})})}return n},t.isPartial=function(e){return!(!e.randomnessObject&&!e.toObject)},(e=>{e.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];e.toOps=function(n,r){let a=[];n.count!==void 0&&a.push({type:0,path:r,props:{count:n.count}});for(let s of i){let o=n[s];o&&Object.keys(o).length>0&&a.push({type:0,path:[...r,s],props:o})}return a}})(GE||(GE={})),HE=["count"],w_=["radius","start","end","position","scale","rotation"],S_=["position","scale","rotation"],M_=["count","size"],E_=["count","position","scale","rotation"],A_=["strength","scale","rotation","position","movement","seed","freqScale"]}),KN=k(()=>{var t;xa(),(t=WE||(WE={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],t.is=function(e){return t.all.includes(e)},(qE||(qE={})).defaultData=function(e){return function(i){if(i==="PointLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(i==="DirectionalLight")return{type:i,color:Je.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(e)}}),QN=k(()=>{var t;(t=T_||(T_={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},t.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},t.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:t.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...t.defaultCollisionData}}),JN=k(()=>{var t;(t=XE||(XE={})).defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},t.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),AC=k(()=>{(Xu||(Xu={})).defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]}}),tF=k(()=>{var t,e;(t=$O||{})[t.Front=0]="Front",t[t.Back=1]="Back",t[t.Double=2]="Double",$O=t,(e=nS||(nS={})).defaultData={castShadow:!0,receiveShadow:!0},e.equals=function(i,n){return i.castShadow===n.castShadow&&i.receiveShadow===n.receiveShadow},(i=>{i.defaultData={flatShading:!1,wireframe:!1,side:0},i.equals=function(n,r){return n.flatShading===r.flatShading&&n.side===r.side&&n.wireframe===r.wireframe&&(n.shadowCatcher??!1)===(r.shadowCatcher??!1)}})(rS||(rS={})),($E||($E={})).defaultData={...rS.defaultData,...nS.defaultData},(YO||(YO={})).getMaterialData=function(i,n){let r=[];if("material"in i){let a=typeof i.material=="string"?n.materials[i.material]??n.lib.materials[i.material]?.asset:i.material;a&&r.push(a)}else if("materials"in i)for(let a of i.materials){let s=typeof a=="string"?n.materials[a]??n.lib.materials[a]?.asset:a;s&&r.push(s)}return r}}),eF=k(()=>{var t;(t=C_||(C_={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},t.maxSize=3e7}),Vb=k(()=>{var t,e,i,n;Ye(),xa(),eF(),xa(),(ZO||(ZO={})).is=function(r){return r==="texture"||r==="video"||r==="color"||r==="depth"||r==="normal"||r==="gradient"||r==="noise"||r==="fresnel"||r==="cavity"||r==="dust"||r==="rainbow"||r==="toon"||r==="outline"||r==="particle"||r==="transmission"||r==="reflection"||r==="matcap"||r==="displace"||r==="pattern"||r==="vertexColor"||r==="light"},(KO||(KO={})).is=function(r){return r==="luminance"||r==="r"||r==="g"||r==="b"||r==="a"},(P_||(P_={})).is=function(r){return typeof r=="object"&&r!==null&&r.image!=null},(QO||(QO={})).is=function(r){return r==="phong"||r==="toon"||r==="lambert"||r==="physical"},(n=JO||{})[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",JO=n,tI=(r=>(r[r.RepeatWrapping=1e3]="RepeatWrapping",r[r.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",r[r.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",r))(tI||{}),eI=(r=>(r[r.NearestFilter=1003]="NearestFilter",r[r.LinearFilter=1006]="LinearFilter",r[r.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",r))(eI||{}),(i=iI||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",iI=i,(e=nI||{})[e.Simplex=0]="Simplex",e[e.SimplexFractal=1]="SimplexFractal",e[e.Ashima=2]="Ashima",e[e.Fbm=3]="Fbm",e[e.Perlin=4]="Perlin",e[e.Voronoi=5]="Voronoi",nI=e,(t=rI||{})[t.F1=0]="F1",t[t.F2=1]="F2",t[t.F2MinusF1=2]="F2MinusF1",t[t.SmoothBlend=3]="SmoothBlend",t[t.Edge=4]="Edge",t[t.Power=5]="Power",t[t.Lines=6]="Lines",t[t.Cells=7]="Cells",rI=t,aI=(r=>(r[r.Lights=0]="Lights",r[r.Static=1]="Static",r[r.Camera=2]="Camera",r))(aI||{}),sI=(r=>(r[r.Circle=0]="Circle",r[r.Ring=1]="Ring",r[r.Polygon=2]="Polygon",r[r.Cross=3]="Cross",r[r.Diamond=4]="Diamond",r[r.Checkerboard=5]="Checkerboard",r[r.Line=6]="Line",r[r.Wave=7]="Wave",r))(sI||{}),MC=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],qN=["wrapping","image","video","name","minFilter","magFilter"],(r=>{r.patch=function(a,s){let{texture:o,...l}=s;if(Object.assign(a,l),o){let c=a.texture;c&&Object.assign(c,o)}},r.defaultColorLayer=function(a){return{...r.defaultData("color"),color:a}},r.defaultData=function(a,s){return a==="light"&&s?function(o){let l={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(o){case"phong":return{...l,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...l,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...l,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...l,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}(s):function(o){let l={alpha:1,mode:0,isMask:!1,visible:!0};switch(o){case"texture":return{...l,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...l,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:C_.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:Cn.fromHex(Rr)};case"vertexColor":return{...l,type:"vertexColor"};case"depth":return{...l,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...l,type:"normal",cnormal:[1,1,1]};case"gradient":return{...l,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...l,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...Cn.fromHex(6710886),a:1},colorB:{...Cn.fromHex(6710886),a:1},colorC:{...Cn.fromHex(16777215),a:1},colorD:{...Cn.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"cavity":return{...l,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...l,type:"fresnel",color:Je.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:Je.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...l,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...l,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Je.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:Je.fromHexAndA(0,1),contourColor:Je.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...l,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...l,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...l,type:"reflection",blur:0,thickness:.001,steps:60,stepSize:.005,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...l,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...Cn.fromHex(0),a:1},colorB:{...Cn.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}(a)}})(Qi||(Qi={})),(r=>{function a(s,o="layer1",l="layer2",c=Cn.fromHex(16777215)){let h=new Vt;return h.push({fi:0,data:Qi.defaultData("light",s),id:o}),h.push({fi:1,data:Qi.defaultData("color"),id:l}),{layers:h}}r.isMergable=function(s){return!s.layers.some(o=>o.data.type==="texture"&&o.data.projection!==0||o.data.type==="depth"&&!o.data.isWorldSpace||o.data.type==="noise"||o.data.type==="dust"&&o.data.noiseStrength!==0||o.data.type==="displace")},r.getHash=function(s){let o="";return s.layers.forEach(l=>{Object.entries(l.data).forEach(([c,h])=>{o+=`${c}${h}`,Array.isArray(h)?h.forEach(d=>o+=`${d}`):typeof h=="object"?Object.values(h).forEach(d=>{o+=typeof d=="number"?`${d.toFixed(4)}`:`${d}`}):o+=`${h}`})}),o},r.defaultEmptyData=function(){return{layers:new Vt}},r.defaultData=function(s="layer1",o="layer2"){return a("physical",s,o)},r.withName=function(s,o){return{...s,name:o}},r.defaultTwoLayerData=a,r.defaultColorMaterial=function(s,o,l="layer1",c="layer2"){let h=new Vt;return h.push({fi:0,data:Qi.defaultData("light",o),id:l}),h.push({fi:1,data:Qi.defaultColorLayer(s),id:c}),{layers:h}},r.defaultUIObjectMaterial=function(s){let o=Qi.defaultData("texture");s&&Object.assign(o.texture,{image:s});let l=new Vt;return l.push({fi:0,data:o,id:"layer1"}),l.push({fi:1,data:{...Qi.defaultData("transmission"),alpha:1},id:"layer2"}),l.push({fi:2,data:{...Qi.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:l}},r.defaultTwoLayerTextureData=function(s,o="physical",l="layer1",c="layer2"){let h=Qi.defaultData("texture");Object.assign(h.texture,{image:s});let d=new Vt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:Qi.defaultData("light",o),id:c}),{layers:d}},r.defaultTwoLayerVideoTextureData=function(s,o="physical",l="layer1",c="layer2"){let h=Qi.defaultData("video");Object.assign(h.texture,{video:s});let d=new Vt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:Qi.defaultData("light",o),id:c}),{layers:d}}})(Vi||(Vi={}))}),NX=k(()=>{Su="Roboto_regular",XN="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),iF=k(()=>{Ye(),(Dg||(Dg={})).defaultData=function(){return{points:new Vt,roundness:0,shapeHoles:[],isClosed:!1}}}),nF=k(()=>{Ye(),(D_||(D_={})).defaultData=function(){return{points:new Vt,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},Mc={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(YE||(YE={})).merge=function(t,e){let i={...t};return R_.forEach(n=>{Object.assign(i,{[n]:e[n]??t[n]})}),i},EC={shape:Mc,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},R_=["depth","offset","angle","twist","startScale","endScale"]}),TC=k(()=>{var t,e;iF(),nF(),(t=O_||(O_={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},t.isParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="BooleanGeometry"||i==="TextGeometry"||i==="InputGeometry"||i==="DecalGeometry"},t.isSwappableGeometry=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="TextGeometry"||i==="SubdivGeometry"||i==="NonParametricGeometry"},(ZE||(ZE={})).merge=function(i,n){let r={...i};return Object.assign(r,n),r.type==="PathGeometry"&&"extrusion"in n&&n.extrusion&&(r.extrusion={...i.extrusion},Object.assign(r.extrusion,YE.merge(r.extrusion,n.extrusion))),r},(e=Wo||(Wo={})).defaultData=function(i){if(i==="RectangleGeometry")return{width:320,height:320,type:i,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="UIGeometry")return{type:i,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(i==="PathGeometry")return{type:i,width:1,height:1,depth:1,path:D_.defaultData(),extrusion:EC};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:Dg.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="ShapeBlendGeometry")return{type:i,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(i==="DecalGeometry")return{type:i,width:200,height:200,depth:200,offset:1};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="InputGeometry")return{...e.defaultData("TextGeometry"),type:i,editable:!0};if(i==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")},i1=["width","height","depth"]}),rF=k(()=>{xa(),(t=>{function e(i){return i.mode??"linear"}t.defaultData={enabled:!1,useBackgroundColor:!1,color:Cn.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},t.getMode=e,t.getModeIndex=function(i){let n=e(i);return n==="height"?1:n==="both"?2:0},t.getDensity=function(i){return i.density??t.defaultData.density},t.getHeightFalloff=function(i){return i.heightFalloff??t.defaultData.heightFalloff},t.getHeightBase=function(i){return i.heightBase??t.defaultData.heightBase}})(er||(er={}))}),CC=k(()=>{(aS||(aS={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(Wl||(Wl={})).defaultData={enabled:!1,mode:"hdri",hdri:aS.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}}),aF=k(()=>{(()=>{let t={opacity:1,blendFunction:13,enabled:!1};(I_||(I_={})).defaultData={enabled:!1,pixelation:{...t,blendFunction:16,granularity:15},bloom:{...t,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...t,offset:[2,2]},vignette:{...t,darkness:1,offset:0},hueSaturation:{...t,hue:3,saturation:0},brightnessContrast:{...t,brightness:.25,contrast:0},depthOfField:{...t,focusDistance:100,focalLength:20,bokehScale:5},noise:{...t,blendFunction:16}}})()}),PC=k(()=>{var t;rF(),CC(),aF(),xa(),(t=ig||(ig={})).defaultData={type:"normal",softShadowQuality:"low"},t.isSoft=function(e){return e!=null&&(e.type===void 0||e.type==="soft")},(sS||(sS={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(oS||(oS={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},e.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(lS||(lS={})),($u||($u={})).defaultData={usePhysics:!1,gravity:-10},(hS||(hS={})).defaultData={playCamera:Qc,gameControlObject:null},(KE||(KE={})).defaultData={backgroundColor:Je.fromHexAndA(WN,1),postprocessing:I_.defaultData,fog:er.defaultData,sky:Wl.defaultData,globalPhysics:$u.defaultData,ambient:sS.defaultData,ao:oS.defaultData,shadow:ig.defaultData,publish:hS.defaultData,grading:lS.defaultData}}),FX=k(()=>{(QE||(QE={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),jb=k(()=>{var t,e,i;Ye(),YN(),KN(),QN(),JN(),AC(),tF(),xa(),Vb(),TC(),ZN(),sr(),PC(),FX(),(t=oI||(oI={})).isComponentRelated=function(n){return n==="Component"||n==="Instance"},t.isEmptyOrComponent=function(n){return n==="Empty"||n==="Instance"},(e=Ld||(Ld={})).identity={...jE.identity,hiddenMatrix:Nc.identity},e.fromObject=function(n){return{position:n.position,rotation:n.rotation,scale:n.scale,pivot:n.pivot,pivotRotation:n.pivotRotation,hiddenMatrix:n.hiddenMatrix}},e.merge=function(n,r){return{position:r?.position||n.position,rotation:r?.rotation||n.rotation,pivot:r?.pivot||n.pivot,pivotRotation:r?.pivotRotation||n.pivotRotation,scale:r?.scale||n.scale,hiddenMatrix:r?.hiddenMatrix||n.hiddenMatrix}},e.diff=function(n,r){return MN({position:ch.isEqual(n.position,r.position)?void 0:r.position,rotation:ch.isEqual(n.rotation,r.rotation)?void 0:r.rotation,scale:ch.isEqual(n.scale,r.scale)?null:r.scale,hiddenMatrix:Nc.isEqual(n.hiddenMatrix,r.hiddenMatrix)?void 0:r.hiddenMatrix})},$N=["slide","offset"],(En||(En={})).defaultData={states:new Vt,events:new Vt,timelineAnimations:new $t,visible:!0,raycastLock:!1,physics:Xu.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...Ld.identity,cloner:null},(L_||(L_={})).defaultData={type:"Empty",...En.defaultData},(lI||(lI={})).defaultData={type:"ParticleCollider",...QE.defaultData,...En.defaultData},(hI||(hI={})).defaultData={type:"Component",...En.defaultData},(cI||(cI={})).defaultData={type:"Particle",...En.defaultData,...T_.defaultData},(dI||(dI={})).defaultData={type:"Hair",...En.defaultData,...XE.defaultData},(Ws||(Ws={})).defaultData={type:"Mesh",...En.defaultData,...$E.defaultData},(ng||(ng={})).defaultData={...En.defaultData,...Ld.identity,position:Jo.DefaultPosition,rotation:Jo.DefaultRotation,...Jo.defaultData},(n=>{n.defaultData=function(r){return{...En.defaultData,...qE.defaultData(r)}},n.defaultDirectionalLightData={...n.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(B_||(B_={})),(n=>{function r(a,s,o=0){for(;o<s.length;){let l=a?a[s[o]]:void 0;if(s.length===o+1)return l;if(!l)return;a=l.descendants,o+=1}}n.resolveWithDes=r,n.resolve=function(a,s,o=0){let l=r(a,s,o);if(l){let c=Object.keys(l);if(c.length===1&&c[0]==="descendants")return}return l}})(U_||(U_={})),(n=>{function r(a,s){return{...En.defaultData,...s,component:a,overrides:new gn,physics:void 0,events:void 0,type:"Instance"}}n.rootOverrideProps=["physics","events"],n.compositeNonOptionalOverrideProps=["geometry"],n.compositeEntireOverrideOverrideProps=["material"],n.ofComponent=r,n.fromComponentData=function(a){let s=Ld.fromObject(a.data);return r(a.id,s)}})(tl||(tl={})),(n=>{n.defaultData={type:"Page",...En.defaultData,physics:{...Xu.defaultData,fusedBody:!1},...KE.defaultData,camera:ng.defaultData},n.isUIPage=function(r){return r.uiScene!==void 0}})(Fc||(Fc={})),(i=uI||(uI={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:Nc.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:Xu.defaultData,states:new Vt,events:new Vt,timelineAnimations:new $t,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...Jo.defaultData},i.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},i.defaultMeshObject={name:"Rectangle",...En.defaultData,...Ws.defaultData,geometry:Wo.defaultData("RectangleGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...En.defaultData,...Ws.defaultData,geometry:Wo.defaultData("BooleanGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...En.defaultData,...Ws.defaultData,geometry:Wo.defaultData("ShapeBlendGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...En.defaultData,...Ws.defaultData,geometry:Wo.defaultData("TextGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...En.defaultData,...Ws.defaultData,geometry:Wo.defaultData("InputGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},(n=>{n.newEmpty=function(r,a){let s={name:a};return r.type==="Mesh"?(s.geometry={},"material"in r&&(s.material={layers:new gn}),"materials"in r&&(s.materials=r.materials.map(o=>({layers:new gn})))):Wc.is(r.type)&&(s.perspective={},s.orthographic={}),s},n.toOps=function(r,a){let s,o=[],l={orthographic:0,perspective:0,geometry:0};function c(h,d){for(let[u,p]of Object.entries(d.layers)){let{texture:f,...g}=p;if(f!==void 0&&Object.keys(f).length>0){let m={path:[...h,"layers",u,"texture"],props:f,type:0};o.push(m)}if(Object.keys(g).length>0){let m={path:[...h,"layers",u],props:g,type:0};o.push(m)}}}for(let[h,d]of Object.entries(a)){let u=d;if(h!=="name")if(h==="cloner")o.push(...GE.toOps(u,["cloner"]));else if(h==="pathSnapping")o.push({path:[h],props:{slide:u.slide,offset:u.offset},type:0});else if(h==="material")c(["material"],u);else if(h==="materials")for(let[p,f]of Object.entries(u))c(["materials",p],f);else if(l[h]===0){if(h==="geometry"&&u.extrusion!==void 0){let p={path:[h,"extrusion"],props:u.extrusion,type:0};o.push(p),u={...u},delete u.extrusion}if(Object.keys(u).length>0){let p={path:[h],props:u,type:0};o.push(p)}}else s===void 0&&(s={path:[],props:{},type:0},o.push(s)),s.props[h]=u}return o},n.patch=function(r,a){if(a===void 0)return r;let s={...r};if(Object.assign(s,Ld.merge(s,a)),Object.assign(s,{pathSnapping:Object.assign({},s.pathSnapping,{slide:a.pathSnapping?.slide??s.pathSnapping?.slide??0,offset:a.pathSnapping?.offset??s.pathSnapping?.offset??0})}),Wc.is(r.type)){s.orthographic={...s.orthographic},s.perspective={...s.perspective};let o=a;o.orthographic?.zoom!==void 0&&(s.orthographic.zoom=o.orthographic.zoom),o.perspective?.zoom!==void 0&&(s.perspective.zoom=o.perspective.zoom),o.isUpVectorFlipped!==void 0&&(s.isUpVectorFlipped=o.isUpVectorFlipped),o.targetOffset!==void 0&&(s.targetOffset=o.targetOffset)}else if(r.type==="Mesh")"geometry"in a&&Object.assign(s,{geometry:ZE.merge(s.geometry,a.geometry)}),(a.material||a.materials)&&(s=function(o,l){if(l===void 0)return o;let c={...o};return"material"in c&&"material"in l&&l.material&&(c.material=m_(c.material,h=>{if(typeof h!="string")for(let[d,u]of Object.entries(l.material.layers)){let p=h.layers.data(d);p&&Qi.patch(p,u)}}).data),c.materials&&l.materials&&(c.materials=m_(c.materials,h=>{for(let d=0;d<c.materials.length;d++){let u=l.materials[d];if(typeof u!="string")for(let[p,f]of Object.entries(u.layers)){let g=h[d]?.layers?.data(p);g&&Qi.patch(g,f)}}}).data),c}(s,a)),s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Jl.merge(s.cloner,a.cloner)});else if(r.type==="Empty")s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Jl.merge(s.cloner,a.cloner)});else if(WE.is(r.type)){let o=a;o.intensity!==void 0&&(s.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?s.color=o.color:s.color=Cn.clone(o.color))}return s}})(th||(th={}))}),DC=k(()=>{(z_||(z_={})).defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0}}),Gb=k(()=>{DC(),xa(),(el||(el={})).defaultData={orbitControls:z_.defaultData,playPage:qu,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((t,e)=>{let i=0,n=0;return e<5?n=-30:e<10&&(n=30),e===0||e===10||e===5?i=30:(e===4||e===11||e===9)&&(i=-30),[120,[i,n],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0}}),sF=k(()=>{var t;(cS||(cS={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(dS||(dS={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(t=Ac||(Ac={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...cS.defaultData},isRandomSeed:!0,seed:t.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:dS.defaultData}),t.generateSeed=()=>Math.round(1e5*Math.random())}),RC=k(()=>{jb(),Ye(),Gb(),xa(),sr(),sF(),(t=>{function e(i,n){let r=i.scene.objects.get(n);if(r&&r.data.type==="Component")return r;{let a=i.shared.lib.components[n];if(a)return{...a.asset,id:n}}}t.physicsEnabled=function(i){return i.find(n=>n.data.type==="Page"&&n.data.globalPhysics.usePhysics)!==void 0},t.getComponentData=e,t.traverseModuleInstances=function(i,n,r){i.scene.objects.traverseFrom(n,(a,s)=>{if(s.type==="Instance"){let o=e(i,s.component)?.data;o&&r(a,s,o.events)}else r(a,s,s.events)})}})(up||(up={})),(t=>{function e(n=!0,r=[]){let a=[];n&&a.push({...t.defaultLight}),a.push(...r);let s=new Xn;return s.push({fi:1,id:qu,data:{...Fc.defaultData,name:"Scene 1"},children:a}),s}function i(n){return{...t.defaultData,objects:ea(n,Xn.prototype)}}t.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",t.defaultLight={fi:-1,data:B_.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},t.createDefaultObjectTreeWithPage=e,t.defaultData={objects:e(),publish:el.defaultData,styles:Ac.defaultData()},t.emptyDataWithoutPage=function(){return{objects:new Xn,publish:el.defaultData,styles:Ac.defaultData()}},t.emptyDataWithPage=function(n=!0){return{objects:e(n),publish:el.defaultData,styles:Ac.defaultData()}},t.emptyData=function(){return{objects:new Xn,publish:{...el.defaultData},styles:Ac.defaultData()}},t.withObjs=i,t.withObj=function(n,r){return i([{id:n,data:r,children:[],fi:0}])}})(Tc||(Tc={}))}),oF=k(()=>{(rg||(rg={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),OC=k(()=>{var t,e;Ye(),sr(),(t=JE||(JE={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Vt}),t.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(pI||(pI={})).defaultData=(i,n="GET")=>({url:i,method:n,name:"New API",headers:new Vt,queries:new Vt,autoStart:!0}),(i=>{function n(a){return a.textValue!==void 0}function r(a){return typeof a=="boolean"}i.isTextValue=n,i.isNumber=function(a){return typeof a=="number"},i.isBoolean=r,i.typeOfVariable=function(a){return n(a)?"string":r(a)?"boolean":"number"},i.getDisplayedValue=function(a){return i.isTextValue(a)?Array.isArray(a.textValue)?a.textValue.map(s=>s.toString().padStart(a.padding??2,"0")).join(a.deliminator??":")+(a.suffix!==void 0?" "+a.suffix:""):a.textValue.toString():i.isBoolean(a)?a?"True":"False":i.isNumber(a)?parseFloat(a.toFixed(3)).toString():a.toString()}})(br||(br={})),(uS||(uS={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(fI||(fI={})).all=[...uS.all,"components"],(mI||(mI={})).defaultData=function(){return{images:new $t,videos:new $t,colors:new $t,audios:new $t,particles:new $t,fonts:new $t,materials:new $t,components:new $t,variables:new $t,userAPIs:new $t,userWebhooks:new $t,timelineAnimations:new $t}},(qo||(qo={})).defaultData=function(){return{images:new $t,videos:new $t,colors:new $t,audios:new $t,particles:new $t,fonts:new $t,materials:new $t,components:new $t,variables:new $t,userAPIs:new $t,userWebhooks:new $t,timelineAnimations:new $t}},(e=ka||(ka={})).defaultColors=function(){return ea({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},$t.prototype)},e.defaultImages=function(){return ea({},$t.prototype)},e.emptyData=function(){return{catelogs:new $t,materials:new $t,images:new $t,videos:new $t,colors:new $t,timelineAnimations:new $t,audios:new $t,particles:new $t,fonts:new $t,variables:new Vt,userAPIs:new $t,userWebhooks:new $t,lib:qo.defaultData()}},e.defaultVariables=function(i){switch(i){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let n=[0,0,0];return{name:"Time",value:{textValue:n,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:n,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",i)}},e.getFormattedTimerTime=function(i,n){if(n.format==="HH:mm:ss"){let r=Math.floor(i/3600),a=Math.floor((i-3600*r)/60);return{textValue:[r,a,Math.round(i-3600*r-60*a)]}}if(n.format==="mm:ss"){let r=Math.floor(i/60);return{textValue:[r,Math.round(i-60*r)]}}return n.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),kX=k(()=>{}),lF=k(()=>{var t;Ye(),RC(),oF(),OC(),(t=Yu||(Yu={})).defaultData={schema:130,scene:Tc.defaultData,frames:new $t().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",rg.defaultData),shared:{...ka.emptyData(),colors:ka.defaultColors()}},t.createDefaultData=function(){return Cg.deserialize(Cg.serialize(t.defaultData))},t.emptyDataForImports=function(){return{schema:130,scene:Tc.emptyDataWithPage(),frames:new $t().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",rg.defaultData),shared:{...ka.emptyData(),colors:ka.defaultColors(),images:ka.defaultImages()}}},t.emptyData=function(){return{schema:130,scene:Tc.emptyDataWithPage(),frames:new $t().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",rg.defaultData),shared:ka.emptyData()}},t.clipboard2dData=function(){return{schema:130,scene:Tc.emptyData(),frames:new $t,shared:ka.emptyData()}},t.withoutLib=function(e){return{...e,shared:{...e.shared,lib:qo.defaultData()}}},t.getComponentData=function(e,i){return up.getComponentData(e,i)},t.hasSensitiveData=function(e){let i=Object.values(e.shared.userAPIs);for(let n of i){let r=n.headers;for(let a of r)if(a.data.key.toLowerCase()==="authorization"&&a.data.value!=="")return!0}return!1}}),VX=k(()=>{(tA||(tA={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}}),IC=k(()=>{var t;xa(),Ye(),(N_||(N_={})).list=["idle","move","jump","run"],(t=F_||(F_={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},t.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:t.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new Vt,move:new Vt,jump:new Vt,run:new Vt},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Je.fromHexAndA(3728051,1)}}});function vc(t,...e){let i={};for(let n of e.flat())t!=null&&n in t&&(i[n]=t[n]);return i}function gI(t){t.layers.forEach(e=>{if(e.type==="depth"&&e.colorA!==void 0){let i=e.colorA,n=e.colorB,r=[[i.r,i.g,i.b,i.a],[n.r,n.g,n.b,n.a]],a=[0,1];for(let o=2;o<10;o++)r.push(r[1]),a.push(1);let s={...vc(cn(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:r,steps:a,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,s)}else if(e.type==="depth"&&e.gradientType===1&&(e.near<0||e.far<0)){let i={...cn(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,i)}})}function Fo(t,e){Object.values(t.shared.materials).forEach(i=>e(i))}function ko(t,e){t.scene.objects.traverse((i,n)=>{"materials"in n?n.materials.forEach((r,a)=>{r===void 0&&(n.materials[a]=Vi.defaultTwoLayerData("phong"),r=n.materials[a]),typeof r!="string"&&e(r)}):"material"in n?typeof n.material!="string"&&(n.material===void 0&&(n.material=Vi.defaultTwoLayerData("phong")),e(n.material)):n.type==="Mesh"&&(n.material===void 0&&(n.material=Vi.defaultTwoLayerData("phong")),e(n.material)),"overrides"in n&&Object.values(n.overrides).forEach(r=>{r.material&&typeof r.material!="string"&&Object.getPrototypeOf(r.material)!==gn.prototype&&e(r.material)})})}function vI(t){t.layers===void 0&&Object.assign(t,Vi.defaultTwoLayerData("lambert"))}function pS(t){!t.layers||t.layers.forEach(e=>{if(e.type==="depth"&&e.colors.length===10){let i=[...e.colors];i.push(e.colors[9]);let n=[...e.steps];n.push(e.steps[9]);let r={...cn(e),colors:i,steps:n};Object.assign(e,r)}})}function yI(t){t.scene.objects.traverse((e,i)=>{"materials"in i?i.materials.forEach(n=>{typeof n!="string"&&pS(n)}):"material"in i&&typeof i.material!="string"&&pS(i.material)}),Object.values(t.shared.materials).forEach(e=>pS(e))}function _I(t){t.layers&&t.layers.forEach(e=>{e.type==="depth"&&e.num!==void 0&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)})}function bI(t){t.layers&&t.layers.forEach(e=>{(function(i){return i.type!=="displace"})(e)&&e.isMask===void 0&&(e.isMask=!1),(e.type==="texture"||e.type==="video")&&e.blending===void 0&&(e.blending=0),(e.type==="noise"||e.type==="displace"&&e.displacementType==="noise")&&(e.voronoiStyle===void 0&&(e.voronoiStyle=0),e.highCut===void 0&&(e.highCut=1),e.lowCut===void 0&&(e.lowCut=0),e.smoothness===void 0&&(e.smoothness=.3),e.seed===void 0&&(e.seed=0),e.quality===void 0&&(e.quality=1))})}function xI(t){let e=t.layers.find(i=>i.type==="light")?.data;if(e?.category==="basic"){let i=Qi.defaultData("light","phong"),n=e;Object.assign(n,i),n.visible=!1}}function wI(t){Fo(t,xI),ko(t,xI)}function SI(t){t.layers.forEach(e=>{e.type==="light"&&e.category!=="toon"&&e.occlusion===void 0&&(e.occlusion=!0)})}function MI(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.bumpMapIntensity===void 0&&(e.bumpMapIntensity=5)})}var jX=k(()=>{Vb(),xa(),DC(),jb(),Ye(),Gb(),sr(),rt(),TC(),IC(),sF(),RC(),AC(),PC()}),hF={};function EI(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.alphaOverride===void 0&&(e.alphaOverride=1)})}function AI(t){t.rotation=t.rotation.slice(0,3).map(e=>e*Ec)}function cF(t){AI(t),t.type==="Page"&&AI(t.camera),t.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(n=>n*Ec))});let e=t.geometry;e&&e.type==="SphereGeometry"&&(e.thetaLength=(e.thetaLength??180)*Ec),e&&e.type==="TorusGeometry"&&(e.arc=e.arc*Ec),e&&e.type==="PathGeometry"&&(e.extrusion.angle*=Ec,e.extrusion.twist*=Ec),t.type==="Mesh"&&t.geometry.type==="TextGeometry"&&(t.geometry.text={textValue:t.geometry.text}),Array.isArray(cn(t.events))&&t.events?.forEach(i=>{(i.type==="MouseDown"||i.type==="MouseUp"||i.type==="MousePress"||i.type==="KeyDown"||i.type==="KeyUp"||i.type==="KeyPress"||i.type==="Collision"||i.type==="Trigger")&&(i.runMode=i.toggle?"Toggle":"Repeat")})}function GX(t){t.scene.objects.traverse((e,i)=>{})}function HX(t){let e=t.schema??104;e!==130&&e<130&&(k_(t.asset),t.schema=130)}function Lu(t,e){e(t.data);for(let i of t.children)Lu(i,e)}function dF(t){let e=t.schema??104;e!==130&&(e<105&&(Lu(t.asset,cF),t.schema=105),e<118&&(Lu(t.asset,pF),t.schema=118),e<121&&(Lu(t.asset,eA),t.schema=121),e<130&&(Lu(t.asset,WX),t.schema=130))}function uF(t,e){ko(t,e),Fo(t,e),Object.values(t.shared.lib.materials).forEach(i=>e(i.asset))}function k_(t){t.layers===void 0&&Object.assign(t,Vi.defaultTwoLayerData("phong"))}function WX(t){"materials"in t?t.materials.forEach(e=>{e!==void 0&&typeof e!="string"&&k_(e)}):"material"in t&&t.material!==void 0&&typeof t.material!="string"&&k_(t.material)}function pF(t){t.timelineAnimations=ea({},$t.prototype)}function eA(t){t.pivot=[0,0,0],t.pivotRotation=[0,0,0]}function qX(t){}function XX(t){let e=t.schema??0;if(e!==130){console.warn("updating from ",e,"to ",130),function(i,n){if(n<1&&(ko(i,gI),Fo(i,gI),i.schema=1),n<2&&(function(r){Object.assign(r.scene.publish,{orbitControls:{...z_.defaultData,...cn(r.scene.publish.orbitControls)}})}(i),i.schema=2),n<3&&(function(r){function a(s){if(s.layers){for(let o of Object.values(s.layers))if(o){for(let[l,c]of Object.entries(o))if((MC.includes(l)||typeof c=="boolean")&&delete o[l],l==="texture")for(let[h,d]of Object.entries(c))(qN.includes(h)||typeof d=="boolean")&&delete c[h]}}}r.scene.objects.traverse((s,o)=>{o.states.forEach(l=>{let c=l;c.material?a(c.material):c.materials&&c.materials.forEach(h=>{a(h)})})})}(i),i.schema=3),n<4&&(function(r){r.scene.publish.withBackground=!0}(i),i.schema=4),n<5&&(function(r){r.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),n<6&&(function(r){r.scene.objects.traverse((a,s)=>{let o=s.cloner;o&&(o.radial.scale=o.radial.scale.map(l=>l+1),o.linear.scale=o.linear.scale.map(l=>l+1))})}(i),i.schema=6),n<7&&(function(r){r.scene.objects.traverse((a,s)=>{let o=s.geometry;o&&(o.type==="DodecahedronGeometry"||o.type==="IcosahedronGeometry")&&(o.detail=Math.round(o.detail))})}(i),i.schema=7),n<8&&(i.schema=8),n<9&&(yI(i),i.schema=9),n<10&&(function(r){r.scene.objects.traverse((a,s)=>{s.type==="Mesh"&&(s.geometry.type==="BooleanGeometry"||s.geometry.type==="SubdivGeometry")&&(s.geometry.phongAngle=35)})}(i),i.schema=10),n<11&&(function(r){r.scene.environment.ambientLight.softShadows=!1,r.scene.environment.ambientLight.softShadowQuality="low",r.scene.objects.traverse((a,s)=>{(s.type==="DirectionalLight"||s.type==="SpotLight")&&(s.shadowResolution=1024,s.shadowRadius=1,s.depth=1e5)}),r.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),n<12&&(yI(i),i.schema=12),n<13&&(function(r){r.shared.audios=ea({},$t.prototype)}(i),i.schema=13),n<14&&(function(r){let a=r.shared.materials;Object.entries(a).forEach(([s,o])=>{if(!o.layers){let l={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(a,{[s]:l})}})}(i),i.schema=14),n<15&&(function(r){Object.entries(cn(r.shared.images)).filter(a=>a[1].asset===!1).map(a=>a[0]).forEach(a=>{delete r.shared.images[a]}),Object.entries(cn(r.shared.audios)).filter(a=>a[1].asset===!1).map(a=>a[0]).forEach(a=>{delete r.shared.audios[a]})}(i),i.schema=15),n<16&&(function(r){r.scene.publish.settings.web.preload=!1}(i),i.schema=16),n<17&&(ko(i,_I),Fo(i,_I),i.schema=17),n<18&&(ko(i,vI),Fo(i,vI),i.schema=18),n<19&&(function(r){Object.assign(r.scene.publish.settings,{video:{...el.defaultData.settings.video,...cn(r.scene.publish.settings.video)}})}(i),i.schema=19),n<20&&(function(r){r.shared.fonts=ea({},$t.prototype)}(i),function(r){let a=[];r.scene.objects.traverse((s,o)=>{let l=o;if(l.type==="TextFrame"){let c=Vi.defaultTwoLayerData("phong"),h=typeof l.color=="string"?r.shared.colors[l.color]:l.color;c.layers[1].data.color={r:h.r,g:h.g,b:h.b},c.layers[1].data.alpha=l.alpha;let d=function(f){return f.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(g=>g.charAt(0).toUpperCase()+g.slice(1)).join(" ")}(l.font);r.shared.fonts[d]===void 0&&(r.shared.fonts[d]={name:d});let u={name:l.name,...En.defaultData,...Ws.defaultData,flatShading:!1,wireframe:!1,geometry:{...Wo.defaultData("TextGeometry"),width:l.width,height:l.height,font:d,depth:0,horizontalAlign:l.horizontalAlign,verticalAlign:l.verticalAlign,fontSize:1.40625*l.fontSize,lineHeight:l.lineHeight/1.40625,letterSpacing:l.letterSpacing-1,text:l.text,textTransform:l.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:c,states:cn(l.states),events:cn(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=cn(r.scene.objects).parent(s);r.scene.objects.insertAfter(p??null,s,[{id:s+"new",data:u,children:[]}]),a.push(s)}}),a.forEach(s=>{r.scene.objects.delete(s)})}(i),i.schema=20),n<21&&(function(r){let a={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};r.scene.objects.traverse((s,o)=>{o.events.forEach(l=>{if(a[Number(l.type)])if(Object.assign(l,{type:a[Number(l.type)]}),l.type==="Audio"&&"audioEvent"in l&&(Object.assign(l,{playAudio:l.audioEvent}),delete l.audioEvent),l.type==="GameControl")Object.assign(l,{gameActions:{idle:new Vt,move:new Vt,jump:new Vt}});else{let c=new Vt;Object.assign(l,{actions:c}),(l.type==="MouseDown"||l.type==="MouseUp"||l.type==="KeyDown"||l.type==="KeyUp")&&"url"in l&&c.push({fi:0,id:It.generateUUID(),data:{type:"Link",url:l.url,delay:0}}),"targets"in l&&(l.targets.forEach((h,d,u)=>{let p={easing:h.easing,duration:h.duration};h.easing===6?Object.assign(p,vc(h,"mass","stiffness","damping","velocity")):h.easing===5&&Object.assign(p,{control1:{...h.control1},control2:{...h.control2}});let f={repeat:h.repeat?-1:0,delay:h.delay,delayDirection:h.delayDirection,direction:h.cycle&&h.rewind?"pingpong-rewind":h.cycle?"pingpong":"normal"},g={state:h.state,...f,...p},m={allowSlerp:!0,type:"Transition",object:h.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Vt({fi:0,id:It.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:It.generateUUID(),data:g})};c.push({fi:u,id:d,data:m})}),delete l.targets)}})})}(i),function(r){r.scene.objects.traverse((a,s)=>{function o(l,c){let h=new Vt,d=[];if(s.events.forEach((u,p,f)=>{if(u.type==="Audio"&&u.trigger===c){let g;d.push(p),u.interaction==="play"?g={...vc(u,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in u?u.after:void 0,toggle:"after"in u?u.toggle:void 0,type:"Audio"}:(u.interaction==="pause"||u.interaction==="stop")&&(g={...vc(u,"interaction","delay","object","playAudio"),type:"Audio"}),g&&h.push({fi:f,id:p,data:g})}}),d.forEach(u=>s.events.delete(u)),h.length){let u=s.events.find(p=>p.type===l)?.data;u?"actions"in u&&u.actions.insertBefore(null,h):s.events.insertBefore(null,[{id:It.generateUUID(),data:{type:l,actions:h}}])}}o("Start","start"),o("MouseDown","mouseDown"),o("MouseUp","mouseUp"),o("KeyDown","keyDown"),o("KeyUp","keyUp")})}(i),i.schema=21),n<22&&(wI(i),i.schema=22),n<23&&(function(r){r.scene.objects.traverse((a,s)=>{s.type==="Mesh"&&s.geometry.type==="SubdivGeometry"&&(s.geometry.scaleBaked||(s.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),n<24&&(function(r){r.scene.objects.traverse((a,s)=>{(s.type==="Empty"||s.type==="Mesh")&&s.cloner&&!s.cloner.randomnessObject&&!s.cloner.toObject&&!s.cloner.randomness&&(s.cloner={...s.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}(i),i.schema=24),(n<25||i.shared.videos===void 0)&&(function(r){r.shared.videos=ea({},$t.prototype)}(i),n<25&&(i.schema=25)),n<26&&(function(r){r.scene.objects.traverse((a,s)=>{let o=r.scene.objects.unproxy().parent(a);if(o){let l=cn(r.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&s.type==="Mesh"&&(s.visible=cn(s).booleanExclude!==!0)}})}(i),i.schema=26),n<27&&(function(r){r.scene.objects.traverse((a,s)=>{if(s.type==="Mesh"){let o=s;s.geometry.type==="NonParametricGeometry"?o.material!==void 0&&delete o.material:o.materials!==void 0&&delete o.materials}})}(i),i.schema=27),n<28&&(wI(i),i.schema=28),n<29&&(function(r){function a(o){Object.setPrototypeOf(o,gn.prototype),o.texture&&Object.setPrototypeOf(o.texture,gn.prototype)}function s(o){Object.setPrototypeOf(o,gn.prototype);for(let l in o)a(o[l])}r.scene.objects.traverse((o,l)=>{l.states.forEach(c=>{let h=c;if(h.material){let d=cn(h.material).layers;s(d),h.material.layers=d}if(h.materials)for(let d=0;d<h.materials.length;d++){let u=h.materials[d],p=cn(u).layers;s(p),u.layers=p}})})}(i),i.schema=29),n<30&&(function(r){r.scene.objects.traverse((a,s)=>{s.type==="Mesh"&&s.geometry.type==="NonParametricGeometry"&&!("material"in s)&&!("materials"in s)&&(s.material=Vi.defaultTwoLayerData("phong"))})}(i),i.schema=30),n<31&&(function(r){r.scene.publish.orbitControls.autoZoom===void 0&&(r.scene.publish.orbitControls.autoZoom=!1),r.scene.objects.traverse((a,s)=>{(s.type==="OrthographicCamera"||s.type==="PerspectiveCamera")&&(s.orthographic.autoZoom===void 0&&(s.orthographic.autoZoom=!1),s.orthographic.autoZoomFrustumSize===void 0&&(s.orthographic.autoZoomFrustumSize=790))})}(i),i.schema=31),n<33&&(function(r){r.scene.objects.traverse((a,s)=>{s.pathSnapping===void 0&&(s.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),s.pathSnapping.offset===void 0&&(s.pathSnapping.offset=0)})}(i),i.schema=33),n<34&&(function(r){r.scene.publish.mouseEventTarget===void 0&&(r.scene.publish.mouseEventTarget="canvas"),r.scene.publish.settings.web.hint===void 0&&(r.scene.publish.settings.web.hint=!1)}(i),i.schema=34),n<35&&(function(r){let{video:a}=r.scene.publish.settings;a.format==="gif"&&a.fps>48&&(a.fps=15)}(i),i.schema=35),n<36&&(function(r){r.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-s.position[1]))})})}(i),i.schema=36),n<37&&(function(r){let a=r.scene.environment.usePhysics;r.scene.objects.traverse((s,o)=>{a&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),n<38&&(ko(i,bI),Fo(i,bI),i.schema=38),n<39&&(function(r){r.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=F_.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),n<40&&(function(r){r.scene.styles||(r.scene.styles=Ac.defaultData())}(i),i.schema=40),n<41&&(function(r){r.scene.environment.ambientLight.occlusion===void 0&&(r.scene.environment.ambientLight.occlusion=!1),r.scene.environment.ambientLight.aoFullRes===void 0&&(r.scene.environment.ambientLight.aoFullRes=!1),r.scene.environment.ambientLight.radius===void 0&&(r.scene.environment.ambientLight.radius=256),r.scene.environment.ambientLight.bias===void 0&&(r.scene.environment.ambientLight.bias=.5),r.scene.environment.ambientLight.aoColor===void 0&&(r.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),ko(r,SI),Fo(r,SI)}(i),i.schema=41),n<42&&(function(r){r.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Vt})})})}(i),i.schema=42),n<43&&(function(r){r.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),n<99){ko(i,MI),Fo(i,MI),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=Qc);let r=cn(i.scene.objects),a=i.scene.objects;i.scene.publish.playPage=qu,a.insertBefore(null,null,[{id:qu,data:{...Fc.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:vc(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:vc(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...$u.defaultData,...vc(i.scene.environment,"usePhysics","gravity")},camera:cn(i.scene.ownerCamera)??Fc.defaultData.camera,name:"Scene"},children:[]}]);for(let l of r)l.id!==Tc.TRASH_CAN_ID&&a.move(qu,l.fi,l.id);let s=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,c)=>{c.type==="DirectionalLight"?(c.penumbraSize=i.shared.penumbraSize[Math.min(s,2)],s+=1):c.type==="SpotLight"&&(c.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(c.physics===void 0||c.physics===null)&&c.type!=="Instance"&&(c.physics={},Object.assign(c.physics,Xu.defaultData)),c.physics!==void 0&&c.physics!==null&&(c.physics.enabled=c.collision??"visibility",delete c.collision)}),i.schema=99}}(t,e),e<100&&(t.scene.publish.joystickSizeAndXYOffset===void 0&&(t.scene.publish.joystickSizeAndXYOffset=el.defaultData.joystickSizeAndXYOffset),t.schema=100),e<101&&(ko(t,EI),Fo(t,EI),t.schema=101),e<102&&(function(i){i.scene.objects.traverse((n,r)=>{let a=r.geometry;a&&a.type==="PathGeometry"&&(a.extrusion.capType="flat",a.extrusion.bevel=50,a.extrusion.bevelSides=6,a.extrusion.shape.type==="Custom"&&(a.extrusion.shape.shapeQuality="low"))})}(t),t.schema=102),e<104&&(t.shared.catelogs=new $t,t.shared.lib=qo.defaultData(),t.schema=104),e<105&&(function(i){i.shared.variables=ea({},$t.prototype)}(t),t.scene.objects.traverse((i,n)=>{cF(n)}),t.schema=105);for(let i of Object.values(t.shared.lib.components))dF(i);e<106&&(function(i){let n=cn(i.shared.variables);i.shared.variables=ea(Object.entries(n??{}).map(([r,a],s)=>({fi:s,id:r,data:a})),Vt.prototype)}(t),t.schema=106),e<107&&(t.shared.lib.variables=qo.defaultData().variables,t.schema=107),e<109&&(function(i){i.shared.particles=ea({},$t.prototype),i.shared.lib&&(i.shared.lib.particles=qo.defaultData().particles)}(t),t.schema=109),e<110&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Particle"&&typeof r.renderMaterial.size=="number"&&Object.assign(r.renderMaterial,{size:[r.renderMaterial.size,r.renderMaterial.size]})})}(t),t.schema=110),e<111&&(t.scene.objects.traverse((i,n)=>{(function(r){Array.isArray(cn(r.events))&&r.events?.forEach(a=>{"disabled"in a||(a.disabled=!1),(a.type==="MouseDown"||a.type==="MouseUp"||a.type==="MousePress")&&(a.mode=a.mode||"Object")})})(n)}),t.schema=111),e<112&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Page"&&(r.postprocessing.depthOfField.focusDistance=100,r.postprocessing.depthOfField.focalLength=20,r.postprocessing.depthOfField.bokehScale=5)})}(t),t.schema=112),e<113&&(function(i){i.scene.objects.traverse((n,r)=>{Array.isArray(cn(r.events))!==!1&&r.events?.forEach(a=>{let s=a.runMode;a.type==="MouseDown"||a.type==="MouseUp"||a.type==="KeyDown"||a.type==="KeyUp"||a.type==="Collision"||a.type==="Trigger"?a.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=s??"Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode=s==="Toggle"?"Toggle":"Normal")}):a.type==="MouseHover"||a.type==="MousePress"||a.type==="KeyPress"?a.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):a.type==="GameControl"?(delete a.actions,Object.keys(a.gameActions).forEach(o=>{a.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&(l.runMode="Normal")})})):a.type==="DragDrop"?(delete a.actions,a.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),a.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):a.type==="Resize"?(delete a.actions,a.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):a.type==="Start"?a.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):a.type==="VariableChange"||a.type==="Scroll"?a.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):a.type==="Conditional"&&(delete a.actions,a.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}),a.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(t),t.schema=113),e<114&&(t.scene.publish.settings.web.imageQuality===void 0&&(t.scene.publish.settings.web.imageQuality=70),t.schema=114),e<115&&(function(i){i.shared.userAPIs=ea({},$t.prototype),i.shared.userWebhooks=ea({},$t.prototype),i.shared.lib&&(i.shared.lib.userAPIs=qo.defaultData().userAPIs,i.shared.lib.userWebhooks=qo.defaultData().userWebhooks)}(t),t.schema=115),e<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=el.defaultData.settings.videoStatic)}(t),t.schema=116),e<117&&(t.scene.publish.settings.web.pixelRatioMobile===void 0&&(t.scene.publish.settings.web.pixelRatioMobile=0),t.scene.publish.settings.web.pixelRatioDesktop===void 0&&(t.scene.publish.settings.web.pixelRatioDesktop=0),t.schema=117),e<118&&(t.shared.timelineAnimations=ea({},$t.prototype),t.scene.objects.traverse((i,n)=>{pF(n)}),t.schema=118),e<119&&(t.scene.publish.settings.videoStatic.format=Yu.defaultData.scene.publish.settings.videoStatic.format,t.scene.publish.settings.videoStatic.imageFormat=Yu.defaultData.scene.publish.settings.videoStatic.imageFormat,t.schema=119),e<120&&(t.scene.publish.settings.image.colorSpace="display-p3",t.scene.publish.settings.videoStatic.colorSpace="display-p3",t.schema=120),e<121&&(t.scene.objects.traverse((i,n)=>{eA(n),n.type==="Page"&&n.camera!==void 0&&eA(n.camera)}),t.schema=121),e<122&&(delete t.scene.publish.settings.video,t.scene.publish.orbitControls.rotationSpeed=Yu.defaultData.scene.publish.orbitControls.rotationSpeed,t.schema=122),e<123&&(t.scene.objects.traverse((i,n)=>{n.type==="Page"&&n.sky===void 0&&(n.sky=Wl.defaultData)}),t.schema=123),e<124&&(e>=123&&t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(typeof r.exposure=="number"&&(r.exposure=Math.round(r.exposure/5e-4*1e4)/1e4),r.lighting===void 0&&(r.lighting=Wl.defaultData.lighting))}),t.schema=124),e<125&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingIntensity===void 0&&(r.lightingIntensity=Wl.defaultData.lightingIntensity)}),t.schema=125),e<126&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(r.mode===void 0&&(r.mode="physical"),r.hdri===void 0?r.hdri={...Wl.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=Wl.defaultData.hdri.blur),Array.isArray(r.hdri.rotation)&&(r.hdri.rotation=r.hdri.rotation[1]??0)))}),t.schema=126),e<127&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r?.hdri!==void 0&&r.hdri.showBackground===void 0&&(r.hdri.showBackground=!0)}),t.schema=127),e<128&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingQuality===void 0&&(r.lightingQuality="full")}),t.schema=128),e<129&&(t.scene.objects.traverse((i,n)=>{if(n.type==="Page"){n.camera===void 0&&(n.camera=Fc.defaultData.camera);let r=n.camera;r.far=1e5,r.perspective?r.perspective.near=70:r.perspective={near:70,fov:45,zoom:1}}}),t.schema=129),e<130&&(uF(t,k_),t.schema=130)}}jg(hF,{updateAllMaterials:()=>uF,updateDocumentSchema:()=>XX,updateLibSchema:()=>qX,updateMaterialSchema:()=>HX,updateObjectStateRec:()=>Lu,updateObjectsSchema:()=>dF,updateTextValues:()=>GX});var Ec,TI,av,fS,CI,sv,Cc,Df,Bd,ov,mS,n1,gS,vS,PI,r1,yS,kc,iA,Hb=k(()=>{lF(),Ye(),jX(),Gb(),Vb(),sr(),OC(),jb(),CC(),Ec=180/Math.PI}),$X=k(()=>{var t,e,i;xa(),Ye(),sr(),(TI||(TI={})).is=function(n){return!0},(t=av||(av={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},t.merge=function(n,r){return{position:r?.position??n.position,rotation:r?.rotation??n.rotation,scale:r?.scale??n.scale,shear:r?.shear??n.shear}},t.diff=function(n,r){return MN({position:eo.isEqual(n.position,r.position)?void 0:r.position,rotation:n.rotation===r.rotation?void 0:r.rotation,scale:eo.isEqual(n.scale,r.scale)?void 0:r.scale,shear:n.shear&&r.shear&&eo.isEqual(n.shear,r.shear)?void 0:r.shear})},(fS||(fS={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(CI||(CI={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(sv||(sv={})).defaultData={opacity:1,fill:{color:Je.fromHexAndA(Rr,1),enabled:!0},stroke:{color:Je.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0}},(e=Cc||(Cc={})).newEmpty=function(n,r){return{name:r}},e.patch=function(n,r){if(r===void 0)return n;let a={...n};return Object.assign(a,av.merge(a,r)),a=function(s,o){if(o===void 0)return s;let l={...s},c=["width","height","cornerRadius"];for(let h of c)h in l&&h in o&&o[h]!==void 0&&Object.assign(l,{[h]:o[h]});return l}(a,r),a=function(s,o){if(o===void 0)return s;let l={...s};return"fill"in l&&"fill"in o&&o.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...o.fill}}),"stroke"in l&&"stroke"in o&&o.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...o.stroke}}),"layerBlur"in l&&"layerBlur"in o&&o.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...o.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in o&&o.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...o.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in o&&o.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...o.dropShadow}}),"innerShadow"in l&&"innerShadow"in o&&o.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...o.innerShadow}}),l}(a,r),a},e.toOps=function(n,r){let a,s=[];for(let[o,l]of Object.entries(r))o!=="name"&&(a===void 0&&(a={path:[],props:{},type:0},s.push(a)),a.props[o]=l);return s},(Df||(Df={})).defaultData={...av.defaultData,...fS.defaultData,states:new Vt,events:new Vt,visible:!0,raycastLock:!1},(Bd||(Bd={})).defaultData={...Df.defaultData,...sv.defaultData},(ov||(ov={})).defaultData={cornerRadius:[0,0,0,0]},(mS||(mS={})).defaultData={...Bd.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(n1||(n1={})).defaultData={...Bd.defaultData,...ov.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(gS||(gS={})).defaultData={...Bd.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"},(vS||(vS={})).defaultData={...Bd.defaultData,type:"path2d",path:"",name:"Path"},(PI||(PI={})).is=function(n){return n.type==="ellipse2d"||n.type==="rectangle2d"||n.type==="text2d"||n.type==="vector2d"||n.type==="path2d"},(r1||(r1={})).defaultData={...Df.defaultData,name:"Group",type:"group2d"},(yS||(yS={})).defaultData=()=>({...Df.defaultData,...ov.defaultData,...sv.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Je.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Je.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(n=>{n.defaultData=function(r){switch(r){case"rectangle2d":case"vector2d":return{...n1.defaultData};case"ellipse2d":return{...mS.defaultData};case"text2d":return{...gS.defaultData};case"path2d":return{...vS.defaultData};case"frame2d":return{...yS.defaultData()};case"group2d":return{...r1.defaultData}}},n.getPivot=function(r){return"width"in r&&"height"in r?[typeof r.width=="number"?.5*r.width:0,typeof r.height=="number"?.5*r.height:0]:[0,0]},n.isResizeable=function(r){return r.type==="rectangle2d"||r.type==="ellipse2d"||r.type==="text2d"||r.type==="frame2d"},n.isAutoLayoutable=function(r){return r.type==="frame2d"&&r.autoLayout!==void 0},n.hasCorners=function(r){return r.type==="rectangle2d"||r.type==="frame2d"}})(kc||(kc={})),(i=iA||(iA={})).defaultData={name:"UI",type:"scene2d",objects:new Xn},i.emptyData=function(){return{type:"scene2d",objects:new Xn}}}),YX=k(()=>{UX(),zX(),YN(),ZN(),lF(),HN(),VX(),eF(),rF(),CC(),Hb(),oF(),TC(),AC(),KN(),Vb(),tF(),aF(),xa(),Gb(),jb(),DC(),nF(),OC(),RC(),NX(),iF(),IC(),PC(),QN(),JN(),$X()});function Pc(t,e=!1){let i=t[0].index!==null,n=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),a={},s={},o=t[0].morphTargetsRelative,l=new Gt,c=0;for(let h=0;h<t.length;++h){let d=t[h],u=0;if(i!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.attributes[p]),u++}if(u!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(o!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.morphAttributes[p])}if(e){let p;if(i)p=d.index.count;else{if(d.attributes.position===void 0)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;p=d.attributes.position.count}l.addGroup(c,p,h),c+=p}}if(i){let h=0,d=[];for(let u=0;u<t.length;++u){let p=t[u].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+h);h+=t[u].attributes.position.count}l.setIndex(d)}for(let h in a){let d=DI(a[h]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,d)}for(let h in s){let d=s[h][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let u=0;u<d;++u){let p=[];for(let g=0;g<s[h].length;++g)p.push(s[h][g][u]);let f=DI(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(f)}}}return l}function DI(t){let e,i,n,r=-1,a=0;for(let c=0;c<t.length;++c){let h=t[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(i===void 0&&(i=h.itemSize),i!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=h.normalized),n!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=h.gpuType),r!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;a+=h.count*i}let s=new e(a),o=new Ht(s,i,n),l=0;for(let c=0;c<t.length;++c){let h=t[c];if(h.isInterleavedBufferAttribute){let d=l/i;for(let u=0,p=h.count;u<p;u++)for(let f=0;f<i;f++){let g=h.getComponent(u,f);o.setComponent(u+d,f,g)}}else s.set(h.array,l);l+=h.count*i}return r!==void 0&&(o.gpuType=r),o}var Wg=k(()=>{rt()});function fF(t){let e=t.points.length/7,i=new Vt;for(let n=0;n<e;n++){let r=7*n,a=t.points[r+0],s=t.points[r+1],o=t.points[r+2],l=t.points[r+3],c=t.points[r+4],h=t.points[r+5],d=t.points[r+6];i.push({fi:n,id:It.generateUUID(),data:{roundness:d,position:[a,s],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[c,h]}}})}return{points:i,isClosed:t.isClosed,roundness:t.roundness,shapeHoles:t.shapeHoles?.map(n=>fF(n))??[]}}function mF(t){let{userData:e,uuid:i,...n}=t;if(e===void 0||e.type==="NonParametricGeometry")return function(s){let o,{userData:l,data:c}=s,h=c?.groups,d=c?.attributes??{},u=c?.morphAttributes??{},p=c?.interleavedBuffers,f=c?.arrayBuffers,g=c?.index;d.position!==void 0&&Array.isArray(d.position.array)&&(o=function(y){let v=1/0,_=1/0,b=1/0,x=-1/0,w=-1/0,S=-1/0;for(let T=0;T<y.length;T+=3){let E=y[T],P=y[T+1],A=y[T+2];v=Math.min(v,E),_=Math.min(_,P),b=Math.min(b,A),x=Math.max(x,E),w=Math.max(w,P),S=Math.max(S,A)}return{width:x-v,height:w-_,depth:S-b}}(d.position.array));let m={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:u,interleavedBuffers:p,arrayBuffers:f},...o===void 0?{}:o,type:"NonParametricGeometry"};return g!==void 0&&Object.assign(m.data,{index:g}),h!==void 0&&Object.assign(m.data,{groups:h.map(y=>({...y,materialIndex:y.materialIndex??0}))}),m}(t);if(e.type==="SubdivGeometry"){let s="SubdivGeometry",o=n.data?.attributes;if(o?.positionWASM===void 0){let c=new Gt;if(o?.position===void 0||o?.faceMap===void 0)return null;let h=o.position.array,d=o.faceMap.array,u=n.data.index.array;c.setAttribute("position",new Ft(h,3)),c.setIndex(new oh(u,1));let p=function(y,v=1e-4){v=Math.max(v,Number.EPSILON);let _={},b=y.getIndex(),x=y.getAttribute("position"),w=b?b.count:x.count,S=0,T=Object.keys(y.attributes),E={},P={},A=[],R=["getX","getY","getZ","getW"],O=["setX","setY","setZ","setW"];for(let H=0,J=T.length;H<J;H++){let K=T[H],tt=y.attributes[K];E[K]=new tt.constructor(new tt.array.constructor(tt.count*tt.itemSize),tt.itemSize,tt.normalized);let ct=y.morphAttributes[K];ct&&(P[K]||(P[K]=[]),ct.forEach((et,st)=>{let dt=new et.array.constructor(et.count*et.itemSize);P[K][st]=new et.constructor(dt,et.itemSize,et.normalized)}))}let D=.5*v,I=Math.log10(1/v),U=Math.pow(10,I),N=D*U;for(let H=0;H<w;H++){let J=b?b.getX(H):H,K="";for(let tt=0,ct=T.length;tt<ct;tt++){let et=T[tt],st=y.getAttribute(et),dt=st.itemSize;for(let Y=0;Y<dt;Y++)K+=~~(st[R[Y]](J)*U+N)+","}if(K in _)A.push(_[K]);else{for(let tt=0,ct=T.length;tt<ct;tt++){let et=T[tt],st=y.getAttribute(et),dt=y.morphAttributes[et],Y=st.itemSize,ht=E[et],F=P[et];for(let B=0;B<Y;B++){let j=R[B],Z=O[B];if(ht[Z](S,st[j](J)),dt)for(let L=0,W=dt.length;L<W;L++)F[L][Z](S,dt[L][j](J))}}_[K]=S,A.push(S),S++}}let G=y.clone();for(let H in y.attributes){let J=E[H];if(G.setAttribute(H,new J.constructor(J.array.slice(0,S*J.itemSize),J.itemSize,J.normalized)),H in P)for(let K=0;K<P[H].length;K++){let tt=P[H][K];G.morphAttributes[H][K]=new tt.constructor(tt.array.slice(0,S*tt.itemSize),tt.itemSize,tt.normalized)}}return G.setIndex(A),G}(c),f=[],g=new Array(d[d.length-1]+1).fill(3),m=p.getIndex().array;for(let y=0,v=d.length;y<v;)d[y]===d[y+1]?(g[d[y]]++,f.push(...new Set(m.slice(3*y,3*y+6))),y+=2):(f.push(...m.slice(3*y,3*y+3)),y++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:g}}if(o?.positionWASM===void 0||o?.positionWASM.length===0||o?.indexWASM===void 0||o?.indexWASM.length===0||o?.verticesPerFaceWASM===void 0||o?.verticesPerFaceWASM.length===0)return null;let l={type:s,...ZX(o.positionWASM.array)};l.subdivisions=e.parameters.subdivisions;for(let c in o)c==="positionWASM"?l[c]=new Float32Array(o[c].array):c==="indexWASM"?l[c]=new Int32Array(o[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(o[c].array));return l.scaleBaked=[1,1,1],l}let r=e.type,a=e.parameters;return r==="VectorGeometry"?(a.extrudeDepth&&(a.depth=a.extrudeDepth),{...a,width:100,height:100,shape:fF(e.shape),type:r}):r==="LatheGeometry"?{...e.parameters,type:r,points:(e?.parameters.points??[]).map(s=>[s.x,s.y])}:(a.extrudeDepth&&(a.depth=a.extrudeDepth),{...a,type:r})}function ZX(t){return nA.setFromArray(t),nA.getSize(Cm),{width:Cm.x,height:Cm.y,depth:Cm.z}}var nA,Cm,KX=k(()=>{Ye(),rt(),Wg(),new At,new Yt,new Ti,new C,new C,nA=new ci,Cm=new C}),QX=k(()=>{}),JX=k(()=>{Ye(),Hb()});function An(t,e=[0,0]){return[t&&!isNaN(t[0])?t[0]:e[0],t&&!isNaN(t[1])?t[1]:e[1]]}function na(t,e,i){switch(t){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:n,control2:r}=e??{...x_.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:a,velocity:s}=i??{...b_.defaultData},o=new gF(n,r,a,s),l=o.solve(1);return()=>c=>o.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}function RI(t,e,i){return{id:e,fi:i,data:{id:e,path:t,keyframes:new Vt}}}var OI,II,rA,gF,vF,al,ag,yF,xp,Rf,lv,_S,wp,LI,bS,BI,xS,pp,El,Al,To,wS,UI,zI,SS,aA,il,t$=k(()=>{var t;Ye(),xa(),(OI||(OI={})).is=function(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"},(t=II||(II={})).getControlsWithDefault=function(e,i){let n=[0,0],r=[1,1];if(e?.cubicControls)n=An(e.cubicControls.control1,n);else switch(e?.type){case 2:case 4:n=[.42,0];break;case 3:case 0:n=[0,0];break;case 1:n=[.25,.1];break;case 7:n=[.25,1]}if(i?.cubicControls)r=An(i.cubicControls.control2,r);else switch(i?.type){case 2:case 0:r=[1,1];break;case 3:case 4:r=[.58,1];break;case 1:r=[.25,1];break;case 7:r=[.5,1]}return{control1:n,control2:r}},t.defaultData=function(e,i){return{id:e,name:i,to:5,properties:new Vt}},t.createMaterialGroup=function(e){let i=new Vt;return e.forEach(({data:n,id:r,fi:a})=>{if(n.type==="light"){let s=RI(["material",`${n.category} lighting`],r,a);i.push(s)}else{let s=RI(["material",n.type],r,a);i.push(s)}}),i},t.createName=function(e){return Object.entries(e).reduce((i,[n,r])=>(typeof r!="string"&&i.push({name:r.name}),i),[])},t.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:na(3),duration:1e3},opacity:{value:[0,1],easing:na(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:na(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:na(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:na(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}],rA=["x","y","z"],gF=class{constructor(e=1,i=100,n=10,r=0){this.mass=e,this.stiffness=i,this.damping=n,this.initialVelocity=r,this.m_w0=Math.sqrt(i/e),this.m_zeta=n/(2*Math.sqrt(i*e)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(e){return 1-(this.m_zeta<1?Math.exp(-e*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*e)+this.m_B*Math.sin(this.m_wd*e)):(this.m_A+this.m_B*e)*Math.exp(-e*this.m_w0))}getDuration(){let e=.16666666666666666,i=0,n=0;for(;;)if(i+=e,this.solve(i)===1){if(n++,n>=16)break}else n=0;return i*e*1e3}}}),te=k(()=>{YX(),QX(),kX(),Hb(),JX(),t$(),IC(),Ye()}),ll=k(()=>{vF=[3,4,8,9],al=5,ag=3,yF=32}),qg=k(()=>{rt(),xp=t=>{var e;return(e=class extends t{}).geometryHelper=new _s(30,30,30),e}}),Xg=k(()=>{rt(),Rf=new Zo,lv=new vr,_S=new At,wp=(t,e,i,n,r=!1,a=t)=>{let s=e,o=a.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),lv.copy(s.boundingSphere),lv.applyMatrix4(o),i.ray.intersectsSphere(lv)===!1||(_S.copy(o).invert(),Rf.copy(i.ray).applyMatrix4(_S),s.boundingBox!==null&&Rf.intersectsBox(s.boundingBox)===!1))return;let l,c,h,d,u,p,f=s.index,g=s.attributes.position,m=s.drawRange;if(r===!1){for(u=Math.max(0,m.start),p=Math.min(f.count,m.start+m.count);u<p;u+=3)if(c=f.getX(u),h=f.getX(u+1),d=f.getX(u+2),l=y(t,i,Rf,g,c,h,d),l)return l.faceIndex=Math.floor(u/3),void n.push(l)}else{let v=s.attributes.position,_=new C,b=new C,x=new C,w=new C,S=2,T=1/((a.scale.x+a.scale.y+a.scale.z)/3),E=T*T;for(let P=Math.max(0,m.start),A=Math.min(v.count,m.start+m.count)-1;P<A;P+=S){if(_.fromBufferAttribute(v,P),b.fromBufferAttribute(v,P+1),Rf.distanceSqToSegment(_,b,w,x)>E)continue;w.applyMatrix4(a.matrixWorld);let R=i.ray.origin.distanceTo(w);R<i.near||R>i.far||n.push({distance:R,point:x.clone().applyMatrix4(a.matrixWorld),object:t})}}function y(v,_,b,x,w,S,T){let E=new C,P=new C,A=new C,R=new C,O=new C;if(E.fromBufferAttribute(x,w),P.fromBufferAttribute(x,S),A.fromBufferAttribute(x,T),b.intersectTriangle(E,P,A,!1,R)===null)return null;O.copy(R),O.applyMatrix4(v.matrixWorld);let D=_.ray.origin.distanceTo(O);return D<_.near||D>_.far?null:{faceIndex:1,distance:D,point:O.clone(),object:v}}}}),Wb=k(()=>{rt(),qg(),Xg(),LI=new C(1,1,1),bS=new C,BI=new C,xS=new Yt,pp=class extends xp(Wz){constructor(t,e=15){super(e),this.object=t,this.dummy=new _p,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(t,e){wp(this.object,pp.geometryHelper,t,e,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(t){this.object.matrixWorld.decompose(bS,xS,BI),this.matrix.compose(bS,xS,LI),super.updateMatrixWorld(t)}updateWorldMatrix(t,e){}}}),e$=k(()=>{rt(),El=new C,Al=new C,To=new At,wS=[new C(-1,1,1),new C(-1,-1,1),new C(1,-1,1),new C(1,1,1),new C(-1,1,-1),new C(-1,-1,-1),new C(1,-1,-1),new C(1,1,-1)],UI=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],zI=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],SS=(t,e,i)=>{t.updateEntityBoxSize(El,Al),To.copy(e).multiply(t.matrixWorld),Al.x===0&&Al.y===0&&Al.z===0?i.push(new C(El.x,El.y,El.z).applyMatrix4(To)):wS.forEach(n=>{i.push(n.clone().multiply(Al).add(El).applyMatrix4(To))})},aA=class extends ci{constructor(){super(...arguments),this.matrix=new At,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(e=>e.clone()),this.faces=t.faces.map(e=>e.clone()),this.edges=t.edges.map(e=>e.clone()),this.centerEdges=t.centerEdges.map(e=>e.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=new At().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let n=[];if(i===!0){let r=[];t.traverseEntity(a=>{if(a.visible||a.cloner&&a.data.visible){if(!("geometry"in a))return To.copy(e).multiply(a.matrixWorld),void r.push(new C().applyMatrix4(To));SS(a,e,n)}}),n.length===0&&n.push(...r)}else SS(t,e,n);return this.setFromPoints(n)}getCenter(t){return(t=super.getCenter(t)).applyMatrix4(this.matrix),t}getPositionToCenter(t){return(t=super.getCenter(t)).applyMatrix4(To.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Al).multiplyScalar(.5),this.getCenter(El),To.copy(this.matrix).setPosition(El),this.vertices=wS.map(t=>t.clone().multiply(Al).applyMatrix4(To))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=UI.map(([t,e])=>new _a(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new C))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=zI.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}}}),V_=k(()=>{il={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function sg(t){return t?.isParticleSystem===!0}function qc(t){return t?.isHairSystem===!0}function mh(t){return t?.isShapeBlendEntity===!0}function LC(t){return t?.isPathObject===!0}function oa(t){return t?.isObject2D===!0}function Cr(t){return t?.isUIObject===!0}function Bu(t){return t?.isCloner===!0}function Dc(t){return t?.isClone===!0}function a1(t){return t?.isComponentObject===!0}var Ui=k(()=>{});function Si(t){BC.add(t)}function Gn(t,e){let i=`${t}:${e}`;lA.has(i)||lA.add(i)}function j_(t,e){UC.set(t,e)}function MS(t){return UC.get(t)}function Sp(t,e){zC.set(t,e)}function ES(t){return zC.get(t)}function sA(t,e){NC.set(t,e)}function _F(t){return NC.get(t)}function oA(){return qb}var BC,lA,UC,zC,NC,qb,G_,ke=k(()=>{BC=new Set,lA=new Set,UC=new Map,zC=new Map,NC=new Map,qb=null,G_=null});function bF(t){let e=t.elements;ds.set(e[0],e[1],e[2]),us.set(e[4],e[5],e[6]),Ys.set(e[8],e[9],e[10])}function xF(){let t=Math.max(ds.lengthSq(),us.lengthSq(),Ys.lengthSq());ds.lengthSq()>Pm*t?va.copy(ds).normalize():va.set(1,0,0),ya.crossVectors(Ys,va),ya.lengthSq()<=Pm*t&&(ya.copy(us).addScaledVector(va,-us.dot(va)),ya.lengthSq()<=Pm*t&&function(e,i){e.set(1,0,0).cross(i),e.lengthSq()<=Pm&&e.set(0,1,0).cross(i),e.normalize()}(ya,va)),ya.normalize(),Rc.crossVectors(va,ya)}function wF(t){return bF(t),xF(),SF.makeBasis(va,ya,Rc)}var ds,us,Ys,va,ya,Rc,SF,Pm,Dm,hv,Oc,Xb,MF=k(()=>{rt(),ds=new C,us=new C,Ys=new C,va=new C,ya=new C,Rc=new C,SF=new At,Pm=1e-12,Dm=.01}),$g=k(()=>{rt(),MF(),hv=new At,(Oc||(Oc={})).is=function(t){return t&&t.__isSPEObject},Xb=t=>class extends t{constructor(){super(...arguments),this.previousModelViewMatrix=new At,this.copyPreviousMatrix=!0,this.hiddenMatrix=new At,this.pivotMatrix=new At,this.matrixWorldRigid=new At,this.shearScale=new At,this.shearScaleInv=new At}get __isSPEObject(){return!0}getPhysicsLocalMatrix(e){return!!this.rigidBody?.isDynamic()&&(e.copy(this.matrixWorld),this.hasNonUniformScale&&e.multiply(this.shearScaleInv),this.parent&&e.premultiply(hv.copy(this.parent.matrixWorld).invert()),e.premultiply(hv.copy(this.hiddenMatrix).invert()),e.multiply(hv.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(e){e instanceof bi&&(e=e.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===e)return!0;i=i.parent}return!1}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(let i of this.children)i.updateMatrixWorld(e)}updateWorldMatrix(e,i){let n=this.parent;if(e&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),i)for(let r of this.children)r.updateWorldMatrix(!1,!0)}traverseChildren(e,i=0){for(let n of this.children)Oc.is(n)&&n.traverseObject(e,i+1)}traverseObject(e,i=0){if(e(this,i)!==!0)for(let n of this.children)Oc.is(n)&&n.traverseObject(e,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(e,i,n){return bF(e),xF(),i.makeBasis(va,ya,Rc),n.set(va.dot(ds),va.dot(us),va.dot(Ys),0,ya.dot(ds),ya.dot(us),ya.dot(Ys),0,Rc.dot(ds),Rc.dot(us),Rc.dot(Ys),0,0,0,0,1),function(){let r=ds.length(),a=us.length(),s=Ys.length(),o=Math.max(r,a,s);if(o-r>Dm||o-a>Dm||o-s>Dm)return!0;let l=Dm*o*o;return Math.abs(ds.dot(us))>l||Math.abs(ds.dot(Ys))>l||Math.abs(us.dot(Ys))>l}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(e,i){this.updateWorldMatrix(!0,!1);let n=new At().copy(this.matrixWorld).invert();return e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),n.multiply(e.parent.matrixWorld)),"hiddenMatrix"in e&&e.hiddenMatrix instanceof At?e.hiddenMatrix.premultiply(n):e.applyMatrix4(n),e.updateWorldMatrix(!1,!1),this.add(e),i!==void 0&&(this.children.pop(),this.children.splice(i,0,e)),this}copy(e,i=!1){return super.copy(e,i),this.hasNonUniformScale=e.hasNonUniformScale,this}onAfterRender(e,i,n,r,a,s){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function NI(t,e,i){return ql.subVectors(e,t),Rg.subVectors(e,i),ql.cross(Rg).length()<=og}function EF(t){let e=dA.get(t.points);if(e!==void 0&&e.isClosed===t.isClosed)return e.curve;let i=function(n){let r=n.points,a=[r[0]],s=[new C(...r[0].data.position)];yc.copy(s[0]);for(let y=0;y<r.length-1;y++)ql.fromArray(r[y].data.position),Rg.fromArray(r[y+1].data.position),Mu.subVectors(ql,yc),Eu.subVectors(ql,Rg),Mu.cross(Eu).length()>og&&(a.push(r[y]),s.push(new C().copy(ql)),yc.copy(ql));let o=r[r.length-1];a.push(o),s.push(new C(...o.data.position));let l=n.isClosed,c=a.length-(l?0:1),h=a.length,d=[],u=[];for(let y=0;y<h;y++){let v=a[y].data;d.push(new C(...v.controlPrevious.position)),u.push(new C(...v.controlNext.position))}let p=[];for(let y=0;y<c;y++){let v=y===h-1?0:y+1;p.push(NI(s[y],u[y],s[v])&&NI(s[y],d[v],s[v]))}let f=[];for(let y=0;y<h;y++){let v=a[y].data,_=s[y],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[y],controlNext:u[y],tan:void 0,baseRoundness:v.roundness,removedLength:0};if(f.push(b),v.roundness===0||!l&&(y===0||y===h-1))continue;let x=l&&y==0?h-1:y-1,w=l&&y==h-1?0:y+1,S=new C().subVectors(s[x],_).normalize(),T=new C().subVectors(s[w],_).normalize();b.prevDir=S,b.nextDir=T;let E=p[l&&y===0?h-1:y-1],P=p[y];if(E&&P){_c.addVectors(S,T).normalize();let A=yc.crossVectors(_c,S).length()/S.dot(_c);b.tan=A,b.removedLength=v.roundness/A}}for(let y=0;y<c;y++){let v=l&&y===h-1?0:y+1,_=f[y],b=f[v];if(_.removedLength!==0||b.removedLength!==0){let x=_.position.distanceTo(b.position);_.removedLength=Math.min(_.removedLength,x/2),b.removedLength=Math.min(b.removedLength,x/2)}}let g=new Array(2*h).fill(null);for(let y=0;y<c;y++){let v=l&&y===h-1?0:y+1,_=f[y],b=f[v],x=null;if(p[y]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(yc.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(yc.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>og&&(x=new Km(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>og&&(x=new Km(_.position,_.controlNext,b.controlPrevious,b.position));g[2*y+1]=x}for(let y=0;y<h;y++){let v=f[y];if(v.removedLength===0)continue;let _=v.position,b=v.prevDir.clone().multiplyScalar(v.removedLength).add(_),x=v.nextDir.clone().multiplyScalar(v.removedLength).add(_),w=v.tan*v.removedLength;_c.addVectors(v.prevDir,v.nextDir).normalize(),Mu.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;cA.copy(_c).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Mu),s1.copy(_c).multiplyScalar(-w).add(cA);let T=_.distanceTo(s1)/_.distanceTo(Mu);Eu.copy(v.prevDir).multiplyScalar(T*_.distanceTo(b)).add(_),hA.copy(Eu).lerp(s1,2);let E=b.clone().lerp(Eu,4/3),P=x.clone().lerp(hA,4/3);g[2*y]=new Km(b,E,P,x)}let m=new AF;for(let y=0;y<g.length;y++){let v=g[y];v&&m.add(v)}return m}(t);return dA.set(t.points,{isClosed:t.isClosed,curve:i}),i}var AF,og,ql,Rg,yc,_c,Mu,s1,Eu,hA,cA,dA,Be,qs,FI,kI,Ud,AS,cv,dv,VI,TS,CS,$b,uA,Jc,Zs,TF=k(()=>{rt(),AF=class extends aE{constructor(){super()}getPoints(t=12){let e,i=[],n=this.getCurveLengths(),r=n[n.length-1]/n.length;for(let a=0,s=this.curves;a<s.length;a++){let o=s[a],l=a===0?n[a]:n[a]-n[a-1],c=Math.ceil(t*l/r),h=o.getPoints(c);for(let d=0;d<h.length;d++){let u=h[d];e&&e.equals(u)||(i.push(u),e=u)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},og=.001,ql=new C,Rg=new C,yc=new C,_c=new C,Mu=new C,s1=new C,Eu=new C,hA=new C,cA=new C,dA=new WeakMap}),Wr=k(()=>{rt(),te(),e$(),Ye(),V_(),Ui(),ke(),$g(),TF(),ti(),(Be||(Be={})).is=function(t){return t&&t.__isEntity},qs=t=>Be.is(t),FI={type:"completeState",isfromEntity:!0},kI=["x","y","z"],Ud=new C,AS=new C(1,1,1),cv=new Yt,dv=new Ti,VI=new C().set(0,1,0),TS=new At,CS=new At,$b=t=>class extends Xb(t){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new aA,this._recursiveBBox=new aA,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(e){let i=this.children[e];if(Be.is(i))return i}entityChildrenCount(){let e=this.children.length;for(;e--;)if(Be.is(this.children[e]))return e+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let e=this;for(;e.data.type!=="Instance";){let i=e.parent;if(!Be.is(i))return;e=i}return e}forInstancesRec(e){this.instances.forEach(i=>{i.disposed||e(i),i.forInstancesRec(e)})}super_Entity(e,i){typeof e=="string"&&(this.uuid=e),this.identity=e,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(e,i,n=!1){if(this.data.states.length!==0||n){for(let r of this.data.states)th.toOps(this.data,r.data).forEach(a=>{let s=f_.replaceProps(a,this.data);this.dataPatched=this.data,this.updateByPatchedOp(s,this.data,i)});if(e!==null){let r=this.data.states.data(e);r&&(this.dataPatched=th.patch(this.data,r),th.toOps(this.data,r).forEach(a=>{this.updateByPatchedOp(a,this.dataPatched,i)}))}n&&this.updateTransformState(this.dataPatched,i),this.stateSelection=e,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(e,i){e.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{qs(e)&&e.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(e=>{e.resetBBoxNeedsUpdateSelf()})}find(e){let i;return this.traverseEntity(n=>{n.uuid===e&&(i=n)}),i}traverseSortNextHelper(){let e=this.parent;if(e){let i=e.children,n=i.indexOf(this)+1;if(Be.is(i[n]))return i[n];if(Be.is(e))return e.traverseSortNextHelper()}}sortNext(){let e=this.children;return this.children.length>0&&Be.is(this.children[0])?e[0]:this.traverseSortNextHelper()}goUp(e){let i=this;for(;e>0&&i!==null;)i=i.parent,e-=1;return i}hasAnccestorOrSelf(e){return this===e||this.hasAnccestor(e)}hasAnccestor(e){let i=this.parent;for(;i;){if(e===i)return!0;i=i.parent}return!1}countToAccestor(e){let i=0,n=this;for(;n!==e;){if(n===null)return-1;n=n.parent,i+=1}return i}forEachEntity(e){for(let i of this.children)qs(i)&&e(i)}traverseEntityAncestors(e){this.traverseAncestors(i=>{Be.is(i)&&e(i)})}traverseConcreteEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)qs(n)&&n.isConcreteEntity&&n.traverseEntity(e,i+1)}traverseEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)qs(n)&&n.traverseEntity(e,i+1)}traverseVisibleEntity(e){e(this);for(let i of this.children)qs(i)&&i.visible&&i.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.dispatchEvent({type:"updateMatrixWorld"})}copy(e,i=!1){return super.copy(e,i),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),this}hasEntityChild(){return this.children.some(e=>qs(e))}isAncestorOf(e){if(this.uuid===e)return!1;let i=!1;return this.traverseEntity(n=>{n.uuid===e&&(i=!0)}),i}toObjectTransformState(e=[]){return this.updateWorldMatrix(!0,!1),ME({position:this.position.toArray(),rotation:[this.rotation.x*It.RAD2DEG,this.rotation.y*It.RAD2DEG,this.rotation.z*It.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]},e)}getTransformValues(e,i,n){return i[e].map((r,a)=>n?.shared.getVariable(r,[this.uuid,e,kI[a]])??r)}updateTransformState(e,i){let n=!1;if(e.position&&(this.position.fromArray(this.getTransformValues("position",e,i)),n=!0),e.rotation&&(Ud.fromArray(this.getTransformValues("rotation",e,i)).multiplyScalar(It.DEG2RAD),this.rotation.setFromVector3(Ud),n=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,i)),n=!0),e.hiddenMatrix!==void 0&&(n=!0,this.hiddenMatrix.fromArray(e.hiddenMatrix??Nc.identity)),e.pivot!==void 0||e.pivotRotation!==void 0){if(n=!0,e.pivot!==void 0&&e.pivotRotation!==void 0)this.pivotMatrix.compose(Ud.fromArray(e.pivot).negate(),cv.setFromEuler(dv.fromArray(e.pivotRotation.map(r=>r*It.DEG2RAD))).invert(),AS);else if(e.pivot!==void 0)this.pivotMatrix.setPosition(-e.pivot[0],-e.pivot[1],-e.pivot[2]);else if(e.pivotRotation!==void 0){let r=Ud.setFromMatrixPosition(this.pivotMatrix);cv.setFromEuler(dv.fromArray(e.pivotRotation.map(a=>a*It.DEG2RAD))).invert(),this.pivotMatrix.compose(r,cv,AS)}}return n&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)})),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),n}onVariableUpdate(e=!1){e?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(i=>{i.invalidateClonerTransform(this)}),this.requestRender())}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let e of this.children)Be.is(e)&&e.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(e=>{Be.is(e)&&e.disposeRecursively()})}toState(e=[]){return ME({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)},e)}updateByObjUpdateOp(e,i){e!==void 0&&this.updateByOp({type:0,props:e,path:[]},{...this.data,...e},i,!1)}updateByOp(e,i,n,r){let a=this.data;this.data=i;let s=e,o=ri(e.path,["states","*"]);if(o!==null){if(e.type===0){let[l]=o;if(this?.stateSelection===l){let c={...e.props};if(delete c.name,Object.values(e.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let d=jn.zoom(h,e.path.slice(2));if(d)for(let u in e.props)e.props[u]===void 0&&u in d&&(c[u]=d[u])}}s={...e,props:c,path:e.path.slice(2)}}}}else if(e.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(e.props.name!==void 0&&l.name){let{name:h,...d}=l;l=d}if(e.props.material!==void 0&&"material"in l){let{material:h,...d}=l;l=d}let c=jn.removeOverridden(e.path,e.props,l);s={...e,props:c}}}if(this.updateByPatchedOpBase(s,th.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),n),ri(e.path,["overrides"])){let l=[],c=[...e.path];for(l.push(c[1]),c.splice(0,2);c.length>0&&c[0]==="descendants";)l.push(c[1]),c.splice(0,2);if(l[l.length-1]===void 0){if(e.type===0)for(let h of Object.keys(e.props)){l[l.length-1]=h;let d=n.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=e.props[h],d.updateState(hh.apply(d.component.data,d.overrideData),n))}}else{let h=n.scene.findInstance([this.uuid,...l]);if(h){let d=jn.zoom(h.component.data,c);if((e={...e,path:c}).type===0){let u=e.props;if(d)for(let[p,f]of Object.entries(e.props))f===void 0&&(u===e.props&&(u={...e.props}),u[p]=d[p]);e={...e,props:u}}h.overrideData=U_.resolve(i.overrides,l),h.updateByOp(e,tr.applySimple(h.data,e),n,!1)}}}else if(this.instances.length>0){let l;if(e.path.length===0&&e.type===0){let c;for(let h of tl.rootOverrideProps)h in e.props&&(c===void 0&&(c={}),c[h]=e.props[h]);c&&(l={...e,props:c})}else for(let c of tl.rootOverrideProps)if(ri(e.path,[c])){l=e;break}l!==void 0&&this.instances.forEach(c=>{if(c.isInstanceRoot){let h=hh.filterOp(c.overrideData,l);h&&c.updateByOp(h,tr.applySimple(c.data,h),n,!0)}}),this.instances.forEach(c=>{if(!c.isInstanceRoot){let h=hh.filterOp(c.overrideData,e);if(h){let d;d=a===c.data&&e===h?i:tr.applySimple(c.data,h),c.updateByOp(h,d,n,!0)}}})}}updateByPatchedOpBase(e,i,n){if(this.dataPatched=i,e.path.length===0&&e.type===0)e.props.type!==void 0&&!Wc.is(e.props.type)&&il.changeEntityProptotype(this,i,n);else if(e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&"type"in e.props){il.changeEntityProptotype(this,i,n);for(let r of this.children)Be.is(r)&&r.updateVisible(n.scene)}this.updateByPatchedOp(e,i,n)}updateByPatchedOp(e,i,n){if(e.path.length===0&&e.type===0?this.updateState(e.props,n):e.type===0&&("resolutionLevel"in e.props||"useChildrenColors"in e.props)&&this.updateState(i,n),e.path[0]==="morphTargetInfluences"&&e.type===0){let r=i.morphTargetInfluences.get(e.path[1])?.data.name;r&&this.updateMorphInfluences(r,n.shared.getVariable(e.props.value,[this.uuid,"morphTargetInfluences",r]))}if(ri(e.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),ri(e.path,["cloner"])!==null){let r=tr.drop(e,1);r.path.length===0&&r.type===0&&r.props.disabled===!0?this.setFromClonerState(null,n):this.cloner?this.cloner.updateState(i.cloner,n):(this.setFromClonerState(i.cloner,n),this.expandCloner(n)),this.updateVisible(n.scene)}}updatePathSnapping(e=this.dataPatched.pathSnapping){this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(e){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,n=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,r=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,a=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let s=e.find(i);if(!s)return;this._needApplyPathSnapping=!1;let o=s.data;if(o.geometry.path.points.length<=1)return;let l=EF(o.geometry.path),c=(n+r)%1;n+r===1&&c===0&&(c=1);let h=null;try{h=l.curves.length?l.getPointAt(c):null}catch{}if(h===null)return;s.updateMatrixWorld();let d=this.parent?TS.copy(this.parent.matrixWorld).invert():TS.identity();d.multiply(s.matrixWorld),h.applyMatrix4(d);let u={position:h.toArray(),rotation:o.rotation};if(a==="tangential"){let p=CS.extractRotation(s.matrixWorld),f=l.getTangentAt(c).applyMatrix4(p).add(h),g=CS.lookAt(h,f,VI),m=Ud.setFromEuler(dv.setFromRotationMatrix(g)).multiplyScalar(It.RAD2DEG);u={...u,rotation:m.toArray()}}this.updateTransformState(u),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(FI)})}updateVisible(e){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!e)return;let i=!1;this.traverseEntity(n=>{if(n.data.type==="Splat")return i=!0,!0}),i&&e.reloadSplats()}updateState_Entity(e,i){e.name!==void 0&&(this.name=e.name),e.raycastLock!==void 0&&(this.raycastLock=e.raycastLock),e.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in e&&e.cloner!==void 0&&(this.setFromClonerState(e.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(e,i)}get attachedSurfaceCloners(){return this.children.filter(e=>Bu(e)&&e.parameters.type==="toObject")}setFromClonerState(e,i){if(!this.disposed)if(e===null||e.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(il.Cloner===null)return void Gn("cloners","a cloner");this.cloner=new il.Cloner(this,e),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(e,i)}expandCloner(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}invalidateClonerTransform(e){this.cloner&&this.cloner.invalidateTransform(e)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),td=k(()=>{rt(),Wr(),(uA||(uA={})).is=t=>"objectHelper"in t,Jc=(t,e)=>class extends $b(t){constructor(){super(...arguments),this.objectHelper=new e(this),this.gizmos={}}get geometryHelper(){return e.geometryHelper}raycast(i,n){this.objectHelper.raycast(i,n)}showGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Mg&&(n.visible=!0)}}updateEntityBoxSize(i,n){this.objectHelper.visible&&this.geometryHelper instanceof _s?(i.setScalar(0),n.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,n)}hideGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Mg&&(n.visible=!1)}}}}),Yb=k(()=>{rt(),Wb(),td(),Zs=class extends Jc(_p,pp){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function ts(t,e,i,n,r,a,s){Rm.set(r,a,s).unproject(n);let o=e[t];if(o!==void 0){let l=i.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Rm.x,Rm.y,Rm.z)}}var Rm,ua,jI,CF,i$=k(()=>{rt(),qg(),Xg(),Rm=new C,ua=new Zl,jI=class extends vu{constructor(t){let e=new Gt,i=new No({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],r=[],a={},s=new Jt(15711266),o=new Jt(15711266),l=new Jt(2857471);function c(d,u,p){h(d,p),h(u,p)}function h(d,u){n.push(0,0,0),r.push(u.r,u.g,u.b),a[d]===void 0&&(a[d]=[]),a[d].push(n.length/3-1)}c("n1","n2",s),c("n2","n4",s),c("n4","n3",s),c("n3","n1",s),c("f1","f2",s),c("f2","f4",s),c("f4","f3",s),c("f3","f1",s),c("n1","f1",s),c("n2","f2",s),c("n3","f3",s),c("n4","f4",s),c("p","n1",o),c("p","n2",o),c("p","n3",o),c("p","n4",o),c("u1","u2",l),c("u2","u3",l),c("u3","u1",l),e.setAttribute("position",new Ft(n,3)),e.setAttribute("color",new Ft(r,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let t=this.geometry,e=this.pointMap;ua.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;ts("n1",e,t,ua,-1,-1,i),ts("n2",e,t,ua,1,-1,i),ts("n3",e,t,ua,-1,1,i),ts("n4",e,t,ua,1,1,i);let n=i;ts("f1",e,t,ua,-1,-1,n),ts("f2",e,t,ua,1,-1,n),ts("f3",e,t,ua,-1,1,n),ts("f4",e,t,ua,1,1,n);let r=n;ts("u1",e,t,ua,.35,1.1,r),ts("u2",e,t,ua,-.35,1.1,r),ts("u3",e,t,ua,0,1.55,r),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},CF=class extends xp(jI){constructor(t){super(t),this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,e){wp(this.object,this.geometry,t,e,!0)}}});function GI(t){return 1-Math.pow(1-t,3)}var Jh,uv,pv,fv,zd,mv,Us,tn,qa=k(()=>{rt(),i$(),te(),td(),ti(),Jh=new C,uv=new C,pv=new Yt,fv=new C,zd=new C,mv=new C,Us=class extends Jc(Zl,CF){constructor(t="",e={...ng.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=Jo.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let r=this._projectionTransition;if(r===void 0)return;if(this.disposed)return void this._endProjectionTransition();r.raf=requestAnimationFrame(this._tickProjectionTransition);let a=Us.projectionTransitionRequestRender??r.requestRender;this.updateProjectionMatrix(),a?.()},this.super_Entity(t,e),this.previousProjectionMatrix=new At,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,n=this.height;this.orthoCamera=new cp(-.5*i,.5*i,.5*n,-.5*n,-5e4,1e4),this.perspCamera=new ju(45,i/n,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(t){let e=Us.projectionTransitionsEnabled;Us.projectionTransitionsEnabled=!1;try{return t()}finally{Us.projectionTransitionsEnabled=e}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(t){this.perspCamera.fov=t}get fov(){return this.perspCamera.fov}setNear(t,e){t==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t,e,i){typeof t=="number"&&(t=new C(t,e,i)),super.lookAt(t),this.getWorldPosition(Jh),this.targetOffset=Jh.distanceTo(t)}getTarget(t=new C){return this.getWorldDirection(uv),this.getWorldPosition(Jh),uv.multiplyScalar(this.targetOffset),t.copy(Jh).add(uv),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Jh),Jh.distanceTo(t)}updateUp(){this.getWorldQuaternion(pv),fv.set(0,0,1).applyQuaternion(pv),zd.copy(bi.DEFAULT_UP),this.isUpVectorFlipped&&zd.negate(),zd.applyQuaternion(pv),mv.copy(bi.DEFAULT_UP).projectOnPlane(fv),this.angleOffsetFromUp=mv.angleTo(zd),this.angleOffsetFromUp*=mv.cross(zd).dot(fv)>=0?1:-1}updateTransformState(t,e){let i=super.updateTransformState(t,e);return t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(t){let e=t.getWorldPosition(new C),i=t.getWorldDirection(new C).multiplyScalar(this.targetOffset);return{position:e.clone().add(i),target:e}}getViewToTarget(t){let e=this.getWorldDirection(new C).multiplyScalar(this.targetOffset);return{position:t.clone().sub(e),target:t}}getViewToObject(t){let e=new C;return t.getWorldPosition(e),this.getViewToTarget(e)}setViewplaneSize(t,e,i=!1){if(this.aspect=t/e,i){let n=t>e?this.aspect:1,r=t>e?1:this.aspect;this.left=-395*n,this.right=395*n,this.top=1/r*395,this.bottom=1/r*-395}else this.left=.5*-t,this.right=.5*t,this.top=.5*e,this.bottom=.5*-e;this.updateProjectionMatrix()}copyViewPlaneSize(t){this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let t=this._projectionTransition;if(t===void 0)return 1;let e=(performance.now()-t.start)/t.duration;return e>=1?1:e<=0?0:GI(e)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return Us.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=Us.projectionTransitionMinAgeMs}_beginProjectionTransition(t){let e=this._projectionTransition;e===void 0&&(e={from:new At,blend:new At,blendInverse:new At,start:0,duration:Us.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:t},this._projectionTransition=e),e.from.copy(this.projectionMatrix),e.start=performance.now(),e.duration=Us.projectionTransitionDuration,e.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,t&&(e.requestRender=t),e.raf!==0&&cancelAnimationFrame(e.raf),e.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;let e=(performance.now()-t.start)/t.duration;if(e>=1)return void this._endProjectionTransition();let i=GI(e),n=t.from.elements,r=this._activeSubCamera.projectionMatrix.elements,a=t.blend.elements,s=t.referenceDepth,o=Math.max(1e-6,n[15]-n[11]*s),l=i*o/(i*o+(1-i)*Math.max(1e-6,r[15]-r[11]*s));for(let c=0;c<16;c++)a[c]=n[c]+(r[c]-n[c])*l;t.blendInverse.copy(t.blend).invert(),this.projectionMatrix=t.blend,this.projectionMatrixInverse=t.blendInverse}_endProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;t.raf!==0&&cancelAnimationFrame(t.raf),this._projectionTransition=void 0;let e=this._activeSubCamera;this.projectionMatrix=e.projectionMatrix,this.projectionMatrixInverse=e.projectionMatrixInverse}_syncProjectionTransition(t){let e=t._projectionTransition;if(e===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new At,blend:new At,blendInverse:new At,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=i):i.raf!==0&&(cancelAnimationFrame(i.raf),i.raf=0),i.requestRender=void 0,i.from.copy(e.from),i.start=e.start,i.duration=e.duration,i.referenceDepth=e.referenceDepth,this._applyProjectionTransition()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,e,i,n,r,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,e,i,n,r,a):this.orthoCamera.setViewOffset(t,e,i,n,r,a),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.parent=t.parent,this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=Jo.sanitizeTargetOffset(t.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(t),this}toCameraState(t=[]){return ME({type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped},t)}updateCameraSubtype(t,e){let i=t==="perspective"?"PerspectiveCamera":"OrthographicCamera";e.zoom!==void 0&&this.setZoom(i,e.zoom),e.near!==void 0&&this.setNear(i,e.near),e.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=e.fov)}updateState(t,e){this.updateCameraState(t,e)}updateCameraState(t,e){this.updateState_Entity(t,e),t.far!==void 0&&(this.far=t.far),t.orthographic!==void 0&&this.updateCameraSubtype("orthographic",t.orthographic),t.perspective!==void 0&&this.updateCameraSubtype("perspective",t.perspective),t.type!==void 0&&(t.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(e?.shared.requestRender),this.cameraType=t.type),t.up!==void 0&&this.up.fromArray(t.up.map(i=>typeof i=="number"?i:0)),t.targetOffset!==void 0&&(this.targetOffset=Jo.sanitizeTargetOffset(t.targetOffset)),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.type===0&&this.updateCameraSubtype(t.path[0],t.props)}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}},(tn=Us).projectionTransitionsEnabled=!1,tn.projectionTransitionDuration=350,tn.projectionTransitionMinAgeMs=1e3});function PF(t){return t.type==="TorusGeometry"&&t.arc===360}var DF,gv,pA,Og=k(()=>{rt(),DF=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??n),a=Math.abs(i.depth??n),s=Math.abs(Math.min(n,a))/2;return{parameters:Object.assign(i,{width:n,height:r,depth:a,radius:s,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:n,radius:r,revolutions:a,segments:s,pathRadius:o,pathType:l,pathSegments:c,cornerRadius:h,cornerSegments:d}=t.parameters,u=new pA(!1,e,i,n,r,a,s,o,l,c,h,d);return Object.assign(u,{userData:{...t,type:"HelixGeometry"}})}},gv=new oh([0,0,0],1),pA=class extends Gt{constructor(t=!0,e=1,i=1,n=1,r=1,a=1,s=1,o=1,l=1,c=1,h=1,d=1){if(super(),a===0)return;let u=t&&a===1;u&&(d=0),h>100&&(h=100),h===0&&(d=0);let p,f,g,m,y,v,_,b,x=()=>new C,w=new C,S=x(),T=x(),E=x(),P=x(),A=x(),R=x(),O=x(),D=x(),I=x(),U=x(),N=x(),G=i-2*o+.001,H=G/a,J=Math.ceil(s*a),K=J+1,tt=G/J,ct=-G/2,et=c+1,st=2*Math.PI/c,dt=Math.PI/2/d,Y=Math.min((1-h/100)*o,o-.01),ht=o-Y,F=0,B=2*d+2,j=et*B/2,Z=j+et*K,L=Math.max(0,et*(K+B)),[W,X,V]=[3,3,2].map(jt=>Array(L*jt).fill(0)),nt=[],lt=r-o;function ft(jt,Nt){let _e=Math.PI/2;v=Nt*tt,b=2*Math.PI*(v%H)/H+_e,v+=ct,_=Math.sin(b)*lt,y=Math.cos(b)*lt,t?jt.set(y,_,v):jt.set(y,v,_)}ft(w,-1e-10),ft(S,0),P.copy(w),ft(w,1);let pt=w.distanceTo(S),Pt=u?0:ht+Y,bt=pt*J+2*Pt,Rt=Y,_t=bt-Pt;for(let jt=0;jt<=J;jt++){ft(T,jt),N.subVectors(T,P).normalize(),P.copy(T),I.copy(T).setComponent(+t+1,0).normalize(),U.crossVectors(N,I).normalize();let Nt=jt===0,_e=jt===J,be=Nt?3*Math.PI/2:dt,ji=Nt?Rt:_t,oe=Nt?et:Z,le=Nt?0:L-et,Pe=N.clone().multiplyScalar(Nt?-ht:ht).add(T),ai=N.clone().multiplyScalar(Nt?-1:1).normalize();for(let ze=0;ze<et;ze++){let Di=ze*st;if(A.addVectors(w.copy(I).multiplyScalar(o*Math.cos(Di)),S.copy(U).multiplyScalar(o*Math.sin(Di))),R.copy(A).normalize(),Nt||_e){u||(F=le+ze,[0,1,2].forEach(ui=>{W[3*F+ui]=Pe.getComponent(ui),X[3*F+ui]=ai.getComponent(ui)}),V[2*F]=+_e,V[2*F+1]=ze/c),S.copy(R).multiplyScalar(Y),E.addVectors(T,S);for(let ui=0;ui<d;ui++){let nn=ui*dt+be;O.addVectors(w.copy(N).multiplyScalar(ht*Math.sin(nn)),S.copy(R).multiplyScalar(ht*Math.cos(nn))),D.copy(O).normalize(),S.addVectors(E,O),O.normalize(),F=oe+ui*et+ze,[0,1,2].forEach(yn=>{W[3*F+yn]=S.getComponent(yn),X[3*F+yn]=D.getComponent(yn)});let Zr=+Nt+Math.sin(nn);V[2*F]=(ji+ht*Zr)/bt,V[2*F+1]=ze/c}}S.addVectors(T,A),F=j+jt*et+ze,[0,1,2].forEach(ui=>{W[3*F+ui]=S.getComponent(ui),X[3*F+ui]=R.getComponent(ui)}),V[2*F]=(Pt+jt*pt)/bt,V[2*F+1]=ze/c}}let $=K+2*d+2,[vt,Dt]=[+u,$-1];for(let jt=vt;jt<=Dt-1;jt++){let Nt=u&&jt===Dt-1;for(let _e=0;_e<et-1;_e++)p=jt*et+_e,f=p+1,g=(Nt?_e:p)+et,m=(Nt?_e+1:f)+et,jt===0?nt.push(f,m,g):jt===$-2?nt.push(p,f,g):nt.push(p,f,g,f,m,g)}this.setIndex(nt),this.setAttribute("position",new Ft(W,3)),this.setAttribute("normal",new Ft(X,3)),this.setAttribute("uv",new Ft(V,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t,e,i,n,r=this.userData.parameters,a=Math.ceil(r.tubularSegments),s=r.radialSegments,o=s+1,l=[];for(let c=1;c<a;c++)for(let h=0;h<s;h++)t=c*o+h,e=t+1,i=t+o,n=e+o,l.push(t,e,i,e,n,i);for(let c=0;c<s;c++)t=a*o+c,e=t+1,i=c+o,n=c+1+o,l.push(t,e,i,e,n,i);return gv.array=new Uint32Array(l),gv.count=l.length,gv}}});function n$(t){return WI||(WI=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.12/build",i=import("./boolean.js"),[n,r]=await Promise.all([i,fetch(`${e}/boolean.wasm`).then(a=>a.arrayBuffer())]);await n.default({module_or_path:r}),Ig=n}())}function H_(){if(Ig===void 0)throw new Error("boolean-wasm is not loaded");return Ig}function FC(t){let e=Lg.get(t);if(e===void 0)throw new Error("Unknown csg mesh set handle "+t);return e}function kC(t){return Lg.set(++fA,t),fA}function r$(t,e,i){if(Ig===void 0)return-1;let{positions:n,indices:r,normals:a}=function(s,o){if(o&&s.userData.positions!==void 0){let p=s.userData,f=[];for(let g=0,m=0;g<p.verticesPerFace.length;g++){let y=p.verticesPerFace[g];for(let v=1;v<y-1;v++)f.push(p.indices[m],p.indices[m+v],p.indices[m+v+1]);m+=y}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(f)}}let l;l=PF(s.userData.parameters)?s.getClosedTorusIndicesForBooleanOrSubdiv():s.getIndex();let c,h=s.getAttribute("position");if(l===null){c=new Uint32Array(h.count);for(let p=0;p<c.length;p++)c[p]=p}else c=l.array instanceof Uint32Array?l.array:new Uint32Array(l.array);let d=s.getAttribute("normal"),u=d!==void 0&&d.itemSize===3&&d.count===h.count&&d.array instanceof Float32Array&&d.isInterleavedBufferAttribute!==!0?d.array:void 0;return{positions:h.array,indices:c,normals:u}}(t,e);return kC(new Ig.CsgMesh(n,r,a))}function HI(t,e){let i=H_(),n=OF[e];if(n===void 0)throw new Error("Unknown boolean operation "+e);let r=t.map(FC);if(r.length===1)return i.clone_mesh(r[0]);let a,s=[];if(e===2&&r.length>2){let o=r[0];for(let l=1;l<r.length-1;l++)o=i.boolean_mesh(o,r[l],0),s.push(o);a=i.boolean_mesh(r[r.length-1],o,2)}else if(e===2)a=i.boolean_mesh(r[1],r[0],2);else{let o=r[r.length-1];for(let l=0;l<r.length-1&&(o=i.boolean_mesh(o,r[l],n),s.push(o),o.tri_count()!==0);l++);a=o,s.pop()}for(let o of s)o.free();return a}function PS(t,e){FC(t).transform(new Float32Array(e.elements))}function RF(t){let e=Lg.get(t);e!==void 0&&(e.free(),Lg.delete(t))}var Ig,Lg,fA,WI,OF,Zb=k(()=>{rt(),Og(),Lg=new Map,fA=0,OF={0:0,1:1,2:2}});function tc(t){return t!==null&&"booleanOp"in t}var mA,IF,a$=k(()=>{rt(),Wr(),Zb(),mA=class extends $b(wi){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new At}updateVisible(t){super.updateVisible(t),this.visible=!tc(this.parent)&&this.visible,tc(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){tc(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(RF(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),tc(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)t instanceof mA&&(t.freeBooleanPointer(),tc(t)&&t.invalidateUpstreamBooleanData())}updateTransformState(t,e){let i=super.updateTransformState(t,e);return i&&tc(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(t=!1){super.onVariableUpdate(t),tc(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),s$=k(()=>{IF=null});function VC(t,e=0,i=t.count,n,r){let a=1/0,s=1/0,o=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d=e;d<i;d++){let u=t.getX(d),p=t.getY(d),f=t.getZ(d);u<a&&(a=u),p<s&&(s=p),f<o&&(o=f),u>l&&(l=u),p>c&&(c=p),f>h&&(h=f)}Om.min.set(a,s,o),Om.max.set(l,c,h),Om.getCenter(n),Om.getSize(r).multiplyScalar(.5)}var Om,qI,XI,$i,lr=k(()=>{rt(),a$(),s$(),Om=new ci,qI=new Gt,XI=new Wa,$i=class extends mA{constructor(t,e){super(qI,XI),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){let i=IF;i===null?super.raycast(t,e):i(this,t,e)}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");i!==void 0?VC(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}}});function W_(t){return t?.isClassicNodeMaterial===!0}var vn,Bg,LF,BF,lg,UF,zF,NF,jC=k(()=>{}),xs=k(()=>{rt(),vn=class extends Jt{constructor(t,e,i,n){super(t,e,i),this.isColorA=!0,this.a=n}setRGBA(t,e,i,n){super.setRGB(t,e,i),this.a=n}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(t){return super.equals(t)&&this.a===t.a}setStyle(t,e="srgb"){let i;if(t==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(t)){let n,r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=r==="rgba"?parseFloat(n[4]):1,super.setStyle(t,e);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=r==="hsla"?parseFloat(n[4]):1,super.setStyle(t,e)}}return super.setStyle(t,e)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}}}),FF=k(()=>{xs(),Bg=class extends vn{}}),o$=k(()=>{LF=class{constructor(t=1e4){this.timeout=t,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let i=e;e=e.next,e.prev=this.head,this.head.next=e,i.next=null,i.prev=null,i.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),i=this.cache.get(t);return i===void 0?(i={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,i)):(i.time=e,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),kF=k(()=>{o$(),BF=class extends LF{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}}),VF=k(()=>{UF=class{constructor(t,e){this.data=t,this.cache=e,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},zF=class{constructor(){this.cache=new Map}remove(t){this.cache.delete(t.data)}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}}),l$=k(()=>{rt(),NF=class extends Lz{constructor(t){super(t),this.type=$n}parse(t){let e=function(p,f){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(f||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(f||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(f||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(f||""))}},i=function(p,f,g){f=f||1024;let m=p.pos,y=-1,v=0,_="",b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(m,m+128)));for(;0>(y=b.indexOf(`
|
|
4162
|
+
})();`}),xN=k(()=>{uC=class{constructor(t,e,i){this.deps=t,this.onConsole=e,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let i=this.deps;switch(t){case"setVariable":{let n=i.setVariable(String(e[0]),e[1]);return n.warning&&this.onConsole("warn",n.warning),n.ok}case"setVariables":{let n=e[0]??{},r=!0;for(let[a,s]of Object.entries(n)){let o=i.setVariable(a,s);o.warning&&this.onConsole("warn",o.warning),r=r&&o.ok}return r}case"getVariable":return i.getVariable(String(e[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(e[0]));case"getGeometry":{let n=i.getGeometry(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.data}case"updateObject":return i.updateObject(String(e[0]),e[1]??{});case"createObject":return i.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":if(i.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.createCustomMaterial(e[0]);case"setMaterial":if(i.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.setMaterial(String(e[0]),e[1]);case"cloneObject":return i.cloneObject(String(e[0]),e[1]??{});case"removeObject":return i.removeObject(String(e[0]));case"spawnObject":{let n=i.spawnObject(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.object}case"destroyObject":return i.destroyObject(String(e[0]));case"setInstanceTransforms":{let n=e[1]===null||e[1]===void 0?null:e[1],r=i.setInstanceTransforms(String(e[0]),n);return r<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),r}case"emitEvent":case"emitEventReverse":{let n=i.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return n.warning&&this.onConsole("warn",n.warning),n.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let n=String(e[0]);return n==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(n)||this.eventUnsubs.set(n,i.addSplineEventListener(n,r=>{this.onEvent(n,r)})),!0}case"unlistenEvent":{let n=String(e[0]);return n==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(n)?.(),this.eventUnsubs.delete(n)),!0}default:throw new Error(`Unknown spline bridge method: ${t}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=function(i,n){let r=[];for(let a of Object.keys(n))i[a]!==n[a]&&r.push({name:a,value:n[a]});return r}(this.lastVariables??{},t);this.lastVariables=t;for(let i of e)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function _X(t,e,i,n){return[t[0]*e+t[4]*i+t[8]*n+t[12],t[1]*e+t[5]*i+t[9]*n+t[13],t[2]*e+t[6]*i+t[10]*n+t[14]]}var bX=k(()=>{}),wN,xX=k(()=>{}),wX=k(()=>{pC(),xN(),wN=class{constructor(t,e,i){this.iframe=t,this.deps=e,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=n=>{if(this.disposed||n.source!==this.iframe.contentWindow)return;let r=n.data;var a;typeof(a=r)!="object"||a===null||a[Vl]!==!0||typeof a.kind!="string"||this.handleMessage(r)},this.host=new uC(e,i,(n,r)=>{this.sendEvent(n,r)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Vl]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[Vl]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(i){e=Promise.reject(i)}e.then(i=>{this.send({[Vl]:!0,kind:"result",id:t.id,ok:!0,value:i,error:void 0})},i=>{let n=i instanceof Error?i.message:String(i);this.send({[Vl]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:n}),this.onConsole("error",n)});break}case"input":this.dispatchInput(t.event)}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[Vl]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let i=this.iframe.getBoundingClientRect(),n={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":e.dispatchEvent(new PointerEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break;case"click":case"dblclick":e.dispatchEvent(new MouseEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons}));break;case"wheel":{let r=new WheelEvent("wheel",{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(r,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(r,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(r);break}case"keydown":case"keyup":e.dispatchEvent(new KeyboardEvent(t.type,{...n,key:t.key,code:t.code,repeat:t.repeat}))}}}}),ti=k(()=>{dC(),rX(),aX(),sX(),lX(),hX(),cX(),dX(),uX(),pX(),fX(),vX(),pC(),yX(),xN(),bX(),xX(),wX()}),SX=k(()=>{});function SN(t){return Array.isArray(t)?t:[t]}function u_(t,e){let i=0;for(;i<t.length&&i<e.length;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i+=1}return i!==e.length?-1:i!==t.length?1:0}var MX=k(()=>{});function ea(t,e){return Object.setPrototypeOf(t,e),t}function Hw(t){let e={...t};return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}function Kl(t,e,i){if(t===void 0?e===void 0?(t=0,e=10):t=e-10:e===void 0&&(e=t+10),t>e){let a=t;t=e,e=a}let n=[],r=1/(i+1);for(let a=0;a<i;a++){let s=t+(e-t)*(a+.75+.5*Math.random())*r;n.push(s)}return n}function fC(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array}var EX=k(()=>{});function mC(t){if(t.deepFreeze!==void 0)return void t.deepFreeze(t);let e=Object.getOwnPropertyNames(t);for(let i of e){let n=t[i];n&&typeof n=="object"&&mC(n)}return Object.freeze(t)}function MN(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var Ww,p_,EE,$t,gC,AX=k(()=>{}),sr=k(()=>{SX(),MX(),EX(),AX()}),vC=k(()=>{Ww=class{},p_=class extends Ww{constructor(t){super(),this.id=t}},EE=class extends Ww{constructor(t){super(),this.data=t}}}),TX=k(()=>{}),zb=k(()=>{$t=class{modifyById(t,e){let i=this;if(i[t]===void 0)throw new Error("not expected");{let n={...i,[t]:e};return Object.setPrototypeOf(n,$t.prototype),n}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let i,n=e[t.id];i=n===void 0?{type:2,id:t.id}:{type:1,id:t.id,data:n};let{id:r,data:a}=t,s={...e,[r]:a};return Object.setPrototypeOf(s,$t.prototype),{data:s,actual:t,reverse:i}}if(t.type===2){let{id:i}=t,n=e[i];if(n===void 0)return null;{let r={...e};return Object.setPrototypeOf(r,$t.prototype),delete r[i],{data:r,actual:t,reverse:{type:1,id:i,data:n}}}}return null}}}),yC=k(()=>{gC=class extends Error{}});function EN(t,e){for(let i of t)e(i.id,i.data)!==!0&&EN(i.children,e)}function AN(t,e){if(e(t.id,t.data)!==!0)for(let i of t.children)AN(i,e)}var Xn,ev,dp,Vt,Zc=k(()=>{sr(),yC(),sr(),Xn=class extends Array{constructor(...t){super(...t),Js(this,"partialObjectCaches"),Js(this,"objCaches"),Js(this,"parentCaches"),Object.setPrototypeOf(this,Xn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)mC(this[t]),t++}fillCaches0(t,e){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,e);for(let i of t.children)this.fillCaches0(i,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}nonExistOrDescendantOf(t,e){if(!this.has(t))return!0;for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}rootAcestor(t){for(;t;){let e=this.parent(t);if(!e)return t;t=e}return t}isDescendantOf(t,e){for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}data(t){return this.get(t)?.data}has(t){return this.childrenOf(t)!==void 0}partialCache(t){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let e=this.get(t);e!==void 0&&this.partialObjectCaches.set(t,e)}get(t){if(this.partialObjectCaches!==void 0){let e=this.partialObjectCaches.get(t);if(e!==void 0)return e}return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){return t===null?this:this.get(t)?.children}traverseFrom(t,e){if(t===null)this.traverse(e);else{let i=this.get(t);i&&AN(i,e)}}traverse(t){EN(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this.parent(t),n=this.childrenArray(i),r=n.findIndex(o=>o.id===t);if(r<0)throw new Error("not expected");let a=n[r];n=[...n],n[r]={...a,data:e};let s=new Map;return s.set(t,n[r]),this.modifyArrayBy(i,n,s)}}modifyArrayBy(t,e,i=void 0){let n=t,r=e;for(;n!==null;){let s=r,o=n;if(n=this.parent(n),n===void 0)throw new Error;r=this.childrenArray(n);let l=r.findIndex(c=>c.id===o);if(l<0)throw new Error;r=[...r],r[l]={...r[l],children:s},i&&i.set(o,r[l])}Object.setPrototypeOf(r,Xn.prototype);let a=r;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){a.objCaches=this.objCaches;for(let[s,o]of i)a.objCaches.set(s,o);a.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else a.fillCaches();return a}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}return null}checkDuplicatedIdRec({id:t,children:e}){if(this.get(t)!==void 0)return!0;for(let i of e)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(t){let{parent:e,fi:i,id:n,data:r,children:a}=t;if(e!==null&&this.get(e)===void 0||this.checkDuplicatedIdRec(t))return null;{let s=e,o=this.childrenArray(s),l={fi:i,id:n,data:r,children:a};return o=[...o,l],o.sort((c,h)=>c.fi-h.fi),t.localIndex=o.indexOf(l),{data:this.modifyArrayBy(s,o),actual:t,reverse:{type:8,id:n}}}}deleteOp(t){let{id:e}=t;if(this.get(e)===null)return null;{let i=this.parent(e);if(i===void 0)return null;let n=this.childrenArray(i),r=n.findIndex(s=>s.id===e);t.localIndex=r,n=[...n];let a=n.splice(r,1)[0];return{data:this.modifyArrayBy(i,n),actual:t,reverse:{type:7,...a,parent:i}}}}moveOp(t){let{parent:e,fi:i,id:n}=t;if(e!==null&&this.get(e)===void 0)return this.deleteOp({type:8,id:n});if(e!==null){let d=e;for(;d!==null;){if(d===void 0)throw new Error;if(d===n)throw new gC("cyclic tree");d=this.parent(d)}}let r=this.parent(n);if(r===void 0)return null;let a=r,s=this.childrenArray(r),o=s.findIndex(d=>d.id===n);s=[...s];let l=s.splice(o,1)[0],c=this.modifyArrayBy(r,s);r=e,s=c.childrenArray(r);let h=l.fi;return l={...l,fi:i},s=[...s,l],s.sort((d,u)=>d.fi-u.fi),t.localIndex=s.indexOf(l),c=c.modifyArrayBy(r,s),{data:c,actual:t,reverse:{type:9,parent:a,fi:h,id:n}}}previous(t,e){if(e===null){let n=this.childrenArray(t);return n.length===0?null:n[n.length-1].id}let i=null;for(let n of this.childrenArray(t)){if(n.id===e)return i;i=n.id}return null}traverseSortNext(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)+1;if(n<i.length)return i[n].id;if(e)return this.traverseSortNext(e)}}sortNext(t){let e=this.childrenArray(t);return e.length>0?e[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let e=this.childrenArray(t);return e.length>0?this.traverseSortPrevious(e[e.length-1].id):t}sortPrevious(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)-1;return n>=0?this.traverseSortPrevious(i[n].id):e}}getAllSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i.id);n!==void 0&&e.push({...i,...n})}e.sort((i,n)=>u_(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e}getAllIdSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i);n!==void 0&&e.push(n)}e.sort((i,n)=>u_(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e.map(i=>i.id)}getWithSortKey(t){let e=t,i=[],n=this.get(e),r=n;if(n!==void 0){for(;e;)i.splice(0,0,n.fi),e=this.parent(e),e!==null&&(n=this.get(e));return{...r,sortKey:i}}}insertBeforeHelper(t,e,i){return this.insertAfterHelper(t,this.previous(t,e),i)}insertAfterHelper(t,e,i){let n=this.childrenArray(t);if(e===null){if(n.length===0)return Kl(0,i,i);{let r=n[0].fi;return Kl(r-i,r,i)}}{let r=this.get(e);if(r===void 0||this.parent(e)!==t)throw new Error("illegal args");let a=n.find(s=>s.fi>r.fi);if(a===void 0){let s=n[n.length-1].fi;return Kl(s,s+i,i)}return Kl(r.fi,a.fi,i)}}}}),_C=k(()=>{var t;ev=null,(t=dp||(dp={})).setPreservePrototype=function(e){ev=e},t.tryPreservePrototype=function(e,i){return Object.getPrototypeOf(e)===ev&&Object.setPrototypeOf(i,ev),i},t.runOp=function(e,i){if(i.type!==0)return null;if(Array.isArray(e)){let n=i.props,r={},a=[...e],s=!1;if(n)for(let o of Object.keys(n)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");r[o]=a[l],a[l]=n[o],s=!0}return s?{data:a,actual:i,reverse:{type:0,props:r}}:null}{let n=i.props,r={},a={...e},s=!1;if(n)for(let o of Object.keys(n)){r[o]=a[o];let l=n[o];l===void 0?delete a[o]:a[o]=l,s=!0}return s?{data:t.tryPreservePrototype(e,a),actual:i,reverse:{type:0,props:r}}:null}}}),Kc=k(()=>{sr(),sr(),Vt=class extends Array{constructor(...t){super(...t),Js(this,"objCaches"),Object.setPrototypeOf(this,Vt.prototype)}deepFreeze(){let t=0;for(;t<this.length;)mC(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){return this.get(t)?.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this,n=i.findIndex(a=>a.id===t);if(n<0)throw new Error("not expected");let r=i[n];return i=[...i],i[n]={...r,data:e},this.modifyArrayBy(i)}}modifyArrayBy(t){Object.setPrototypeOf(t,Vt.prototype);let e=t;return typeof process<"u"||e.fillCaches(),e}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}return null}addOp(t){let{fi:e,id:i,data:n}=t,r=this,a={fi:e,id:i,data:n};return r=[...r,a],r.sort((s,o)=>s.fi-o.fi),t.localIndex=r.indexOf(a),{data:this.modifyArrayBy(r),actual:t,reverse:{type:5,id:i}}}deleteOp(t){let{id:e}=t,i=this,n=i.findIndex(a=>a.id===e);if(n===-1)return null;t.localIndex=n,i=[...i];let r=i.splice(n,1)[0];return{data:this.modifyArrayBy(i),actual:t,reverse:{type:4,...r}}}moveOp(t){let{fi:e,id:i}=t,n=this;n=[...n];let r=n.findIndex(o=>o.id===i);if(r===-1)return null;let a=n[r].fi,s={...n[r],fi:e};return n[r]=s,n.sort((o,l)=>o.fi-l.fi),t.localIndex=n.indexOf(s),{data:this.modifyArrayBy(n),actual:t,reverse:{type:6,fi:a,id:i}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let e=null;for(let i of this){if(i.id===t)return e;e=i.id}return null}insertBeforeHelper(t,e){return this.insertAfterHelper(this.previous(t),e)}insertAfterHelper(t,e){let i=this;if(t===null){if(i.length===0)return Kl(0,e,e);{let n=i[0].fi;return Kl(n-e,n,e)}}{let n=this.get(t);if(n===void 0)throw new Error("illegal args");let r=i.find(a=>a.fi>n.fi);if(r===void 0){let a=i[i.length-1].fi;return Kl(a,a+e,e)}return Kl(n.fi,r.fi,e)}}}});function CX(t,e){let i={cur:[],result:[],len:0};return[t=Hu(t,e,i)??t,i.result]}function Jy(t,e){return t===null?null:(t.cur[t.len]=e,t.len+=1,t)}function t1(t){t&&(t.len-=1)}function TN(t,e,i){let n=!1,r=t.map(a=>{let s=a.id,o=e[s];if(o!==void 0&&typeof o=="string"&&(n=!0,s=o,i!==null))throw new Error("not supported");let l=Hu(a.data,e,Jy(i,s));t1(i),n=n||l!==void 0,l===void 0&&(l=a.data);let c=TN(a.children,e,i);return c!==void 0?n=!0:c=a.children,{...a,id:s,data:l,children:c}});if(n)return r}function Hu(t,e,i){if(t instanceof Xn){let n=TN(t,e,i);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}if(t instanceof Vt)return function(n,r,a){let s=!1,o=n.map(l=>{let c=l.id,h=r[c];if(h!==void 0&&typeof h=="string"&&(s=!0,c=h,a!==null))throw new Error("not supported");let d=Hu(l.data,r,Jy(a,c));return t1(a),s=s||d!==void 0,d===void 0&&(d=l.data),{...l,id:c,data:d}});if(s)return Object.setPrototypeOf(o,Object.getPrototypeOf(n)),o}(t,e,i);if(Array.isArray(t)){let n=!1,r=t.map((a,s)=>{let o=Hu(a,e,Jy(i,s));return t1(i),n=n||o!==void 0,o===void 0&&(o=a),o});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}if(t&&typeof t=="object"&&!fC(t)){let n={},r=!1;for(let[a,s]of Object.entries(t))if(a!=="name"&&a!=="variableId"){let o=e[a];if(typeof o=="string"){if(i!==null)throw new Error("not supported");r=!0,a=o}let l=Hu(s,e,Jy(i,a));t1(i),r=r||l!==void 0,l===void 0&&(l=s),n[a]=l}else n[a]=s;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(typeof t=="string"){let n=e[t];return n!==void 0&&function(r){if(r===null)return null;r.result.push(r.cur.slice(0,r.len))}(i),n}}var CN=k(()=>{Zc(),Kc(),sr()});function Wu(t){return t&&typeof t=="object"&&t instanceof gn}function bC(t,e){if(e===void 0)return;let i=!1,n=t.map(r=>{let a=r.id,s=eg(r.data,e[a]);if(i=i||s!==void 0,s===void 0&&(s=r.data),r.children){let o=bC(r.children,e);return o!==void 0?i=!0:o=r.children,{...r,id:a,data:s,children:o}}return{...r,id:a,data:s}});return i?n:void 0}function eg(t,e){if(!Wu(e))return e;if(t instanceof Xn){let i=bC(t,e);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}if(t instanceof Vt)return function(i,n){if(n===void 0)return;let r=!1,a=i.map(s=>{let o=s.id,l=eg(s.data,n[o]);return r=r||l!==void 0,l===void 0&&(l=s.data),{...s,id:o,data:l}});return r?(Object.setPrototypeOf(a,Object.getPrototypeOf(i)),a):void 0}(t,e);if(Array.isArray(t)){let i=!1,n=t.map((r,a)=>{let s=eg(r,e[a]);return i=i||s!==void 0,s===void 0&&(s=r),s});return i?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(t instanceof gn)return xC(t,e);if(t&&typeof t=="object"){let i={},n=!1;for(let[r,a]of Object.entries(t)){let s=eg(a,e[r]);n=n||s!==void 0,s===void 0&&(s=a),i[r]=s}return n?(Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i):void 0}}function xC(t,e){if(t===void 0)return e;if(e===void 0)return t;if(!Wu(e))return e;if(!Wu(t))return hh.apply(t,e);let i=new Set;for(let r of Object.keys(t))i.add(r);for(let r of Object.keys(e))i.add(r);let n=new gn;for(let r of i){let a=xC(t===void 0?void 0:t[r],e===void 0?void 0:e[r]);n[r]=a}return n}var gn,hh,f_,tr,XR,wC=k(()=>{var t;Zc(),Kc(),kb(),sr(),gn=class{unusedFunOverridesTable(e){}runOp(e){let i=[],n=this,r=0,a={};for(;r<e.path.length;){if(i.push(n),n=n===void 0?void 0:n[e.path[r]],n!==void 0&&!Wu(n))return null;r+=1}n=n?Hw(n):new gn;for(let[s,o]of Object.entries(e.props)){let l=n[s];a[s]=l,o===void 0?delete n[s]:n[s]=o}for(;r>0;){if(Object.keys(n).length===0){let s=i[r-1];s&&(n=Hw(s),delete n[e.path[r-1]])}else{let s=i[r-1];if(s){let o=Hw(s);o[e.path[r-1]]=n,n=o}else{let o=new gn;o[e.path[r-1]]=n,n=o}}r-=1}return{data:Object.setPrototypeOf(n,gn.prototype),actual:e,reverse:{...e,props:a}}}},(t=hh||(hh={})).apply=function(e,i){return eg(e,i)??e},t.merge=function(e,i){return xC(e,i)},t.filterOp=function(e,i){let n=0,r=i.path,a=e;for(;n<r.length&&a!==void 0;){if(a=jn.zoomOnce(a,r[n]),a===void 0)return i;if(!Wu(a))return;n+=1}if(a===void 0)return i;if(Wu(a)){if(i.type===0){let s={...i.props};for(let o of Object.keys(a))delete s[o];return{...i,props:s}}if(i.type===1||i.type===4||i.type===7){let s=bC([i],a);return s?s[0]:i}return i}}}),PX=k(()=>{kb(),zb(),Zc(),yC(),_C(),Kc(),CN(),wC(),(f_||(f_={})).replaceProps=function(t,e){let i=jn.zoom(e,t.path);if(typeof i=="object"){let n={};for(let r of Object.keys(t.props))n[r]=i[r];return{...t,props:n}}return{...t,props:{}}},(t=>{function e(r,a){let s=a.path,o=[];for(;;){let l;if(r instanceof gn&&a.type===0&&(l=r.runOp({...a,path:s.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===s.length&&(l=r instanceof Xn||r instanceof Vt||r instanceof $t?r.runOp(a):dp.runOp(r,a)),l!==void 0){if(l!==null){let d=l.data;for(let u=o.length-1;u>=0;u--){let p=s[u],f=o[u];if(f instanceof Xn){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Vt){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof $t){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof gn){let g={...f,[p]:d};d=Object.setPrototypeOf(g,gn.prototype)}else{if(typeof f!="object")return null;if(Array.isArray(f)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let g=d;d=[...f],d[p]=g}else d=dp.tryPreservePrototype(f,{...f,[p]:d})}}return{data:d,actual:{...l.actual,path:s},reverse:{...l.reverse,path:s}}}return null}let c,h=s[o.length];if(r instanceof Xn){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else if(r instanceof Vt){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else r!==null&&(c=r[h]);if(c===void 0)return null;o.push(r),r=c}}function i(r,a){for(let s=0;s<r.length&&s<a.length;s++)if(r[s]!==a[s])return!0;return!1}function n(r,a){if(r.length!==a.length)return!1;for(let s=0;s<r.length;s++)if(r[s]!==a[s])return!1;return!0}t.drop=function(r,a){return{...r,path:r.path.slice(a)}},t.applySimple=function(r,a){return e(r,a)?.data??r},t.apply=e,t.pathDisjoint=i,t.pathEq=n,t.commutative=function(r,a){return i(r.path,a.path)},t.subsumed=function(r,a){return!(r.type!==0||a.type!==0||!n(r.path,a.path))&&Object.keys(r.props).every(s=>a.props[s]!==void 0)}})(tr||(tr={})),(t=>{function e(i,n){let r=i,a=[],s=[];for(let o of n)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,c,h;if(o.type===3?(l=jn.zoom(r,[...o.path,o.id]),h=tr.apply(r,{...o,type:2})):(l=jn.zoom(r,[...o.path,o.id,"value"]),h=tr.apply(r,o)),h!==null){r=h.data;let[d,u]=CX(r,{[o.id]:l});r=d;for(let p=0;p<u.length;p++){let f=u[p],g=f.pop();if(typeof g=="number"){let m=[g];for(let v=p+1;v<u.length;v++){let _=u[v],b=_[_.length-1];if(typeof b!="number"||!jn.equal(f,_.slice(0,_.length-1)))break;m.push(b),u.splice(v,1)}let y=jn.zoom(r,f);c=y.map((v,_)=>m.includes(_)?o.id:v),l=y,g=f.pop()}else{if(g==="alphaOverride"||g==="alpha"){l/=100;let m=l,y=jn.zoom(r,f.slice(0,f.length-2)),v=y.layers.map(_=>_.id===f[f.length-1]?{..._,data:{..._.data,[g]:m}}:_);Object.setPrototypeOf(v,Object.getPrototypeOf(y.layers)),y.layers=v}c=o.id}a.push({type:0,path:f,props:{[g]:l}}),s.push({type:0,path:f,props:{[g]:c}})}s.push(h.reverse),a.push(h.actual)}}else{let l=tr.apply(r,o);l!==null&&(a.push(l.actual),r=l.data,s.push(l.reverse))}}catch(l){if(l instanceof gC)return null;throw l}return{data:r,actual:a,reverse:s.reverse()}}t.empty=function(){return[]},t.removePrefix=function(i,n){let r=[];for(let a of i){let[s,...o]=a.path;s===n&&r.push({...a,path:o})}return r},t.addPrefix=function(i,n){return i.map(r=>({...r,path:[n,...r.path]}))},t.concat=function(i,n){return[...i,...n]},t.compress=function(i,n){return[...i.filter(r=>!n.some(a=>tr.subsumed(r,a))),...n]},t.commutative=function(i,n){return i.every(r=>n.every(a=>tr.commutative(r,a)))},t.applyAll=function(i,n){for(let r of n){let a=e(i,r);a!==null&&(i=a.data)}return i},t.apply=e})(XR||(XR={}))});function qw(t,e,i){if(t.length>0){let n=t[t.length-1];if(n.type===0&&e.type===0&&jn.equal(n.path,i))return void Object.assign(n.props,e.props)}t.push({...e,path:i})}function e1(t,e,i){return i instanceof Xn?new Nb(t,e,i):i instanceof Vt?new Fb(t,e,i):i instanceof $t?new Proxy(new DN(t,e,i),ON):i!==null&&typeof i=="object"?fC(i)?i:new Proxy(new PN(t,e,i),RN):i}function Em(t){let e=new TE(t);return[e1(e,"",t),e]}function m_(t,e){let[i,n]=Em(t);return e(i),n.result()}function cn(t){return t instanceof Nb||t instanceof Fb?t._current:t!==null&&typeof t=="object"?t[AE]:t}var AE,$R,Pf,Id,PN,DN,Xw,RN,ON,Nb,Fb,TE,jn,IN=k(()=>{zb(),Zc(),_C(),Kc(),sr(),kb(),AE=Symbol(),$R=Symbol(),Pf=Symbol(),Id=class{reportOp(t,e,i=[]){let n=this;if(e===null)return;n._current=e.data;let r=i;for(;!(n instanceof TE);){let a=n._path,s=n._current;if(a!==""&&r.splice(0,0,a),n=n._parent,n===null)return;n.update(a,s)}n.push(r,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let i=e[Pf];i&&i(),delete this._children[t]}}}},PN=class extends Id{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=dp.tryPreservePrototype(this._current,{...this._current,[t]:e})}runOp(t){this.reportOp(t,dp.runOp(this._current,t),t.path)}},DN=class extends Id{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,$t.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},Xw={get(t,e){if(e===Pf)return()=>{t._parent=null};if(e===AE)return t._current;if(e===$R)return t;let{_current:i,_children:n}=t;if(e==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[e];if(r!==void 0)return r;let a=i[e],s=e1(t,e,a);return s!==a?(n===void 0&&(n={},t._children=n),n[e]=s,s):a},has:(t,e)=>e in t._current,ownKeys:t=>Reflect.ownKeys(t._current),defineProperty(){throw Error("not supported")},getPrototypeOf:t=>Object.getPrototypeOf(t._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(t,e){let i=t._current,n=Reflect.getOwnPropertyDescriptor(i,e);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:i[e]}}},RN={...Xw,set(t,e,i){let n={type:0,props:{[e]:cn(i)??i}};return t.deleteChildren(e),t.runOp(n),!0},deleteProperty(t,e){let i={type:0,props:{[e]:void 0}};return t.deleteChildren(e),t.runOp(i),!0}},ON={...Xw,set(t,e,i){return i===void 0?this.deleteProperty(t,e):(t.deleteChildren(e),t.runOp({type:1,id:e,data:i})),!0},deleteProperty:(t,e)=>(t.runOp({type:2,id:e}),!0)},Nb=class extends Id{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Pf]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,i)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,a=e1(this,t,r);return a!==r?(i===void 0&&(i={},this._children=i),i[t]=a,a):r}add(t,e,i,n,r){this.runOp({type:7,parent:t,fi:e,id:i,data:n,children:r})}move(t,e,i){this.runOp({type:9,parent:t,fi:e,id:i})}insertAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let a=i[r];this.add(t,n[r],a.id,a.data,a.children)}}insertBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let a=i[r];this.add(t,n[r],a.id,a.data,a.children)}}moveAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let a=i[r];this.move(t,n[r],a)}}moveBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let a=i[r];this.move(t,n[r],a)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},Fb=class extends Id{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Pf]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id,r=this._current[i].fi;t(this.data(this._current[i].id),n,r,i)}}find(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id;if(t(this.data(n),n))return this.get(n)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:i}=this._current.at(t);return{id:e,fi:i,data:this.data(e)}}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,a=e1(this,t,r);return a!==r?(i===void 0&&(i={},this._children=i),i[t]=a,a):r}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,i){this.runOp({type:4,fi:t,id:e,data:i})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}insertBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}moveAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}moveBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}},TE=class extends Id{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,i,n){qw(this.ts,e,t),qw(this.actual,i,t),qw(this.reverse,n,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),kb=k(()=>{vC(),IN(),Kc(),Zc(),sr(),(t=>{function e(n,r){return(n instanceof Xn||n instanceof Nb)&&typeof r=="string"||(n instanceof Vt||n instanceof Fb)&&typeof r=="string"?n.data(r):typeof r=="number"&&Array.isArray(n)||typeof r=="string"&&typeof n=="object"&&n!==null?n[r]:void 0}function i(n,r,a=0){for(;a<r.length&&n!==void 0;)n=e(n,r[a]),a+=1;return n}t.equal=function(n,r){if(r.length!==n.length)return!1;{let a=0;for(;a<n.length;){if(n[a]!==r[a])return!1;a+=1}}return!0},t.removeOverridden=function(n,r,a){let s=i(a,n);if(s!==void 0&&typeof s=="object"&&s!==null){let o={...r};return Object.keys(s).forEach(l=>{delete o[l]}),o}return r},t.zoomOnce=e,t.zoom=i,t.findPathes=function(n,r){let a=[];return function s(o,l){if(o instanceof p_&&o.id===r.id)a.push(l);else if(o instanceof Vt)for(let c=0;c<o.length;c++)s(o[c].data,[...l,o[c].id]);else if(o instanceof Xn)o.traverse((c,h)=>{s(c,[...l,h])});else if(Array.isArray(o))for(let c=0;c<o.length;c++)s(o[c],[...l,c]);else{if(fC(o))return;if(typeof o=="object"&&o!==null)for(let c in o)s(o[c],[...l,c])}}(n,[]),a}})(jn||(jn={}))}),DX=k(()=>{});function ri(t,e){let i=[];if(!(e.length<=t.length))return null;{let n=0;for(;n<e.length;){if(e[n]==="*")i.push(t[n]);else if(t[n]!==e[n])return null;n+=1}}return i}var RX=k(()=>{});function iv(t){try{if(!xi.trusted&&!Qo){let i=Qe.sharedLength||0;i<Qe.length&&(Qe.length=i)}let e;if(xi.randomAccessStructure&&kt[gt]<64&&kt[gt]>=32&&tO?(e=tO(kt,gt,Va,xi),kt=null,!(t&&t.lazy)&&e&&(e=e.toJSON()),gt=Va):e=mn(),_r&&(gt=_r.postBundlePosition,_r=null),Qo&&(Qe.restoreStructures=null),gt==Va)Qe&&Qe.restoreStructures&&YR(),Qe=null,kt=null,Ko&&(Ko=null);else{if(gt>Va)throw new Error("Unexpected end of MessagePack data");if(!Qo){let i;try{i=JSON.stringify(e,(n,r)=>typeof r=="bigint"?`${r}n`:r).slice(0,100)}catch(n){i="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return e}catch(e){throw Qe&&Qe.restoreStructures&&YR(),PE(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||gt>Va)&&(e.incomplete=!0),e}}function YR(){for(let t in Qe.restoreStructures)Qe[t]=Qe.restoreStructures[t];Qe.restoreStructures=null}function mn(){let t=kt[gt++];if(t<160){if(t<128){if(t<64)return t;{let e=Qe[63&t]||xi.getStructures&&LN()[63&t];return e?(e.read||(e.read=CE(e,63&t)),e.read()):t}}if(t<144){if(t-=128,xi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=UN();n==="__proto__"&&(n="__proto_"),e[n]=mn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(mn(),mn());return e}}{t-=144;let e=new Array(t);for(let i=0;i<t;i++)e[i]=mn();return xi.freezeData?Object.freeze(e):e}}if(t<192){let e=t-160;if(fs>=gt)return Ql.slice(gt-ga,(gt+=e)-ga);if(fs==0&&Va<140){let i=e<16?SC(e):BN(e);if(i!=null)return i}return y_(e)}{let e;switch(t){case 192:return null;case 193:return _r?(e=mn(),e>0?_r[1].slice(_r.position1,_r.position1+=e):_r[0].slice(_r.position0,_r.position0-=e)):FN;case 194:return!1;case 195:return!0;case 196:if(e=kt[gt++],e===void 0)throw new Error("Unexpected end of buffer");return $w(e);case 197:return e=He.getUint16(gt),gt+=2,$w(e);case 198:return e=He.getUint32(gt),gt+=4,$w(e);case 199:return Qh(kt[gt++]);case 200:return e=He.getUint16(gt),gt+=2,Qh(e);case 201:return e=He.getUint32(gt),gt+=4,Qh(e);case 202:if(e=He.getFloat32(gt),xi.useFloat32>2){let i=BE[(127&kt[gt])<<1|kt[gt+1]>>7];return gt+=4,(i*e+(e>0?.5:-.5)|0)/i}return gt+=4,e;case 203:return e=He.getFloat64(gt),gt+=8,e;case 204:return kt[gt++];case 205:return e=He.getUint16(gt),gt+=2,e;case 206:return e=He.getUint32(gt),gt+=4,e;case 207:return xi.int64AsType==="number"?(e=4294967296*He.getUint32(gt),e+=He.getUint32(gt+4)):xi.int64AsType==="string"?e=He.getBigUint64(gt).toString():xi.int64AsType==="auto"?(e=He.getBigUint64(gt),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigUint64(gt),gt+=8,e;case 208:return He.getInt8(gt++);case 209:return e=He.getInt16(gt),gt+=2,e;case 210:return e=He.getInt32(gt),gt+=4,e;case 211:return xi.int64AsType==="number"?(e=4294967296*He.getInt32(gt),e+=He.getUint32(gt+4)):xi.int64AsType==="string"?e=He.getBigInt64(gt).toString():xi.int64AsType==="auto"?(e=He.getBigInt64(gt),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigInt64(gt),gt+=8,e;case 212:if(e=kt[gt++],e==114)return LE(63&kt[gt++]);{let i=gr[e];if(i)return i.read?(gt++,i.read(mn())):i.noBuffer?(gt++,i()):i(kt.subarray(gt,++gt));throw new Error("Unknown extension "+e)}case 213:return e=kt[gt],e==114?(gt++,LE(63&kt[gt++],kt[gt++])):Qh(2);case 214:return Qh(4);case 215:return Qh(8);case 216:return Qh(16);case 217:return e=kt[gt++],fs>=gt?Ql.slice(gt-ga,(gt+=e)-ga):VN(e);case 218:return e=He.getUint16(gt),fs>=(gt+=2)?Ql.slice(gt-ga,(gt+=e)-ga):jN(e);case 219:return e=He.getUint32(gt),fs>=(gt+=4)?Ql.slice(gt-ga,(gt+=e)-ga):GN(e);case 220:return e=He.getUint16(gt),gt+=2,ZR(e);case 221:return e=He.getUint32(gt),gt+=4,ZR(e);case 222:return e=He.getUint16(gt),gt+=2,KR(e);case 223:return e=He.getUint32(gt),gt+=4,KR(e);default:if(t>=224)return t-256;if(t===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+t)}}}function CE(t,e){function i(){if(i.count++>RE){let r;try{r=t.read=new Function("r","return function(){return "+(xi.freezeData?"Object.freeze":"")+"({"+t.map(a=>a==="__proto__"?"__proto_:r()":kN.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(mn)}catch{return RE=1/0,i()}return t.read0=r,t.highByte===0&&(t.read=OE(e,t.read)),r()}let n={};for(let r=0,a=t.length;r<a;r++){let s=t[r];s==="__proto__"&&(s="__proto_"),n[s]=mn()}return xi.freezeData?Object.freeze(n):n}return i.count=0,t.read0=i,t.highByte===0?OE(e,i):i}function LN(){let t=NN(()=>(kt=null,xi.getStructures()));return Qe=xi._mergeStructures(t,Qe)}function Am(t){let e;if(t<16&&(e=SC(t)))return e;if(t>64&&DE)return DE.decode(kt.subarray(gt,gt+=t));let i=gt+t,n=[];for(e="";gt<i;){let r=kt[gt++];if(128&r)if((224&r)==192){let a=(31&r)<<6|63&kt[gt++];a<128?n.push(65533):n.push(a)}else if((240&r)==224){let a=(31&r)<<12|(63&kt[gt++])<<6|63&kt[gt++];a<2048||a>=55296&&a<=57343?n.push(65533):n.push(a)}else if((248&r)==240){let a=(7&r)<<18|(63&kt[gt++])<<12|(63&kt[gt++])<<6|63&kt[gt++];a<65536||a>1114111?n.push(65533):(a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a))}else n.push(65533);else n.push(r);n.length>=4096&&(e+=kn.apply(String,n),n.length=0)}return n.length>0&&(e+=kn.apply(String,n)),e}function ZR(t){let e=new Array(t);for(let i=0;i<t;i++)e[i]=mn();return xi.freezeData?Object.freeze(e):e}function KR(t){if(xi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=UN();n==="__proto__"&&(n="__proto_"),e[n]=mn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(mn(),mn());return e}}function BN(t){let e=gt,i=new Array(t);for(let n=0;n<t;n++){let r=kt[gt++];if((128&r)>0)return void(gt=e);i[n]=r}return kn.apply(String,i)}function SC(t){if(t<4){if(t<2){if(t===0)return"";{let e=kt[gt++];return(128&e)>1?void(gt-=1):kn(e)}}{let e=kt[gt++],i=kt[gt++];if((128&e)>0||(128&i)>0)return void(gt-=2);if(t<3)return kn(e,i);let n=kt[gt++];return(128&n)>0?void(gt-=3):kn(e,i,n)}}{let e=kt[gt++],i=kt[gt++],n=kt[gt++],r=kt[gt++];if((128&e)>0||(128&i)>0||(128&n)>0||(128&r)>0)return void(gt-=4);if(t<6){if(t===4)return kn(e,i,n,r);{let a=kt[gt++];return(128&a)>0?void(gt-=5):kn(e,i,n,r,a)}}if(t<8){let a=kt[gt++],s=kt[gt++];if((128&a)>0||(128&s)>0)return void(gt-=6);if(t<7)return kn(e,i,n,r,a,s);let o=kt[gt++];return(128&o)>0?void(gt-=7):kn(e,i,n,r,a,s,o)}{let a=kt[gt++],s=kt[gt++],o=kt[gt++],l=kt[gt++];if((128&a)>0||(128&s)>0||(128&o)>0||(128&l)>0)return void(gt-=8);if(t<10){if(t===8)return kn(e,i,n,r,a,s,o,l);{let c=kt[gt++];return(128&c)>0?void(gt-=9):kn(e,i,n,r,a,s,o,l,c)}}if(t<12){let c=kt[gt++],h=kt[gt++];if((128&c)>0||(128&h)>0)return void(gt-=10);if(t<11)return kn(e,i,n,r,a,s,o,l,c,h);let d=kt[gt++];return(128&d)>0?void(gt-=11):kn(e,i,n,r,a,s,o,l,c,h,d)}{let c=kt[gt++],h=kt[gt++],d=kt[gt++],u=kt[gt++];if((128&c)>0||(128&h)>0||(128&d)>0||(128&u)>0)return void(gt-=12);if(t<14){if(t===12)return kn(e,i,n,r,a,s,o,l,c,h,d,u);{let p=kt[gt++];return(128&p)>0?void(gt-=13):kn(e,i,n,r,a,s,o,l,c,h,d,u,p)}}{let p=kt[gt++],f=kt[gt++];if((128&p)>0||(128&f)>0)return void(gt-=14);if(t<15)return kn(e,i,n,r,a,s,o,l,c,h,d,u,p,f);let g=kt[gt++];return(128&g)>0?void(gt-=15):kn(e,i,n,r,a,s,o,l,c,h,d,u,p,f,g)}}}}}function QR(){let t,e=kt[gt++];if(e<192)t=e-160;else switch(e){case 217:t=kt[gt++];break;case 218:t=He.getUint16(gt),gt+=2;break;case 219:t=He.getUint32(gt),gt+=4;break;default:throw new Error("Expected string")}return Am(t)}function $w(t){return xi.copyBuffers?Uint8Array.prototype.slice.call(kt,gt,gt+=t):kt.subarray(gt,gt+=t)}function Qh(t){let e=kt[gt++];if(gr[e]){let i;return gr[e](kt.subarray(gt,i=gt+=t),n=>{gt=n;try{return mn()}finally{gt=i}})}throw new Error("Unknown extension type "+e)}function UN(){let t=kt[gt++];if(!(t>=160&&t<192))return gt--,zN(mn());if(t-=160,fs>=gt)return Ql.slice(gt-ga,(gt+=t)-ga);if(!(fs==0&&Va<180))return y_(t);let e,i=4095&(t<<5^(t>1?He.getUint16(gt):t>0?kt[gt]:0)),n=IE[i],r=gt,a=gt+t-3,s=0;if(n&&n.bytes==t){for(;r<a;){if(e=He.getUint32(r),e!=n[s++]){r=1879048192;break}r+=4}for(a+=3;r<a;)if(e=kt[r++],e!=n[s++]){r=1879048192;break}if(r===a)return gt=r,n.string;a-=3,r=gt}for(n=[],IE[i]=n,n.bytes=t;r<a;)e=He.getUint32(r),n.push(e),r+=4;for(a+=3;r<a;)e=kt[r++],n.push(e);let o=t<16?SC(t):BN(t);return n.string=o??y_(t)}function zN(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return t.toString();if(t==null)return t+"";if(xi.allowArraysInMapKeys&&Array.isArray(t)&&t.flat().every(e=>["string","number","boolean","bigint"].includes(typeof e)))return t.flat().toString();throw new Error("Invalid property type for record: "+typeof t)}function NN(t){eO&&eO();let e=Va,i=gt,n=v_,r=ga,a=fs,s=Ql,o=g_,l=Ko,c=_r,h=new Uint8Array(kt.slice(0,Va)),d=Qe,u=Qe.slice(0,Qe.length),p=xi,f=Qo,g=t();return Va=e,gt=i,v_=n,ga=r,fs=a,Ql=s,g_=o,Ko=l,_r=c,kt=h,Qo=f,(Qe=d).splice(0,Qe.length,...u),xi=p,He=new DataView(kt.buffer,kt.byteOffset,kt.byteLength),g}function PE(){kt=null,Ko=null,Qe=null}function OX(t){t.unpack?gr[t.type]=t.unpack:gr[t.type]=t}var DE,kt,Va,gt,JR,g_,v_,xi,Qe,Ql,ga,fs,_r,Ko,gr,He,Yw,FN,Qo,RE,tO,eO,Tm,kN,OE,y_,VN,jN,GN,kn,IE,LE,Zw,iO,nO,rO,BE,nv,aO,sO,oO,UE,Kw,Cg,IX=k(()=>{try{DE=new TextDecoder}catch{}gt=0,g_=JR=[],v_=0,xi={},ga=0,fs=0,gr=[],Yw={useRecords:!1,mapsAsObjects:!0},(FN=new class{}).name="MessagePack 0xC1",Qo=!1,RE=2,Tm=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=0&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(kt)return NN(()=>(PE(),this?this.unpack(t,e):Tm.prototype.unpack.call(Yw,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(Va=e.end||t.length,gt=e.start||0):(gt=0,Va=e>-1?e:t.length),v_=0,fs=0,Ql=null,g_=JR,_r=null,kt=t;try{He=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw kt=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof Tm){if(xi=this,this.structures)return Qe=this.structures,iv(e);(!Qe||Qe.length>0)&&(Qe=[])}else xi=Yw,(!Qe||Qe.length>0)&&(Qe=[]);return iv(e)}unpackMultiple(t,e){let i,n=0;try{Qo=!0;let r=t.length,a=this?this.unpack(t,r):nv.unpack(t,r);if(!e){for(i=[a];gt<r;)n=gt,i.push(iv());return i}if(e(a,n,gt)===!1)return;for(;gt<r;)if(n=gt,e(iv(),n,gt)===!1)return}catch(r){throw r.lastPosition=n,r.values=i,r}finally{Qo=!1,PE()}}_mergeStructures(t,e){t=t||[],Object.isFrozen(t)&&(t=t.map(i=>i.slice(0)));for(let i=0,n=t.length;i<n;i++){let r=t[i];r&&(r.isShared=!0,i>=32&&(r.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in e||[])if(i>=0){let n=t[i],r=e[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,e){return this.unpack(t,e)}},kN=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,OE=(t,e)=>function(){let i=kt[gt++];if(i===0)return e();let n=t<32?-(t+(i<<5)):t+(i<<5),r=Qe[n]||LN()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=CE(r,t)),r.read()},y_=Am,VN=Am,jN=Am,GN=Am,kn=String.fromCharCode,IE=new Array(4096),LE=(t,e)=>{let i=mn().map(zN),n=t;e!==void 0&&(t=t<32?-((e<<5)+t):(e<<5)+t,i.highByte=e);let r=Qe[t];return r&&(r.isShared||Qo)&&((Qe.restoreStructures||(Qe.restoreStructures=[]))[t]=r),Qe[t]=i,i.read=CE(i,n),(i.read0||i.read)()},gr[0]=()=>{},gr[0].noBuffer=!0,gr[66]=t=>{let e=t.byteLength%8||8,i=BigInt(128&t[0]?t[0]-256:t[0]);for(let n=1;n<e;n++)i<<=BigInt(8),i+=BigInt(t[n]);if(t.byteLength!==e){let n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=(a,s)=>{let o=s-a;if(o<=40){let d=n.getBigUint64(a);for(let u=a+8;u<s;u+=8)d<<=BigInt(64),d|=n.getBigUint64(u);return d}let l=a+(o>>4<<3),c=r(a,l),h=r(l,s);return c<<BigInt(8*(s-l))|h};i=i<<BigInt(8*(n.byteLength-e))|r(e,n.byteLength)}return i},Zw={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},gr[101]=()=>{let t=mn();if(!Zw[t[0]]){let e=Error(t[1],{cause:t[2]});return e.name=t[0],e}return Zw[t[0]](t[1],{cause:t[2]})},gr[105]=t=>{if(xi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(gt-4);Ko||(Ko=new Map);let i,n=kt[gt];i=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&kt[gt+1]===115?new Set:{};let r={target:i};Ko.set(e,r);let a=mn();if(!r.used)return r.target=a;if(Object.assign(i,a),i instanceof Map)for(let[s,o]of a.entries())i.set(s,o);if(i instanceof Set)for(let s of Array.from(a))i.add(s);return i},gr[112]=t=>{if(xi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(gt-4),i=Ko.get(e);return i.used=!0,i.target},gr[115]=()=>new Set(mn()),iO=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(t=>t+"Array"),nO=typeof globalThis=="object"?globalThis:window,gr[116]=t=>{let e=t[0],i=Uint8Array.prototype.slice.call(t,1).buffer,n=iO[e];if(!n){if(e===16)return i;if(e===17)return new DataView(i);throw new Error("Could not find typed array for code "+e)}return new nO[n](i)},gr[120]=()=>{let t=mn();return new RegExp(t[0],t[1])},rO=[],gr[98]=t=>{let e=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3],i=gt;return gt+=e-t.length,_r=rO,(_r=[QR(),QR()]).position0=0,_r.position1=0,_r.postBundlePosition=gt,gt=i,mn()},gr[255]=t=>t.length==4?new Date(1e3*(16777216*t[0]+(t[1]<<16)+(t[2]<<8)+t[3])):t.length==8?new Date(((t[0]<<22)+(t[1]<<14)+(t[2]<<6)+(t[3]>>2))/1e6+1e3*(4294967296*(3&t[3])+16777216*t[4]+(t[5]<<16)+(t[6]<<8)+t[7])):t.length==12?new Date(((t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3])/1e6+1e3*((128&t[4]?-281474976710656:0)+1099511627776*t[6]+4294967296*t[7]+16777216*t[8]+(t[9]<<16)+(t[10]<<8)+t[11])):new Date("invalid"),BE=new Array(147);for(let t=0;t<256;t++)BE[t]=+("1e"+Math.floor(45.15-.30103*t));(nv=new Tm({useRecords:!1})).unpack,nv.unpackMultiple,nv.unpack,aO=new Float32Array(1),new Uint8Array(aO.buffer,0,4)}),LX=k(()=>{IX(),vC(),wC(),Kc(),zb(),Zc(),sO=[{Class:$t.prototype.constructor,type:1,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,$t.prototype),t)},{Class:Vt.prototype.constructor,type:2,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Vt.prototype),t)},{Class:Xn.prototype.constructor,type:3,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Xn.prototype),t)},{Class:p_.prototype.constructor,type:4,write:t=>t.id,read:t=>new p_(t)},{Class:EE.prototype.constructor,type:5,write:t=>t.data,read:t=>new EE(t)},{Class:gn.prototype.constructor,type:6,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,gn.prototype),t)}];for(let t of sO)OX(t);oO=new Tm({structuredClone:!0}),(UE||(UE={})).deserialize=function(t){return oO.unpack(t)}}),BX=k(()=>{LX(),Kw=t=>()=>{throw new Error(t+" is not available in the runtime build (decode-only CollabSerialize)")},Cg={deserialize:UE.deserialize,serialize:Kw("CollabSerialize.serialize"),checksum:Kw("CollabSerialize.checksum")}}),Ye=k(()=>{kb(),TX(),yC(),Zc(),zb(),_C(),Kc(),PX(),DX(),IN(),RX(),vC(),BX(),CN(),wC()});function __(t){return t==="MouseDown"||t==="MouseUp"||t==="KeyDown"||t==="KeyUp"||t==="Collision"||t==="Trigger"}var lO,zE,Iu,rv,Qw,hO,cO,dO,NE,FE,uO,pO,fO,mO,gO,kE,VE,vO,yO,_O,bO,HN=k(()=>{var t,e,i;Ye(),rt(),(t=lO||(lO={})).toEventUIType=function(n){return n.type==="Conditional"?n.condition.type==="Distance"?"Distance":"StateChange":n.type},t.fromEventUIType=function(n){return n==="Distance"||n==="StateChange"?"Conditional":n},zE={LookAt:[],Follow:["Create"],DragDrop:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseHover:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Scroll:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Start:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Conditional:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MousePress:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyPress:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],GameControl:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],Collision:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Trigger:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Resize:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],VariableChange:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],API:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],WEBHOOK:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],AIAssistantListener:["SetVariable"],AIAssistantTrigger:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]},(n=>{n.is=function(r){return r.type==="MouseDown"||r.type==="MouseUp"||r.type==="MousePress"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="KeyPress"},n.defaultData=function(r){return r==="MouseDown"||r==="MouseUp"||r==="MousePress"?{type:r,mode:"Object",disabled:!1,name:"",actions:new Vt}:{type:r,disabled:!1,name:"",key:void 0,actions:new Vt}}})(Iu||(Iu={})),(n=>{n.propertyDefaultData=function(r){return{type:"Property",value:[r??null,"position","x"]}},n.valueDefaultData={type:"Literal",value:0}})(rv||(rv={})),(e=Qw||(Qw={})).comparisonDefaultData=function(n){return{type:"Comparison",operator:"==",lOperand:rv.propertyDefaultData(n),rOperand:{...rv.valueDefaultData}}},e.distanceDefaultData=function(n){return{type:"Distance",toObject:n??null,fromObject:n??null,distance:200}},e.stateDefaultData=function(n,r){return{type:"State",object:n??null,state:r??null}},(hO||(hO={})).isConditionalSubActions=function(n){return n.find(r=>r==="ifActions"||r==="elseActions")!==void 0},(n=>{n.is=function(r){return r.type==="Conditional"},n.defaultData=function(r){return{type:"Conditional",disabled:!1,name:"",inActions:new Vt,outActions:new Vt,condition:Qw.distanceDefaultData(r)}}})(cO||(cO={})),(dO||(dO={})).defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new Vt,drop:new Vt}},(NE||(NE={})).defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new Vt},(FE||(FE={})).defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5},(n=>{n.is=function(r){return r.type==="MouseHover"},n.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new Vt}}})(uO||(uO={})),(n=>{n.is=function(r){return r.type==="Scroll"},n.defaultData=function(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new Vt}}})(pO||(pO={})),(n=>{n.is=function(r){return r.type==="Start"},n.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Vt}}})(fO||(fO={})),(n=>{n.is=function(r){return r.type==="Collision"},n.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Vt}}})(mO||(mO={})),(n=>{n.is=function(r){return r.type==="Trigger"},n.defaultData=function(r,a){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Vt,triggerZone:"box",position:a.toArray(),rotation:[0,0,0],size:r.toArray(),radius:r.length()/2,helperVisible:!0}}})(gO||(gO={})),(i=kE||(kE={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},i.is=function(n){return n.type==="Resize"},i.sizeToDevice=function(n){return typeof n=="string"?n:"custom"},i.deviceToSize=function(n){return typeof n=="string"?[...i.defaultSizes[n]]:[...n]},i.defaultData=function(){let n={size:"mobile",operator:"<",actions:new Vt},r={size:"tablet",operator:"<",actions:new Vt},a={size:[...i.defaultSizes.custom],operator:"<>",actions:new Vt},s=new Vt;return s.push({id:It.generateUUID(),fi:0,data:n},{id:It.generateUUID(),fi:1,data:r},{id:It.generateUUID(),fi:2,data:a}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:s}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new Vt}},(n=>{n.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]},n.is=function(r){return r.type==="VariableChange"},n.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new Vt,variableId:"",objectId:null,property:"Position X"}}})(VE||(VE={})),(n=>{n.is=function(r){return r.type==="API"},n.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Vt,errorActions:new Vt,userAPIId:""}}})(vO||(vO={})),(n=>{n.is=function(r){return r.type==="WEBHOOK"},n.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Vt,userWebhookId:""}}})(yO||(yO={})),(n=>{n.is=function(r){return r.type==="AIAssistantListener"},n.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Vt,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(_O||(_O={})),(n=>{n.is=function(r){return r.type==="AIAssistantTrigger"},n.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Vt}}})(bO||(bO={}))});function xO(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function wO(t){return typeof t=="string"&&t.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)}var Qc,qu,WN,Rr,SO,eo,ch,Pg,MO,Nc,Cn,Je,jE,EO,b_,x_,Sc,AO,TO,CO,PO,DO,RO,OO,Jw,IO,LO,tS,BO,UO,zO,eS,NO,iS,FO,kO,VO,jO,GO,HO,WO,qO,XO,Wc,Jo,Jl,GE,HE,w_,S_,M_,E_,A_,WE,qE,T_,XE,Xu,$O,nS,rS,$E,YO,C_,ZO,KO,P_,QO,JO,tI,eI,iI,nI,rI,aI,sI,MC,qN,Qi,Vi,Su,XN,Dg,D_,Mc,YE,EC,R_,O_,ZE,Wo,i1,er,aS,Wl,I_,ig,sS,oS,lS,$u,hS,KE,QE,oI,Ld,$N,En,L_,lI,hI,cI,dI,Ws,ng,B_,U_,tl,Fc,uI,th,z_,el,cS,dS,Ac,up,Tc,rg,JE,pI,br,uS,fI,mI,qo,ka,Yu,tA,N_,F_,xa=k(()=>{var t,e,i,n,r,a,s,o;Qc="personal camera",qu="a218fcc3-276b-49b9-b485-49037fd14f5f",WN=2500134,Rr=5526619,(t=SO||{}).x="x",t.y="y",t.z="z",SO=t,(l=>{function c(u,p){return Math.pow(p[0]-u[0],2)+Math.pow(p[1]-u[1],2)}function h(u,p){return Math.sqrt(c(u,p))}function d(u,p,f){let g=l.sub(p,u),m=l.sub(f,u),y=l.dot(g,m)/l.dot(g,g),v=l.scalarMultiply(g,y);return l.add(u,v)}l.isEqual=function(u,p){return u[0]===p[0]&&u[1]===p[1]},l.lerp=function(u,p,f){return[u[0]+(p[0]-u[0])*f,u[1]+(p[1]-u[1])*f]},l.add=function(u,p){return[u[0]+p[0],u[1]+p[1]]},l.sub=function(u,p){return[u[0]-p[0],u[1]-p[1]]},l.multiply=function(u,p){return[u[0]*p[0],u[1]*p[1]]},l.divide=function(u,p){return[u[0]/p[0],u[1]/p[1]]},l.distanceSquared=c,l.distance=h,l.dot=function(u,p){return u[0]*p[0]+u[1]*p[1]},l.scalarMultiply=function(u,p){return[u[0]*p,u[1]*p]},l.projectionOnto=d,l.projectionOntoDistance=function(u,p,f){return h(u,d(u,p,f))},l.center=function(u,p){return[.5*(u[0]+p[0]),.5*(u[1]+p[1])]}})(eo||(eo={})),(e=ch||(ch={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]},e.add=function(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]},e.sub=function(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]},e.div=function(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]},e.mul=function(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]},e.dist=function(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])},e.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h]},(i=Pg||(Pg={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]&&l[3]===c[3]},i.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h,l[3]+(c[3]-l[3])*h]},(l=>{let c=180/Math.PI,h=Math.PI/180;function d(p){return typeof p=="number"?p*c:p}function u(p){return typeof p=="number"?p*h:p}l.radToDeg=function(p){return[d(p[0]),d(p[1]),d(p[2])]},l.degToRad=function(p){return[u(p[0]),u(p[1]),u(p[2])]}})(MO||(MO={})),(n=Nc||(Nc={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],n.isEqual=function(l,c){for(let h=0;h<16;h++)if(l[h]!==c[h])return!1;return!0},n.simplify=function(l){return l??n.identity},n.applyMatrix4=function(l,c){let h=c.slice(0);for(let d=0,u=c.length;d<u;d+=3){let p=l[3]*c[d]+l[7]*c[d+1]+l[11]*c[d+2]+l[15];h[d]=(l[0]*c[d]+l[4]*c[d+1]+l[8]*c[d+2]+l[12])/p,h[d+1]=(l[1]*c[d]+l[5]*c[d+1]+l[9]*c[d+2]+l[13])/p,h[d+2]=(l[2]*c[d]+l[6]*c[d+1]+l[10]*c[d+2]+l[14])/p}return h},(r=Cn||(Cn={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},r.white={r:1,g:1,b:1},r.red={r:1,g:0,b:0},r.black={r:0,g:0,b:0},r.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},r.clone=function(l){return{r:l.r,g:l.g,b:l.b}},r.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},r.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},r.equals=function(l,c){return l.r===c.r&&l.g===c.g&&l.b===c.b},r.equalsFixed=function(l,c){return l.r.toFixed(2)===c.r.toFixed(2)&&l.g.toFixed(2)===c.g.toFixed(2)&&l.b.toFixed(2)===c.b.toFixed(2)},r.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h}},r.is=function(l){return!!xO(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(a=Je||(Je={})).white={...Cn.white,a:1},a.is=function(l){return!!xO(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},a.transparent={...Cn.white,a:0},a.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},a.fromHexAndA=function(l,c){return{...Cn.fromHex(l),a:c}},a.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:l.a}},a.equals=function(l,c){return Cn.equals(l,c)&&l.a===c.a},a.equalsFixed=function(l,c){return Cn.equalsFixed(l,c)&&l.a.toFixed(2)===c.a.toFixed(2)},a.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h,a:l.a+(c.a-l.a)*h}},a.toStyle=function({r:l,g:c,b:h,a:d}=a.white){return`rgba(${255*l}, ${255*c}, ${255*h}, ${d})`},(jE||(jE={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(s=EO||{})[s.LINEAR=0]="LINEAR",s[s.EASE=1]="EASE",s[s.EASE_IN=2]="EASE_IN",s[s.EASE_OUT=3]="EASE_OUT",s[s.EASE_IN_OUT=4]="EASE_IN_OUT",s[s.CUBIC=5]="CUBIC",s[s.SPRING=6]="SPRING",s[s.ARC=7]="ARC",s[s.NONE=8]="NONE",EO=s,(b_||(b_={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(x_||(x_={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=Sc||(Sc={})).linear=[0,0,1,1],o.ease=[.25,.1,.25,1],o.easeIn=[.42,0,1,1],o.easeOut=[0,0,.58,1],o.easeInOut=[.42,0,.58,1]}),UX=k(()=>{var t,e;Ye(),HN(),(AO||(AO={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(TO||(TO={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(CO||(CO={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(PO||(PO={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(DO||(DO={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(RO||(RO={})).defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"},(OO||(OO={})).defaultData={type:"Reset",name:"",delay:0},(Jw||(Jw={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(t=IO||(IO={})).pauseDefaultData={interaction:"pause",delay:0},t.stopDefaultData={interaction:"stop",delay:0},(e=LO||(LO={})).defaultData={type:"Audio",name:"",...Jw.defaultData},e.hasAudioByActions=i=>i.some(({data:n})=>n.type==="Audio"&&n.interaction==="play"&&n.audio),e.hasAudioByEvents=i=>{for(let{data:n}of i)if(Iu.is(n)||n.type==="Start"||n.type==="Collision"){if(e.hasAudioByActions(n.actions))return!0}else if(n.type==="Conditional"){if(e.hasAudioByActions(n.inActions)||e.hasAudioByActions(n.outActions))return!0}else if(n.type==="GameControl"&&Object.values(n.gameActions).find(r=>e.hasAudioByActions(r)))return!0},e.getAudiosByActions=i=>{let n=[];return i.forEach(r=>{let a=r.data;a.type==="Audio"&&a.interaction==="play"&&a.audio&&n.push(r),a.type==="Conditional"&&(n.push(...e.getAudiosByActions(a.ifActions)),n.push(...e.getAudiosByActions(a.elseActions)))}),n},e.getAudiosByEvents=i=>{let n=[];return i.forEach(({data:r})=>{Iu.is(r)||r.type==="Collision"||r.type==="Start"||r.type==="Trigger"?n.push(...e.getAudiosByActions(r.actions)):r.type==="Conditional"?(n.push(...e.getAudiosByActions(r.inActions)),n.push(...e.getAudiosByActions(r.outActions))):r.type==="GameControl"?Object.values(r.gameActions).forEach(a=>{n.push(...e.getAudiosByActions(a))}):r.type==="DragDrop"&&(n.push(...e.getAudiosByActions(r.dragDropActions.drag)),n.push(...e.getAudiosByActions(r.dragDropActions.drop)))}),n},(tS||(tS={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(BO||(BO={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...tS.defaultData},i.hasVideoByActions=n=>n.some(({data:r})=>r.type==="Video"&&r.interaction==="play"&&r.layerId),i.hasVideoByObject=n=>{if(n.events){for(let{data:r}of n.events)if((Iu.is(r)||r.type==="Start")&&i.hasVideoByActions(r.actions))return!0}},i.getVideosByActions=n=>{let r=[];return n.forEach(a=>{let s=a.data;s.type==="Video"&&s.interaction==="play"&&s.layerId&&r.push(a)}),r},i.getVideosByEvents=n=>{let r=[];return n.forEach(({data:a})=>{(Iu.is(a)||a.type==="Start")&&r.push(...i.getVideosByActions(a.actions))}),r}})(UO||(UO={})),(zO||(zO={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(eS||(eS={})).defaultData=function(){return{tweens:new Vt,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(NO||(NO={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...eS.defaultData()}},(iS||(iS={})).defaultData=function(i){return{interaction:"play",timeline:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(FO||(FO={})),(kO||(kO={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...iS.defaultData(i)}},(VO||(VO={})).defaultData=function(i,n,r){return{type:"Animation",name:"",object:i,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(jO||(jO={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(GO||(GO={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Vt,elseActions:new Vt,condition:[]}),(HO||(HO={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(WO||(WO={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(qO||(qO={})).defaultData={name:"",type:"UserAPI"}}),zX=k(()=>{var t;(t=XO||(XO={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),e=>e.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},t.maxSize=2e6}),YN=k(()=>{var t;(t=Wc||(Wc={})).all=["PerspectiveCamera","OrthographicCamera"],t.is=function(e){return t.all.includes(e)},(e=>{e.DefaultUp=[0,1,0],e.DefaultTargetOffset=1e3,e.MinTargetOffset=.001,e.sanitizeTargetOffset=function(a){return a===void 0||!Number.isFinite(a)||a<e.MinTargetOffset?e.DefaultTargetOffset:a},e.DefaultAzimuth=-24,e.DefaultElevation=15;let i=e.DefaultAzimuth*Math.PI/180,n=e.DefaultElevation*Math.PI/180,r=180/Math.PI;e.DefaultPosition=[e.DefaultTargetOffset*Math.sin(i)*Math.cos(n),e.DefaultTargetOffset*Math.sin(n),e.DefaultTargetOffset*Math.cos(i)*Math.cos(n)],e.DefaultRotation=[Math.atan2(-Math.sin(n),Math.cos(i)*Math.cos(n))*r,Math.asin(Math.sin(i)*Math.cos(n))*r,Math.atan2(Math.sin(i)*Math.sin(n),Math.cos(i))*r],e.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:e.DefaultUp,isUpVectorFlipped:!1,targetOffset:e.DefaultTargetOffset},e.getZoom=function(a){return a.type==="PerspectiveCamera"?a.perspective?.zoom??1:a.orthographic?.zoom??1}})(Jo||(Jo={}))}),ZN=k(()=>{var t;(t=Jl||(Jl={})).defaultData=function(e,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof e[0]=="number"?e[0]:1,typeof e[1]=="number"?e[1]:1),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof e[0]=="number"?e[0]+e[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:e.map(n=>(typeof n=="number"?n:1)*(1+i)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}},t.merge=function(e,i){let n={...e};if(HE.forEach(r=>{Object.assign(n,{[r]:i[r]??e[r]})}),n.radial={...e.radial},i.radial){let r=e.radial,a=i.radial;w_.forEach(s=>{Object.assign(n.radial,{[s]:a[s]??r[s]})})}if(n.linear={...e.linear},i.linear){let r=e.linear,a=i.linear;S_.forEach(s=>{Object.assign(n.linear,{[s]:a[s]??r[s]})})}if(n.grid={...e.grid},i.grid){let r=e.grid,a=i.grid;M_.forEach(s=>{Object.assign(n.grid,{[s]:a[s]??r[s]})})}if(n.toObject={...e.toObject},i.toObject){let r=e.toObject,a=i.toObject;E_.forEach(s=>{Object.assign(n.toObject,{[s]:a[s]??r[s]})})}if(n.randomnessObject={...e.randomnessObject},i.randomnessObject){let r=e.randomnessObject,a=i.randomnessObject;A_.forEach(s=>{Object.assign(n.randomnessObject,{[s]:a[s]??r[s]})})}return n},t.isPartial=function(e){return!(!e.randomnessObject&&!e.toObject)},(e=>{e.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];e.toOps=function(n,r){let a=[];n.count!==void 0&&a.push({type:0,path:r,props:{count:n.count}});for(let s of i){let o=n[s];o&&Object.keys(o).length>0&&a.push({type:0,path:[...r,s],props:o})}return a}})(GE||(GE={})),HE=["count"],w_=["radius","start","end","position","scale","rotation"],S_=["position","scale","rotation"],M_=["count","size"],E_=["count","position","scale","rotation"],A_=["strength","scale","rotation","position","movement","seed","freqScale"]}),KN=k(()=>{var t;xa(),(t=WE||(WE={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],t.is=function(e){return t.all.includes(e)},(qE||(qE={})).defaultData=function(e){return function(i){if(i==="PointLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(i==="DirectionalLight")return{type:i,color:Je.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(e)}}),QN=k(()=>{var t;(t=T_||(T_={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},t.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},t.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:t.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...t.defaultCollisionData}}),JN=k(()=>{var t;(t=XE||(XE={})).defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},t.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),AC=k(()=>{(Xu||(Xu={})).defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]}}),tF=k(()=>{var t,e;(t=$O||{})[t.Front=0]="Front",t[t.Back=1]="Back",t[t.Double=2]="Double",$O=t,(e=nS||(nS={})).defaultData={castShadow:!0,receiveShadow:!0},e.equals=function(i,n){return i.castShadow===n.castShadow&&i.receiveShadow===n.receiveShadow},(i=>{i.defaultData={flatShading:!1,wireframe:!1,side:0},i.equals=function(n,r){return n.flatShading===r.flatShading&&n.side===r.side&&n.wireframe===r.wireframe&&(n.shadowCatcher??!1)===(r.shadowCatcher??!1)}})(rS||(rS={})),($E||($E={})).defaultData={...rS.defaultData,...nS.defaultData},(YO||(YO={})).getMaterialData=function(i,n){let r=[];if("material"in i){let a=typeof i.material=="string"?n.materials[i.material]??n.lib.materials[i.material]?.asset:i.material;a&&r.push(a)}else if("materials"in i)for(let a of i.materials){let s=typeof a=="string"?n.materials[a]??n.lib.materials[a]?.asset:a;s&&r.push(s)}return r}}),eF=k(()=>{var t;(t=C_||(C_={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},t.maxSize=3e7}),Vb=k(()=>{var t,e,i,n;Ye(),xa(),eF(),xa(),(ZO||(ZO={})).is=function(r){return r==="texture"||r==="video"||r==="color"||r==="depth"||r==="normal"||r==="gradient"||r==="noise"||r==="fresnel"||r==="cavity"||r==="dust"||r==="rainbow"||r==="toon"||r==="outline"||r==="particle"||r==="transmission"||r==="reflection"||r==="matcap"||r==="displace"||r==="pattern"||r==="vertexColor"||r==="light"},(KO||(KO={})).is=function(r){return r==="luminance"||r==="r"||r==="g"||r==="b"||r==="a"},(P_||(P_={})).is=function(r){return typeof r=="object"&&r!==null&&r.image!=null},(QO||(QO={})).is=function(r){return r==="phong"||r==="toon"||r==="lambert"||r==="physical"},(n=JO||{})[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",JO=n,tI=(r=>(r[r.RepeatWrapping=1e3]="RepeatWrapping",r[r.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",r[r.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",r))(tI||{}),eI=(r=>(r[r.NearestFilter=1003]="NearestFilter",r[r.LinearFilter=1006]="LinearFilter",r[r.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",r))(eI||{}),(i=iI||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",iI=i,(e=nI||{})[e.Simplex=0]="Simplex",e[e.SimplexFractal=1]="SimplexFractal",e[e.Ashima=2]="Ashima",e[e.Fbm=3]="Fbm",e[e.Perlin=4]="Perlin",e[e.Voronoi=5]="Voronoi",nI=e,(t=rI||{})[t.F1=0]="F1",t[t.F2=1]="F2",t[t.F2MinusF1=2]="F2MinusF1",t[t.SmoothBlend=3]="SmoothBlend",t[t.Edge=4]="Edge",t[t.Power=5]="Power",t[t.Lines=6]="Lines",t[t.Cells=7]="Cells",rI=t,aI=(r=>(r[r.Lights=0]="Lights",r[r.Static=1]="Static",r[r.Camera=2]="Camera",r))(aI||{}),sI=(r=>(r[r.Circle=0]="Circle",r[r.Ring=1]="Ring",r[r.Polygon=2]="Polygon",r[r.Cross=3]="Cross",r[r.Diamond=4]="Diamond",r[r.Checkerboard=5]="Checkerboard",r[r.Line=6]="Line",r[r.Wave=7]="Wave",r))(sI||{}),MC=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],qN=["wrapping","image","video","name","minFilter","magFilter"],(r=>{r.patch=function(a,s){let{texture:o,...l}=s;if(Object.assign(a,l),o){let c=a.texture;c&&Object.assign(c,o)}},r.defaultColorLayer=function(a){return{...r.defaultData("color"),color:a}},r.defaultData=function(a,s){return a==="light"&&s?function(o){let l={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(o){case"phong":return{...l,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...l,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...l,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...l,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}(s):function(o){let l={alpha:1,mode:0,isMask:!1,visible:!0};switch(o){case"texture":return{...l,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...l,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:C_.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:Cn.fromHex(Rr)};case"vertexColor":return{...l,type:"vertexColor"};case"depth":return{...l,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...l,type:"normal",cnormal:[1,1,1]};case"gradient":return{...l,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...l,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...Cn.fromHex(6710886),a:1},colorB:{...Cn.fromHex(6710886),a:1},colorC:{...Cn.fromHex(16777215),a:1},colorD:{...Cn.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"cavity":return{...l,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...l,type:"fresnel",color:Je.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:Je.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...l,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...l,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Je.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:Je.fromHexAndA(0,1),contourColor:Je.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...l,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...l,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...l,type:"reflection",blur:0,thickness:.001,steps:60,stepSize:.005,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...l,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...Cn.fromHex(0),a:1},colorB:{...Cn.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}(a)}})(Qi||(Qi={})),(r=>{function a(s,o="layer1",l="layer2",c=Cn.fromHex(16777215)){let h=new Vt;return h.push({fi:0,data:Qi.defaultData("light",s),id:o}),h.push({fi:1,data:Qi.defaultData("color"),id:l}),{layers:h}}r.isMergable=function(s){return!s.layers.some(o=>o.data.type==="texture"&&o.data.projection!==0||o.data.type==="depth"&&!o.data.isWorldSpace||o.data.type==="noise"||o.data.type==="dust"&&o.data.noiseStrength!==0||o.data.type==="displace")},r.getHash=function(s){let o="";return s.layers.forEach(l=>{Object.entries(l.data).forEach(([c,h])=>{o+=`${c}${h}`,Array.isArray(h)?h.forEach(d=>o+=`${d}`):typeof h=="object"?Object.values(h).forEach(d=>{o+=typeof d=="number"?`${d.toFixed(4)}`:`${d}`}):o+=`${h}`})}),o},r.defaultEmptyData=function(){return{layers:new Vt}},r.defaultData=function(s="layer1",o="layer2"){return a("physical",s,o)},r.withName=function(s,o){return{...s,name:o}},r.defaultTwoLayerData=a,r.defaultColorMaterial=function(s,o,l="layer1",c="layer2"){let h=new Vt;return h.push({fi:0,data:Qi.defaultData("light",o),id:l}),h.push({fi:1,data:Qi.defaultColorLayer(s),id:c}),{layers:h}},r.defaultUIObjectMaterial=function(s){let o=Qi.defaultData("texture");s&&Object.assign(o.texture,{image:s});let l=new Vt;return l.push({fi:0,data:o,id:"layer1"}),l.push({fi:1,data:{...Qi.defaultData("transmission"),alpha:1},id:"layer2"}),l.push({fi:2,data:{...Qi.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:l}},r.defaultTwoLayerTextureData=function(s,o="physical",l="layer1",c="layer2"){let h=Qi.defaultData("texture");Object.assign(h.texture,{image:s});let d=new Vt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:Qi.defaultData("light",o),id:c}),{layers:d}},r.defaultTwoLayerVideoTextureData=function(s,o="physical",l="layer1",c="layer2"){let h=Qi.defaultData("video");Object.assign(h.texture,{video:s});let d=new Vt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:Qi.defaultData("light",o),id:c}),{layers:d}}})(Vi||(Vi={}))}),NX=k(()=>{Su="Roboto_regular",XN="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),iF=k(()=>{Ye(),(Dg||(Dg={})).defaultData=function(){return{points:new Vt,roundness:0,shapeHoles:[],isClosed:!1}}}),nF=k(()=>{Ye(),(D_||(D_={})).defaultData=function(){return{points:new Vt,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},Mc={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(YE||(YE={})).merge=function(t,e){let i={...t};return R_.forEach(n=>{Object.assign(i,{[n]:e[n]??t[n]})}),i},EC={shape:Mc,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},R_=["depth","offset","angle","twist","startScale","endScale"]}),TC=k(()=>{var t,e;iF(),nF(),(t=O_||(O_={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},t.isParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="BooleanGeometry"||i==="TextGeometry"||i==="InputGeometry"||i==="DecalGeometry"},t.isSwappableGeometry=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="TextGeometry"||i==="SubdivGeometry"||i==="NonParametricGeometry"},(ZE||(ZE={})).merge=function(i,n){let r={...i};return Object.assign(r,n),r.type==="PathGeometry"&&"extrusion"in n&&n.extrusion&&(r.extrusion={...i.extrusion},Object.assign(r.extrusion,YE.merge(r.extrusion,n.extrusion))),r},(e=Wo||(Wo={})).defaultData=function(i){if(i==="RectangleGeometry")return{width:320,height:320,type:i,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="UIGeometry")return{type:i,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(i==="PathGeometry")return{type:i,width:1,height:1,depth:1,path:D_.defaultData(),extrusion:EC};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:Dg.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="ShapeBlendGeometry")return{type:i,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(i==="DecalGeometry")return{type:i,width:200,height:200,depth:200,offset:1};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="InputGeometry")return{...e.defaultData("TextGeometry"),type:i,editable:!0};if(i==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")},i1=["width","height","depth"]}),rF=k(()=>{xa(),(t=>{function e(i){return i.mode??"linear"}t.defaultData={enabled:!1,useBackgroundColor:!1,color:Cn.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},t.getMode=e,t.getModeIndex=function(i){let n=e(i);return n==="height"?1:n==="both"?2:0},t.getDensity=function(i){return i.density??t.defaultData.density},t.getHeightFalloff=function(i){return i.heightFalloff??t.defaultData.heightFalloff},t.getHeightBase=function(i){return i.heightBase??t.defaultData.heightBase}})(er||(er={}))}),CC=k(()=>{(aS||(aS={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(Wl||(Wl={})).defaultData={enabled:!1,mode:"hdri",hdri:aS.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}}),aF=k(()=>{(()=>{let t={opacity:1,blendFunction:13,enabled:!1};(I_||(I_={})).defaultData={enabled:!1,pixelation:{...t,blendFunction:16,granularity:15},bloom:{...t,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...t,offset:[2,2]},vignette:{...t,darkness:1,offset:0},hueSaturation:{...t,hue:3,saturation:0},brightnessContrast:{...t,brightness:.25,contrast:0},depthOfField:{...t,focusDistance:100,focalLength:20,bokehScale:5},noise:{...t,blendFunction:16}}})()}),PC=k(()=>{var t;rF(),CC(),aF(),xa(),(t=ig||(ig={})).defaultData={type:"normal",softShadowQuality:"low"},t.isSoft=function(e){return e!=null&&(e.type===void 0||e.type==="soft")},(sS||(sS={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(oS||(oS={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},e.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(lS||(lS={})),($u||($u={})).defaultData={usePhysics:!1,gravity:-10},(hS||(hS={})).defaultData={playCamera:Qc,gameControlObject:null},(KE||(KE={})).defaultData={backgroundColor:Je.fromHexAndA(WN,1),postprocessing:I_.defaultData,fog:er.defaultData,sky:Wl.defaultData,globalPhysics:$u.defaultData,ambient:sS.defaultData,ao:oS.defaultData,shadow:ig.defaultData,publish:hS.defaultData,grading:lS.defaultData}}),FX=k(()=>{(QE||(QE={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),jb=k(()=>{var t,e,i;Ye(),YN(),KN(),QN(),JN(),AC(),tF(),xa(),Vb(),TC(),ZN(),sr(),PC(),FX(),(t=oI||(oI={})).isComponentRelated=function(n){return n==="Component"||n==="Instance"},t.isEmptyOrComponent=function(n){return n==="Empty"||n==="Instance"},(e=Ld||(Ld={})).identity={...jE.identity,hiddenMatrix:Nc.identity},e.fromObject=function(n){return{position:n.position,rotation:n.rotation,scale:n.scale,pivot:n.pivot,pivotRotation:n.pivotRotation,hiddenMatrix:n.hiddenMatrix}},e.merge=function(n,r){return{position:r?.position||n.position,rotation:r?.rotation||n.rotation,pivot:r?.pivot||n.pivot,pivotRotation:r?.pivotRotation||n.pivotRotation,scale:r?.scale||n.scale,hiddenMatrix:r?.hiddenMatrix||n.hiddenMatrix}},e.diff=function(n,r){return MN({position:ch.isEqual(n.position,r.position)?void 0:r.position,rotation:ch.isEqual(n.rotation,r.rotation)?void 0:r.rotation,scale:ch.isEqual(n.scale,r.scale)?null:r.scale,hiddenMatrix:Nc.isEqual(n.hiddenMatrix,r.hiddenMatrix)?void 0:r.hiddenMatrix})},$N=["slide","offset"],(En||(En={})).defaultData={states:new Vt,events:new Vt,timelineAnimations:new $t,visible:!0,raycastLock:!1,physics:Xu.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...Ld.identity,cloner:null},(L_||(L_={})).defaultData={type:"Empty",...En.defaultData},(lI||(lI={})).defaultData={type:"ParticleCollider",...QE.defaultData,...En.defaultData},(hI||(hI={})).defaultData={type:"Component",...En.defaultData},(cI||(cI={})).defaultData={type:"Particle",...En.defaultData,...T_.defaultData},(dI||(dI={})).defaultData={type:"Hair",...En.defaultData,...XE.defaultData},(Ws||(Ws={})).defaultData={type:"Mesh",...En.defaultData,...$E.defaultData},(ng||(ng={})).defaultData={...En.defaultData,...Ld.identity,position:Jo.DefaultPosition,rotation:Jo.DefaultRotation,...Jo.defaultData},(n=>{n.defaultData=function(r){return{...En.defaultData,...qE.defaultData(r)}},n.defaultDirectionalLightData={...n.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(B_||(B_={})),(n=>{function r(a,s,o=0){for(;o<s.length;){let l=a?a[s[o]]:void 0;if(s.length===o+1)return l;if(!l)return;a=l.descendants,o+=1}}n.resolveWithDes=r,n.resolve=function(a,s,o=0){let l=r(a,s,o);if(l){let c=Object.keys(l);if(c.length===1&&c[0]==="descendants")return}return l}})(U_||(U_={})),(n=>{function r(a,s){return{...En.defaultData,...s,component:a,overrides:new gn,physics:void 0,events:void 0,type:"Instance"}}n.rootOverrideProps=["physics","events"],n.compositeNonOptionalOverrideProps=["geometry"],n.compositeEntireOverrideOverrideProps=["material"],n.ofComponent=r,n.fromComponentData=function(a){let s=Ld.fromObject(a.data);return r(a.id,s)}})(tl||(tl={})),(n=>{n.defaultData={type:"Page",...En.defaultData,physics:{...Xu.defaultData,fusedBody:!1},...KE.defaultData,camera:ng.defaultData},n.isUIPage=function(r){return r.uiScene!==void 0}})(Fc||(Fc={})),(i=uI||(uI={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:Nc.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:Xu.defaultData,states:new Vt,events:new Vt,timelineAnimations:new $t,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...Jo.defaultData},i.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},i.defaultMeshObject={name:"Rectangle",...En.defaultData,...Ws.defaultData,geometry:Wo.defaultData("RectangleGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...En.defaultData,...Ws.defaultData,geometry:Wo.defaultData("BooleanGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...En.defaultData,...Ws.defaultData,geometry:Wo.defaultData("ShapeBlendGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...En.defaultData,...Ws.defaultData,geometry:Wo.defaultData("TextGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...En.defaultData,...Ws.defaultData,geometry:Wo.defaultData("InputGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},(n=>{n.newEmpty=function(r,a){let s={name:a};return r.type==="Mesh"?(s.geometry={},"material"in r&&(s.material={layers:new gn}),"materials"in r&&(s.materials=r.materials.map(o=>({layers:new gn})))):Wc.is(r.type)&&(s.perspective={},s.orthographic={}),s},n.toOps=function(r,a){let s,o=[],l={orthographic:0,perspective:0,geometry:0};function c(h,d){for(let[u,p]of Object.entries(d.layers)){let{texture:f,...g}=p;if(f!==void 0&&Object.keys(f).length>0){let m={path:[...h,"layers",u,"texture"],props:f,type:0};o.push(m)}if(Object.keys(g).length>0){let m={path:[...h,"layers",u],props:g,type:0};o.push(m)}}}for(let[h,d]of Object.entries(a)){let u=d;if(h!=="name")if(h==="cloner")o.push(...GE.toOps(u,["cloner"]));else if(h==="pathSnapping")o.push({path:[h],props:{slide:u.slide,offset:u.offset},type:0});else if(h==="material")c(["material"],u);else if(h==="materials")for(let[p,f]of Object.entries(u))c(["materials",p],f);else if(l[h]===0){if(h==="geometry"&&u.extrusion!==void 0){let p={path:[h,"extrusion"],props:u.extrusion,type:0};o.push(p),u={...u},delete u.extrusion}if(Object.keys(u).length>0){let p={path:[h],props:u,type:0};o.push(p)}}else s===void 0&&(s={path:[],props:{},type:0},o.push(s)),s.props[h]=u}return o},n.patch=function(r,a){if(a===void 0)return r;let s={...r};if(Object.assign(s,Ld.merge(s,a)),Object.assign(s,{pathSnapping:Object.assign({},s.pathSnapping,{slide:a.pathSnapping?.slide??s.pathSnapping?.slide??0,offset:a.pathSnapping?.offset??s.pathSnapping?.offset??0})}),Wc.is(r.type)){s.orthographic={...s.orthographic},s.perspective={...s.perspective};let o=a;o.orthographic?.zoom!==void 0&&(s.orthographic.zoom=o.orthographic.zoom),o.perspective?.zoom!==void 0&&(s.perspective.zoom=o.perspective.zoom),o.isUpVectorFlipped!==void 0&&(s.isUpVectorFlipped=o.isUpVectorFlipped),o.targetOffset!==void 0&&(s.targetOffset=o.targetOffset)}else if(r.type==="Mesh")"geometry"in a&&Object.assign(s,{geometry:ZE.merge(s.geometry,a.geometry)}),(a.material||a.materials)&&(s=function(o,l){if(l===void 0)return o;let c={...o};return"material"in c&&"material"in l&&l.material&&(c.material=m_(c.material,h=>{if(typeof h!="string")for(let[d,u]of Object.entries(l.material.layers)){let p=h.layers.data(d);p&&Qi.patch(p,u)}}).data),c.materials&&l.materials&&(c.materials=m_(c.materials,h=>{for(let d=0;d<c.materials.length;d++){let u=l.materials[d];if(typeof u!="string")for(let[p,f]of Object.entries(u.layers)){let g=h[d]?.layers?.data(p);g&&Qi.patch(g,f)}}}).data),c}(s,a)),s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Jl.merge(s.cloner,a.cloner)});else if(r.type==="Empty")s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Jl.merge(s.cloner,a.cloner)});else if(WE.is(r.type)){let o=a;o.intensity!==void 0&&(s.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?s.color=o.color:s.color=Cn.clone(o.color))}return s}})(th||(th={}))}),DC=k(()=>{(z_||(z_={})).defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0}}),Gb=k(()=>{DC(),xa(),(el||(el={})).defaultData={orbitControls:z_.defaultData,playPage:qu,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((t,e)=>{let i=0,n=0;return e<5?n=-30:e<10&&(n=30),e===0||e===10||e===5?i=30:(e===4||e===11||e===9)&&(i=-30),[120,[i,n],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0}}),sF=k(()=>{var t;(cS||(cS={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(dS||(dS={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(t=Ac||(Ac={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...cS.defaultData},isRandomSeed:!0,seed:t.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:dS.defaultData}),t.generateSeed=()=>Math.round(1e5*Math.random())}),RC=k(()=>{jb(),Ye(),Gb(),xa(),sr(),sF(),(t=>{function e(i,n){let r=i.scene.objects.get(n);if(r&&r.data.type==="Component")return r;{let a=i.shared.lib.components[n];if(a)return{...a.asset,id:n}}}t.physicsEnabled=function(i){return i.find(n=>n.data.type==="Page"&&n.data.globalPhysics.usePhysics)!==void 0},t.getComponentData=e,t.traverseModuleInstances=function(i,n,r){i.scene.objects.traverseFrom(n,(a,s)=>{if(s.type==="Instance"){let o=e(i,s.component)?.data;o&&r(a,s,o.events)}else r(a,s,s.events)})}})(up||(up={})),(t=>{function e(n=!0,r=[]){let a=[];n&&a.push({...t.defaultLight}),a.push(...r);let s=new Xn;return s.push({fi:1,id:qu,data:{...Fc.defaultData,name:"Scene 1"},children:a}),s}function i(n){return{...t.defaultData,objects:ea(n,Xn.prototype)}}t.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",t.defaultLight={fi:-1,data:B_.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},t.createDefaultObjectTreeWithPage=e,t.defaultData={objects:e(),publish:el.defaultData,styles:Ac.defaultData()},t.emptyDataWithoutPage=function(){return{objects:new Xn,publish:el.defaultData,styles:Ac.defaultData()}},t.emptyDataWithPage=function(n=!0){return{objects:e(n),publish:el.defaultData,styles:Ac.defaultData()}},t.emptyData=function(){return{objects:new Xn,publish:{...el.defaultData},styles:Ac.defaultData()}},t.withObjs=i,t.withObj=function(n,r){return i([{id:n,data:r,children:[],fi:0}])}})(Tc||(Tc={}))}),oF=k(()=>{(rg||(rg={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),OC=k(()=>{var t,e;Ye(),sr(),(t=JE||(JE={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Vt}),t.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(pI||(pI={})).defaultData=(i,n="GET")=>({url:i,method:n,name:"New API",headers:new Vt,queries:new Vt,autoStart:!0}),(i=>{function n(a){return a.textValue!==void 0}function r(a){return typeof a=="boolean"}i.isTextValue=n,i.isNumber=function(a){return typeof a=="number"},i.isBoolean=r,i.typeOfVariable=function(a){return n(a)?"string":r(a)?"boolean":"number"},i.getDisplayedValue=function(a){return i.isTextValue(a)?Array.isArray(a.textValue)?a.textValue.map(s=>s.toString().padStart(a.padding??2,"0")).join(a.deliminator??":")+(a.suffix!==void 0?" "+a.suffix:""):a.textValue.toString():i.isBoolean(a)?a?"True":"False":i.isNumber(a)?parseFloat(a.toFixed(3)).toString():a.toString()}})(br||(br={})),(uS||(uS={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(fI||(fI={})).all=[...uS.all,"components"],(mI||(mI={})).defaultData=function(){return{images:new $t,videos:new $t,colors:new $t,audios:new $t,particles:new $t,fonts:new $t,materials:new $t,components:new $t,variables:new $t,userAPIs:new $t,userWebhooks:new $t,timelineAnimations:new $t}},(qo||(qo={})).defaultData=function(){return{images:new $t,videos:new $t,colors:new $t,audios:new $t,particles:new $t,fonts:new $t,materials:new $t,components:new $t,variables:new $t,userAPIs:new $t,userWebhooks:new $t,timelineAnimations:new $t}},(e=ka||(ka={})).defaultColors=function(){return ea({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},$t.prototype)},e.defaultImages=function(){return ea({},$t.prototype)},e.emptyData=function(){return{catelogs:new $t,materials:new $t,images:new $t,videos:new $t,colors:new $t,timelineAnimations:new $t,audios:new $t,particles:new $t,fonts:new $t,variables:new Vt,userAPIs:new $t,userWebhooks:new $t,lib:qo.defaultData()}},e.defaultVariables=function(i){switch(i){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let n=[0,0,0];return{name:"Time",value:{textValue:n,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:n,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",i)}},e.getFormattedTimerTime=function(i,n){if(n.format==="HH:mm:ss"){let r=Math.floor(i/3600),a=Math.floor((i-3600*r)/60);return{textValue:[r,a,Math.round(i-3600*r-60*a)]}}if(n.format==="mm:ss"){let r=Math.floor(i/60);return{textValue:[r,Math.round(i-60*r)]}}return n.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),kX=k(()=>{}),lF=k(()=>{var t;Ye(),RC(),oF(),OC(),(t=Yu||(Yu={})).defaultData={schema:130,scene:Tc.defaultData,frames:new $t().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",rg.defaultData),shared:{...ka.emptyData(),colors:ka.defaultColors()}},t.createDefaultData=function(){return Cg.deserialize(Cg.serialize(t.defaultData))},t.emptyDataForImports=function(){return{schema:130,scene:Tc.emptyDataWithPage(),frames:new $t().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",rg.defaultData),shared:{...ka.emptyData(),colors:ka.defaultColors(),images:ka.defaultImages()}}},t.emptyData=function(){return{schema:130,scene:Tc.emptyDataWithPage(),frames:new $t().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",rg.defaultData),shared:ka.emptyData()}},t.clipboard2dData=function(){return{schema:130,scene:Tc.emptyData(),frames:new $t,shared:ka.emptyData()}},t.withoutLib=function(e){return{...e,shared:{...e.shared,lib:qo.defaultData()}}},t.getComponentData=function(e,i){return up.getComponentData(e,i)},t.hasSensitiveData=function(e){let i=Object.values(e.shared.userAPIs);for(let n of i){let r=n.headers;for(let a of r)if(a.data.key.toLowerCase()==="authorization"&&a.data.value!=="")return!0}return!1}}),VX=k(()=>{(tA||(tA={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}}),IC=k(()=>{var t;xa(),Ye(),(N_||(N_={})).list=["idle","move","jump","run"],(t=F_||(F_={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},t.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:t.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new Vt,move:new Vt,jump:new Vt,run:new Vt},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Je.fromHexAndA(3728051,1)}}});function vc(t,...e){let i={};for(let n of e.flat())t!=null&&n in t&&(i[n]=t[n]);return i}function gI(t){t.layers.forEach(e=>{if(e.type==="depth"&&e.colorA!==void 0){let i=e.colorA,n=e.colorB,r=[[i.r,i.g,i.b,i.a],[n.r,n.g,n.b,n.a]],a=[0,1];for(let o=2;o<10;o++)r.push(r[1]),a.push(1);let s={...vc(cn(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:r,steps:a,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,s)}else if(e.type==="depth"&&e.gradientType===1&&(e.near<0||e.far<0)){let i={...cn(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,i)}})}function Fo(t,e){Object.values(t.shared.materials).forEach(i=>e(i))}function ko(t,e){t.scene.objects.traverse((i,n)=>{"materials"in n?n.materials.forEach((r,a)=>{r===void 0&&(n.materials[a]=Vi.defaultTwoLayerData("phong"),r=n.materials[a]),typeof r!="string"&&e(r)}):"material"in n?typeof n.material!="string"&&(n.material===void 0&&(n.material=Vi.defaultTwoLayerData("phong")),e(n.material)):n.type==="Mesh"&&(n.material===void 0&&(n.material=Vi.defaultTwoLayerData("phong")),e(n.material)),"overrides"in n&&Object.values(n.overrides).forEach(r=>{r.material&&typeof r.material!="string"&&Object.getPrototypeOf(r.material)!==gn.prototype&&e(r.material)})})}function vI(t){t.layers===void 0&&Object.assign(t,Vi.defaultTwoLayerData("lambert"))}function pS(t){!t.layers||t.layers.forEach(e=>{if(e.type==="depth"&&e.colors.length===10){let i=[...e.colors];i.push(e.colors[9]);let n=[...e.steps];n.push(e.steps[9]);let r={...cn(e),colors:i,steps:n};Object.assign(e,r)}})}function yI(t){t.scene.objects.traverse((e,i)=>{"materials"in i?i.materials.forEach(n=>{typeof n!="string"&&pS(n)}):"material"in i&&typeof i.material!="string"&&pS(i.material)}),Object.values(t.shared.materials).forEach(e=>pS(e))}function _I(t){t.layers&&t.layers.forEach(e=>{e.type==="depth"&&e.num!==void 0&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)})}function bI(t){t.layers&&t.layers.forEach(e=>{(function(i){return i.type!=="displace"})(e)&&e.isMask===void 0&&(e.isMask=!1),(e.type==="texture"||e.type==="video")&&e.blending===void 0&&(e.blending=0),(e.type==="noise"||e.type==="displace"&&e.displacementType==="noise")&&(e.voronoiStyle===void 0&&(e.voronoiStyle=0),e.highCut===void 0&&(e.highCut=1),e.lowCut===void 0&&(e.lowCut=0),e.smoothness===void 0&&(e.smoothness=.3),e.seed===void 0&&(e.seed=0),e.quality===void 0&&(e.quality=1))})}function xI(t){let e=t.layers.find(i=>i.type==="light")?.data;if(e?.category==="basic"){let i=Qi.defaultData("light","phong"),n=e;Object.assign(n,i),n.visible=!1}}function wI(t){Fo(t,xI),ko(t,xI)}function SI(t){t.layers.forEach(e=>{e.type==="light"&&e.category!=="toon"&&e.occlusion===void 0&&(e.occlusion=!0)})}function MI(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.bumpMapIntensity===void 0&&(e.bumpMapIntensity=5)})}var jX=k(()=>{Vb(),xa(),DC(),jb(),Ye(),Gb(),sr(),rt(),TC(),IC(),sF(),RC(),AC(),PC()}),hF={};function EI(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.alphaOverride===void 0&&(e.alphaOverride=1)})}function AI(t){t.rotation=t.rotation.slice(0,3).map(e=>e*Ec)}function cF(t){AI(t),t.type==="Page"&&AI(t.camera),t.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(n=>n*Ec))});let e=t.geometry;e&&e.type==="SphereGeometry"&&(e.thetaLength=(e.thetaLength??180)*Ec),e&&e.type==="TorusGeometry"&&(e.arc=e.arc*Ec),e&&e.type==="PathGeometry"&&(e.extrusion.angle*=Ec,e.extrusion.twist*=Ec),t.type==="Mesh"&&t.geometry.type==="TextGeometry"&&(t.geometry.text={textValue:t.geometry.text}),Array.isArray(cn(t.events))&&t.events?.forEach(i=>{(i.type==="MouseDown"||i.type==="MouseUp"||i.type==="MousePress"||i.type==="KeyDown"||i.type==="KeyUp"||i.type==="KeyPress"||i.type==="Collision"||i.type==="Trigger")&&(i.runMode=i.toggle?"Toggle":"Repeat")})}function GX(t){t.scene.objects.traverse((e,i)=>{})}function HX(t){let e=t.schema??104;e!==130&&e<130&&(k_(t.asset),t.schema=130)}function Lu(t,e){e(t.data);for(let i of t.children)Lu(i,e)}function dF(t){let e=t.schema??104;e!==130&&(e<105&&(Lu(t.asset,cF),t.schema=105),e<118&&(Lu(t.asset,pF),t.schema=118),e<121&&(Lu(t.asset,eA),t.schema=121),e<130&&(Lu(t.asset,WX),t.schema=130))}function uF(t,e){ko(t,e),Fo(t,e),Object.values(t.shared.lib.materials).forEach(i=>e(i.asset))}function k_(t){t.layers===void 0&&Object.assign(t,Vi.defaultTwoLayerData("phong"))}function WX(t){"materials"in t?t.materials.forEach(e=>{e!==void 0&&typeof e!="string"&&k_(e)}):"material"in t&&t.material!==void 0&&typeof t.material!="string"&&k_(t.material)}function pF(t){t.timelineAnimations=ea({},$t.prototype)}function eA(t){t.pivot=[0,0,0],t.pivotRotation=[0,0,0]}function qX(t){}function XX(t){let e=t.schema??0;if(e!==130){console.warn("updating from ",e,"to ",130),function(i,n){if(n<1&&(ko(i,gI),Fo(i,gI),i.schema=1),n<2&&(function(r){Object.assign(r.scene.publish,{orbitControls:{...z_.defaultData,...cn(r.scene.publish.orbitControls)}})}(i),i.schema=2),n<3&&(function(r){function a(s){if(s.layers){for(let o of Object.values(s.layers))if(o){for(let[l,c]of Object.entries(o))if((MC.includes(l)||typeof c=="boolean")&&delete o[l],l==="texture")for(let[h,d]of Object.entries(c))(qN.includes(h)||typeof d=="boolean")&&delete c[h]}}}r.scene.objects.traverse((s,o)=>{o.states.forEach(l=>{let c=l;c.material?a(c.material):c.materials&&c.materials.forEach(h=>{a(h)})})})}(i),i.schema=3),n<4&&(function(r){r.scene.publish.withBackground=!0}(i),i.schema=4),n<5&&(function(r){r.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),n<6&&(function(r){r.scene.objects.traverse((a,s)=>{let o=s.cloner;o&&(o.radial.scale=o.radial.scale.map(l=>l+1),o.linear.scale=o.linear.scale.map(l=>l+1))})}(i),i.schema=6),n<7&&(function(r){r.scene.objects.traverse((a,s)=>{let o=s.geometry;o&&(o.type==="DodecahedronGeometry"||o.type==="IcosahedronGeometry")&&(o.detail=Math.round(o.detail))})}(i),i.schema=7),n<8&&(i.schema=8),n<9&&(yI(i),i.schema=9),n<10&&(function(r){r.scene.objects.traverse((a,s)=>{s.type==="Mesh"&&(s.geometry.type==="BooleanGeometry"||s.geometry.type==="SubdivGeometry")&&(s.geometry.phongAngle=35)})}(i),i.schema=10),n<11&&(function(r){r.scene.environment.ambientLight.softShadows=!1,r.scene.environment.ambientLight.softShadowQuality="low",r.scene.objects.traverse((a,s)=>{(s.type==="DirectionalLight"||s.type==="SpotLight")&&(s.shadowResolution=1024,s.shadowRadius=1,s.depth=1e5)}),r.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),n<12&&(yI(i),i.schema=12),n<13&&(function(r){r.shared.audios=ea({},$t.prototype)}(i),i.schema=13),n<14&&(function(r){let a=r.shared.materials;Object.entries(a).forEach(([s,o])=>{if(!o.layers){let l={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(a,{[s]:l})}})}(i),i.schema=14),n<15&&(function(r){Object.entries(cn(r.shared.images)).filter(a=>a[1].asset===!1).map(a=>a[0]).forEach(a=>{delete r.shared.images[a]}),Object.entries(cn(r.shared.audios)).filter(a=>a[1].asset===!1).map(a=>a[0]).forEach(a=>{delete r.shared.audios[a]})}(i),i.schema=15),n<16&&(function(r){r.scene.publish.settings.web.preload=!1}(i),i.schema=16),n<17&&(ko(i,_I),Fo(i,_I),i.schema=17),n<18&&(ko(i,vI),Fo(i,vI),i.schema=18),n<19&&(function(r){Object.assign(r.scene.publish.settings,{video:{...el.defaultData.settings.video,...cn(r.scene.publish.settings.video)}})}(i),i.schema=19),n<20&&(function(r){r.shared.fonts=ea({},$t.prototype)}(i),function(r){let a=[];r.scene.objects.traverse((s,o)=>{let l=o;if(l.type==="TextFrame"){let c=Vi.defaultTwoLayerData("phong"),h=typeof l.color=="string"?r.shared.colors[l.color]:l.color;c.layers[1].data.color={r:h.r,g:h.g,b:h.b},c.layers[1].data.alpha=l.alpha;let d=function(f){return f.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(g=>g.charAt(0).toUpperCase()+g.slice(1)).join(" ")}(l.font);r.shared.fonts[d]===void 0&&(r.shared.fonts[d]={name:d});let u={name:l.name,...En.defaultData,...Ws.defaultData,flatShading:!1,wireframe:!1,geometry:{...Wo.defaultData("TextGeometry"),width:l.width,height:l.height,font:d,depth:0,horizontalAlign:l.horizontalAlign,verticalAlign:l.verticalAlign,fontSize:1.40625*l.fontSize,lineHeight:l.lineHeight/1.40625,letterSpacing:l.letterSpacing-1,text:l.text,textTransform:l.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:c,states:cn(l.states),events:cn(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=cn(r.scene.objects).parent(s);r.scene.objects.insertAfter(p??null,s,[{id:s+"new",data:u,children:[]}]),a.push(s)}}),a.forEach(s=>{r.scene.objects.delete(s)})}(i),i.schema=20),n<21&&(function(r){let a={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};r.scene.objects.traverse((s,o)=>{o.events.forEach(l=>{if(a[Number(l.type)])if(Object.assign(l,{type:a[Number(l.type)]}),l.type==="Audio"&&"audioEvent"in l&&(Object.assign(l,{playAudio:l.audioEvent}),delete l.audioEvent),l.type==="GameControl")Object.assign(l,{gameActions:{idle:new Vt,move:new Vt,jump:new Vt}});else{let c=new Vt;Object.assign(l,{actions:c}),(l.type==="MouseDown"||l.type==="MouseUp"||l.type==="KeyDown"||l.type==="KeyUp")&&"url"in l&&c.push({fi:0,id:It.generateUUID(),data:{type:"Link",url:l.url,delay:0}}),"targets"in l&&(l.targets.forEach((h,d,u)=>{let p={easing:h.easing,duration:h.duration};h.easing===6?Object.assign(p,vc(h,"mass","stiffness","damping","velocity")):h.easing===5&&Object.assign(p,{control1:{...h.control1},control2:{...h.control2}});let f={repeat:h.repeat?-1:0,delay:h.delay,delayDirection:h.delayDirection,direction:h.cycle&&h.rewind?"pingpong-rewind":h.cycle?"pingpong":"normal"},g={state:h.state,...f,...p},m={allowSlerp:!0,type:"Transition",object:h.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Vt({fi:0,id:It.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:It.generateUUID(),data:g})};c.push({fi:u,id:d,data:m})}),delete l.targets)}})})}(i),function(r){r.scene.objects.traverse((a,s)=>{function o(l,c){let h=new Vt,d=[];if(s.events.forEach((u,p,f)=>{if(u.type==="Audio"&&u.trigger===c){let g;d.push(p),u.interaction==="play"?g={...vc(u,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in u?u.after:void 0,toggle:"after"in u?u.toggle:void 0,type:"Audio"}:(u.interaction==="pause"||u.interaction==="stop")&&(g={...vc(u,"interaction","delay","object","playAudio"),type:"Audio"}),g&&h.push({fi:f,id:p,data:g})}}),d.forEach(u=>s.events.delete(u)),h.length){let u=s.events.find(p=>p.type===l)?.data;u?"actions"in u&&u.actions.insertBefore(null,h):s.events.insertBefore(null,[{id:It.generateUUID(),data:{type:l,actions:h}}])}}o("Start","start"),o("MouseDown","mouseDown"),o("MouseUp","mouseUp"),o("KeyDown","keyDown"),o("KeyUp","keyUp")})}(i),i.schema=21),n<22&&(wI(i),i.schema=22),n<23&&(function(r){r.scene.objects.traverse((a,s)=>{s.type==="Mesh"&&s.geometry.type==="SubdivGeometry"&&(s.geometry.scaleBaked||(s.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),n<24&&(function(r){r.scene.objects.traverse((a,s)=>{(s.type==="Empty"||s.type==="Mesh")&&s.cloner&&!s.cloner.randomnessObject&&!s.cloner.toObject&&!s.cloner.randomness&&(s.cloner={...s.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}(i),i.schema=24),(n<25||i.shared.videos===void 0)&&(function(r){r.shared.videos=ea({},$t.prototype)}(i),n<25&&(i.schema=25)),n<26&&(function(r){r.scene.objects.traverse((a,s)=>{let o=r.scene.objects.unproxy().parent(a);if(o){let l=cn(r.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&s.type==="Mesh"&&(s.visible=cn(s).booleanExclude!==!0)}})}(i),i.schema=26),n<27&&(function(r){r.scene.objects.traverse((a,s)=>{if(s.type==="Mesh"){let o=s;s.geometry.type==="NonParametricGeometry"?o.material!==void 0&&delete o.material:o.materials!==void 0&&delete o.materials}})}(i),i.schema=27),n<28&&(wI(i),i.schema=28),n<29&&(function(r){function a(o){Object.setPrototypeOf(o,gn.prototype),o.texture&&Object.setPrototypeOf(o.texture,gn.prototype)}function s(o){Object.setPrototypeOf(o,gn.prototype);for(let l in o)a(o[l])}r.scene.objects.traverse((o,l)=>{l.states.forEach(c=>{let h=c;if(h.material){let d=cn(h.material).layers;s(d),h.material.layers=d}if(h.materials)for(let d=0;d<h.materials.length;d++){let u=h.materials[d],p=cn(u).layers;s(p),u.layers=p}})})}(i),i.schema=29),n<30&&(function(r){r.scene.objects.traverse((a,s)=>{s.type==="Mesh"&&s.geometry.type==="NonParametricGeometry"&&!("material"in s)&&!("materials"in s)&&(s.material=Vi.defaultTwoLayerData("phong"))})}(i),i.schema=30),n<31&&(function(r){r.scene.publish.orbitControls.autoZoom===void 0&&(r.scene.publish.orbitControls.autoZoom=!1),r.scene.objects.traverse((a,s)=>{(s.type==="OrthographicCamera"||s.type==="PerspectiveCamera")&&(s.orthographic.autoZoom===void 0&&(s.orthographic.autoZoom=!1),s.orthographic.autoZoomFrustumSize===void 0&&(s.orthographic.autoZoomFrustumSize=790))})}(i),i.schema=31),n<33&&(function(r){r.scene.objects.traverse((a,s)=>{s.pathSnapping===void 0&&(s.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),s.pathSnapping.offset===void 0&&(s.pathSnapping.offset=0)})}(i),i.schema=33),n<34&&(function(r){r.scene.publish.mouseEventTarget===void 0&&(r.scene.publish.mouseEventTarget="canvas"),r.scene.publish.settings.web.hint===void 0&&(r.scene.publish.settings.web.hint=!1)}(i),i.schema=34),n<35&&(function(r){let{video:a}=r.scene.publish.settings;a.format==="gif"&&a.fps>48&&(a.fps=15)}(i),i.schema=35),n<36&&(function(r){r.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-s.position[1]))})})}(i),i.schema=36),n<37&&(function(r){let a=r.scene.environment.usePhysics;r.scene.objects.traverse((s,o)=>{a&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),n<38&&(ko(i,bI),Fo(i,bI),i.schema=38),n<39&&(function(r){r.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=F_.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),n<40&&(function(r){r.scene.styles||(r.scene.styles=Ac.defaultData())}(i),i.schema=40),n<41&&(function(r){r.scene.environment.ambientLight.occlusion===void 0&&(r.scene.environment.ambientLight.occlusion=!1),r.scene.environment.ambientLight.aoFullRes===void 0&&(r.scene.environment.ambientLight.aoFullRes=!1),r.scene.environment.ambientLight.radius===void 0&&(r.scene.environment.ambientLight.radius=256),r.scene.environment.ambientLight.bias===void 0&&(r.scene.environment.ambientLight.bias=.5),r.scene.environment.ambientLight.aoColor===void 0&&(r.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),ko(r,SI),Fo(r,SI)}(i),i.schema=41),n<42&&(function(r){r.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Vt})})})}(i),i.schema=42),n<43&&(function(r){r.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),n<99){ko(i,MI),Fo(i,MI),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=Qc);let r=cn(i.scene.objects),a=i.scene.objects;i.scene.publish.playPage=qu,a.insertBefore(null,null,[{id:qu,data:{...Fc.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:vc(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:vc(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...$u.defaultData,...vc(i.scene.environment,"usePhysics","gravity")},camera:cn(i.scene.ownerCamera)??Fc.defaultData.camera,name:"Scene"},children:[]}]);for(let l of r)l.id!==Tc.TRASH_CAN_ID&&a.move(qu,l.fi,l.id);let s=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,c)=>{c.type==="DirectionalLight"?(c.penumbraSize=i.shared.penumbraSize[Math.min(s,2)],s+=1):c.type==="SpotLight"&&(c.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(c.physics===void 0||c.physics===null)&&c.type!=="Instance"&&(c.physics={},Object.assign(c.physics,Xu.defaultData)),c.physics!==void 0&&c.physics!==null&&(c.physics.enabled=c.collision??"visibility",delete c.collision)}),i.schema=99}}(t,e),e<100&&(t.scene.publish.joystickSizeAndXYOffset===void 0&&(t.scene.publish.joystickSizeAndXYOffset=el.defaultData.joystickSizeAndXYOffset),t.schema=100),e<101&&(ko(t,EI),Fo(t,EI),t.schema=101),e<102&&(function(i){i.scene.objects.traverse((n,r)=>{let a=r.geometry;a&&a.type==="PathGeometry"&&(a.extrusion.capType="flat",a.extrusion.bevel=50,a.extrusion.bevelSides=6,a.extrusion.shape.type==="Custom"&&(a.extrusion.shape.shapeQuality="low"))})}(t),t.schema=102),e<104&&(t.shared.catelogs=new $t,t.shared.lib=qo.defaultData(),t.schema=104),e<105&&(function(i){i.shared.variables=ea({},$t.prototype)}(t),t.scene.objects.traverse((i,n)=>{cF(n)}),t.schema=105);for(let i of Object.values(t.shared.lib.components))dF(i);e<106&&(function(i){let n=cn(i.shared.variables);i.shared.variables=ea(Object.entries(n??{}).map(([r,a],s)=>({fi:s,id:r,data:a})),Vt.prototype)}(t),t.schema=106),e<107&&(t.shared.lib.variables=qo.defaultData().variables,t.schema=107),e<109&&(function(i){i.shared.particles=ea({},$t.prototype),i.shared.lib&&(i.shared.lib.particles=qo.defaultData().particles)}(t),t.schema=109),e<110&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Particle"&&typeof r.renderMaterial.size=="number"&&Object.assign(r.renderMaterial,{size:[r.renderMaterial.size,r.renderMaterial.size]})})}(t),t.schema=110),e<111&&(t.scene.objects.traverse((i,n)=>{(function(r){Array.isArray(cn(r.events))&&r.events?.forEach(a=>{"disabled"in a||(a.disabled=!1),(a.type==="MouseDown"||a.type==="MouseUp"||a.type==="MousePress")&&(a.mode=a.mode||"Object")})})(n)}),t.schema=111),e<112&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Page"&&(r.postprocessing.depthOfField.focusDistance=100,r.postprocessing.depthOfField.focalLength=20,r.postprocessing.depthOfField.bokehScale=5)})}(t),t.schema=112),e<113&&(function(i){i.scene.objects.traverse((n,r)=>{Array.isArray(cn(r.events))!==!1&&r.events?.forEach(a=>{let s=a.runMode;a.type==="MouseDown"||a.type==="MouseUp"||a.type==="KeyDown"||a.type==="KeyUp"||a.type==="Collision"||a.type==="Trigger"?a.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=s??"Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode=s==="Toggle"?"Toggle":"Normal")}):a.type==="MouseHover"||a.type==="MousePress"||a.type==="KeyPress"?a.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):a.type==="GameControl"?(delete a.actions,Object.keys(a.gameActions).forEach(o=>{a.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&(l.runMode="Normal")})})):a.type==="DragDrop"?(delete a.actions,a.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),a.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):a.type==="Resize"?(delete a.actions,a.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):a.type==="Start"?a.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):a.type==="VariableChange"||a.type==="Scroll"?a.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):a.type==="Conditional"&&(delete a.actions,a.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}),a.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(t),t.schema=113),e<114&&(t.scene.publish.settings.web.imageQuality===void 0&&(t.scene.publish.settings.web.imageQuality=70),t.schema=114),e<115&&(function(i){i.shared.userAPIs=ea({},$t.prototype),i.shared.userWebhooks=ea({},$t.prototype),i.shared.lib&&(i.shared.lib.userAPIs=qo.defaultData().userAPIs,i.shared.lib.userWebhooks=qo.defaultData().userWebhooks)}(t),t.schema=115),e<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=el.defaultData.settings.videoStatic)}(t),t.schema=116),e<117&&(t.scene.publish.settings.web.pixelRatioMobile===void 0&&(t.scene.publish.settings.web.pixelRatioMobile=0),t.scene.publish.settings.web.pixelRatioDesktop===void 0&&(t.scene.publish.settings.web.pixelRatioDesktop=0),t.schema=117),e<118&&(t.shared.timelineAnimations=ea({},$t.prototype),t.scene.objects.traverse((i,n)=>{pF(n)}),t.schema=118),e<119&&(t.scene.publish.settings.videoStatic.format=Yu.defaultData.scene.publish.settings.videoStatic.format,t.scene.publish.settings.videoStatic.imageFormat=Yu.defaultData.scene.publish.settings.videoStatic.imageFormat,t.schema=119),e<120&&(t.scene.publish.settings.image.colorSpace="display-p3",t.scene.publish.settings.videoStatic.colorSpace="display-p3",t.schema=120),e<121&&(t.scene.objects.traverse((i,n)=>{eA(n),n.type==="Page"&&n.camera!==void 0&&eA(n.camera)}),t.schema=121),e<122&&(delete t.scene.publish.settings.video,t.scene.publish.orbitControls.rotationSpeed=Yu.defaultData.scene.publish.orbitControls.rotationSpeed,t.schema=122),e<123&&(t.scene.objects.traverse((i,n)=>{n.type==="Page"&&n.sky===void 0&&(n.sky=Wl.defaultData)}),t.schema=123),e<124&&(e>=123&&t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(typeof r.exposure=="number"&&(r.exposure=Math.round(r.exposure/5e-4*1e4)/1e4),r.lighting===void 0&&(r.lighting=Wl.defaultData.lighting))}),t.schema=124),e<125&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingIntensity===void 0&&(r.lightingIntensity=Wl.defaultData.lightingIntensity)}),t.schema=125),e<126&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(r.mode===void 0&&(r.mode="physical"),r.hdri===void 0?r.hdri={...Wl.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=Wl.defaultData.hdri.blur),Array.isArray(r.hdri.rotation)&&(r.hdri.rotation=r.hdri.rotation[1]??0)))}),t.schema=126),e<127&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r?.hdri!==void 0&&r.hdri.showBackground===void 0&&(r.hdri.showBackground=!0)}),t.schema=127),e<128&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingQuality===void 0&&(r.lightingQuality="full")}),t.schema=128),e<129&&(t.scene.objects.traverse((i,n)=>{if(n.type==="Page"){n.camera===void 0&&(n.camera=Fc.defaultData.camera);let r=n.camera;r.far=1e5,r.perspective?r.perspective.near=70:r.perspective={near:70,fov:45,zoom:1}}}),t.schema=129),e<130&&(uF(t,k_),t.schema=130)}}jg(hF,{updateAllMaterials:()=>uF,updateDocumentSchema:()=>XX,updateLibSchema:()=>qX,updateMaterialSchema:()=>HX,updateObjectStateRec:()=>Lu,updateObjectsSchema:()=>dF,updateTextValues:()=>GX});var Ec,TI,av,fS,CI,sv,Cc,Df,Bd,ov,mS,n1,gS,vS,PI,r1,yS,kc,iA,Hb=k(()=>{lF(),Ye(),jX(),Gb(),Vb(),sr(),OC(),jb(),CC(),Ec=180/Math.PI}),$X=k(()=>{var t,e,i;xa(),Ye(),sr(),(TI||(TI={})).is=function(n){return!0},(t=av||(av={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},t.merge=function(n,r){return{position:r?.position??n.position,rotation:r?.rotation??n.rotation,scale:r?.scale??n.scale,shear:r?.shear??n.shear}},t.diff=function(n,r){return MN({position:eo.isEqual(n.position,r.position)?void 0:r.position,rotation:n.rotation===r.rotation?void 0:r.rotation,scale:eo.isEqual(n.scale,r.scale)?void 0:r.scale,shear:n.shear&&r.shear&&eo.isEqual(n.shear,r.shear)?void 0:r.shear})},(fS||(fS={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(CI||(CI={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(sv||(sv={})).defaultData={opacity:1,fill:{color:Je.fromHexAndA(Rr,1),enabled:!0},stroke:{color:Je.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0}},(e=Cc||(Cc={})).newEmpty=function(n,r){return{name:r}},e.patch=function(n,r){if(r===void 0)return n;let a={...n};return Object.assign(a,av.merge(a,r)),a=function(s,o){if(o===void 0)return s;let l={...s},c=["width","height","cornerRadius"];for(let h of c)h in l&&h in o&&o[h]!==void 0&&Object.assign(l,{[h]:o[h]});return l}(a,r),a=function(s,o){if(o===void 0)return s;let l={...s};return"fill"in l&&"fill"in o&&o.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...o.fill}}),"stroke"in l&&"stroke"in o&&o.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...o.stroke}}),"layerBlur"in l&&"layerBlur"in o&&o.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...o.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in o&&o.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...o.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in o&&o.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...o.dropShadow}}),"innerShadow"in l&&"innerShadow"in o&&o.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...o.innerShadow}}),l}(a,r),a},e.toOps=function(n,r){let a,s=[];for(let[o,l]of Object.entries(r))o!=="name"&&(a===void 0&&(a={path:[],props:{},type:0},s.push(a)),a.props[o]=l);return s},(Df||(Df={})).defaultData={...av.defaultData,...fS.defaultData,states:new Vt,events:new Vt,visible:!0,raycastLock:!1},(Bd||(Bd={})).defaultData={...Df.defaultData,...sv.defaultData},(ov||(ov={})).defaultData={cornerRadius:[0,0,0,0]},(mS||(mS={})).defaultData={...Bd.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(n1||(n1={})).defaultData={...Bd.defaultData,...ov.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(gS||(gS={})).defaultData={...Bd.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"},(vS||(vS={})).defaultData={...Bd.defaultData,type:"path2d",path:"",name:"Path"},(PI||(PI={})).is=function(n){return n.type==="ellipse2d"||n.type==="rectangle2d"||n.type==="text2d"||n.type==="vector2d"||n.type==="path2d"},(r1||(r1={})).defaultData={...Df.defaultData,name:"Group",type:"group2d"},(yS||(yS={})).defaultData=()=>({...Df.defaultData,...ov.defaultData,...sv.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Je.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Je.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(n=>{n.defaultData=function(r){switch(r){case"rectangle2d":case"vector2d":return{...n1.defaultData};case"ellipse2d":return{...mS.defaultData};case"text2d":return{...gS.defaultData};case"path2d":return{...vS.defaultData};case"frame2d":return{...yS.defaultData()};case"group2d":return{...r1.defaultData}}},n.getPivot=function(r){return"width"in r&&"height"in r?[typeof r.width=="number"?.5*r.width:0,typeof r.height=="number"?.5*r.height:0]:[0,0]},n.isResizeable=function(r){return r.type==="rectangle2d"||r.type==="ellipse2d"||r.type==="text2d"||r.type==="frame2d"},n.isAutoLayoutable=function(r){return r.type==="frame2d"&&r.autoLayout!==void 0},n.hasCorners=function(r){return r.type==="rectangle2d"||r.type==="frame2d"}})(kc||(kc={})),(i=iA||(iA={})).defaultData={name:"UI",type:"scene2d",objects:new Xn},i.emptyData=function(){return{type:"scene2d",objects:new Xn}}}),YX=k(()=>{UX(),zX(),YN(),ZN(),lF(),HN(),VX(),eF(),rF(),CC(),Hb(),oF(),TC(),AC(),KN(),Vb(),tF(),aF(),xa(),Gb(),jb(),DC(),nF(),OC(),RC(),NX(),iF(),IC(),PC(),QN(),JN(),$X()});function Pc(t,e=!1){let i=t[0].index!==null,n=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),a={},s={},o=t[0].morphTargetsRelative,l=new Gt,c=0;for(let h=0;h<t.length;++h){let d=t[h],u=0;if(i!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.attributes[p]),u++}if(u!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(o!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.morphAttributes[p])}if(e){let p;if(i)p=d.index.count;else{if(d.attributes.position===void 0)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;p=d.attributes.position.count}l.addGroup(c,p,h),c+=p}}if(i){let h=0,d=[];for(let u=0;u<t.length;++u){let p=t[u].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+h);h+=t[u].attributes.position.count}l.setIndex(d)}for(let h in a){let d=DI(a[h]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,d)}for(let h in s){let d=s[h][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let u=0;u<d;++u){let p=[];for(let g=0;g<s[h].length;++g)p.push(s[h][g][u]);let f=DI(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(f)}}}return l}function DI(t){let e,i,n,r=-1,a=0;for(let c=0;c<t.length;++c){let h=t[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(i===void 0&&(i=h.itemSize),i!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=h.normalized),n!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=h.gpuType),r!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;a+=h.count*i}let s=new e(a),o=new Ht(s,i,n),l=0;for(let c=0;c<t.length;++c){let h=t[c];if(h.isInterleavedBufferAttribute){let d=l/i;for(let u=0,p=h.count;u<p;u++)for(let f=0;f<i;f++){let g=h.getComponent(u,f);o.setComponent(u+d,f,g)}}else s.set(h.array,l);l+=h.count*i}return r!==void 0&&(o.gpuType=r),o}var Wg=k(()=>{rt()});function fF(t){let e=t.points.length/7,i=new Vt;for(let n=0;n<e;n++){let r=7*n,a=t.points[r+0],s=t.points[r+1],o=t.points[r+2],l=t.points[r+3],c=t.points[r+4],h=t.points[r+5],d=t.points[r+6];i.push({fi:n,id:It.generateUUID(),data:{roundness:d,position:[a,s],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[c,h]}}})}return{points:i,isClosed:t.isClosed,roundness:t.roundness,shapeHoles:t.shapeHoles?.map(n=>fF(n))??[]}}function mF(t){let{userData:e,uuid:i,...n}=t;if(e===void 0||e.type==="NonParametricGeometry")return function(s){let o,{userData:l,data:c}=s,h=c?.groups,d=c?.attributes??{},u=c?.morphAttributes??{},p=c?.interleavedBuffers,f=c?.arrayBuffers,g=c?.index;d.position!==void 0&&Array.isArray(d.position.array)&&(o=function(y){let v=1/0,_=1/0,b=1/0,x=-1/0,w=-1/0,S=-1/0;for(let T=0;T<y.length;T+=3){let E=y[T],P=y[T+1],A=y[T+2];v=Math.min(v,E),_=Math.min(_,P),b=Math.min(b,A),x=Math.max(x,E),w=Math.max(w,P),S=Math.max(S,A)}return{width:x-v,height:w-_,depth:S-b}}(d.position.array));let m={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:u,interleavedBuffers:p,arrayBuffers:f},...o===void 0?{}:o,type:"NonParametricGeometry"};return g!==void 0&&Object.assign(m.data,{index:g}),h!==void 0&&Object.assign(m.data,{groups:h.map(y=>({...y,materialIndex:y.materialIndex??0}))}),m}(t);if(e.type==="SubdivGeometry"){let s="SubdivGeometry",o=n.data?.attributes;if(o?.positionWASM===void 0){let c=new Gt;if(o?.position===void 0||o?.faceMap===void 0)return null;let h=o.position.array,d=o.faceMap.array,u=n.data.index.array;c.setAttribute("position",new Ft(h,3)),c.setIndex(new oh(u,1));let p=function(y,v=1e-4){v=Math.max(v,Number.EPSILON);let _={},b=y.getIndex(),x=y.getAttribute("position"),w=b?b.count:x.count,S=0,T=Object.keys(y.attributes),E={},P={},A=[],R=["getX","getY","getZ","getW"],O=["setX","setY","setZ","setW"];for(let H=0,J=T.length;H<J;H++){let K=T[H],tt=y.attributes[K];E[K]=new tt.constructor(new tt.array.constructor(tt.count*tt.itemSize),tt.itemSize,tt.normalized);let ct=y.morphAttributes[K];ct&&(P[K]||(P[K]=[]),ct.forEach((et,st)=>{let dt=new et.array.constructor(et.count*et.itemSize);P[K][st]=new et.constructor(dt,et.itemSize,et.normalized)}))}let D=.5*v,I=Math.log10(1/v),U=Math.pow(10,I),N=D*U;for(let H=0;H<w;H++){let J=b?b.getX(H):H,K="";for(let tt=0,ct=T.length;tt<ct;tt++){let et=T[tt],st=y.getAttribute(et),dt=st.itemSize;for(let Y=0;Y<dt;Y++)K+=~~(st[R[Y]](J)*U+N)+","}if(K in _)A.push(_[K]);else{for(let tt=0,ct=T.length;tt<ct;tt++){let et=T[tt],st=y.getAttribute(et),dt=y.morphAttributes[et],Y=st.itemSize,ht=E[et],F=P[et];for(let B=0;B<Y;B++){let j=R[B],Z=O[B];if(ht[Z](S,st[j](J)),dt)for(let L=0,W=dt.length;L<W;L++)F[L][Z](S,dt[L][j](J))}}_[K]=S,A.push(S),S++}}let G=y.clone();for(let H in y.attributes){let J=E[H];if(G.setAttribute(H,new J.constructor(J.array.slice(0,S*J.itemSize),J.itemSize,J.normalized)),H in P)for(let K=0;K<P[H].length;K++){let tt=P[H][K];G.morphAttributes[H][K]=new tt.constructor(tt.array.slice(0,S*tt.itemSize),tt.itemSize,tt.normalized)}}return G.setIndex(A),G}(c),f=[],g=new Array(d[d.length-1]+1).fill(3),m=p.getIndex().array;for(let y=0,v=d.length;y<v;)d[y]===d[y+1]?(g[d[y]]++,f.push(...new Set(m.slice(3*y,3*y+6))),y+=2):(f.push(...m.slice(3*y,3*y+3)),y++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:g}}if(o?.positionWASM===void 0||o?.positionWASM.length===0||o?.indexWASM===void 0||o?.indexWASM.length===0||o?.verticesPerFaceWASM===void 0||o?.verticesPerFaceWASM.length===0)return null;let l={type:s,...ZX(o.positionWASM.array)};l.subdivisions=e.parameters.subdivisions;for(let c in o)c==="positionWASM"?l[c]=new Float32Array(o[c].array):c==="indexWASM"?l[c]=new Int32Array(o[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(o[c].array));return l.scaleBaked=[1,1,1],l}let r=e.type,a=e.parameters;return r==="VectorGeometry"?(a.extrudeDepth&&(a.depth=a.extrudeDepth),{...a,width:100,height:100,shape:fF(e.shape),type:r}):r==="LatheGeometry"?{...e.parameters,type:r,points:(e?.parameters.points??[]).map(s=>[s.x,s.y])}:(a.extrudeDepth&&(a.depth=a.extrudeDepth),{...a,type:r})}function ZX(t){return nA.setFromArray(t),nA.getSize(Cm),{width:Cm.x,height:Cm.y,depth:Cm.z}}var nA,Cm,KX=k(()=>{Ye(),rt(),Wg(),new At,new Yt,new Ti,new C,new C,nA=new ci,Cm=new C}),QX=k(()=>{}),JX=k(()=>{Ye(),Hb()});function An(t,e=[0,0]){return[t&&!isNaN(t[0])?t[0]:e[0],t&&!isNaN(t[1])?t[1]:e[1]]}function na(t,e,i){switch(t){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:n,control2:r}=e??{...x_.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:a,velocity:s}=i??{...b_.defaultData},o=new gF(n,r,a,s),l=o.solve(1);return()=>c=>o.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}function RI(t,e,i){return{id:e,fi:i,data:{id:e,path:t,keyframes:new Vt}}}var OI,II,rA,gF,vF,al,ag,yF,xp,Rf,lv,_S,wp,LI,bS,BI,xS,pp,El,Al,To,wS,UI,zI,SS,aA,il,t$=k(()=>{var t;Ye(),xa(),(OI||(OI={})).is=function(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"},(t=II||(II={})).getControlsWithDefault=function(e,i){let n=[0,0],r=[1,1];if(e?.cubicControls)n=An(e.cubicControls.control1,n);else switch(e?.type){case 2:case 4:n=[.42,0];break;case 3:case 0:n=[0,0];break;case 1:n=[.25,.1];break;case 7:n=[.25,1]}if(i?.cubicControls)r=An(i.cubicControls.control2,r);else switch(i?.type){case 2:case 0:r=[1,1];break;case 3:case 4:r=[.58,1];break;case 1:r=[.25,1];break;case 7:r=[.5,1]}return{control1:n,control2:r}},t.defaultData=function(e,i){return{id:e,name:i,to:5,properties:new Vt}},t.createMaterialGroup=function(e){let i=new Vt;return e.forEach(({data:n,id:r,fi:a})=>{if(n.type==="light"){let s=RI(["material",`${n.category} lighting`],r,a);i.push(s)}else{let s=RI(["material",n.type],r,a);i.push(s)}}),i},t.createName=function(e){return Object.entries(e).reduce((i,[n,r])=>(typeof r!="string"&&i.push({name:r.name}),i),[])},t.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:na(3),duration:1e3},opacity:{value:[0,1],easing:na(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:na(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:na(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:na(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}],rA=["x","y","z"],gF=class{constructor(e=1,i=100,n=10,r=0){this.mass=e,this.stiffness=i,this.damping=n,this.initialVelocity=r,this.m_w0=Math.sqrt(i/e),this.m_zeta=n/(2*Math.sqrt(i*e)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(e){return 1-(this.m_zeta<1?Math.exp(-e*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*e)+this.m_B*Math.sin(this.m_wd*e)):(this.m_A+this.m_B*e)*Math.exp(-e*this.m_w0))}getDuration(){let e=.16666666666666666,i=0,n=0;for(;;)if(i+=e,this.solve(i)===1){if(n++,n>=16)break}else n=0;return i*e*1e3}}}),te=k(()=>{YX(),QX(),kX(),Hb(),JX(),t$(),IC(),Ye()}),ll=k(()=>{vF=[3,4,8,9],al=5,ag=3,yF=32}),qg=k(()=>{rt(),xp=t=>{var e;return(e=class extends t{}).geometryHelper=new _s(30,30,30),e}}),Xg=k(()=>{rt(),Rf=new Zo,lv=new vr,_S=new At,wp=(t,e,i,n,r=!1,a=t)=>{let s=e,o=a.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),lv.copy(s.boundingSphere),lv.applyMatrix4(o),i.ray.intersectsSphere(lv)===!1||(_S.copy(o).invert(),Rf.copy(i.ray).applyMatrix4(_S),s.boundingBox!==null&&Rf.intersectsBox(s.boundingBox)===!1))return;let l,c,h,d,u,p,f=s.index,g=s.attributes.position,m=s.drawRange;if(r===!1){for(u=Math.max(0,m.start),p=Math.min(f.count,m.start+m.count);u<p;u+=3)if(c=f.getX(u),h=f.getX(u+1),d=f.getX(u+2),l=y(t,i,Rf,g,c,h,d),l)return l.faceIndex=Math.floor(u/3),void n.push(l)}else{let v=s.attributes.position,_=new C,b=new C,x=new C,w=new C,S=2,T=1/((a.scale.x+a.scale.y+a.scale.z)/3),E=T*T;for(let P=Math.max(0,m.start),A=Math.min(v.count,m.start+m.count)-1;P<A;P+=S){if(_.fromBufferAttribute(v,P),b.fromBufferAttribute(v,P+1),Rf.distanceSqToSegment(_,b,w,x)>E)continue;w.applyMatrix4(a.matrixWorld);let R=i.ray.origin.distanceTo(w);R<i.near||R>i.far||n.push({distance:R,point:x.clone().applyMatrix4(a.matrixWorld),object:t})}}function y(v,_,b,x,w,S,T){let E=new C,P=new C,A=new C,R=new C,O=new C;if(E.fromBufferAttribute(x,w),P.fromBufferAttribute(x,S),A.fromBufferAttribute(x,T),b.intersectTriangle(E,P,A,!1,R)===null)return null;O.copy(R),O.applyMatrix4(v.matrixWorld);let D=_.ray.origin.distanceTo(O);return D<_.near||D>_.far?null:{faceIndex:1,distance:D,point:O.clone(),object:v}}}}),Wb=k(()=>{rt(),qg(),Xg(),LI=new C(1,1,1),bS=new C,BI=new C,xS=new Yt,pp=class extends xp(Wz){constructor(t,e=15){super(e),this.object=t,this.dummy=new _p,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(t,e){wp(this.object,pp.geometryHelper,t,e,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(t){this.object.matrixWorld.decompose(bS,xS,BI),this.matrix.compose(bS,xS,LI),super.updateMatrixWorld(t)}updateWorldMatrix(t,e){}}}),e$=k(()=>{rt(),El=new C,Al=new C,To=new At,wS=[new C(-1,1,1),new C(-1,-1,1),new C(1,-1,1),new C(1,1,1),new C(-1,1,-1),new C(-1,-1,-1),new C(1,-1,-1),new C(1,1,-1)],UI=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],zI=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],SS=(t,e,i)=>{t.updateEntityBoxSize(El,Al),To.copy(e).multiply(t.matrixWorld),Al.x===0&&Al.y===0&&Al.z===0?i.push(new C(El.x,El.y,El.z).applyMatrix4(To)):wS.forEach(n=>{i.push(n.clone().multiply(Al).add(El).applyMatrix4(To))})},aA=class extends ci{constructor(){super(...arguments),this.matrix=new At,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(e=>e.clone()),this.faces=t.faces.map(e=>e.clone()),this.edges=t.edges.map(e=>e.clone()),this.centerEdges=t.centerEdges.map(e=>e.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=new At().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let n=[];if(i===!0){let r=[];t.traverseEntity(a=>{if(a.visible||a.cloner&&a.data.visible){if(!("geometry"in a))return To.copy(e).multiply(a.matrixWorld),void r.push(new C().applyMatrix4(To));SS(a,e,n)}}),n.length===0&&n.push(...r)}else SS(t,e,n);return this.setFromPoints(n)}getCenter(t){return(t=super.getCenter(t)).applyMatrix4(this.matrix),t}getPositionToCenter(t){return(t=super.getCenter(t)).applyMatrix4(To.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Al).multiplyScalar(.5),this.getCenter(El),To.copy(this.matrix).setPosition(El),this.vertices=wS.map(t=>t.clone().multiply(Al).applyMatrix4(To))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=UI.map(([t,e])=>new _a(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new C))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=zI.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}}}),V_=k(()=>{il={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function sg(t){return t?.isParticleSystem===!0}function qc(t){return t?.isHairSystem===!0}function mh(t){return t?.isShapeBlendEntity===!0}function LC(t){return t?.isPathObject===!0}function oa(t){return t?.isObject2D===!0}function Cr(t){return t?.isUIObject===!0}function Bu(t){return t?.isCloner===!0}function Dc(t){return t?.isClone===!0}function a1(t){return t?.isComponentObject===!0}var Ui=k(()=>{});function Si(t){BC.add(t)}function Gn(t,e){let i=`${t}:${e}`;lA.has(i)||lA.add(i)}function j_(t,e){UC.set(t,e)}function MS(t){return UC.get(t)}function Sp(t,e){zC.set(t,e)}function ES(t){return zC.get(t)}function sA(t,e){NC.set(t,e)}function _F(t){return NC.get(t)}function oA(){return qb}var BC,lA,UC,zC,NC,qb,G_,ke=k(()=>{BC=new Set,lA=new Set,UC=new Map,zC=new Map,NC=new Map,qb=null,G_=null});function bF(t){let e=t.elements;ds.set(e[0],e[1],e[2]),us.set(e[4],e[5],e[6]),Ys.set(e[8],e[9],e[10])}function xF(){let t=Math.max(ds.lengthSq(),us.lengthSq(),Ys.lengthSq());ds.lengthSq()>Pm*t?va.copy(ds).normalize():va.set(1,0,0),ya.crossVectors(Ys,va),ya.lengthSq()<=Pm*t&&(ya.copy(us).addScaledVector(va,-us.dot(va)),ya.lengthSq()<=Pm*t&&function(e,i){e.set(1,0,0).cross(i),e.lengthSq()<=Pm&&e.set(0,1,0).cross(i),e.normalize()}(ya,va)),ya.normalize(),Rc.crossVectors(va,ya)}function wF(t){return bF(t),xF(),SF.makeBasis(va,ya,Rc)}var ds,us,Ys,va,ya,Rc,SF,Pm,Dm,hv,Oc,Xb,MF=k(()=>{rt(),ds=new C,us=new C,Ys=new C,va=new C,ya=new C,Rc=new C,SF=new At,Pm=1e-12,Dm=.01}),$g=k(()=>{rt(),MF(),hv=new At,(Oc||(Oc={})).is=function(t){return t&&t.__isSPEObject},Xb=t=>class extends t{constructor(){super(...arguments),this.previousModelViewMatrix=new At,this.copyPreviousMatrix=!0,this.hiddenMatrix=new At,this.pivotMatrix=new At,this.matrixWorldRigid=new At,this.shearScale=new At,this.shearScaleInv=new At}get __isSPEObject(){return!0}getPhysicsLocalMatrix(e){return!!this.rigidBody?.isDynamic()&&(e.copy(this.matrixWorld),this.hasNonUniformScale&&e.multiply(this.shearScaleInv),this.parent&&e.premultiply(hv.copy(this.parent.matrixWorld).invert()),e.premultiply(hv.copy(this.hiddenMatrix).invert()),e.multiply(hv.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(e){e instanceof bi&&(e=e.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===e)return!0;i=i.parent}return!1}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(let i of this.children)i.updateMatrixWorld(e)}updateWorldMatrix(e,i){let n=this.parent;if(e&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),i)for(let r of this.children)r.updateWorldMatrix(!1,!0)}traverseChildren(e,i=0){for(let n of this.children)Oc.is(n)&&n.traverseObject(e,i+1)}traverseObject(e,i=0){if(e(this,i)!==!0)for(let n of this.children)Oc.is(n)&&n.traverseObject(e,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(e,i,n){return bF(e),xF(),i.makeBasis(va,ya,Rc),n.set(va.dot(ds),va.dot(us),va.dot(Ys),0,ya.dot(ds),ya.dot(us),ya.dot(Ys),0,Rc.dot(ds),Rc.dot(us),Rc.dot(Ys),0,0,0,0,1),function(){let r=ds.length(),a=us.length(),s=Ys.length(),o=Math.max(r,a,s);if(o-r>Dm||o-a>Dm||o-s>Dm)return!0;let l=Dm*o*o;return Math.abs(ds.dot(us))>l||Math.abs(ds.dot(Ys))>l||Math.abs(us.dot(Ys))>l}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(e,i){this.updateWorldMatrix(!0,!1);let n=new At().copy(this.matrixWorld).invert();return e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),n.multiply(e.parent.matrixWorld)),"hiddenMatrix"in e&&e.hiddenMatrix instanceof At?e.hiddenMatrix.premultiply(n):e.applyMatrix4(n),e.updateWorldMatrix(!1,!1),this.add(e),i!==void 0&&(this.children.pop(),this.children.splice(i,0,e)),this}copy(e,i=!1){return super.copy(e,i),this.hasNonUniformScale=e.hasNonUniformScale,this}onAfterRender(e,i,n,r,a,s){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function NI(t,e,i){return ql.subVectors(e,t),Rg.subVectors(e,i),ql.cross(Rg).length()<=og}function EF(t){let e=dA.get(t.points);if(e!==void 0&&e.isClosed===t.isClosed)return e.curve;let i=function(n){let r=n.points,a=[r[0]],s=[new C(...r[0].data.position)];yc.copy(s[0]);for(let y=0;y<r.length-1;y++)ql.fromArray(r[y].data.position),Rg.fromArray(r[y+1].data.position),Mu.subVectors(ql,yc),Eu.subVectors(ql,Rg),Mu.cross(Eu).length()>og&&(a.push(r[y]),s.push(new C().copy(ql)),yc.copy(ql));let o=r[r.length-1];a.push(o),s.push(new C(...o.data.position));let l=n.isClosed,c=a.length-(l?0:1),h=a.length,d=[],u=[];for(let y=0;y<h;y++){let v=a[y].data;d.push(new C(...v.controlPrevious.position)),u.push(new C(...v.controlNext.position))}let p=[];for(let y=0;y<c;y++){let v=y===h-1?0:y+1;p.push(NI(s[y],u[y],s[v])&&NI(s[y],d[v],s[v]))}let f=[];for(let y=0;y<h;y++){let v=a[y].data,_=s[y],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[y],controlNext:u[y],tan:void 0,baseRoundness:v.roundness,removedLength:0};if(f.push(b),v.roundness===0||!l&&(y===0||y===h-1))continue;let x=l&&y==0?h-1:y-1,w=l&&y==h-1?0:y+1,S=new C().subVectors(s[x],_).normalize(),T=new C().subVectors(s[w],_).normalize();b.prevDir=S,b.nextDir=T;let E=p[l&&y===0?h-1:y-1],P=p[y];if(E&&P){_c.addVectors(S,T).normalize();let A=yc.crossVectors(_c,S).length()/S.dot(_c);b.tan=A,b.removedLength=v.roundness/A}}for(let y=0;y<c;y++){let v=l&&y===h-1?0:y+1,_=f[y],b=f[v];if(_.removedLength!==0||b.removedLength!==0){let x=_.position.distanceTo(b.position);_.removedLength=Math.min(_.removedLength,x/2),b.removedLength=Math.min(b.removedLength,x/2)}}let g=new Array(2*h).fill(null);for(let y=0;y<c;y++){let v=l&&y===h-1?0:y+1,_=f[y],b=f[v],x=null;if(p[y]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(yc.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(yc.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>og&&(x=new Km(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>og&&(x=new Km(_.position,_.controlNext,b.controlPrevious,b.position));g[2*y+1]=x}for(let y=0;y<h;y++){let v=f[y];if(v.removedLength===0)continue;let _=v.position,b=v.prevDir.clone().multiplyScalar(v.removedLength).add(_),x=v.nextDir.clone().multiplyScalar(v.removedLength).add(_),w=v.tan*v.removedLength;_c.addVectors(v.prevDir,v.nextDir).normalize(),Mu.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;cA.copy(_c).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Mu),s1.copy(_c).multiplyScalar(-w).add(cA);let T=_.distanceTo(s1)/_.distanceTo(Mu);Eu.copy(v.prevDir).multiplyScalar(T*_.distanceTo(b)).add(_),hA.copy(Eu).lerp(s1,2);let E=b.clone().lerp(Eu,4/3),P=x.clone().lerp(hA,4/3);g[2*y]=new Km(b,E,P,x)}let m=new AF;for(let y=0;y<g.length;y++){let v=g[y];v&&m.add(v)}return m}(t);return dA.set(t.points,{isClosed:t.isClosed,curve:i}),i}var AF,og,ql,Rg,yc,_c,Mu,s1,Eu,hA,cA,dA,Be,qs,FI,kI,Ud,AS,cv,dv,VI,TS,CS,$b,uA,Jc,Zs,TF=k(()=>{rt(),AF=class extends aE{constructor(){super()}getPoints(t=12){let e,i=[],n=this.getCurveLengths(),r=n[n.length-1]/n.length;for(let a=0,s=this.curves;a<s.length;a++){let o=s[a],l=a===0?n[a]:n[a]-n[a-1],c=Math.ceil(t*l/r),h=o.getPoints(c);for(let d=0;d<h.length;d++){let u=h[d];e&&e.equals(u)||(i.push(u),e=u)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},og=.001,ql=new C,Rg=new C,yc=new C,_c=new C,Mu=new C,s1=new C,Eu=new C,hA=new C,cA=new C,dA=new WeakMap}),Wr=k(()=>{rt(),te(),e$(),Ye(),V_(),Ui(),ke(),$g(),TF(),ti(),(Be||(Be={})).is=function(t){return t&&t.__isEntity},qs=t=>Be.is(t),FI={type:"completeState",isfromEntity:!0},kI=["x","y","z"],Ud=new C,AS=new C(1,1,1),cv=new Yt,dv=new Ti,VI=new C().set(0,1,0),TS=new At,CS=new At,$b=t=>class extends Xb(t){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new aA,this._recursiveBBox=new aA,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(e){let i=this.children[e];if(Be.is(i))return i}entityChildrenCount(){let e=this.children.length;for(;e--;)if(Be.is(this.children[e]))return e+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let e=this;for(;e.data.type!=="Instance";){let i=e.parent;if(!Be.is(i))return;e=i}return e}forInstancesRec(e){this.instances.forEach(i=>{i.disposed||e(i),i.forInstancesRec(e)})}super_Entity(e,i){typeof e=="string"&&(this.uuid=e),this.identity=e,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(e,i,n=!1){if(this.data.states.length!==0||n){for(let r of this.data.states)th.toOps(this.data,r.data).forEach(a=>{let s=f_.replaceProps(a,this.data);this.dataPatched=this.data,this.updateByPatchedOp(s,this.data,i)});if(e!==null){let r=this.data.states.data(e);r&&(this.dataPatched=th.patch(this.data,r),th.toOps(this.data,r).forEach(a=>{this.updateByPatchedOp(a,this.dataPatched,i)}))}n&&this.updateTransformState(this.dataPatched,i),this.stateSelection=e,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(e,i){e.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{qs(e)&&e.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(e=>{e.resetBBoxNeedsUpdateSelf()})}find(e){let i;return this.traverseEntity(n=>{n.uuid===e&&(i=n)}),i}traverseSortNextHelper(){let e=this.parent;if(e){let i=e.children,n=i.indexOf(this)+1;if(Be.is(i[n]))return i[n];if(Be.is(e))return e.traverseSortNextHelper()}}sortNext(){let e=this.children;return this.children.length>0&&Be.is(this.children[0])?e[0]:this.traverseSortNextHelper()}goUp(e){let i=this;for(;e>0&&i!==null;)i=i.parent,e-=1;return i}hasAnccestorOrSelf(e){return this===e||this.hasAnccestor(e)}hasAnccestor(e){let i=this.parent;for(;i;){if(e===i)return!0;i=i.parent}return!1}countToAccestor(e){let i=0,n=this;for(;n!==e;){if(n===null)return-1;n=n.parent,i+=1}return i}forEachEntity(e){for(let i of this.children)qs(i)&&e(i)}traverseEntityAncestors(e){this.traverseAncestors(i=>{Be.is(i)&&e(i)})}traverseConcreteEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)qs(n)&&n.isConcreteEntity&&n.traverseEntity(e,i+1)}traverseEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)qs(n)&&n.traverseEntity(e,i+1)}traverseVisibleEntity(e){e(this);for(let i of this.children)qs(i)&&i.visible&&i.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.dispatchEvent({type:"updateMatrixWorld"})}copy(e,i=!1){return super.copy(e,i),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),this}hasEntityChild(){return this.children.some(e=>qs(e))}isAncestorOf(e){if(this.uuid===e)return!1;let i=!1;return this.traverseEntity(n=>{n.uuid===e&&(i=!0)}),i}toObjectTransformState(e=[]){return this.updateWorldMatrix(!0,!1),ME({position:this.position.toArray(),rotation:[this.rotation.x*It.RAD2DEG,this.rotation.y*It.RAD2DEG,this.rotation.z*It.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]},e)}getTransformValues(e,i,n){return i[e].map((r,a)=>n?.shared.getVariable(r,[this.uuid,e,kI[a]])??r)}updateTransformState(e,i){let n=!1;if(e.position&&(this.position.fromArray(this.getTransformValues("position",e,i)),n=!0),e.rotation&&(Ud.fromArray(this.getTransformValues("rotation",e,i)).multiplyScalar(It.DEG2RAD),this.rotation.setFromVector3(Ud),n=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,i)),n=!0),e.hiddenMatrix!==void 0&&(n=!0,this.hiddenMatrix.fromArray(e.hiddenMatrix??Nc.identity)),e.pivot!==void 0||e.pivotRotation!==void 0){if(n=!0,e.pivot!==void 0&&e.pivotRotation!==void 0)this.pivotMatrix.compose(Ud.fromArray(e.pivot).negate(),cv.setFromEuler(dv.fromArray(e.pivotRotation.map(r=>r*It.DEG2RAD))).invert(),AS);else if(e.pivot!==void 0)this.pivotMatrix.setPosition(-e.pivot[0],-e.pivot[1],-e.pivot[2]);else if(e.pivotRotation!==void 0){let r=Ud.setFromMatrixPosition(this.pivotMatrix);cv.setFromEuler(dv.fromArray(e.pivotRotation.map(a=>a*It.DEG2RAD))).invert(),this.pivotMatrix.compose(r,cv,AS)}}return n&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)})),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),n}onVariableUpdate(e=!1){e?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(i=>{i.invalidateClonerTransform(this)}),this.requestRender())}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let e of this.children)Be.is(e)&&e.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(e=>{Be.is(e)&&e.disposeRecursively()})}toState(e=[]){return ME({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)},e)}updateByObjUpdateOp(e,i){e!==void 0&&this.updateByOp({type:0,props:e,path:[]},{...this.data,...e},i,!1)}updateByOp(e,i,n,r){let a=this.data;this.data=i;let s=e,o=ri(e.path,["states","*"]);if(o!==null){if(e.type===0){let[l]=o;if(this?.stateSelection===l){let c={...e.props};if(delete c.name,Object.values(e.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let d=jn.zoom(h,e.path.slice(2));if(d)for(let u in e.props)e.props[u]===void 0&&u in d&&(c[u]=d[u])}}s={...e,props:c,path:e.path.slice(2)}}}}else if(e.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(e.props.name!==void 0&&l.name){let{name:h,...d}=l;l=d}if(e.props.material!==void 0&&"material"in l){let{material:h,...d}=l;l=d}let c=jn.removeOverridden(e.path,e.props,l);s={...e,props:c}}}if(this.updateByPatchedOpBase(s,th.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),n),ri(e.path,["overrides"])){let l=[],c=[...e.path];for(l.push(c[1]),c.splice(0,2);c.length>0&&c[0]==="descendants";)l.push(c[1]),c.splice(0,2);if(l[l.length-1]===void 0){if(e.type===0)for(let h of Object.keys(e.props)){l[l.length-1]=h;let d=n.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=e.props[h],d.updateState(hh.apply(d.component.data,d.overrideData),n))}}else{let h=n.scene.findInstance([this.uuid,...l]);if(h){let d=jn.zoom(h.component.data,c);if((e={...e,path:c}).type===0){let u=e.props;if(d)for(let[p,f]of Object.entries(e.props))f===void 0&&(u===e.props&&(u={...e.props}),u[p]=d[p]);e={...e,props:u}}h.overrideData=U_.resolve(i.overrides,l),h.updateByOp(e,tr.applySimple(h.data,e),n,!1)}}}else if(this.instances.length>0){let l;if(e.path.length===0&&e.type===0){let c;for(let h of tl.rootOverrideProps)h in e.props&&(c===void 0&&(c={}),c[h]=e.props[h]);c&&(l={...e,props:c})}else for(let c of tl.rootOverrideProps)if(ri(e.path,[c])){l=e;break}l!==void 0&&this.instances.forEach(c=>{if(c.isInstanceRoot){let h=hh.filterOp(c.overrideData,l);h&&c.updateByOp(h,tr.applySimple(c.data,h),n,!0)}}),this.instances.forEach(c=>{if(!c.isInstanceRoot){let h=hh.filterOp(c.overrideData,e);if(h){let d;d=a===c.data&&e===h?i:tr.applySimple(c.data,h),c.updateByOp(h,d,n,!0)}}})}}updateByPatchedOpBase(e,i,n){if(this.dataPatched=i,e.path.length===0&&e.type===0)e.props.type!==void 0&&!Wc.is(e.props.type)&&il.changeEntityProptotype(this,i,n);else if(e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&"type"in e.props){il.changeEntityProptotype(this,i,n);for(let r of this.children)Be.is(r)&&r.updateVisible(n.scene)}this.updateByPatchedOp(e,i,n)}updateByPatchedOp(e,i,n){if(e.path.length===0&&e.type===0?this.updateState(e.props,n):e.type===0&&("resolutionLevel"in e.props||"useChildrenColors"in e.props)&&this.updateState(i,n),e.path[0]==="morphTargetInfluences"&&e.type===0){let r=i.morphTargetInfluences.get(e.path[1])?.data.name;r&&this.updateMorphInfluences(r,n.shared.getVariable(e.props.value,[this.uuid,"morphTargetInfluences",r]))}if(ri(e.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),ri(e.path,["cloner"])!==null){let r=tr.drop(e,1);r.path.length===0&&r.type===0&&r.props.disabled===!0?this.setFromClonerState(null,n):this.cloner?this.cloner.updateState(i.cloner,n):(this.setFromClonerState(i.cloner,n),this.expandCloner(n)),this.updateVisible(n.scene)}}updatePathSnapping(e=this.dataPatched.pathSnapping){this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(e){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,n=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,r=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,a=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let s=e.find(i);if(!s)return;this._needApplyPathSnapping=!1;let o=s.data;if(o.geometry.path.points.length<=1)return;let l=EF(o.geometry.path),c=(n+r)%1;n+r===1&&c===0&&(c=1);let h=null;try{h=l.curves.length?l.getPointAt(c):null}catch{}if(h===null)return;s.updateMatrixWorld();let d=this.parent?TS.copy(this.parent.matrixWorld).invert():TS.identity();d.multiply(s.matrixWorld),h.applyMatrix4(d);let u={position:h.toArray(),rotation:o.rotation};if(a==="tangential"){let p=CS.extractRotation(s.matrixWorld),f=l.getTangentAt(c).applyMatrix4(p).add(h),g=CS.lookAt(h,f,VI),m=Ud.setFromEuler(dv.setFromRotationMatrix(g)).multiplyScalar(It.RAD2DEG);u={...u,rotation:m.toArray()}}this.updateTransformState(u),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(FI)})}updateVisible(e){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!e)return;let i=!1;this.traverseEntity(n=>{if(n.data.type==="Splat")return i=!0,!0}),i&&e.reloadSplats()}updateState_Entity(e,i){e.name!==void 0&&(this.name=e.name),e.raycastLock!==void 0&&(this.raycastLock=e.raycastLock),e.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in e&&e.cloner!==void 0&&(this.setFromClonerState(e.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(e,i)}get attachedSurfaceCloners(){return this.children.filter(e=>Bu(e)&&e.parameters.type==="toObject")}setFromClonerState(e,i){if(!this.disposed)if(e===null||e.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(il.Cloner===null)return void Gn("cloners","a cloner");this.cloner=new il.Cloner(this,e),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(e,i)}expandCloner(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}invalidateClonerTransform(e){this.cloner&&this.cloner.invalidateTransform(e)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),td=k(()=>{rt(),Wr(),(uA||(uA={})).is=t=>"objectHelper"in t,Jc=(t,e)=>class extends $b(t){constructor(){super(...arguments),this.objectHelper=new e(this),this.gizmos={}}get geometryHelper(){return e.geometryHelper}raycast(i,n){this.objectHelper.raycast(i,n)}showGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Mg&&(n.visible=!0)}}updateEntityBoxSize(i,n){this.objectHelper.visible&&this.geometryHelper instanceof _s?(i.setScalar(0),n.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,n)}hideGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Mg&&(n.visible=!1)}}}}),Yb=k(()=>{rt(),Wb(),td(),Zs=class extends Jc(_p,pp){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function ts(t,e,i,n,r,a,s){Rm.set(r,a,s).unproject(n);let o=e[t];if(o!==void 0){let l=i.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Rm.x,Rm.y,Rm.z)}}var Rm,ua,jI,CF,i$=k(()=>{rt(),qg(),Xg(),Rm=new C,ua=new Zl,jI=class extends vu{constructor(t){let e=new Gt,i=new No({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],r=[],a={},s=new Jt(15711266),o=new Jt(15711266),l=new Jt(2857471);function c(d,u,p){h(d,p),h(u,p)}function h(d,u){n.push(0,0,0),r.push(u.r,u.g,u.b),a[d]===void 0&&(a[d]=[]),a[d].push(n.length/3-1)}c("n1","n2",s),c("n2","n4",s),c("n4","n3",s),c("n3","n1",s),c("f1","f2",s),c("f2","f4",s),c("f4","f3",s),c("f3","f1",s),c("n1","f1",s),c("n2","f2",s),c("n3","f3",s),c("n4","f4",s),c("p","n1",o),c("p","n2",o),c("p","n3",o),c("p","n4",o),c("u1","u2",l),c("u2","u3",l),c("u3","u1",l),e.setAttribute("position",new Ft(n,3)),e.setAttribute("color",new Ft(r,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let t=this.geometry,e=this.pointMap;ua.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;ts("n1",e,t,ua,-1,-1,i),ts("n2",e,t,ua,1,-1,i),ts("n3",e,t,ua,-1,1,i),ts("n4",e,t,ua,1,1,i);let n=i;ts("f1",e,t,ua,-1,-1,n),ts("f2",e,t,ua,1,-1,n),ts("f3",e,t,ua,-1,1,n),ts("f4",e,t,ua,1,1,n);let r=n;ts("u1",e,t,ua,.35,1.1,r),ts("u2",e,t,ua,-.35,1.1,r),ts("u3",e,t,ua,0,1.55,r),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},CF=class extends xp(jI){constructor(t){super(t),this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,e){wp(this.object,this.geometry,t,e,!0)}}});function GI(t){return 1-Math.pow(1-t,3)}var Jh,uv,pv,fv,zd,mv,Us,tn,qa=k(()=>{rt(),i$(),te(),td(),ti(),Jh=new C,uv=new C,pv=new Yt,fv=new C,zd=new C,mv=new C,Us=class extends Jc(Zl,CF){constructor(t="",e={...ng.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=Jo.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let r=this._projectionTransition;if(r===void 0)return;if(this.disposed)return void this._endProjectionTransition();r.raf=requestAnimationFrame(this._tickProjectionTransition);let a=Us.projectionTransitionRequestRender??r.requestRender;this.updateProjectionMatrix(),a?.()},this.super_Entity(t,e),this.previousProjectionMatrix=new At,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,n=this.height;this.orthoCamera=new cp(-.5*i,.5*i,.5*n,-.5*n,-5e4,1e4),this.perspCamera=new ju(45,i/n,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(t){let e=Us.projectionTransitionsEnabled;Us.projectionTransitionsEnabled=!1;try{return t()}finally{Us.projectionTransitionsEnabled=e}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(t){this.perspCamera.fov=t}get fov(){return this.perspCamera.fov}setNear(t,e){t==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t,e,i){typeof t=="number"&&(t=new C(t,e,i)),super.lookAt(t),this.getWorldPosition(Jh),this.targetOffset=Jh.distanceTo(t)}getTarget(t=new C){return this.getWorldDirection(uv),this.getWorldPosition(Jh),uv.multiplyScalar(this.targetOffset),t.copy(Jh).add(uv),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Jh),Jh.distanceTo(t)}updateUp(){this.getWorldQuaternion(pv),fv.set(0,0,1).applyQuaternion(pv),zd.copy(bi.DEFAULT_UP),this.isUpVectorFlipped&&zd.negate(),zd.applyQuaternion(pv),mv.copy(bi.DEFAULT_UP).projectOnPlane(fv),this.angleOffsetFromUp=mv.angleTo(zd),this.angleOffsetFromUp*=mv.cross(zd).dot(fv)>=0?1:-1}updateTransformState(t,e){let i=super.updateTransformState(t,e);return t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(t){let e=t.getWorldPosition(new C),i=t.getWorldDirection(new C).multiplyScalar(this.targetOffset);return{position:e.clone().add(i),target:e}}getViewToTarget(t){let e=this.getWorldDirection(new C).multiplyScalar(this.targetOffset);return{position:t.clone().sub(e),target:t}}getViewToObject(t){let e=new C;return t.getWorldPosition(e),this.getViewToTarget(e)}setViewplaneSize(t,e,i=!1){if(this.aspect=t/e,i){let n=t>e?this.aspect:1,r=t>e?1:this.aspect;this.left=-395*n,this.right=395*n,this.top=1/r*395,this.bottom=1/r*-395}else this.left=.5*-t,this.right=.5*t,this.top=.5*e,this.bottom=.5*-e;this.updateProjectionMatrix()}copyViewPlaneSize(t){this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let t=this._projectionTransition;if(t===void 0)return 1;let e=(performance.now()-t.start)/t.duration;return e>=1?1:e<=0?0:GI(e)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return Us.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=Us.projectionTransitionMinAgeMs}_beginProjectionTransition(t){let e=this._projectionTransition;e===void 0&&(e={from:new At,blend:new At,blendInverse:new At,start:0,duration:Us.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:t},this._projectionTransition=e),e.from.copy(this.projectionMatrix),e.start=performance.now(),e.duration=Us.projectionTransitionDuration,e.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,t&&(e.requestRender=t),e.raf!==0&&cancelAnimationFrame(e.raf),e.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;let e=(performance.now()-t.start)/t.duration;if(e>=1)return void this._endProjectionTransition();let i=GI(e),n=t.from.elements,r=this._activeSubCamera.projectionMatrix.elements,a=t.blend.elements,s=t.referenceDepth,o=Math.max(1e-6,n[15]-n[11]*s),l=i*o/(i*o+(1-i)*Math.max(1e-6,r[15]-r[11]*s));for(let c=0;c<16;c++)a[c]=n[c]+(r[c]-n[c])*l;t.blendInverse.copy(t.blend).invert(),this.projectionMatrix=t.blend,this.projectionMatrixInverse=t.blendInverse}_endProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;t.raf!==0&&cancelAnimationFrame(t.raf),this._projectionTransition=void 0;let e=this._activeSubCamera;this.projectionMatrix=e.projectionMatrix,this.projectionMatrixInverse=e.projectionMatrixInverse}_syncProjectionTransition(t){let e=t._projectionTransition;if(e===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new At,blend:new At,blendInverse:new At,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=i):i.raf!==0&&(cancelAnimationFrame(i.raf),i.raf=0),i.requestRender=void 0,i.from.copy(e.from),i.start=e.start,i.duration=e.duration,i.referenceDepth=e.referenceDepth,this._applyProjectionTransition()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,e,i,n,r,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,e,i,n,r,a):this.orthoCamera.setViewOffset(t,e,i,n,r,a),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.parent=t.parent,this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=Jo.sanitizeTargetOffset(t.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(t),this}toCameraState(t=[]){return ME({type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped},t)}updateCameraSubtype(t,e){let i=t==="perspective"?"PerspectiveCamera":"OrthographicCamera";e.zoom!==void 0&&this.setZoom(i,e.zoom),e.near!==void 0&&this.setNear(i,e.near),e.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=e.fov)}updateState(t,e){this.updateCameraState(t,e)}updateCameraState(t,e){this.updateState_Entity(t,e),t.far!==void 0&&(this.far=t.far),t.orthographic!==void 0&&this.updateCameraSubtype("orthographic",t.orthographic),t.perspective!==void 0&&this.updateCameraSubtype("perspective",t.perspective),t.type!==void 0&&(t.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(e?.shared.requestRender),this.cameraType=t.type),t.up!==void 0&&this.up.fromArray(t.up.map(i=>typeof i=="number"?i:0)),t.targetOffset!==void 0&&(this.targetOffset=Jo.sanitizeTargetOffset(t.targetOffset)),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.type===0&&this.updateCameraSubtype(t.path[0],t.props)}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}},(tn=Us).projectionTransitionsEnabled=!1,tn.projectionTransitionDuration=350,tn.projectionTransitionMinAgeMs=1e3});function PF(t){return t.type==="TorusGeometry"&&t.arc===360}var DF,gv,pA,Og=k(()=>{rt(),DF=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??n),a=Math.abs(i.depth??n),s=Math.abs(Math.min(n,a))/2;return{parameters:Object.assign(i,{width:n,height:r,depth:a,radius:s,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:n,radius:r,revolutions:a,segments:s,pathRadius:o,pathType:l,pathSegments:c,cornerRadius:h,cornerSegments:d}=t.parameters,u=new pA(!1,e,i,n,r,a,s,o,l,c,h,d);return Object.assign(u,{userData:{...t,type:"HelixGeometry"}})}},gv=new oh([0,0,0],1),pA=class extends Gt{constructor(t=!0,e=1,i=1,n=1,r=1,a=1,s=1,o=1,l=1,c=1,h=1,d=1){if(super(),a===0)return;let u=t&&a===1;u&&(d=0),h>100&&(h=100),h===0&&(d=0);let p,f,g,m,y,v,_,b,x=()=>new C,w=new C,S=x(),T=x(),E=x(),P=x(),A=x(),R=x(),O=x(),D=x(),I=x(),U=x(),N=x(),G=i-2*o+.001,H=G/a,J=Math.ceil(s*a),K=J+1,tt=G/J,ct=-G/2,et=c+1,st=2*Math.PI/c,dt=Math.PI/2/d,Y=Math.min((1-h/100)*o,o-.01),ht=o-Y,F=0,B=2*d+2,j=et*B/2,Z=j+et*K,L=Math.max(0,et*(K+B)),[W,X,V]=[3,3,2].map(jt=>Array(L*jt).fill(0)),nt=[],lt=r-o;function ft(jt,Nt){let _e=Math.PI/2;v=Nt*tt,b=2*Math.PI*(v%H)/H+_e,v+=ct,_=Math.sin(b)*lt,y=Math.cos(b)*lt,t?jt.set(y,_,v):jt.set(y,v,_)}ft(w,-1e-10),ft(S,0),P.copy(w),ft(w,1);let pt=w.distanceTo(S),Pt=u?0:ht+Y,bt=pt*J+2*Pt,Rt=Y,_t=bt-Pt;for(let jt=0;jt<=J;jt++){ft(T,jt),N.subVectors(T,P).normalize(),P.copy(T),I.copy(T).setComponent(+t+1,0).normalize(),U.crossVectors(N,I).normalize();let Nt=jt===0,_e=jt===J,be=Nt?3*Math.PI/2:dt,ji=Nt?Rt:_t,oe=Nt?et:Z,le=Nt?0:L-et,Pe=N.clone().multiplyScalar(Nt?-ht:ht).add(T),ai=N.clone().multiplyScalar(Nt?-1:1).normalize();for(let ze=0;ze<et;ze++){let Di=ze*st;if(A.addVectors(w.copy(I).multiplyScalar(o*Math.cos(Di)),S.copy(U).multiplyScalar(o*Math.sin(Di))),R.copy(A).normalize(),Nt||_e){u||(F=le+ze,[0,1,2].forEach(ui=>{W[3*F+ui]=Pe.getComponent(ui),X[3*F+ui]=ai.getComponent(ui)}),V[2*F]=+_e,V[2*F+1]=ze/c),S.copy(R).multiplyScalar(Y),E.addVectors(T,S);for(let ui=0;ui<d;ui++){let nn=ui*dt+be;O.addVectors(w.copy(N).multiplyScalar(ht*Math.sin(nn)),S.copy(R).multiplyScalar(ht*Math.cos(nn))),D.copy(O).normalize(),S.addVectors(E,O),O.normalize(),F=oe+ui*et+ze,[0,1,2].forEach(yn=>{W[3*F+yn]=S.getComponent(yn),X[3*F+yn]=D.getComponent(yn)});let Zr=+Nt+Math.sin(nn);V[2*F]=(ji+ht*Zr)/bt,V[2*F+1]=ze/c}}S.addVectors(T,A),F=j+jt*et+ze,[0,1,2].forEach(ui=>{W[3*F+ui]=S.getComponent(ui),X[3*F+ui]=R.getComponent(ui)}),V[2*F]=(Pt+jt*pt)/bt,V[2*F+1]=ze/c}}let $=K+2*d+2,[vt,Dt]=[+u,$-1];for(let jt=vt;jt<=Dt-1;jt++){let Nt=u&&jt===Dt-1;for(let _e=0;_e<et-1;_e++)p=jt*et+_e,f=p+1,g=(Nt?_e:p)+et,m=(Nt?_e+1:f)+et,jt===0?nt.push(f,m,g):jt===$-2?nt.push(p,f,g):nt.push(p,f,g,f,m,g)}this.setIndex(nt),this.setAttribute("position",new Ft(W,3)),this.setAttribute("normal",new Ft(X,3)),this.setAttribute("uv",new Ft(V,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t,e,i,n,r=this.userData.parameters,a=Math.ceil(r.tubularSegments),s=r.radialSegments,o=s+1,l=[];for(let c=1;c<a;c++)for(let h=0;h<s;h++)t=c*o+h,e=t+1,i=t+o,n=e+o,l.push(t,e,i,e,n,i);for(let c=0;c<s;c++)t=a*o+c,e=t+1,i=c+o,n=c+1+o,l.push(t,e,i,e,n,i);return gv.array=new Uint32Array(l),gv.count=l.length,gv}}});function n$(t){return WI||(WI=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.13/build",i=import("./boolean.js"),[n,r]=await Promise.all([i,fetch(`${e}/boolean.wasm`).then(a=>a.arrayBuffer())]);await n.default({module_or_path:r}),Ig=n}())}function H_(){if(Ig===void 0)throw new Error("boolean-wasm is not loaded");return Ig}function FC(t){let e=Lg.get(t);if(e===void 0)throw new Error("Unknown csg mesh set handle "+t);return e}function kC(t){return Lg.set(++fA,t),fA}function r$(t,e,i){if(Ig===void 0)return-1;let{positions:n,indices:r,normals:a}=function(s,o){if(o&&s.userData.positions!==void 0){let p=s.userData,f=[];for(let g=0,m=0;g<p.verticesPerFace.length;g++){let y=p.verticesPerFace[g];for(let v=1;v<y-1;v++)f.push(p.indices[m],p.indices[m+v],p.indices[m+v+1]);m+=y}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(f)}}let l;l=PF(s.userData.parameters)?s.getClosedTorusIndicesForBooleanOrSubdiv():s.getIndex();let c,h=s.getAttribute("position");if(l===null){c=new Uint32Array(h.count);for(let p=0;p<c.length;p++)c[p]=p}else c=l.array instanceof Uint32Array?l.array:new Uint32Array(l.array);let d=s.getAttribute("normal"),u=d!==void 0&&d.itemSize===3&&d.count===h.count&&d.array instanceof Float32Array&&d.isInterleavedBufferAttribute!==!0?d.array:void 0;return{positions:h.array,indices:c,normals:u}}(t,e);return kC(new Ig.CsgMesh(n,r,a))}function HI(t,e){let i=H_(),n=OF[e];if(n===void 0)throw new Error("Unknown boolean operation "+e);let r=t.map(FC);if(r.length===1)return i.clone_mesh(r[0]);let a,s=[];if(e===2&&r.length>2){let o=r[0];for(let l=1;l<r.length-1;l++)o=i.boolean_mesh(o,r[l],0),s.push(o);a=i.boolean_mesh(r[r.length-1],o,2)}else if(e===2)a=i.boolean_mesh(r[1],r[0],2);else{let o=r[r.length-1];for(let l=0;l<r.length-1&&(o=i.boolean_mesh(o,r[l],n),s.push(o),o.tri_count()!==0);l++);a=o,s.pop()}for(let o of s)o.free();return a}function PS(t,e){FC(t).transform(new Float32Array(e.elements))}function RF(t){let e=Lg.get(t);e!==void 0&&(e.free(),Lg.delete(t))}var Ig,Lg,fA,WI,OF,Zb=k(()=>{rt(),Og(),Lg=new Map,fA=0,OF={0:0,1:1,2:2}});function tc(t){return t!==null&&"booleanOp"in t}var mA,IF,a$=k(()=>{rt(),Wr(),Zb(),mA=class extends $b(wi){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new At}updateVisible(t){super.updateVisible(t),this.visible=!tc(this.parent)&&this.visible,tc(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){tc(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(RF(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),tc(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)t instanceof mA&&(t.freeBooleanPointer(),tc(t)&&t.invalidateUpstreamBooleanData())}updateTransformState(t,e){let i=super.updateTransformState(t,e);return i&&tc(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(t=!1){super.onVariableUpdate(t),tc(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),s$=k(()=>{IF=null});function VC(t,e=0,i=t.count,n,r){let a=1/0,s=1/0,o=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d=e;d<i;d++){let u=t.getX(d),p=t.getY(d),f=t.getZ(d);u<a&&(a=u),p<s&&(s=p),f<o&&(o=f),u>l&&(l=u),p>c&&(c=p),f>h&&(h=f)}Om.min.set(a,s,o),Om.max.set(l,c,h),Om.getCenter(n),Om.getSize(r).multiplyScalar(.5)}var Om,qI,XI,$i,lr=k(()=>{rt(),a$(),s$(),Om=new ci,qI=new Gt,XI=new Wa,$i=class extends mA{constructor(t,e){super(qI,XI),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){let i=IF;i===null?super.raycast(t,e):i(this,t,e)}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");i!==void 0?VC(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}}});function W_(t){return t?.isClassicNodeMaterial===!0}var vn,Bg,LF,BF,lg,UF,zF,NF,jC=k(()=>{}),xs=k(()=>{rt(),vn=class extends Jt{constructor(t,e,i,n){super(t,e,i),this.isColorA=!0,this.a=n}setRGBA(t,e,i,n){super.setRGB(t,e,i),this.a=n}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(t){return super.equals(t)&&this.a===t.a}setStyle(t,e="srgb"){let i;if(t==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(t)){let n,r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=r==="rgba"?parseFloat(n[4]):1,super.setStyle(t,e);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=r==="hsla"?parseFloat(n[4]):1,super.setStyle(t,e)}}return super.setStyle(t,e)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}}}),FF=k(()=>{xs(),Bg=class extends vn{}}),o$=k(()=>{LF=class{constructor(t=1e4){this.timeout=t,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let i=e;e=e.next,e.prev=this.head,this.head.next=e,i.next=null,i.prev=null,i.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),i=this.cache.get(t);return i===void 0?(i={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,i)):(i.time=e,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),kF=k(()=>{o$(),BF=class extends LF{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}}),VF=k(()=>{UF=class{constructor(t,e){this.data=t,this.cache=e,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},zF=class{constructor(){this.cache=new Map}remove(t){this.cache.delete(t.data)}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}}),l$=k(()=>{rt(),NF=class extends Lz{constructor(t){super(t),this.type=$n}parse(t){let e=function(p,f){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(f||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(f||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(f||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(f||""))}},i=function(p,f,g){f=f||1024;let m=p.pos,y=-1,v=0,_="",b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(m,m+128)));for(;0>(y=b.indexOf(`
|
|
4163
4163
|
`))&&v<f&&m<p.byteLength;)_+=b,v+=b.length,m+=128,b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(m,m+128)));return-1<y&&(g!==!1&&(p.pos+=v+y+1),_+b.slice(0,y))},n=function(p,f,g,m){let y=p[f+3],v=Math.pow(2,y-128)/255;g[m+0]=p[f+0]*v,g[m+1]=p[f+1]*v,g[m+2]=p[f+2]*v,g[m+3]=1},r=function(p,f,g,m){let y=p[f+3],v=Math.pow(2,y-128)/255;g[m+0]=Yl.toHalfFloat(Math.min(p[f+0]*v,65504)),g[m+1]=Yl.toHalfFloat(Math.min(p[f+1]*v,65504)),g[m+2]=Yl.toHalfFloat(Math.min(p[f+2]*v,65504)),g[m+3]=Yl.toHalfFloat(1)},a=new Uint8Array(t);a.pos=0;let s,o,l,c=function(p){let f,g,m=/^#\?(\S+)/,y=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,v=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,_=/^\s*FORMAT=(\S+)\s*$/,b=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,x={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for((p.pos>=p.byteLength||!(f=i(p)))&&e(1,"no header found"),(g=f.match(m))||e(3,"bad initial token"),x.valid|=1,x.programtype=g[1],x.string+=f+`
|
|
4164
4164
|
`;f=i(p),f!==!1;)if(x.string+=f+`
|
|
4165
4165
|
`,f.charAt(0)!=="#"){if((g=f.match(y))&&(x.gamma=parseFloat(g[1])),(g=f.match(v))&&(x.exposure=parseFloat(g[1])),(g=f.match(_))&&(x.valid|=2,x.format=g[1]),(g=f.match(b))&&(x.valid|=4,x.height=parseInt(g[1],10),x.width=parseInt(g[2],10)),2&x.valid&&4&x.valid)break}else x.comments+=f+`
|
|
4166
4166
|
`;return 2&x.valid||e(3,"missing format specifier"),4&x.valid||e(3,"missing image size specifier"),x}(a),h=c.width,d=c.height,u=function(p,f,g){let m=f;if(m<8||m>32767||p[0]!==2||p[1]!==2||128&p[2])return new Uint8Array(p);m!==(p[2]<<8|p[3])&&e(3,"wrong scanline width");let y=new Uint8Array(4*f*g);y.length||e(4,"unable to allocate buffer space");let v=0,_=0,b=4*m,x=new Uint8Array(4),w=new Uint8Array(b),S=g;for(;S>0&&_<p.byteLength;){_+4>p.byteLength&&e(1),x[0]=p[_++],x[1]=p[_++],x[2]=p[_++],x[3]=p[_++],(x[0]!=2||x[1]!=2||(x[2]<<8|x[3])!=m)&&e(3,"bad rgbe scanline format");let T,E=0;for(;E<b&&_<p.byteLength;){T=p[_++];let A=T>128;if(A&&(T-=128),(T===0||E+T>b)&&e(3,"bad scanline data"),A){let R=p[_++];for(let O=0;O<T;O++)w[E++]=R}else w.set(p.subarray(_,_+T),E),E+=T,_+=T}let P=m;for(let A=0;A<P;A++){let R=0;y[v]=w[A+R],R+=m,y[v+1]=w[A+R],R+=m,y[v+2]=w[A+R],R+=m,y[v+3]=w[A+R],v+=4}S--}return y}(a.subarray(a.pos),h,d);switch(this.type){case $e:l=u.length/4;let p=new Float32Array(4*l);for(let g=0;g<l;g++)n(u,4*g,p,4*g);s=p,o=$e;break;case $n:l=u.length/4;let f=new Uint16Array(4*l);for(let g=0;g<l;g++)r(u,4*g,f,4*g);s=f,o=$n;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:h,height:d,data:s,header:c.string,gamma:c.gamma,exposure:c.exposure,type:o,colorSpace:Vu,minFilter:de,magFilter:de,generateMipmaps:!1,flipY:!0}}setDataType(t){return this.type=t,this}}});function $I(t){return t.length>2&&t[0]===35&&t[1]===63}var YI,GC,Xo,h$=k(()=>{rt(),l$()}),jF=k(()=>{rt(),kF(),VF(),h$(),YI=0,GC=class extends UF{constructor(t,e){super(t,e.imageHolderCache),this.data=t,this.shared=e,this.instanceId=++YI,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this.isHdr=!1,this._cache={1e3:{},1001:{},1002:{}},this.isVideo=t.type==="video",this.isBuffer=t.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?t:t.data)}async updateSrc(t){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let e=()=>{this.loaded=!0;for(let n of Object.values(this._cache))for(let r of Object.values(n))for(let a of Object.values(r))a&&(a.image=this.img,a.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=t,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,typeof t!="string"){let n,r=new FileReader;r.readAsDataURL(new Blob([t],{type:"video/mp4"})),await new Promise(a=>{r.onloadend=s=>{n=s.target?.result,a(null)}}),this.img.src=n}else this.img.src=t;this.img.onloadeddata=()=>{e()}}else if(t instanceof Uint8Array?$I(t):typeof t=="string"&&/\.hdr($|[?#])/i.test(t)){let n=t instanceof Uint8Array?t:null;if(n===null)try{n=new Uint8Array(await(await fetch(t)).arrayBuffer())}catch{n=null}let r=n!==null&&$I(n)?function(a){try{let s=new NF().parse(a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength));if(!s||!s.width||!s.height)return null;let{width:o,height:l}=s,c=s.data,h=new Uint16Array(c.length),d=4*o,u=g=>Yl.toHalfFloat(Math.pow(Math.max(Yl.fromHalfFloat(g),0),1/2.2)),p=new Map,f=g=>{let m=p.get(g);return m===void 0&&(m=u(g),p.set(g,m)),m};for(let g=0;g<l;g++){let m=g*d,y=(l-1-g)*d;for(let v=0;v<d;v+=4)h[y+v]=f(c[m+v]),h[y+v+1]=f(c[m+v+1]),h[y+v+2]=f(c[m+v+2]),h[y+v+3]=c[m+v+3]}return{isSplineHdr:!0,data:h,width:o,height:l}}catch{return null}}(n):null;r!==null&&(this.isHdr=!0,this.img=r,e())}else this.img=new Image,this.img.src=typeof(i=t)=="string"?i:(lg||(lg=new BF),lg.load(i)),this.img.onload=e,await new Promise(n=>{this.img.onload=()=>{e(),n(null)}});var i}getTexture(t,e=1008,i=1006){let n=this._cache[t]?.[e]?.[i];if(n)return n;{let r;return this.isBuffer?r=this.img.texture:this.isVideo?r=new Az(this.img,void 0,t,t):this.isHdr?(r=function(a){let s=new Pn(a.data,a.width,a.height,Xi,$n);return s.flipY=!1,s.image.isSplineHdr=!0,s.needsUpdate=!0,s}(this.img),r.wrapS=t,r.wrapT=t,r.magFilter=i,r.minFilter=e):r=new Ni(this.img,void 0,t,t,i,e),this.isBuffer||(r.anisotropy=8,r.generateMipmaps=e===1008),this.loaded&&(r.needsUpdate=!0),this._cache[t]===void 0&&(this._cache[t]={}),this._cache[t][e]===void 0&&(this._cache[t][e]={}),this._cache[t][e][i]=r,r}}setNeedsUpdate(t){if(!this.isBuffer)for(let e of Object.values(this._cache))for(let i of Object.values(e))for(let n of Object.values(i))n&&(n.needsUpdate=t)}disposeTextures(){for(let[t,e]of Object.entries(this._cache))for(let[i,n]of Object.entries(e))for(let[r,a]of Object.entries(n))a?.dispose(),this._cache[t]!==void 0&&this._cache[t][i]!==void 0&&(this._cache[t][i][r]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}}),HC=k(()=>{jF(),Xo=class extends GC{}});function c$(t){if(typeof t=="string")return t;let e=gA.get(t);return e||(e={url:URL.createObjectURL(new Blob([t]))},gA.set(t,e)),e.url}var gA,d$=k(()=>{gA=new Map});function u$(){if(!vA)return ZI||(ZI=async function(){await Promise.resolve().then(()=>(xP(),_9)),GF(window!==void 0?window:global),vA=!0}())}var GF,HF,vA,ZI,WF=k(()=>{HF=new Promise(t=>{GF=t}),vA=!1});function KI(t,e){t.forEach(i=>{"dragDropActions"in i.data?(e.push(...i.data.dragDropActions.drag),e.push(...i.data.dragDropActions.drop)):"inActions"in i.data?(e.push(...i.data.inActions),e.push(...i.data.outActions)):"gameActions"in i.data?(e.push(...i.data.gameActions.idle),e.push(...i.data.gameActions.move),e.push(...i.data.gameActions.jump),e.push(...i.data.gameActions.run)):"breakpoints"in i.data?i.data.breakpoints.forEach(n=>{e.push(...n.data.actions)}):"actions"in i.data&&(e.push(...i.data.actions),i.data.actions.forEach(n=>{n.data.type==="Conditional"&&n.data.ifActions&&(e.push(...n.data.ifActions),e.push(...n.data.elseActions))}))})}function p$(t){let e=!1,i=[];return t.scene.objects.traverse((n,r)=>{if(r.type==="Page"&&r.uiScene!==void 0&&r.uiScene.objects.traverse((a,s)=>{if(s.events===void 0||Array.isArray(s.events)===!1)return!0;KI(s.events,i),e=e||i.some(o=>o.data.type==="Audio")}),r.events===void 0||Array.isArray(r.events)===!1)return!0;KI(r.events,i),e=e||i.some(a=>a.data.type==="Audio")}),e}var QI,Uu,WC=k(()=>{d$(),WF(),HF.then(t=>QI=t),Uu=class{constructor({src:t,volume:e,delay:i,loop:n}){let r;this._volume=1,this.delay=0,this._loop=1,this.loopsRemaining=0,this._status="stopped",this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)},r=typeof t=="string"?{src:t}:{src:c$(t),format:"wav"},this.sound=new QI.Howl(r),this.sound.on("end",this.onEnd),this.src=t,e!==void 0&&(this.volume=e),i!==void 0&&(this.delay=i),n!==void 0&&(this.loop=n)}get status(){return this._status}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}on(t,e,i){this.sound.on(t,e,i)}off(t,e,i){this.sound.off(t,e,i)}play(){this._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}}});function JI(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&(n.geometry.type==="TextGeometry"||n.geometry.type==="InputGeometry")&&(e=!0)}),e}var qC,XC=k(()=>{qC=null});function t4(t){return new at(t.y,-t.x)}var $C,yA,qF,XF,vv,e4,q_,$F,DS,X_=k(()=>{rt(),$C=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=t.parameters?.radiusTop,n=t.parameters?.radiusBottom,r=Object.assign({},e?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},t.parameters);r.thetaLength=It.clamp(r.thetaLength,0,360),r.hollow=It.clamp(r.hollow??0,0,1);let a=r.width/2,s=r.radiusTop??a,o=r.radiusBottom??a;if(s===o?(s=a,o=a):s>o?(s=a,o=o*a/s):(s=s*a/o,o=a),r.shapeBlendNode){s=i??a,o=n??a;let l=2*Math.max(s,o);r.width=l,r.depth=l}return{parameters:Object.assign(r,{width:Math.abs(r.width),height:Math.abs(r.height??r.width),depth:Math.abs(r.depth??r.width),radiusTop:s,radiusBottom:o})}}static build(t){let e,{width:i,depth:n,height:r,radialSegments:a,heightSegments:s,openEnded:o,thetaStart:l,thetaLength:c,radiusTop:h,radiusBottom:d,cornerRadius:u,cornerSegments:p,hollow:f}=t.parameters;c===0?(e=new Gt,e.setAttribute("position",new Ft([],3))):e=u||f?new yA(h,d,r,a,s,o,l,c*Math.PI/180,u,u,p,f):new Zm(h,d,r,a,s,o,l,c*Math.PI/180);let g=n/i;return g!==1&&e.scale(1,1,g),Object.assign(e,{userData:{...t,type:"CylinderGeometry"}})}},yA=class extends Gt{constructor(t,e,i,n,r,a,s,o,l,c,h,d,u=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,i=i||1,n=Math.floor(n)||8,r=Math.floor(r)||1,a=a!==void 0&&a,s=s!==void 0?s:0,o=o!==void 0?o:2*Math.PI,a&&(l=0,c=0);let p=i/2;u&&t==0&&(t=l),u&&e==0&&(e=c);let f=new at(t,p),g=new at(e,-p),m=null,y=null,v=null,_=null,b=f.clone().sub(g),x=0,w=0,S=0;d>0&&(x=Math.min(t,e)*(1-d),w=t-x,S=e-x);let T=f.clone();T.x-=x;let E=Math.PI-b.angle(),P=b.angle(),A=Math.tan(P/2),R=Math.tan(E/2),O=A+R,D=d?O:R,I=d?O:A;if(l=Math.min(l,(t-w)/D,b.length()/O),c=Math.min(c,(e-S)/I,b.length()/O),l>0){let nt=l/A;m=f.clone().sub(new at(nt,l)),d&&(v=m.clone(),v.x-=x-O*l),f.sub(b.clone().setLength(nt))}if(c>0){let nt=c/R;y=g.clone().sub(new at(nt,-c)),g.add(b.clone().setLength(nt)),d&&(_=y.clone(),_.x-=x-O*c,T.sub(b.clone().setLength(nt)))}b=f.clone().sub(g);let U=b.length()<.5,N=[],G=[],H=[],J=[],K=[],tt=[],ct=(nt,lt,ft,pt,Pt)=>{for(let bt=0;bt<h+1;bt++){let Rt=bt/h,_t=pt<0?Rt:1-Rt;Pt&&(_t-=1),_t*=nt;let $=Math.sin(_t),vt=Math.cos(_t)*pt,Dt=vt*lt+ft.y;N.push($*lt+ft.x),G.push(Dt),H.push($),J.push(vt),K.push(.5+Dt/i),tt.push(!1)}},et=(nt,lt,ft)=>{let pt=[nt,lt];ft<0&&pt.reverse();for(let Pt of pt)N.push(Pt),G.push(p*ft),H.push(0),J.push(ft),K.push(.5),tt.push(!0)};if(_&&y?(ct(E,c,_,-1,!0),ct(P,c,y,-1,!1)):y?(et(y.x,0,-1),ct(P,c,y,-1,!1)):a||et(e,S,-1),!U){let nt=t4(b).normalize();for(let lt=0;lt<=r;lt++){let ft=lt/r,pt=b.y*ft+g.y;N.push(b.x*ft+g.x),G.push(pt),H.push(nt.x),J.push(nt.y),K.push(.5+pt/i),tt.push(!1)}}if(v&&m?(ct(E,l,m,1,!1),ct(P,l,v,1,!0)):m?(ct(E,l,m,1,!1),et(m.x,0,1)):a||et(t,w,1),d&&!U){let nt=t4(b).multiplyScalar(-1).normalize();for(let lt=0;lt<=r;lt++){let ft=lt/r,pt=b.y*-ft+T.y;N.push(b.x*-ft+T.x),G.push(pt),H.push(nt.x),J.push(nt.y),K.push(.5+pt/i),tt.push(!1)}}let st=N.length,dt=st+(d&&!a?1:0),Y=(nt,lt)=>nt*st+(lt===st?0:lt),ht=o<2*Math.PI,F=(n+1)*st+(ht?2*(1+dt):0),B=new Float32Array(3*F),j=new Float32Array(3*F),Z=new Float32Array(2*F),L=F-1>65535?new Uint32Array(n*Math.max(0,dt-1)*6+(ht?2*(dt+1)*3:0)):new Uint16Array(n*Math.max(0,dt-1)*6+(ht?2*(dt+1)*3:0)),W=0,X=0;for(let nt=0;nt<=n;nt++){let lt=nt/n,ft=lt*o+s,pt=Math.sin(ft),Pt=Math.cos(ft);for(let bt=0;bt<st;bt++){let Rt=3*X,_t=2*X,$=N[bt],vt=H[bt];B[Rt]=$*pt,B[Rt+1]=G[bt],B[Rt+2]=$*Pt,j[Rt]=vt*pt,j[Rt+1]=J[bt],j[Rt+2]=vt*Pt,tt[bt]?(Z[_t]=.5,Z[_t+1]=.5):(Z[_t]=lt,Z[_t+1]=K[bt]),X++}}for(let nt=0;nt<n;nt++)for(let lt=0;lt<dt-1;lt++){if(a&&d&<==r)continue;let ft=Y(nt,lt),pt=Y(nt+1,lt),Pt=Y(nt+1,lt+1),bt=Y(nt,lt+1),Rt=B[3*Pt+0],_t=B[3*Pt+2];L[W++]=ft,L[W++]=pt,L[W++]=bt,(Rt!=0||_t!=0)&&(L[W++]=pt,L[W++]=Pt,L[W++]=bt)}function V(nt,lt,ft){let pt=Math.sin(ft),Pt=Math.cos(ft),bt=-Pt,Rt=pt,_t=nt<0?(Nt,_e,be)=>{L[W++]=Nt,L[W++]=_e,L[W++]=be}:(Nt,_e,be)=>{L[W++]=Nt,L[W++]=be,L[W++]=_e},$=(t+e+w+S)/4,vt=3*X,Dt=2*X;B[vt]=$*pt,B[vt+1]=0,B[vt+2]=$*Pt,j[vt]=bt,j[vt+1]=0,j[vt+2]=Rt,Z[Dt]=.5,Z[Dt+1]=.5;let jt=X++;for(let Nt=0;Nt<dt;Nt++){let _e=3*(lt+(Nt===st?0:Nt));vt=3*X,Dt=2*X,B[vt]=B[_e],B[vt+1]=B[_e+1],B[vt+2]=B[_e+2],j[vt]=bt,j[vt+1]=0,j[vt+2]=Rt;let be=_e/3*2|0;Z[Dt]=Z[be],Z[Dt+1]=Z[be+1],X++}for(let Nt=jt+1;Nt<X-1;Nt++)_t(jt,Nt,Nt+1);_t(jt,X-1,jt+1)}ht&&(V(-1,0,s),V(1,n*st,s+o)),this.setIndex(new Ht(L.slice(0,W),1)),this.setAttribute("position",new Ht(B,3)),this.setAttribute("normal",new Ht(j,3)),this.setAttribute("uv",new Ht(Z,2))}}}),i4=k(()=>{rt(),X_(),qF=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},t.parameters);return i.thetaLength=It.clamp(i.thetaLength,0,360),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,depth:n,height:r,radialSegments:a,heightSegments:s,openEnded:o,thetaStart:l,thetaLength:c,cornerRadiusTop:h,cornerRadiusBottom:d,cornerSegments:u}=t.parameters;c===0?(e=new Gt,e.setAttribute("position",new Ft([],3))):e=h>0||d>0||c<360?new yA(0,i/2,r,a,s,o,l,c*Math.PI/180,h,d,u,0,!0):new l_(i/2,r,a,s,o);let p=n/i;return p!==1&&e.scale(1,1,p),Object.assign(e,{userData:{...t,type:"ConeGeometry"}})}}}),n4=k(()=>{rt(),XF=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,height:n,depth:r,widthSegments:a,heightSegments:s,depthSegments:o,cornerRadius:l,cornerSegments:c}=t.parameters;return e=l===0?new _s(i,n,r,a,s,o):new e4(i,n,r,a,s,o,l,c),Object.assign(e,{userData:{...t,type:"CubeGeometry"}})}},vv=Math.PI/2,e4=class extends Gt{constructor(t=1,e=1,i=1,n=1,r=1,a=1,s=0,o=4){super(),this.type="BoxGeometry",n=Math.floor(n),r=Math.floor(r),a=Math.floor(a),o=Math.floor(o);let l=(s=Math.min(s,t/2,e/2,i/2))>0,c=o+1,h=2*((a+1)*(r+1)+(n+1)*(a+1)+(n+1)*(r+1))+(l?4*c*(a+1+(n+1)+(r+1))+c*(c+1)/2*8:0),d=2*(a*r+n*a+n*r)+(l?4*o*(a+n+r):0),u=l?8*o*o:0,p=new Float32Array(3*h),f=new Float32Array(3*h),g=new Float32Array(2*h),m=h-1>65535?new Uint32Array(6*d+3*u):new Uint16Array(6*d+3*u),y=0,v=0,_=new Float64Array(c),b=new Float64Array(c),x=new Float64Array(c),w=new Float64Array(c);for(let O=0;O<c;O++){let D=O/o*vv;_[O]=Math.sin(D)*s,b[O]=(1-Math.cos(D))*s,x[O]=Math.sin(D),w[O]=Math.cos(D)}let S=c*(c+1)/2,T=new Float64Array(3*S),E=new Float64Array(3*S);{let O=new C(t/2,e/2,i/2);O.subScalar(s);let D=0;for(let I=0;I<=o;I++){let U=vv*(1-I/o),N=Math.cos(U),G=Math.sin(U),H=0;for(let J=0;J<=I;J++){let K=N*Math.cos(H),tt=G,ct=N*Math.sin(H);T[3*D]=K,T[3*D+1]=tt,T[3*D+2]=ct,E[3*D]=O.x+K*s,E[3*D+1]=O.y+tt*s,E[3*D+2]=O.z+ct*s,D++,H+=vv/I}}}function P(O,D,I,U,N,G,H,J,K,tt){let ct=(G-2*s)/K,et=(H-2*s)/tt,st=G/2-s,dt=H/2-s,Y=J/2,ht=K+1,F=tt+1,B=0,j=new C;for(let Z=0;Z<F;Z++){let L=Z*et-dt;for(let W=0;W<ht;W++){let X=W*ct-st,V=3*(y+B),nt=2*(y+B);j[O]=X*U,j[D]=L*N,j[I]=Y,p[V]=j.x,p[V+1]=j.y,p[V+2]=j.z,j[O]=0,j[D]=0,j[I]=J>0?1:-1,f[V]=j.x,f[V+1]=j.y,f[V+2]=j.z,g[nt]=W/K,g[nt+1]=1-Z/tt,B+=1}}for(let Z=0;Z<tt;Z++)for(let L=0;L<K;L++){let W=y+L+ht*Z,X=y+L+ht*(Z+1),V=y+(L+1)+ht*(Z+1),nt=y+(L+1)+ht*Z;m[v++]=W,m[v++]=X,m[v++]=nt,m[v++]=X,m[v++]=V,m[v++]=nt}y+=B}function A(O,D,I,U,N,G,H,J,K,tt){let ct=(H-2*s)/tt,et=H/2-s,st=J/2-s,dt=K/2,Y=tt+1,ht=0,F=new C,B=new C;for(let j=0;j<o+1;j++){F[D]=(st+_[j])*N,F[I]=(dt-b[j])*G,B[O]=0,B[D]=x[j]*Math.sign(F[D]),B[I]=w[j]*Math.sign(F[I]);for(let Z=0;Z<Y;Z++){let L=Z*ct-et;F[O]=L*U;let W=3*(y+ht),X=2*(y+ht);p[W]=F.x,p[W+1]=F.y,p[W+2]=F.z,f[W]=B.x,f[W+1]=B.y,f[W+2]=B.z,g[X]=Z/tt,g[X+1]=0,ht+=1}}for(let j=0;j<o;j++)for(let Z=0;Z<tt;Z++){let L=y+Z+Y*j,W=y+Z+Y*(j+1),X=y+(Z+1)+Y*(j+1),V=y+(Z+1)+Y*j;m[v++]=L,m[v++]=W,m[v++]=V,m[v++]=W,m[v++]=X,m[v++]=V}y+=ht}function R(O,D,I){let U=O*D*I>0?(G,H,J)=>{m[v++]=G,m[v++]=H,m[v++]=J}:(G,H,J)=>{m[v++]=G,m[v++]=J,m[v++]=H},N=y;for(let G=0;G<S;G++){let H=3*G,J=3*y,K=2*y;p[J]=O*E[H],p[J+1]=D*E[H+1],p[J+2]=I*E[H+2],f[J]=O*T[H],f[J+1]=D*T[H+1],f[J+2]=I*T[H+2],g[K]=0,g[K+1]=0,y++}for(let G=0;G<o;G++){let H=N+G*(G+1)/2,J=N+(G+1)*(G+2)/2;U(H,J+1,J);for(let K=1;K<=G;K++)U(H+K-1,H+K,J+K),U(H+K,J+K+1,J+K)}}P("z","y","x",-1,-1,i,e,t,a,r),P("z","y","x",1,-1,i,e,-t,a,r),P("x","z","y",1,1,t,i,e,n,a),P("x","z","y",1,-1,t,i,-e,n,a),P("x","y","z",1,-1,t,e,i,n,r),P("x","y","z",-1,-1,t,e,-i,n,r),s>0&&(A("z","y","x",-1,-1,1,i,e,t,a),A("z","y","x",1,-1,-1,i,e,t,a),A("z","y","x",-1,1,-1,i,e,t,a),A("z","y","x",1,1,1,i,e,t,a),A("x","y","z",-1,-1,-1,t,e,i,n),A("x","y","z",1,-1,1,t,e,i,n),A("x","y","z",-1,1,1,t,e,i,n),A("x","y","z",1,1,-1,t,e,i,n),A("y","x","z",-1,-1,1,e,t,i,r),A("y","x","z",1,-1,-1,e,t,i,r),A("y","x","z",1,1,1,e,t,i,r),A("y","x","z",-1,1,-1,e,t,i,r),R(1,1,1),R(-1,1,1),R(1,-1,1),R(-1,-1,1),R(1,1,-1),R(-1,1,-1),R(1,-1,-1),R(-1,-1,-1)),this.setIndex(new Ht(m,1)),this.setAttribute("position",new Ht(p,3)),this.setAttribute("normal",new Ht(f,3)),this.setAttribute("uv",new Ht(g,2))}}}),YF=k(()=>{rt(),q_=class extends Gt{constructor(t=[],e=[],i="",n=1,r=.2,a=4){super(),this.type="PolyhedronGeometryRound";let s,o,l,c=0;return function(){(r=Math.min(.99999,r))==0&&(a=0);let h={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new C,u=d.clone(),p=new fn,f=r*n,g=n-f,m=a+1,y=new C,v=(Y,ht)=>y.subVectors(Y,ht).normalize(),_=(Y,ht)=>Array(Y).fill(void 0).map(ht),b=_(t.length/3,(Y,ht)=>new C().fromArray(t,3*ht).setLength(n)),x=[],w=1e6;for(let Y=0;Y<b.length;Y++){let ht,F,B,j=b[Y],Z=[],L=1e10,W=-1;for(;(W=e.indexOf(Y,W+1))!=-1;){let lt=W-W%3;ht=e[lt+(W+1)%3],F=e[lt+(W+2)%3],B=j.distanceToSquared(b[ht]),L=Math.min(L,B),Z.push([ht,F,B])}L+=1e-6;let X=[],V=0,nt=Z.length;for(let lt=0;lt<nt;lt++){[ht,F,B]=Z[V];let ft=x[ht]?.includes(Y)==1;B<=L&&X.push(ht+ +ft*w),V=Z.findIndex(pt=>pt[0]==F)}x.push(X)}let S=[];{let Y,ht,F=0,B=0,j=h==3;for(let Z=0;Z<=a;Z++){Y=Z*(Z+1)/2,ht=(Z+1)*(Z+2)/2;for(let L=0;L<a-Z;L++)[F,B]=[Y+L+Z+2,ht+L+Z+3],S.push(Y,ht,...j?[B,Y]:[F,ht],B,F),[Y,ht]=[F,B];S.push(Y,ht,Y+a+2)}}let T=0;for(let Y=0;Y<x.length;Y++)for(let ht=0;ht<h;ht++)x[Y][ht]<w&&T++;let E=b.length*h*S.length*3+T*m*6*3+2*T*3*3;s=new Float64Array(E),o=new Float64Array(E),l=new Float64Array(E/3*2);let P=(Y,ht,F)=>{let B=c/3*2;l[B]=Math.atan2(F,-Y)/2/Math.PI+.5,l[B+1]=1-(Math.atan2(-ht,Math.sqrt(Y*Y+F*F))/Math.PI+.5)},A=Y=>{s[c]=Y.x,s[c+1]=Y.y,s[c+2]=Y.z,o[c]=y.x,o[c+1]=y.y,o[c+2]=y.z,P(Y.x,Y.y,Y.z),c+=3},R=Y=>{s[c]=Y[0].x,s[c+1]=Y[0].y,s[c+2]=Y[0].z,o[c]=Y[1].x,o[c+1]=Y[1].y,o[c+2]=Y[1].z,P(Y[0].x,Y[0].y,Y[0].z),c+=3},O=(a+2)*(a+3)/2,D=new Float64Array(3*O),I=new Float64Array(3*O),U=new Float64Array(2*O),N=_(2*h*m,()=>new C),G=_(a*Math.max(0,a-1)/2,()=>new C),H=d.clone(),J=d.clone(),K=d.clone(),tt=d.clone(),ct=d.clone(),et=[],st=_(b.length,()=>_(h,()=>d.clone()));for(let Y=0;Y<b.length;Y++){d.copy(b[Y]).normalize(),H.copy(d).multiplyScalar(g);let ht=x[Y];for(let X=0;X<ht.length;X++){let V=ht[X],nt=ht[(X+1)%h];p.setFromPointsAndIndices(b,Y,V%w,nt%w),p.b.sub(p.a).setLength(1e10).add(p.a),p.c.sub(p.a).setLength(1e10).add(p.a),p.closestPointToPoint(H,st[Y][X])}let F=0,B=[],j=[],Z=new C;a==0&&[...st[Y]].reduce((X,V)=>X.add(V),Z).multiplyScalar(1/h);for(let X=0;X<h;X++){let V=[],nt=(X-1+h)%h,lt=st[Y][nt],ft=st[Y][X];d.copy(lt).sub(H),u.copy(ft).sub(H);let pt=H.angleTo(d),Pt=d.angleTo(u),bt=Math.cos(pt)*f;a==0?J.copy(Z):J.copy(H).setLength(g+bt),B.push(bt);let Rt=[J,lt,ft];for(let _t=0;_t<2;_t++){let $=Rt[_t],vt=Rt[_t+1];tt.subVectors($,H),ct.subVectors(vt,H),K.crossVectors(tt,ct).normalize();for(let Dt=0;Dt<m;Dt++){let jt=[pt,Pt][_t]*Dt/m;d.copy(tt).applyAxisAngle(K,jt).add(H),N[F++].copy(d),_t&&(v(d,H),V.push([Dt==0?$:d.clone(),y.clone()]))}_t&&(v(vt,H),V.push([vt,y.clone()]))}j.push(V)}et.push(j);let L=2*m,W=2;for(let X=0;X<h;X++){let V=L*X,nt=L*((X+1)%h),lt=0,ft=[N[V]];for(let pt=1;pt<m;pt++){let Pt=N[V+pt],bt=N[nt+pt];ft.push(Pt);for(let Rt=1,_t=pt-W+1;Rt<=_t;Rt++)d.lerpVectors(Pt,bt,Rt/(_t+1)),d.sub(H).setLength(B[X]).add(H),ft.push(G[lt++].copy(d));ft.push(bt)}for(let pt=0;pt<m;pt++)ft.push(N[pt+m+V]);ft.push(N[nt+m]);for(let pt=0,Pt=ft.length;pt<Pt;pt++){let bt=ft[pt],Rt=3*pt,_t=2*pt;D[Rt]=bt.x,D[Rt+1]=bt.y,D[Rt+2]=bt.z,v(bt,H),I[Rt]=y.x,I[Rt+1]=y.y,I[Rt+2]=y.z,U[_t]=Math.atan2(bt.z,-bt.x)/2/Math.PI+.5,U[_t+1]=1-(Math.atan2(-bt.y,Math.sqrt(bt.x*bt.x+bt.z*bt.z))/Math.PI+.5)}for(let pt=0,Pt=S.length;pt<Pt;pt++){let bt=3*S[pt],Rt=2*S[pt],_t=c/3*2;s[c]=D[bt],s[c+1]=D[bt+1],s[c+2]=D[bt+2],o[c]=I[bt],o[c+1]=I[bt+1],o[c+2]=I[bt+2],l[_t]=U[Rt],l[_t+1]=U[Rt+1],c+=3}}}let dt=[];for(let Y=0;Y<x.length;Y++)for(let ht=0;ht<h;ht++){let F=x[Y][ht];if(F<w){let B=x[F].findIndex(L=>L%w==Y),j=et[Y][ht],Z=et[F][B];for(let L=0;L<m;L++){let W=j[L],X=Z[m-L],V=j[L+1],nt=Z[m-(L+1)];R(W),R(X),R(V),R(V),R(X),R(nt)}dt.push(j[0][0],Z[m][0],j[m][0],Z[0][0])}}for(;dt.length;){let Y,ht,F,[B,j]=dt.splice(0,2);Y=j;let Z=[B];for(;B!=Y;)Z.push(Y),ht=dt.indexOf(Y),F=ht%2,Y=dt.splice(ht-F,2)[1-F];y.subVectors(Z[0],Z[1]).cross(d.subVectors(Z[0],Z[2])).normalize();let L=y.dot(Z[0])<0;L&&y.negate();for(let W=1;W<=Z.length-2;W++)A(Z[W+ +L]),A(Z[W+1-+L]),A(Z[0])}}(),function(){let h=new C,d=new C,u=new C,p=new C,f=new at,g=new at,m=new at,y=(b,x,w,S)=>{S<0&&b.x===1&&(l[x]=b.x-1),w.x===0&&w.z===0&&(l[x]=S/2/Math.PI+.5)};for(let b=0,x=0;b<c;b+=9,x+=6){h.set(s[b+0],s[b+1],s[b+2]),d.set(s[b+3],s[b+4],s[b+5]),u.set(s[b+6],s[b+7],s[b+8]),f.set(l[x+0],l[x+1]),g.set(l[x+2],l[x+3]),m.set(l[x+4],l[x+5]),p.copy(h).add(d).add(u).divideScalar(3);let w=_(p);y(f,x+0,h,w),y(g,x+2,d,w),y(m,x+4,u,w)}let v=c/3*2;for(let b=0;b<v;b+=6){let x=l[b+0],w=l[b+2],S=l[b+4],T=Math.max(x,w,S),E=Math.min(x,w,S);T>.9&&E<.1&&(x<.2&&(l[b+0]+=1),w<.2&&(l[b+2]+=1),S<.2&&(l[b+4]+=1))}function _(b){return Math.atan2(b.z,-b.x)}}(),this.setAttribute("position",new Ht(new Float32Array(s.subarray(0,c)),3)),this.setAttribute("normal",new Ht(new Float32Array(o.subarray(0,c)),3)),void this.setAttribute("uv",new Ht(new Float32Array(l.subarray(0,c/3*2)),2))}static fromJSON(t){return new q_(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}}}),r4=k(()=>{YF(),rt(),$F=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:a,cornerSides:s}=t.parameters,o=r===0&&a!==0?new DS(.5*e,a,s):new nE(.5*e,r),l=i/e,c=n/e;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...t,type:"DodecahedronGeometry"}})}},DS=class extends q_{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r=1/n,a="DodecahedronGeometry";super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,t,e,i),this.type=a}static fromJSON(t){return new DS(t.radius,t.corner,t.cornerSides)}}});function a4(t,e=new at){let i=t.length();return e.set(-t.y/i,t.x/i)}function f$(t){let e=new at;e.addVectors(t.v0,Lc.subVectors(t.v1,t.v0).multiplyScalar(2/3));let i=new at;return i.addVectors(t.v2,Ug.subVectors(t.v1,t.v2).multiplyScalar(2/3)),new Fa(t.v0,e,i,t.v2)}function Im(t,e,i=Number.EPSILON){return Math.abs(t-e)<i}function m$(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function g$(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function ZF(t,e,i){let n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),a=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2));return Math.acos((r*r+n*n-a*a)/(2*r*n))}function v$(t,e,i){return o4(t,e)&&o4(e,i)&&_A(t.position,e.position,i.position)}function _A(t,e,i){return Lc.copy(e).sub(t).cross(Ug.copy(i).sub(t))===0}function y$(t,e,i,n,r){let a=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),s=(t.y+e.y)/2,o=(t.x+e.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(a/2,2))*(t.y-e.y)/a,c=Math.sqrt(Math.pow(i,2)-Math.pow(a/2,2))*(e.x-t.x)/a;return n.set(o+l,s+c),r.set(o-l,s-c),[n,r]}function _$(t,e,i){return t.distanceTo(i)<e.distanceTo(i)?e:t}function b$(t,e,i,n,r,a){let s,o=e.x-t.x,l=e.y-t.y,c=i.x-t.x,h=i.y-t.y,d=Math.sqrt((o+c)*(o+c)+(l+h)*(l+h));return ZF(e,t,i)>Math.PI&&(d*=-1),s=Im(h,l)?(l+h)*(n/d-.5)*8/3/(o-c):(o+c)*(n/d-.5)*8/3/(h-l),r.set(e.x-s*l,e.y+s*o),a.set(i.x+s*h,i.y-s*c),[r,a]}function s4(t,e){return t.position.equals(t.controls[1].position)&&e.position.equals(e.controls[0].position)}function o4(t,e){return _A(t.position,t.controls[1].position,e.position)&&_A(t.position,e.controls[0].position,e.position)}function l4(t,e=12,i=!1){let n=[];for(let r=0,a=t.length;r<a;r++){let s=t[r],o=0;if(i&&s.roundedCurveCorner!==void 0){let l=.5*Ic(s.roundedCurveCorner,e);r>0&&(n[r-1]+=l),o+=l}s.curveAfter!==void 0&&(o+=Ic(s.curveAfter,e)),n.push(o)}return t.length>0&&i&&t[0].roundedCurveCorner!==void 0&&(n[t.length-1]+=.5*Ic(t[0].roundedCurveCorner,e)),n}function Ic(t,e=12){return t&&t instanceof bm?2*e:t&&(t instanceof ma||t instanceof rE)?1:t&&t instanceof $y?e*t.points.length:e}var Au,yv,_v,Vc,o1,Lc,Ug,KF,QF,JF,tk,bA,xA,bv,h4,c4,d4,u4,p4,ki,ek=k(()=>{rt(),Au=1e-12,yv=class{constructor(t){this.position=new at,this.startPosition=new at,this.uuid=It.generateUUID(),this.position=t.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(t){this.position.copy(this.startPosition).add(t)}copy(t){return this.position.copy(t.position),this.startPosition.copy(t.startPosition),this}clone(){return new yv(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},_v=class extends yv{constructor(t){super(t.position),this.parent=t}copy(t){return super.copy(t),this}clone(){return new _v(this.parent).copy(this)}},Vc=class extends yv{constructor(t,e){super(e),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=t,this.controls.push(new _v(this),new _v(this))}static create(t,e){let i=new Vc(t,new at(...e.position));return i.controls[0].position.set(...e.controlPrevious.position),i.controls[1].position.set(...e.controlNext.position),i.roundness=e.roundness,i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored,i}getOppositeControl(t){let e=this.controls.indexOf(t);return e===0?this.controls[1]:e===1?this.controls[0]:null}applyOffsetToControls(t,e=1){for(let i=0,n=this.controls.length;i<n;i++){let r=this.controls[i];this.position.distanceTo(r.position)<=e?r.position.copy(this.position):r.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new Vc(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let t=this.curveBefore?.getTangentAt(1),e=this.curveAfter?.getTangentAt(0);return[t,e]}computeNormals(t=new at,e=new at){let[i,n]=this.computeTangents();return i&&n&&(a4(i,t),a4(n,e)),[t,e]}computeTangent(t=new at){let[e,i]=this.computeTangents();return e&&i&&t.copy(e).add(i).normalize(),t}computeNormal(t=new at){let[e,i]=this.computeNormals();return t.copy(e).add(i).normalize(),t}},o1=t=>t,Lc=new at,Ug=new at,KF=new at,QF=new at,JF=new at,tk=new at,bA=new C,xA=new C}),Sh=k(()=>{rt(),ek(),bv=new at,h4=new at,c4=new at,d4=new at,u4=new at,p4=new at,ki=class extends wg{constructor(t=100,e=100){super(),this.points=[],this.shapeHoles=[],this.plane=new kr(new C(0,0,-1)),this.subdivision=0,this.controlSnapDistance=4,this.pointIDs=0,this.isMesh2D=!1,this.isText=!1,this._roundness=0,this.isClosed=!1,this.useCubicForRoundedCorners=!0,this.uuid=It.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=t,this._height=e}static createFromState(t,e,i){let n=new ki;return n.isClosed=t.isClosed,n.points=t.points.map(r=>Vc.create(r.id,r.data)),typeof t.roundness=="number"&&(n.roundness=t.roundness),n.shapeHoles=t.shapeHoles.map(r=>ki.createFromState(r)),e!==void 0&&i!==void 0&&n.applySize(e,i),n.update(),n}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let e=0,i=this.points.length;e<i;e++)this.points[e].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(e=>this.getPointIndexById(e)).filter(e=>e>=0)}getPointIndexById(t){let e=this.points.length,i=this.points.findIndex(n=>n.uuid===t);if(i<0){let n=e;for(let r=0,a=this.shapeHoles.length;r<a;r++){let s=this.shapeHoles[r],o=s.points.length,l=s.getPointIndexById(t);if(!(l<0))return l+n;n+=o}}return i}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0){let e=this.points.length;for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],a=t-e;if(a<=r.points.length-1)return r.points[a];e+=r.points.length}}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let e=this.points.indexOf(t);if(e>=0)return e;if(e=this.points.length,this.shapeHoles.length>0)for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],a=r.points.indexOf(t);if(a>=0)return e+a;e+=r.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(e=>e.points));return[...this.points,...t]}applySize(t,e){t===0&&(t=.001),e===0&&(e=.001),this._width=t,this._height=e}applyScale(t,e){let i=bv.set(t,e);for(let n=0,r=this.points.length;n<r;n++){let a=this.points[n];a.position.multiply(i),a.controls[0].position.multiply(i),a.controls[1].position.multiply(i)}for(let n=0,r=this.shapeHoles.length;n<r;n++)this.shapeHoles[n].applyScale(t,e);this._update()}createPoint(t,e=0,i=It.generateUUID()){let n;n=t instanceof at?t:new at(t,e);let r=new Vc(i,n);return r.roundness=this.roundness,r}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,e){this.points.splice(e,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];if(n.uuid===t)return n}for(let e=0,i=this.shapeHoles.length;e<i;e++){let n=this.shapeHoles[e].getPointByUuid(t);if(n)return n}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let e=this.points.indexOf(t);e>=0&&this.points.splice(e,1),this.needsUpdate=!0}removePointById(t){let e=this.points.find(i=>i.uuid===t);e&&this.removePoint(e)}update(){for(let t=0,e=this.shapeHoles.length;t<e;t++)this.shapeHoles[t].update();this._update()}extractShapePointsToBuffer(t,e=12,i=!1){this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e);let n=i?this.roundedCurveDivisions:this.curveDivisions;return function(r,a,s=12,o=!0){let l,c=xA.set(0,0,0),h=0,d=[];for(let u=0;u<a.length;u++){let p=o1(a[u]),f=Lc,g=Ic(p,s);d.push(g);for(let m=0;m<=g;m++)if(p instanceof Fa||p instanceof Ho||p instanceof ma){if(p.getPoint(m/g,f),c.set(f.x,f.y,0),l!==void 0&&g$(l,c))continue;l===void 0&&(l=bA),l.copy(c),r.setXYZ(h,c.x,c.y,c.z),h++}}o&&h>1&&(r.getX(h-1)!==r.getX(0)||r.getY(h-1)!==r.getY(0)||r.getZ(h-1)!==r.getZ(0))&&(r.setXYZ(h,r.getX(0),r.getY(0),r.getZ(0)),h++)}(t,i?this.roundedCurves:this.curves,e,this.autoClose),n.reduce((r,a)=>r+a,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=l4(this.points,t,!1),this.roundedCurveDivisions=l4(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,e,i=12){return 2*function(n,r,a,s=12,o=!0){let l=xA.set(0,0,0),c=0,h=[];for(let d=0;d<r.length;d++){if(a[d]===!1)continue;let u,p=o1(r[d]),f=Lc,g=Ic(p,s);h.push(g);for(let m=0;m<=g;m++)if(p instanceof Fa||p instanceof Ho||p instanceof ma){if(p.getPoint(m/g,f),l.set(f.x,f.y,0),u?.equals(l))continue;u===void 0?u=bA:(n.setXYZ(c,u.x,u.y,u.z),c++,n.setXYZ(c,l.x,l.y,l.z),c++),u.copy(l)}}return o&&c>1&&!(n.getX(c-1)===n.getX(0)&&n.getY(c-1)===n.getY(0)&&n.getZ(c-1)===n.getZ(0))&&(n.setXYZ(c,n.getX(0),n.getY(0),n.getZ(0)),c++),h}(t,this.curves,e,i,this.autoClose).reduce((n,r)=>n+r,0)}extractShapePointsToFlatArray(t,e=12){return this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e),function(i,n,r=12,a=!0){let s,o=0;for(let l=0;l<n.length;l++){let c=o1(n[l]),h=Ic(c,r),d=Lc;for(let u=0;u<=h;u++)if(c instanceof Fa||c instanceof Ho||c instanceof ma){if(c.getPoint(u/h,d),s!==void 0&&m$(s,d,Au))continue;s===void 0&&(s=Ug),s.copy(d),i.push(d.x,d.y),o++}}return Im(i[0],i[i.length-2],Au)&&Im(i[1],i[i.length-1],Au)&&(i.pop(),i.pop()),a&&o>1&&!(Im(i[o-1],i[1],Au)&&Im(i[o-2],i[0],Au))&&(i.push(i[0],i[1]),o++),i}(t,this.roundedCurves,e,this.autoClose)}getCurveIndexFromVertexId(t,e=!1){let i=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let n=e?this.roundedCurveDivisions:this.curveDivisions,r=0;e&&this.points[0].roundedCurveCorner!==void 0&&(r=.5*Ic(this.points[0].roundedCurveCorner,this.subdivision));let a=t-r;a<0&&(a+=n.reduce((s,o)=>s+o,0));for(let s=0,o=n.length;s<o;s++){let l=n[s];if(a<i+l)return[s,(a-i+1)/l];i+=l}return[0,1]}getCurveT(t,e,i){let n=this.points[t],r=this.points[t>=this.points.length-1?0:t+1],a=this.curveDivisions,s=a[t];if(s4(n,r)){let l=n.position.distanceTo(r.position);return n.position.distanceTo(bv.set(i.x,i.y))/l}let o=0;for(let l=0;l<t;l++)o+=a[l];return(e-o)/s}dispose(){}_applyCurveForPoint(t,e){s4(e,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(e.controls[1].position.x,e.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let i=this.curves[this.curves.length-1];t.curveBefore=i,e.curveAfter=i;let n=i.clone();t.roundedCurveBefore=n,e.roundedCurveAfter=n,t.roundedCurveCorner=void 0,this.roundedCurves.push(n)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];if(e===0)this.moveTo(n.position.x,n.position.y);else{let r=this.points[e-1];this._applyCurveForPoint(n,r)}}let t=this.getLastPoint();if(t?.curveAfter&&(t.curveAfter=void 0),this.isClosed){let e=this.points[0],i=this.points[this.points.length-1];this._applyCurveForPoint(e,i)}if(this.points.length>2){let e=0;for(let i=0,n=this.points.length;i<n;i++){let r=this.points[i],a=this.points[i-1]??this.points[this.points.length-1],s=this.points[i+1]??this.points[0],o=r.roundness,l=a&&s&&v$(a,r,s);if(!r.controlsMoved()&&o>0&&!l){let c=r.curveBefore,h=r.curveAfter;if(c===void 0||h===void 0)continue;let d,u=r.roundedCurveBefore,p=r.roundedCurveAfter,f=c instanceof ma?c.v1.distanceTo(c.v2):c.getLength(),g=h instanceof ma?h.v1.distanceTo(h.v2):h.getLength(),m=Math.min(o,.499*f),y=Math.min(o,.499*g),v=Math.min(m,y),_=1-v/f,b=v/g,x=c.getPointAt(_,bv),w=h.getPointAt(b,h4);if(this._subSplitCurve(c,u,_,x,void 0),this._subSplitCurve(h,p,b,void 0,w),this.useCubicForRoundedCorners){let S=ZF(x,r.position,w)/2,T=Math.tan(S)*x.distanceTo(r.position),[E,P]=y$(x,w,T,c4,d4),A=_$(E,P,r.position),[R,O]=b$(A,x,w,T,u4,p4);d=new Fa(x.clone(),R.clone(),O.clone(),w.clone())}else d=new Ho(x.clone(),r.position.clone(),w.clone());r.roundedCurveCorner=d,this.roundedCurves.splice(i+e,0,d),e++}}}}_subSplitCurve(t,e,i,n,r){if(!(t instanceof ma)){let a=t,s=e,o=a.getUtoTmapping(i,0),l=function(c,h,d,u,p=.5){let f=Lc.subVectors(h,c).multiplyScalar(p).add(c),g=Ug.subVectors(d,h).multiplyScalar(p).add(h),m=KF.subVectors(u,d).multiplyScalar(p).add(d),y=f,v=QF.subVectors(g,f).multiplyScalar(p).add(f),_=JF.subVectors(m,g).multiplyScalar(p).add(g),b=m,x=tk.subVectors(_,v).multiplyScalar(p).add(v);return[c.x,c.y,y.x,y.y,v.x,v.y,x.x,x.y,_.x,_.y,b.x,b.y,u.x,u.y]}(a.v0,a.v1,a.v2,a.v3,o);return n!==void 0&&(s.v0.set(l[0],l[1]),s.v1.set(l[2],l[3]),s.v2.set(l[4],l[5]),s.v3.set(l[6],l[7])),r!==void 0&&(s.v0.set(l[6],l[7]),s.v1.set(l[8],l[9]),s.v2.set(l[10],l[11]),s.v3.set(l[12],l[13])),s}return n!==void 0&&e.v2.copy(n),r!==void 0&&e.v1.copy(r),e}clone(){let t=new ki(this._width,this._height);return t.points=this.points.map(e=>e.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(e=>e.clone()),t}toJSON(){return{points:this.points.reduce((t,e)=>t.concat(e.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){this.points=[],this.pointIDs=0;let e=t.points.length/7;for(let i=0;i<e;i++){let n=7*i,r=t.points[n+0],a=t.points[n+1],s=t.points[n+2],o=t.points[n+3],l=t.points[n+4],c=t.points[n+5],h=t.points[n+6],d=new Vc(It.generateUUID(),new at(r,a));d.controls[0].position.set(s,o),d.controls[1].position.set(l,c),d.roundness=h,this.points.push(d)}return this.shapeHoles=t.shapeHoles?.length?t.shapeHoles.map(i=>{let n=new ki;return n.fromJSON(i),n}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t,e=!1){this.isText=e;let i=(n,r)=>{r instanceof Fa&&r.v3.equals(n.position)&&n.controls[0].position.copy(r.v2)};return this.points=(n=>{let r,a,s=[];for(r=0,a=n.length;r<a;r++)n[r]instanceof Ho&&(n[r]=f$(n[r]));for(r=0,a=n.length;r<a;r++){let c,h=n[r],d=r>0?n[r-1]:null;h instanceof Fa?(c=this.createPoint(h.v0),c.controls[1].position.copy(h.v1)):h instanceof ma&&(c=this.createPoint(h.v1)),c!==void 0&&(d!==null&&i(c,d),s.push(c))}let o=n[n.length-1],l=!1;return o instanceof Fa?o.v3.equals(s[0].position)&&(s[0].controls[0].position.copy(o.v2),l=!0):o instanceof ma&&o.v2.equals(s[0].position)&&(l=!0),this.isClosed=l,s})(t.curves),t instanceof wg&&(this.shapeHoles=t.holes.map(n=>{let r=new ki;return r.fromShape(n),r})),this.update(),this}updatePoint(t,e){let i=this.getPointByUuid(t);i&&(e.position!==void 0&&i.position.fromArray(e.position),e.roundness!==void 0&&(i.roundness=e.roundness),e.areControlsDirectionsMirrored!==void 0&&(i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(t,e){let i=this.getPointByUuid(t)?.controls[0];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}updateNextControl(t,e){let i=this.getPointByUuid(t)?.controls[1];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}}});function RS({x:t,y:e},i,n,r,a){return{x:t*i+r,y:e*n+a}}function x$(t,e){let i=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),n=Math.cos(t),r=Math.sin(t),a=Math.cos(t+e),s=Math.sin(t+e);return[{x:n-r*i,y:r+n*i},{x:a+s*i,y:s-a*i},{x:a,y:s}]}function f4(t,e,i,n){let r=t*n-e*i<0?-1:1,a=Math.min(1,Math.max(-1,t*i+e*n));return r*Math.acos(a)}var l1,w$=k(()=>{l1=2*Math.PI});function he(t,e){if(!t)throw e||"Assertion Failed!"}function eh(t){var e=t.windingRule,i=e===void 0?fi.ODD:e,n=t.elementType,r=n===void 0?Tn.POLYGONS:n,a=t.polySize,s=a===void 0?3:a,o=t.vertexSize,l=o===void 0?2:o,c=t.normal,h=c===void 0?[0,0,1]:c,d=t.contours,u=d===void 0?[]:d,p=t.strict,f=p===void 0||p,g=t.debug,m=g!==void 0&&g;if(!u&&f)throw new Error("Contours can't be empty");if(u){var y=new ik;t.edgeCreateCallback&&(y.edgeCreateCallback=t.edgeCreateCallback),t.vertexIdCallback&&(y.vertexIdCallback=t.vertexIdCallback);for(var v=0;v<u.length;v++)y.addContour(l||2,u[v]);return y.tesselate(i,r,s,l,h,f),{vertices:y.vertices,vertexIndices:y.vertexIndices,vertexCount:y.vertexCount,elements:y.elements,elementCount:y.elementCount,mesh:m?y.mesh:void 0}}}var fi,Tn,re,Nd,Of,ec,OS,IS,LS,m4,xv,BS,g4,v4,ik,US,nk,rk,Mp=k(()=>{var t;(t=fi||(fi={}))[t.ODD=0]="ODD",t[t.NONZERO=1]="NONZERO",t[t.POSITIVE=2]="POSITIVE",t[t.NEGATIVE=3]="NEGATIVE",t[t.ABS_GEQ_TWO=4]="ABS_GEQ_TWO",function(e){e[e.POLYGONS=0]="POLYGONS",e[e.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",e[e.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(Tn||(Tn={})),re=function(){function e(){}return e.vertEq=function(i,n){return i.s===n.s&&i.t===n.t},e.vertLeq=function(i,n){return i.s<n.s||i.s===n.s&&i.t<=n.t},e.transLeq=function(i,n){return i.t<n.t||i.t===n.t&&i.s<=n.s},e.edgeGoesLeft=function(i){return e.vertLeq(i.Dst,i.Org)},e.edgeGoesRight=function(i){return e.vertLeq(i.Org,i.Dst)},e.vertL1dist=function(i,n){return Math.abs(i.s-n.s)+Math.abs(i.t-n.t)},e.edgeEval=function(i,n,r){he(e.vertLeq(i,n)&&e.vertLeq(n,r));var a=n.s-i.s,s=r.s-n.s;return a+s>0?a<s?n.t-i.t+(i.t-r.t)*(a/(a+s)):n.t-r.t+(r.t-i.t)*(s/(a+s)):0},e.edgeSign=function(i,n,r){he(e.vertLeq(i,n)&&e.vertLeq(n,r));var a=n.s-i.s,s=r.s-n.s;return a+s>0?(n.t-r.t)*a+(n.t-i.t)*s:0},e.transEval=function(i,n,r){he(e.transLeq(i,n)&&e.transLeq(n,r));var a=n.t-i.t,s=r.t-n.t;return a+s>0?a<s?n.s-i.s+(i.s-r.s)*(a/(a+s)):n.s-r.s+(r.s-i.s)*(s/(a+s)):0},e.transSign=function(i,n,r){he(e.transLeq(i,n)&&e.transLeq(n,r));var a=n.t-i.t,s=r.t-n.t;return a+s>0?(n.s-r.s)*a+(n.s-i.s)*s:0},e.vertCCW=function(i,n,r){return i.s*(n.t-r.t)+n.s*(r.t-i.t)+r.s*(i.t-n.t)>=0},e.interpolate=function(i,n,r,a){return(i=i<0?0:i)<=(r=r<0?0:r)?r===0?(n+a)/2:n+i/(i+r)*(a-n):a+r/(i+r)*(n-a)},e.intersect=function(i,n,r,a,s){var o,l,c;e.vertLeq(i,n)||(c=i,i=n,n=c),e.vertLeq(r,a)||(c=r,r=a,a=c),e.vertLeq(i,r)||(c=i,i=r,r=c,c=n,n=a,a=c),e.vertLeq(r,n)?e.vertLeq(n,a)?((o=e.edgeEval(i,r,n))+(l=e.edgeEval(r,n,a))<0&&(o=-o,l=-l),s.s=e.interpolate(o,r.s,l,n.s)):((o=e.edgeSign(i,r,n))+(l=-e.edgeSign(i,a,n))<0&&(o=-o,l=-l),s.s=e.interpolate(o,r.s,l,a.s)):s.s=(r.s+n.s)/2,e.transLeq(i,n)||(c=i,i=n,n=c),e.transLeq(r,a)||(c=r,r=a,a=c),e.transLeq(i,r)||(c=i,i=r,r=c,c=n,n=a,a=c),e.transLeq(r,n)?e.transLeq(n,a)?((o=e.transEval(i,r,n))+(l=e.transEval(r,n,a))<0&&(o=-o,l=-l),s.t=e.interpolate(o,r.t,l,n.t)):((o=e.transSign(i,r,n))+(l=-e.transSign(i,a,n))<0&&(o=-o,l=-l),s.t=e.interpolate(o,r.t,l,a.t)):s.t=(r.t+n.t)/2},e}(),Nd=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},Of=function(){function e(i){this.side=i,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(i){this.Sym.Lface=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(i){this.Sym.Org=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(i){this.Sym.Lnext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(i){this.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(i){this.Lnext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(i){this.Sym.Onext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(i){this.Sym.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(i){this.Sym.Lnext.Sym=i},enumerable:!0,configurable:!0}),e}(),ec=function(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0},OS=function(){function e(){var i=new ec,n=new Nd,r=new Of(0),a=new Of(1);i.next=i.prev=i,i.anEdge=null,n.next=n.prev=n,r.next=r,r.Sym=a,a.next=a,a.Sym=r,this.vHead=i,this.fHead=n,this.eHead=r,this.eHeadSym=a}return e.prototype.makeEdge_=function(i){var n=new Of(0),r=new Of(1);i.Sym.side<i.side&&(i=i.Sym);var a=i.Sym.next;return r.next=a,a.Sym.next=n,n.next=i,i.Sym.next=r,n.Sym=r,n.Onext=n,n.Lnext=r,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,r.Sym=n,r.Onext=r,r.Lnext=n,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,n},e.prototype.splice_=function(i,n){var r=i.Onext,a=n.Onext;r.Sym.Lnext=n,a.Sym.Lnext=i,i.Onext=a,n.Onext=r},e.prototype.makeVertex_=function(i,n,r){var a=i;he(a,"Vertex can't be null!");var s=r.prev;a.prev=s,s.next=a,a.next=r,r.prev=a,a.anEdge=n;var o=n;do o.Org=a,o=o.Onext;while(o!==n)},e.prototype.makeFace_=function(i,n,r){var a=i;he(a,"Face can't be null");var s=r.prev;a.prev=s,s.next=a,a.next=r,r.prev=a,a.anEdge=n,a.trail=null,a.marked=!1,a.inside=r.inside;var o=n;do o.Lface=a,o=o.Lnext;while(o!==n)},e.prototype.killEdge_=function(i){i.Sym.side<i.side&&(i=i.Sym);var n=i.next,r=i.Sym.next;n.Sym.next=r,r.Sym.next=n},e.prototype.killVertex_=function(i,n){var r=i.anEdge,a=r;do a.Org=n,a=a.Onext;while(a!==r);var s=i.prev,o=i.next;o.prev=s,s.next=o},e.prototype.killFace_=function(i,n){var r=i.anEdge,a=r;do a.Lface=n,a=a.Lnext;while(a!==r);var s=i.prev,o=i.next;o.prev=s,s.next=o},e.prototype.makeEdge=function(){var i=new ec,n=new ec,r=new Nd,a=this.makeEdge_(this.eHead);return this.makeVertex_(i,a,this.vHead),this.makeVertex_(n,a.Sym,this.vHead),this.makeFace_(r,a,this.fHead),a},e.prototype.splice=function(i,n){var r=!1,a=!1;if(i!==n){if(n.Org!==i.Org&&(a=!0,this.killVertex_(n.Org,i.Org)),n.Lface!==i.Lface&&(r=!0,this.killFace_(n.Lface,i.Lface)),this.splice_(n,i),!a){var s=new ec;this.makeVertex_(s,n,i.Org),i.Org.anEdge=i}if(!r){var o=new Nd;this.makeFace_(o,n,i.Lface),i.Lface.anEdge=i}}},e.prototype.delete=function(i){var n=i.Sym,r=!1;if(i.Lface!==i.Rface&&(r=!0,this.killFace_(i.Lface,i.Rface)),i.Onext===i)this.killVertex_(i.Org,null);else if(i.Rface.anEdge=i.Oprev,i.Org.anEdge=i.Onext,this.splice_(i,i.Oprev),!r){var a=new Nd;this.makeFace_(a,i,i.Lface)}n.Onext===n?(this.killVertex_(n.Org,null),this.killFace_(n.Lface,null)):(i.Lface.anEdge=n.Oprev,n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),this.killEdge_(i)},e.prototype.addEdgeVertex=function(i){var n=this.makeEdge_(i),r=n.Sym;this.splice_(n,i.Lnext),n.Org=i.Dst;var a=new ec;return this.makeVertex_(a,r,n.Org),n.Lface=r.Lface=i.Lface,n},e.prototype.splitEdge=function(i){var n=this.addEdgeVertex(i).Sym;return this.splice_(i.Sym,i.Sym.Oprev),this.splice_(i.Sym,n),i.Dst=n.Org,n.Dst.anEdge=n.Sym,n.Rface=i.Rface,n.winding=i.winding,n.Sym.winding=i.Sym.winding,n.idx=i.idx,n.Sym.idx=i.Sym.idx,n},e.prototype.connect=function(i,n){var r=!1,a=this.makeEdge_(i),s=a.Sym;if(n.Lface!==i.Lface&&(r=!0,this.killFace_(n.Lface,i.Lface)),this.splice_(a,i.Lnext),this.splice_(s,n),a.Org=i.Dst,s.Org=n.Org,a.Lface=s.Lface=i.Lface,i.Lface.anEdge=s,!r){var o=new Nd;this.makeFace_(o,a,i.Lface)}return a},e.prototype.zapFace=function(i){var n,r,a,s,o,l=i.anEdge;r=l.Lnext;do r=(n=r).Lnext,n.Lface=null,n.Rface===null&&(n.Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),(a=n.Sym).Onext===a?this.killVertex_(a.Org,null):(a.Org.anEdge=a.Onext,this.splice_(a,a.Oprev)),this.killEdge_(n));while(n!=l);s=i.prev,(o=i.next).prev=s,s.next=o},e.prototype.countFaceVerts_=function(i){var n=i.anEdge,r=0;do r++,n=n.Lnext;while(n!==i.anEdge);return r},e.prototype.mergeConvexFaces=function(i){var n,r,a,s,o;for(n=this.fHead.next;n!==this.fHead;n=n.next)if(n.inside)for(o=(r=n.anEdge).Org;a=r.Lnext,(s=r.Sym)&&s.Lface&&s.Lface.inside&&this.countFaceVerts_(n)+this.countFaceVerts_(s.Lface)-2<=i&&re.vertCCW(r.Lprev.Org,r.Org,s.Lnext.Lnext.Org)&&re.vertCCW(s.Lprev.Org,s.Org,r.Lnext.Lnext.Org)&&(a=s.Lnext,this.delete(s),r=null,s=null),!r||r.Lnext.Org!==o;)r=a;return!0},e.prototype.check=function(){var i,n,r,a,s,o,l=this.fHead,c=this.vHead,h=this.eHead;for(n=l,n=l;(i=n.next)!==l;n=i){he(i.prev===n),s=i.anEdge;do he(s.Sym!==s),he(s.Sym.Sym===s),he(s.Lnext.Onext.Sym===s),he(s.Onext.Sym.Lnext===s),he(s.Lface===i),s=s.Lnext;while(s!==i.anEdge)}for(he(i.prev===n&&i.anEdge===null),a=c,a=c;(r=a.next)!==c;a=r){he(r.prev===a),s=r.anEdge;do he(s.Sym!==s),he(s.Sym.Sym===s),he(s.Lnext.Onext.Sym===s),he(s.Onext.Sym.Lnext===s),he(s.Org===r),s=s.Onext;while(s!==r.anEdge)}for(he(r.prev===a&&r.anEdge===null),o=h,o=h;(s=o.next)!==h;o=s)he(s.Sym.next===o.Sym),he(s.Sym!==s),he(s.Sym.Sym===s),he(s.Org!==null),he(s.Dst!==null),he(s.Lnext.Onext.Sym===s),he(s.Onext.Sym.Lnext===s);he(s.Sym.next===o.Sym&&s.Sym===this.eHeadSym&&s.Sym.Sym===s&&s.Org===null&&s.Dst===null&&s.Lface===null&&s.Rface===null)},e}(),IS=function(){this.handle=null},LS=function(){this.key=null,this.node=0},m4=function(){function e(i,n){this.leq=n,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=i,this.nodes=[],this.handles=[];for(var r=0;r<i+1;r++)this.nodes[r]=new IS,this.handles[r]=new LS;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return e.prototype.floatDown_=function(i){var n,r,a,s=this.nodes,o=this.handles;for(n=s[i].handle;;){if((a=i<<1)<this.size&&this.leq(o[s[a+1].handle].key,o[s[a].handle].key)&&++a,he(a<=this.max),r=s[a].handle,a>this.size||this.leq(o[n].key,o[r].key)){s[i].handle=n,o[n].node=i;break}s[i].handle=r,o[r].node=i,i=a}},e.prototype.floatUp_=function(i){var n,r,a,s=this.nodes,o=this.handles;for(n=s[i].handle;;){if(r=s[a=i>>1].handle,a===0||this.leq(o[r].key,o[n].key)){s[i].handle=n,o[n].node=i;break}s[i].handle=r,o[r].node=i,i=a}},e.prototype.init=function(){for(var i=this.size;i>=1;--i)this.floatDown_(i);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(i){var n,r;if(2*(n=++this.size)>this.max){var a,s;for(this.max*=2,s=this.nodes.length,this.nodes.length=this.max+1,a=s;a<this.nodes.length;a++)this.nodes[a]=new IS;for(s=this.handles.length,this.handles.length=this.max+1,a=s;a<this.handles.length;a++)this.handles[a]=new LS}return this.freeList===0?r=n:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[n].handle=r,this.handles[r].node=n,this.handles[r].key=i,this.initialized&&this.floatUp_(n),r},e.prototype.extractMin=function(){var i=this.nodes,n=this.handles,r=i[1].handle,a=n[r].key;return this.size>0&&(i[1].handle=i[this.size].handle,n[i[1].handle].node=1,n[r].key=null,n[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),a},e.prototype.delete=function(i){var n,r=this.nodes,a=this.handles;he(i>=1&&i<=this.max&&a[i].key!==null),r[n=a[i].node].handle=r[this.size].handle,a[r[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(a[r[n>>1].handle].key,a[r[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),a[i].key=null,a[i].node=this.freeList,this.freeList=i},e}(),xv=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},BS=function(){this.key=null,this.next=null,this.prev=null},g4=function(){function e(i,n){this.frame=i,this.leq=n,this.head=new BS,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(i){return this.insertBefore(this.head,i)},e.prototype.search=function(i){var n=this.head;do n=n.next;while(n.key!==null&&!this.leq(this.frame,i,n.key));return n},e.prototype.insertBefore=function(i,n){do i=i.prev;while(i.key!==null&&!this.leq(this.frame,i.key,n));var r=new BS;return r.key=n,r.next=i.next,i.next.prev=r,r.prev=i,i.next=r,r},e.prototype.delete=function(i){i.next.prev=i.prev,i.prev.next=i.next},e}(),v4=function(){function e(){}return e.regionBelow=function(i){return i.nodeUp.prev.key},e.regionAbove=function(i){return i.nodeUp.next.key},e.debugEvent=function(i){},e.addWinding=function(i,n){i.winding+=n.winding,i.Sym.winding+=n.Sym.winding},e.edgeLeq=function(i,n,r){var a=i.event,s=n.eUp,o=r.eUp;return s.Dst===a?o.Dst===a?re.vertLeq(s.Org,o.Org)?re.edgeSign(o.Dst,s.Org,o.Org)<=0:re.edgeSign(s.Dst,o.Org,s.Org)>=0:re.edgeSign(o.Dst,a,o.Org)<=0:o.Dst===a?re.edgeSign(s.Dst,a,s.Org)>=0:re.edgeEval(s.Dst,a,s.Org)>=re.edgeEval(o.Dst,a,o.Org)},e.deleteRegion=function(i,n){n.fixUpperEdge&&he(n.eUp.winding===0),n.eUp.activeRegion=null,i.dict.delete(n.nodeUp)},e.fixUpperEdge=function(i,n,r){he(n.fixUpperEdge),i.mesh.delete(n.eUp),n.fixUpperEdge=!1,n.eUp=r,r.activeRegion=n},e.topLeftRegion=function(i,n){var r,a=n.eUp.Org;do n=e.regionAbove(n);while(n.eUp.Org===a);if(n.fixUpperEdge){if((r=i.mesh.connect(e.regionBelow(n).eUp.Sym,n.eUp.Lnext))===null)return null;e.fixUpperEdge(i,n,r),n=e.regionAbove(n)}return n},e.topRightRegion=function(i){var n=i.eUp.Dst;do i=e.regionAbove(i);while(i.eUp.Dst===n);return i},e.addRegionBelow=function(i,n,r){var a=new xv;return a.eUp=r,a.nodeUp=i.dict.insertBefore(n.nodeUp,a),a.fixUpperEdge=!1,a.sentinel=!1,a.dirty=!1,r.activeRegion=a,a},e.isWindingInside=function(i,n){switch(i.windingRule){case fi.ODD:return!!(1&n);case fi.NONZERO:return n!==0;case fi.POSITIVE:return n>0;case fi.NEGATIVE:return n<0;case fi.ABS_GEQ_TWO:return n>=2||n<=-2}throw new Error("Invalid winding rulle")},e.computeWinding=function(i,n){n.windingNumber=e.regionAbove(n).windingNumber+n.eUp.winding,n.inside=e.isWindingInside(i,n.windingNumber)},e.finishRegion=function(i,n){var r=n.eUp,a=r.Lface;a.inside=n.inside,a.anEdge=r,e.deleteRegion(i,n)},e.finishLeftRegions=function(i,n,r){for(var a,s=null,o=n,l=n.eUp;o!==r;){if(o.fixUpperEdge=!1,(a=(s=e.regionBelow(o)).eUp).Org!=l.Org){if(!s.fixUpperEdge){e.finishRegion(i,o);break}a=i.mesh.connect(l.Lprev,a.Sym),e.fixUpperEdge(i,s,a)}l.Onext!==a&&(i.mesh.splice(a.Oprev,a),i.mesh.splice(l,a)),e.finishRegion(i,o),l=s.eUp,o=s}return l},e.addRightEdges=function(i,n,r,a,s,o){var l,c,h,d,u=!0;h=r;do he(re.vertLeq(h.Org,h.Dst)),e.addRegionBelow(i,n,h.Sym),h=h.Onext;while(h!==a);for(s===null&&(s=e.regionBelow(n).eUp.Rprev),c=n,d=s;(h=(l=e.regionBelow(c)).eUp.Sym).Org===d.Org;)h.Onext!==d&&(i.mesh.splice(h.Oprev,h),i.mesh.splice(d.Oprev,h)),l.windingNumber=c.windingNumber-h.winding,l.inside=e.isWindingInside(i,l.windingNumber),c.dirty=!0,!u&&e.checkForRightSplice(i,c)&&(e.addWinding(h,d),e.deleteRegion(i,c),i.mesh.delete(d)),u=!1,c=l,d=h;c.dirty=!0,he(c.windingNumber-h.winding===l.windingNumber),o&&e.walkDirtyRegions(i,c)},e.spliceMergeVertices=function(i,n,r){i.mesh.splice(n,r)},e.vertexWeights=function(i,n,r){var a=re.vertL1dist(n,i),s=re.vertL1dist(r,i),o=.5*s/(a+s),l=.5*a/(a+s);i.coords[0]+=o*n.coords[0]+l*r.coords[0],i.coords[1]+=o*n.coords[1]+l*r.coords[1],i.coords[2]+=o*n.coords[2]+l*r.coords[2]},e.getIntersectData=function(i,n,r,a,s,o){n.coords[0]=n.coords[1]=n.coords[2]=0,n.idx=-1,e.vertexWeights(n,r,a),e.vertexWeights(n,s,o)},e.checkForRightSplice=function(i,n){var r=e.regionBelow(n),a=n.eUp,s=r.eUp;if(re.vertLeq(a.Org,s.Org)){if(re.edgeSign(s.Dst,a.Org,s.Org)>0)return!1;re.vertEq(a.Org,s.Org)?a.Org!==s.Org&&(i.pq.delete(a.Org.pqHandle),e.spliceMergeVertices(i,s.Oprev,a)):(i.mesh.splitEdge(s.Sym),i.mesh.splice(a,s.Oprev),n.dirty=r.dirty=!0)}else{if(re.edgeSign(a.Dst,s.Org,a.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,i.mesh.splitEdge(a.Sym),i.mesh.splice(s.Oprev,a)}return!0},e.checkForLeftSplice=function(i,n){var r,a=e.regionBelow(n),s=n.eUp,o=a.eUp;if(he(!re.vertEq(s.Dst,o.Dst)),re.vertLeq(s.Dst,o.Dst)){if(re.edgeSign(s.Dst,o.Dst,s.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,r=i.mesh.splitEdge(s),i.mesh.splice(o.Sym,r),r.Lface.inside=n.inside}else{if(re.edgeSign(o.Dst,s.Dst,o.Org)>0)return!1;n.dirty=a.dirty=!0,r=i.mesh.splitEdge(o),i.mesh.splice(s.Lnext,o.Sym),r.Rface.inside=n.inside}return!0},e.checkForIntersect=function(i,n){var r,a,s=e.regionBelow(n),o=n.eUp,l=s.eUp,c=o.Org,h=l.Org,d=o.Dst,u=l.Dst,p=new ec;if(he(!re.vertEq(u,d)),he(re.edgeSign(d,i.event,c)<=0),he(re.edgeSign(u,i.event,h)>=0),he(c!==i.event&&h!==i.event),he(!n.fixUpperEdge&&!s.fixUpperEdge),c===h||Math.min(c.t,d.t)>Math.max(h.t,u.t))return!1;if(re.vertLeq(c,h)){if(re.edgeSign(u,c,h)>0)return!1}else if(re.edgeSign(d,h,c)<0)return!1;return e.debugEvent(i),re.intersect(d,c,u,h,p),he(Math.min(c.t,d.t)<=p.t),he(p.t<=Math.max(h.t,u.t)),he(Math.min(u.s,d.s)<=p.s),he(p.s<=Math.max(h.s,c.s)),re.vertLeq(p,i.event)&&(p.s=i.event.s,p.t=i.event.t),r=re.vertLeq(c,h)?c:h,re.vertLeq(r,p)&&(p.s=r.s,p.t=r.t),re.vertEq(p,c)||re.vertEq(p,h)?(e.checkForRightSplice(i,n),!1):!re.vertEq(d,i.event)&&re.edgeSign(d,i.event,p)>=0||!re.vertEq(u,i.event)&&re.edgeSign(u,i.event,p)<=0?u===i.event?(i.mesh.splitEdge(o.Sym),i.mesh.splice(l.Sym,o),n=e.topLeftRegion(i,n),o=e.regionBelow(n).eUp,e.finishLeftRegions(i,e.regionBelow(n),s),e.addRightEdges(i,n,o.Oprev,o,o,!0),!0):d===i.event?(i.mesh.splitEdge(l.Sym),i.mesh.splice(o.Lnext,l.Oprev),s=n,n=e.topRightRegion(n),a=e.regionBelow(n).eUp.Rprev,s.eUp=l.Oprev,l=e.finishLeftRegions(i,s,null),e.addRightEdges(i,n,l.Onext,o.Rprev,a,!0),!0):(re.edgeSign(d,i.event,p)>=0&&(e.regionAbove(n).dirty=n.dirty=!0,i.mesh.splitEdge(o.Sym),o.Org.s=i.event.s,o.Org.t=i.event.t),re.edgeSign(u,i.event,p)<=0&&(n.dirty=s.dirty=!0,i.mesh.splitEdge(l.Sym),l.Org.s=i.event.s,l.Org.t=i.event.t),!1):(i.mesh.splitEdge(o.Sym),i.mesh.splitEdge(l.Sym),i.mesh.splice(l.Oprev,o),o.Org.s=p.s,o.Org.t=p.t,o.Org.pqHandle=i.pq.insert(o.Org),e.getIntersectData(i,o.Org,c,d,h,u),e.regionAbove(n).dirty=n.dirty=s.dirty=!0,!1)},e.walkDirtyRegions=function(i,n){for(var r,a,s=e.regionBelow(n);;){for(;s.dirty;)n=s,s=e.regionBelow(s);if(!n.dirty&&(s=n,(n=e.regionAbove(n))===null||!n.dirty))return;if(n.dirty=!1,r=n.eUp,a=s.eUp,r.Dst!==a.Dst&&e.checkForLeftSplice(i,n)&&(s.fixUpperEdge?(e.deleteRegion(i,s),i.mesh.delete(a),a=(s=e.regionBelow(n)).eUp):n.fixUpperEdge&&(e.deleteRegion(i,n),i.mesh.delete(r),r=(n=e.regionAbove(s)).eUp)),r.Org!==a.Org){if(r.Dst===a.Dst||n.fixUpperEdge||s.fixUpperEdge||r.Dst!==i.event&&a.Dst!==i.event)e.checkForRightSplice(i,n);else if(e.checkForIntersect(i,n))return}r.Org===a.Org&&r.Dst===a.Dst&&(e.addWinding(a,r),e.deleteRegion(i,n),i.mesh.delete(r),n=e.regionAbove(s))}},e.connectRightVertex=function(i,n,r){var a,s=r.Onext,o=e.regionBelow(n),l=n.eUp,c=o.eUp,h=!1;l.Dst!==c.Dst&&e.checkForIntersect(i,n),re.vertEq(l.Org,i.event)&&(i.mesh.splice(s.Oprev,l),n=e.topLeftRegion(i,n),s=e.regionBelow(n).eUp,e.finishLeftRegions(i,e.regionBelow(n),o),h=!0),re.vertEq(c.Org,i.event)&&(i.mesh.splice(r,c.Oprev),r=e.finishLeftRegions(i,o,null),h=!0),h?e.addRightEdges(i,n,r.Onext,s,s,!0):(a=re.vertLeq(c.Org,l.Org)?c.Oprev:l,a=i.mesh.connect(r.Lprev,a),e.addRightEdges(i,n,a,a.Onext,a.Onext,!1),a.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(i,n))},e.connectLeftDegenerate=function(i,n,r){var a,s,o,l,c;return a=n.eUp,re.vertEq(a.Org,r)?(he(!1),void e.spliceMergeVertices(i,a,r.anEdge)):re.vertEq(a.Dst,r)?(he(!1),n=e.topRightRegion(n),s=l=(o=(c=e.regionBelow(n)).eUp.Sym).Onext,c.fixUpperEdge&&(he(s!==o),e.deleteRegion(i,c),i.mesh.delete(o),o=s.Oprev),i.mesh.splice(r.anEdge,o),re.edgeGoesLeft(s)||(s=null),void e.addRightEdges(i,n,o.Onext,l,s,!0)):(i.mesh.splitEdge(a.Sym),n.fixUpperEdge&&(i.mesh.delete(a.Onext),n.fixUpperEdge=!1),i.mesh.splice(r.anEdge,a),void e.sweepEvent(i,r))},e.connectLeftVertex=function(i,n){var r,a,s,o,l,c,h=new xv;if(h.eUp=n.anEdge.Sym,r=i.dict.search(h).key,a=e.regionBelow(r)){if(o=r.eUp,l=a.eUp,re.edgeSign(o.Dst,n,o.Org)===0)return void e.connectLeftDegenerate(i,r,n);s=re.vertLeq(l.Dst,o.Dst)?r:a,r.inside||s.fixUpperEdge?(c=s===r?i.mesh.connect(n.anEdge.Sym,o.Lnext):i.mesh.connect(l.Dnext,n.anEdge).Sym,s.fixUpperEdge?e.fixUpperEdge(i,s,c):e.computeWinding(i,e.addRegionBelow(i,r,c)),e.sweepEvent(i,n)):e.addRightEdges(i,r,n.anEdge,n.anEdge,null,!0)}},e.sweepEvent=function(i,n){i.event=n,e.debugEvent(i);for(var r=n.anEdge;r.activeRegion===null;)if((r=r.Onext)===n.anEdge)return void e.connectLeftVertex(i,n);var a=e.topLeftRegion(i,r.activeRegion);he(a!==null);var s=e.regionBelow(a),o=s.eUp,l=e.finishLeftRegions(i,s,null);l.Onext===o?e.connectRightVertex(i,a,l):e.addRightEdges(i,a,l.Onext,o,o,!0)},e.addSentinel=function(i,n,r,a){var s=new xv,o=i.mesh.makeEdge();o.Org.s=r,o.Org.t=a,o.Dst.s=n,o.Dst.t=a,i.event=o.Dst,s.eUp=o,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=i.dict.insert(s)},e.initEdgeDict=function(i){i.dict=new g4(i,e.edgeLeq);var n=i.bmax[0]-i.bmin[0],r=i.bmax[1]-i.bmin[1],a=i.bmin[0]-n,s=i.bmax[0]+n,o=i.bmin[1]-r,l=i.bmax[1]+r;e.addSentinel(i,a,s,o),e.addSentinel(i,a,s,l)},e.doneEdgeDict=function(i){for(var n,r=0;(n=i.dict.min().key)!==null;)n.sentinel||(he(n.fixUpperEdge),he(++r===1)),he(n.windingNumber===0),e.deleteRegion(i,n)},e.removeDegenerateEdges=function(i){var n,r,a,s=i.mesh.eHead;for(n=s.next;n!==s;n=r)r=n.next,a=n.Lnext,re.vertEq(n.Org,n.Dst)&&n.Lnext.Lnext!==n&&(e.spliceMergeVertices(i,a,n),i.mesh.delete(n),a=(n=a).Lnext),a.Lnext===n&&(a!==n&&((a===r||a===r.Sym)&&(r=r.next),i.mesh.delete(a)),(n===r||n===r.Sym)&&(r=r.next),i.mesh.delete(n))},e.initPriorityQ=function(i){var n,r,a,s=0;for(r=(a=i.mesh.vHead).next;r!==a;r=r.next)s++;for(s+=8,n=i.pq=new m4(s,re.vertLeq),r=(a=i.mesh.vHead).next;r!==a;r=r.next)r.pqHandle=n.insert(r);return r===a&&(n.init(),!0)},e.donePriorityQ=function(i){i.pq=null},e.removeDegenerateFaces=function(i,n){var r,a,s;for(r=n.fHead.next;r!==n.fHead;r=a)a=r.next,he((s=r.anEdge).Lnext!==s),s.Lnext.Lnext===s&&(e.addWinding(s.Onext,s),i.mesh.delete(s));return!0},e.computeInterior=function(i,n){var r,a;if(n===void 0&&(n=!0),e.removeDegenerateEdges(i),!e.initPriorityQ(i))return!1;for(e.initEdgeDict(i);(r=i.pq.extractMin())!==null;){for(;(a=i.pq.min())!==null&&re.vertEq(a,r);)a=i.pq.extractMin(),e.spliceMergeVertices(i,r.anEdge,a.anEdge);e.sweepEvent(i,r)}return i.event=i.dict.min().key.eUp.Org,e.debugEvent(i),e.doneEdgeDict(i),e.donePriorityQ(i),!!e.removeDegenerateFaces(i,i.mesh)&&(n&&i.mesh.check(),!0)},e}(),ik=function(){function e(){this.mesh=new OS,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=fi.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return e.prototype.dot_=function(i,n){return i[0]*n[0]+i[1]*n[1]+i[2]*n[2]},e.prototype.normalize_=function(i){var n=i[0]*i[0]+i[1]*i[1]+i[2]*i[2];if(!n)throw"Zero-size vector!";n=Math.sqrt(n),i[0]/=n,i[1]/=n,i[2]/=n},e.prototype.longAxis_=function(i){var n=0;return Math.abs(i[1])>Math.abs(i[0])&&(n=1),Math.abs(i[2])>Math.abs(i[n])&&(n=2),n},e.prototype.computeNormal_=function(i){var n,r,a,s,o,l,c=[0,0,0],h=[0,0,0],d=[0,0,0],u=[0,0,0],p=[0,0,0],f=[null,null,null],g=[null,null,null],m=this.mesh.vHead;n=m.next;for(var y=0;y<3;++y)s=n.coords[y],h[y]=s,g[y]=n,c[y]=s,f[y]=n;for(n=m.next;n!==m;n=n.next)for(var v=0;v<3;++v)(s=n.coords[v])<h[v]&&(h[v]=s,g[v]=n),s>c[v]&&(c[v]=s,f[v]=n);var _=0;if(c[1]-h[1]>c[0]-h[0]&&(_=1),c[2]-h[2]>c[_]-h[_]&&(_=2),h[_]>=c[_])return i[0]=0,i[1]=0,void(i[2]=1);for(l=0,r=g[_],a=f[_],d[0]=r.coords[0]-a.coords[0],d[1]=r.coords[1]-a.coords[1],d[2]=r.coords[2]-a.coords[2],n=m.next;n!==m;n=n.next)u[0]=n.coords[0]-a.coords[0],u[1]=n.coords[1]-a.coords[1],u[2]=n.coords[2]-a.coords[2],p[0]=d[1]*u[2]-d[2]*u[1],p[1]=d[2]*u[0]-d[0]*u[2],p[2]=d[0]*u[1]-d[1]*u[0],(o=p[0]*p[0]+p[1]*p[1]+p[2]*p[2])>l&&(l=o,i[0]=p[0],i[1]=p[1],i[2]=p[2]);l<=0&&(i[0]=i[1]=i[2]=0,i[this.longAxis_(d)]=1)},e.prototype.checkOrientation_=function(){for(var i,n,r=this.mesh.fHead,a=this.mesh.vHead,s=0,o=r.next;o!==r;o=o.next)if(!((n=o.anEdge).winding<=0))do s+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==o.anEdge);if(s<0){for(i=a.next;i!==a;i=i.next)i.t=-i.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var i,n,r=this.mesh.vHead,a=[0,0,0],s=!1;a[0]=this.normal[0],a[1]=this.normal[1],a[2]=this.normal[2],!a[0]&&!a[1]&&!a[2]&&(this.computeNormal_(a),s=!0),i=this.sUnit,n=this.tUnit;var o=this.longAxis_(a);i[o]=0,i[(o+1)%3]=1,i[(o+2)%3]=0,n[o]=0,n[(o+1)%3]=0,n[(o+2)%3]=a[o]>0?1:-1;for(var l=r.next;l!==r;l=l.next)l.s=this.dot_(l.coords,i),l.t=this.dot_(l.coords,n);s&&this.checkOrientation_();for(var c=!0,h=r.next;h!==r;h=h.next)c?(this.bmin[0]=this.bmax[0]=h.s,this.bmin[1]=this.bmax[1]=h.t,c=!1):(h.s<this.bmin[0]&&(this.bmin[0]=h.s),h.s>this.bmax[0]&&(this.bmax[0]=h.s),h.t<this.bmin[1]&&(this.bmin[1]=h.t),h.t>this.bmax[1]&&(this.bmax[1]=h.t))},e.prototype.addWinding_=function(i,n){i.winding+=n.winding,i.Sym.winding+=n.Sym.winding},e.prototype.tessellateMonoRegion_=function(i,n){var r,a;if((r=n.anEdge).Lnext===r||r.Lnext.Lnext===r)throw"Mono region invalid";for(;re.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;re.vertLeq(r.Org,r.Dst);r=r.Lnext);for(a=r.Lprev;r.Lnext!==a;)if(re.vertLeq(r.Dst,a.Org)){for(;a.Lnext!==r&&(re.edgeGoesLeft(a.Lnext)||re.edgeSign(a.Org,a.Dst,a.Lnext.Dst)<=0);)a=i.connect(a.Lnext,a).Sym;a=a.Lprev}else{for(;a.Lnext!==r&&(re.edgeGoesRight(r.Lprev)||re.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)r=i.connect(r,r.Lprev).Sym;r=r.Lnext}if(a.Lnext===r)throw"Mono region invalid";for(;a.Lnext.Lnext!==r;)a=i.connect(a.Lnext,a).Sym;return!0},e.prototype.tessellateInterior_=function(i){for(var n,r=i.fHead.next;r!==i.fHead;r=n)if(n=r.next,r.inside&&!this.tessellateMonoRegion_(i,r))return!1;return!0},e.prototype.discardExterior_=function(i){for(var n,r=i.fHead.next;r!==i.fHead;r=n)n=r.next,r.inside||i.zapFace(r)},e.prototype.setWindingNumber_=function(i,n,r){for(var a,s=i.eHead.next;s!==i.eHead;s=a)a=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?n:-n:r?i.delete(s):s.winding=0},e.prototype.getNeighbourFace_=function(i){return i.Rface&&i.Rface.inside?i.Rface.n:-1},e.prototype.outputPolymesh_=function(i,n,r,a){var s,o,l=0,c=0;r>3&&i.mergeConvexFaces(r);for(var h=i.vHead.next;h!==i.vHead;h=h.next)h.n=-1;for(var d=i.fHead.next;d!==i.fHead;d=d.next)if(d.n=-1,d.inside){s=d.anEdge,o=0;do(h=s.Org).n===-1&&(h.n=c,c++),o++,s=s.Lnext;while(s!==d.anEdge);if(o>r)throw"Face vertex greater that support polygon";d.n=l,++l}for(this.elementCount=l,n===Tn.CONNECTED_POLYGONS&&(l*=2),this.elements=[],this.elements.length=l*r,this.vertexCount=c,this.vertices=[],this.vertices.length=c*a,this.vertexIndices=[],this.vertexIndices.length=c,h=i.vHead.next;h!==i.vHead;h=h.next)if(h.n!==-1){var u=h.n*a;this.vertices[u+0]=h.coords[0],this.vertices[u+1]=h.coords[1],a>2&&(this.vertices[u+2]=h.coords[2]),this.vertexIndices[h.n]=h.idx}var p=0;for(d=i.fHead.next;d!==i.fHead;d=d.next)if(d.inside){s=d.anEdge,o=0;do h=s.Org,this.elements[p++]=h.n,o++,s=s.Lnext;while(s!==d.anEdge);for(var f=o;f<r;++f)this.elements[p++]=-1;if(n===Tn.CONNECTED_POLYGONS){s=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==d.anEdge);for(var g=o;g<r;++g)this.elements[p++]=-1}}},e.prototype.outputContours_=function(i,n){var r,a,s=0,o=0;this.vertexCount=0,this.elementCount=0;for(var l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){a=r=l.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==a);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*n,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var c=0,h=0,d=0;for(s=0,l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){o=0,a=r=l.anEdge;do this.vertices[c++]=r.Org.coords[0],this.vertices[c++]=r.Org.coords[1],n>2&&(this.vertices[c++]=r.Org.coords[2]),this.vertexIndices[h++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,o++,r=r.Lnext;while(r!==a);this.elements[d++]=s,this.elements[d++]=o,s+=o}},e.prototype.addContour=function(i,n){this.mesh===null&&(this.mesh=new OS),i<2&&(i=2),i>3&&(i=3);for(var r=null,a=0;a<n.length;a+=i)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=n[a+0],r.Org.coords[1]=n[a+1],r.Org.coords[2]=i>2?n[a+2]:0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},e.prototype.tesselate=function(i,n,r,a,s,o){if(i===void 0&&(i=fi.ODD),n===void 0&&(n=Tn.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=i,a<2&&(a=2),a>3&&(a=3),!this.mesh)return!1;this.projectPolygon_(),v4.computeInterior(this,o);var l=this.mesh;return n===Tn.BOUNDARY_CONTOURS?this.setWindingNumber_(l,1,!0):this.tessellateInterior_(l),o&&l.check(),n===Tn.BOUNDARY_CONTOURS?this.outputContours_(l,a):this.outputPolymesh_(l,n,r,a),!0},e}(),fi.ODD,fi.NONZERO,fi.POSITIVE,fi.NEGATIVE,fi.ABS_GEQ_TWO,Tn.POLYGONS,Tn.CONNECTED_POLYGONS,Tn.BOUNDARY_CONTOURS}),S$=k(()=>{(nk=US=class{constructor(t=256,e=!1){this.capacity=t,this.size=0,this.debug=e,this.debug&&console.log(`allocating with cap ${t}`);let i=t*US.eSize;this.buffer=new ArrayBuffer(i);let n=Float32Array.BYTES_PER_ELEMENT,r=0;this.positions=new Float32Array(this.buffer,r*n,3*t),r+=3*t,this.normals=new Float32Array(this.buffer,r*n,3*t),r+=3*t,this.uvs=new Float32Array(this.buffer,r*n,2*t)}realloc(t,e=!1){if(t<this.size)throw Error("cannot shrink buffer");if(t<=this.capacity&&!e)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${t}`);let i=t*US.eSize,n=new ArrayBuffer(i),r=Float32Array.BYTES_PER_ELEMENT,a=0,s=new Float32Array(n,a*r,3*t);a+=3*t;let o=new Float32Array(n,a*r,3*t);a+=3*t;let l=new Float32Array(n,a*r,2*t);e?(s.set(this.positions.subarray(0,3*this.size)),o.set(this.normals.subarray(0,3*this.size)),l.set(this.uvs.subarray(0,2*this.size))):(s.set(this.positions),o.set(this.normals),l.set(this.uvs)),this.buffer=n,this.positions=s,this.normals=o,this.uvs=l,this.capacity=t}get(t=1){let e=this.size+t;if(e>this.capacity){let n=this.capacity;for(;e>n;)n*=2;this.realloc(n)}let i=this.size;return this.size=e,i}reserve(t){let e=this.size+t;e>this.capacity&&this.realloc(e)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}}).eSize=8*Float32Array.BYTES_PER_ELEMENT}),M$=k(()=>{rk=class{constructor(t=[],e=(i,n)=>i<n?-1:i>n?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:i}=this,n=e[t];for(;t>0;){let r=t-1>>1,a=e[r];if(i(n,a)>=0)break;e[t]=a,t=r}e[t]=n}_down(t){let{data:e,compare:i}=this,n=this.length>>1,r=e[t];for(;t<n;){let a=1+(t<<1),s=a+1;if(s<this.length&&i(e[s],e[a])<0&&(a=s),i(e[a],r)>=0)break;e[t]=e[a],t=a}e[t]=r}}});function wv(t,e,i,n){this.x=t,this.y=e,this.h=i,this.d=function(r,a,s){let o=!1,l=1/0;for(let c of s)for(let h=0,d=c.length,u=d-1;h<d;u=h++){let p=c[h],f=c[u];p[1]>a!=f[1]>a&&r<(f[0]-p[0])*(a-p[1])/(f[1]-p[1])+p[0]&&(o=!o),l=Math.min(l,E$(r,a,p,f))}return l===0?0:(o?1:-1)*Math.sqrt(l)}(t,e,n),this.max=this.d+this.h*Math.SQRT2}function E$(t,e,i,n){let r=i[0],a=i[1],s=n[0]-r,o=n[1]-a;if(s!==0||o!==0){let l=((t-r)*s+(e-a)*o)/(s*s+o*o);l>1?(r=n[0],a=n[1]):l>0&&(r+=s*l,a+=o*l)}return s=t-r,o=e-a,s*s+o*o}var $_,wA,SA,Sv,Y_,MA,EA,Mh,A$=k(()=>{M$()}),YC=k(()=>{rt(),Mp(),S$(),ti(),A$(),$_={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},wA={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},SA={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0},Sv=(t,e)=>([i,n])=>(n<i&&(n+=e),(t>=i?t:t+e)<=n),Y_=class extends Gt{constructor(t,e,i=0,n=12,r=3,a=fi.ODD,s=!1){super(),this.forPathBevel=s,this.type="ShapeGeometry",this.vertexCache={},this._shape=t,this._depth=e,this._curveSegments=n,this._bevelSegmentsInput=r;let o,l,c,h=this._shape.extractShapePointsToFlatArray([],n),d=this._shape.shapeHoles.map(E=>{let P=E.extractShapePointsToFlatArray([],n),A=[];for(let R=P.length-1;R>=1;R-=2){let O=P[R-1],D=P[R-0];A.push(O,D)}return A}),u=[],p=[];for(let E=0;E<h.length;E+=2)p.push([h[E],h[E+1]]);u.push(p);for(let E=0;E<d.length;E++){let P=d[E],A=[];for(let R=0;R<P.length;R+=2)A.push([P[R],P[R+1]]);u.push(A)}o=t.isText?.1*new Lb().setFromPoints(t.points.map(E=>E.position)).getSize(new at).length():u[0].length===0?i:i>0?function(E,P,A=1,R=!1){let O=1/0,D=1/0,I=-1/0,U=-1/0;for(let[Y,ht]of E[0])Y<O&&(O=Y),ht<D&&(D=ht),Y>I&&(I=Y),ht>U&&(U=ht);let N=I-O,G=U-D,H=Math.max(A,Math.min(N,G));if(H===A){let Y=[O,D];return Y.distance=0,Y.distance}let J=new rk([],(Y,ht)=>ht.max-Y.max),K=function(Y){let ht=0,F=0,B=0,j=Y[0];for(let L=0,W=j.length,X=W-1;L<W;X=L++){let V=j[L],nt=j[X],lt=V[0]*nt[1]-nt[0]*V[1];F+=(V[0]+nt[0])*lt,B+=(V[1]+nt[1])*lt,ht+=3*lt}let Z=new wv(F/ht,B/ht,0,Y);return ht===0||Z.d<0?new wv(j[0][0],j[0][1],0,Y):Z}(E),tt=new wv(O+N/2,D+G/2,0,E);tt.d>K.d&&(K=tt);let ct=2;function et(Y,ht,F){let B=new wv(Y,ht,F,E);if(ct++,B.max>K.d+A&&J.push(B),B.d>K.d&&(K=B,R&&console.log(`found best ${Math.round(1e4*B.d)/1e4} after ${ct} probes`),K.d>P))return P}let st=H/2;for(let Y=O;Y<I;Y+=H)for(let ht=D;ht<U;ht+=H)et(Y+st,ht+st,st);for(;J.length;){let{max:Y,x:ht,y:F,h:B}=J.pop();if(Y-K.d<=A)break;st=B/2,et(ht-st,F-st,st),et(ht+st,F-st,st),et(ht-st,F+st,st),et(ht+st,F+st,st)}R&&console.log(`num probes: ${ct}
|
|
4167
4167
|
best distance: ${K.d}`);let dt=[K.x,K.y];return dt.distance=K.d,dt.distance}(u,i):1e-5,i<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(i,o,e/2),this._bevelSegments=Math.floor(r));try{l=eh({windingRule:a,elementType:Tn.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[h]})}catch{l=$_}try{c=eh({windingRule:fi.ODD,elementType:Tn.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...d]})}catch{c=wA}if(!l)throw new Error("error generating geometry");let f=l.elementCount;if(c){l.elementCount+=c.elementCount;for(let E=0;E<c.elements.length;E++){let P=c.elements[E],A=E%2==0?l.vertexCount:0;l.elements.push(P+A)}for(let E=0;E<c.vertexIndices.length;E++){let P=c.vertexIndices[E],A=l.vertexCount;l.vertexIndices.push(P+A)}for(let E=0;E<c.vertices.length;E++){let P=c.vertices[E];l.vertices.push(P)}}let g=1/0,m=-1/0,y=1/0,v=-1/0;for(let E=0,P=l.vertexCount;E<P;E++){let A=2*E,R=l.vertices[A+0],O=l.vertices[A+1];R<g&&(g=R),R>m&&(m=R),O<y&&(y=O),O>v&&(v=O)}this._minX=g,this._minY=y,this._width=m-g,this._height=v-y,this._buffer=new nk(this._computeBufferEstimatedSize(l));let _=[],b=[];for(let E=l.elementCount-1;E>=0;E--){let P=E>=f,A=2*E,R=l.elements[A+0],O=l.elements[A+1],D=R+O,I={start:R,count:O,normals:[],continuous:[],concave:[]},U=R,N=D-1,G=R+1,H=this._shape.roundedCurves.length;do{let et=U-R,st=l.vertices[2*N+0],dt=l.vertices[2*N+1],Y=l.vertices[2*U+0],ht=l.vertices[2*U+1],F=l.vertices[2*G+0],B=l.vertices[2*G+1],j=Y-st,Z=ht-dt,L=Math.sqrt(j*j+Z*Z);j/=L,Z/=L;let W=Y-F,X=ht-B,V=Math.sqrt(W*W+X*X);W/=V,X/=V,I.normals[2*et+0]=-X,I.normals[2*et+1]=W,I.concave[et]=j*X-Z*W>0;let nt=l.vertexIndices[U];if(Array.isArray(nt))I.continuous[et]=!1;else{let[lt,ft]=this._shape.getCurveIndexFromVertexId(nt-1,!0);if(ft>0&&ft<1)I.continuous[et]=!0;else{let pt=ft===1?lt+1:lt-1;pt=(pt+H)%H;let Pt=ft===1?0:1,bt=this._shape.roundedCurves[lt].getTangent(ft),Rt=this._shape.roundedCurves[pt].getTangent(Pt);I.continuous[et]=bt.dot(Rt)>.95}}P&&(I.normals[2*et+0]*=-1,I.normals[2*et+1]*=-1),[N,U,G]=[U,G,G+1],G>=D&&(G-=O)}while(G!==R+1);let J=[];J.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(2*R,2*D),vertexCount:O,vertexIndices:new Array(O).fill(!0).map((et,st)=>[st,st]),elements:[0,O],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(2*R,2*D)});let K=0;for(let et=1;et<=this._bevelSegments;et++){let st=et/this._bevelSegments*Math.PI/2,dt=(1-Math.cos(st))*this._bevel,Y=[],ht=[],F=[],B=[],j=0;for(let L=0;L<O;L++){let W=2*L,X=(L-1+O)%O*2,V=l.vertices[2*I.start+W+0],nt=l.vertices[2*I.start+W+1],lt=-I.normals[X+0]*dt,ft=-I.normals[X+1]*dt,pt=-I.normals[W+0]*dt,Pt=-I.normals[W+1]*dt;if(I.concave[L]||!I.concave[L]&&P){let bt=Math.atan2(ft,lt),Rt=Math.atan2(Pt,pt);Rt>bt&&(Rt-=2*Math.PI);let _t=Rt-bt;if(I.continuous[L]||P){let $=bt+_t/2,vt=Math.cos($)*dt,Dt=Math.sin($)*dt;Y[2*j+0]=V+vt*(P?-1:1),Y[2*j+1]=nt+Dt*(P?-1:1),B[j]=L,j++}else{let $=Math.max(1,Math.floor(n/4*Math.abs(_t)/Math.PI));for(let vt=0;vt<=$;vt++){let Dt=bt+_t*(vt/$),jt=Math.cos(Dt)*dt,Nt=Math.sin(Dt)*dt;Y[2*j+0]=V+jt,Y[2*j+1]=nt+Nt,B[j]=L,j++}}}else Y[2*j+0]=V+lt,Y[2*j+1]=nt+ft,B[j]=L,ht[L]=j,j++,Y[2*j+0]=V,Y[2*j+1]=nt,B[j]=L,j++,Y[2*j+0]=V+pt,Y[2*j+1]=nt+Pt,B[j]=L,F[L]=j,j++}let Z=eh({windingRule:fi.POSITIVE,elementType:Tn.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[Y],edgeCreateCallback:L=>{let W=L.Org.idx,X=B[W],V=B[(W+1)%B.length];L.idx=[X,V],L.Sym.idx=[V,X]},vertexIdCallback:L=>{let W=L.Lprev.idx;return[W?W[1]:0,L.idx?L.idx[0]:0]}});if(!Z)throw console.log("Error"),new Error(`error generating bevel geometry for ${et}'th loop`);if(!Z.vertexCount){let L=(et-1)/this._bevelSegments*Math.PI/2;K=(1-Math.sin(L))*this._bevel;break}for(let L=0;L<Z.vertexIndices.length;L++){let[W,X]=Z.vertexIndices[L];if(W===X)continue;let V=X;X<W&&(V+=O);for(let nt=W;nt<V;nt++){let lt=nt%O,ft=(nt+1)%O;if(!I.continuous[lt]||!I.continuous[ft]){Z.vertexIndices[L]=[W,lt],Z.vertexIndices.splice(L+1,0,[ft,X]),Z.vertices.splice(2*(L+1),0,Z.vertices[2*L],Z.vertices[2*L+1]);break}}}J.push({bevelI:et,angle:st,size:dt,boundary:Z,reverseMap:B,insetPoints:Y})}let tt=(et,st,dt)=>{let Y=0,ht=et.boundary.vertexIndices.length;for(;Y<ht&&dt(et.boundary.vertexIndices[st]);)st=(st+1)%ht,Y++;return Y},ct=_.length;for(let et=1;et<J.length;et++){let st=J[et-1],dt=J[et],Y=st.boundary.vertexIndices.length,ht=dt.boundary.vertexIndices.length;if(!Y||!ht)break;let F=I.concave.length,B=0,j=Sv(B,O);for(;!st.boundary.vertexIndices.filter(j).length||!dt.boundary.vertexIndices.filter(j).length;)B++,j=Sv(B,O);let Z=st.boundary.vertexIndices.findIndex(j),L=dt.boundary.vertexIndices.findIndex(j);do Z=(Z+1)%Y;while(j(st.boundary.vertexIndices[Z]));do L=(L+1)%ht;while(j(dt.boundary.vertexIndices[L]));B=(B+1)%O;let W,X,V=B,nt=0,lt=this._buildBevelVert(I,st,(Z-1+Y)%Y,void 0,nt),ft=this._buildBevelVert(I,dt,(L-1+ht)%ht,void 0,nt),pt=!1;do{nt=(B||F)/F,j=Sv(B,O);let Pt=tt(st,Z,j),bt=tt(dt,L,j),Rt=pt;if(pt=!1,Pt&&!bt){for(let _t=0;_t<Pt;_t++)W=this._buildBevelVert(I,st,(Z+_t)%Y,_t/(Pt-1),nt),_.push(lt.topN,W.topP,ft.topN),s===!1&&_.push(W.bottomP,lt.bottomN,ft.bottomN),lt=W;pt=!0}else if(!Pt&&bt)for(let _t=0;_t<bt;_t++)X=this._buildBevelVert(I,dt,(L+_t)%ht,_t/(bt-1),nt),_.push(ft.topN,lt.topP,X.topP),s===!1&&_.push(lt.bottomP,ft.bottomN,X.bottomP),ft=X;else if(Pt&&bt)if(W=this._buildBevelVert(I,st,Z,0,nt),X=this._buildBevelVert(I,dt,L,0,nt),Rt?(_.push(lt.topN,X.topP,ft.topN),_.push(lt.topN,W.topP,X.topP),s===!1&&(_.push(X.bottomP,lt.bottomN,ft.bottomN),_.push(X.bottomP,W.bottomP,lt.bottomN))):(_.push(ft.topN,lt.topN,W.topP),_.push(ft.topN,W.topP,X.topP),s===!1&&(_.push(W.bottomP,lt.bottomN,ft.bottomN),_.push(W.bottomP,ft.bottomN,X.bottomP))),lt=W,ft=X,Pt===bt)for(let _t=1;_t<Pt;_t++)W=this._buildBevelVert(I,st,(Z+_t)%Y,_t/(Pt-1),nt),X=this._buildBevelVert(I,dt,(L+_t)%ht,_t/(bt-1),nt),_.push(lt.topN,W.topP,ft.topN),_.push(ft.topN,W.topP,X.topP),s===!1&&(_.push(W.bottomP,lt.bottomN,ft.bottomN),_.push(W.bottomP,ft.bottomN,X.bottomP)),lt=W,ft=X;else if(Pt>bt){let _t=Pt/bt,$=0;for(let vt=1;vt<Pt;vt++)W=this._buildBevelVert(I,st,(Z+vt)%Y,vt/(Pt-1),nt),_.push(lt.topN,W.topP,ft.topN),s===!1&&_.push(W.bottomP,lt.bottomN,ft.bottomN),lt=W,vt>($+1)*_t&&($++,X=this._buildBevelVert(I,dt,(L+$)%ht,$/(bt-1),nt),_.push(ft.topN,W.topP,X.topP),s===!1&&_.push(W.bottomP,ft.bottomN,X.bottomP),ft=X)}else{let _t=bt/Pt,$=0;for(let vt=1;vt<bt;vt++)X=this._buildBevelVert(I,dt,(L+vt)%ht,vt/(bt-1),nt),_.push(ft.topN,W.topP,X.topP),s===!1&&_.push(W.bottomP,ft.bottomN,X.bottomP),ft=X,vt>($+1)*_t&&($++,W=this._buildBevelVert(I,st,(Z+$)%Y,$/(Pt-1),nt),_.push(lt.topN,W.topP,ft.topN),s===!1&&_.push(W.bottomP,lt.bottomN,ft.bottomN),lt=W)}Z=(Z+Pt)%Y,L=(L+bt)%ht,B=(B+1)%F}while(B!==V)}if(s===!1&&this._depth>2*this._bevel&&this._buildWall(J,I,_),P){let et=[];for(let st=_.length-1;st>=ct+2;st-=3){let dt=_[st-2],Y=_[st-1],ht=_[st-0];et.push(ht,Y,dt)}_.splice(ct,_.length-ct,...et)}if(P){let et=[];for(let st=J[J.length-1].boundary.vertices.length-1;st>=1;st-=2){let dt=J[J.length-1].boundary.vertices[st-1],Y=J[J.length-1].boundary.vertices[st-0];et.push(dt,Y)}b.push(et)}if(!P){let et,st=J[J.length-1];try{et=eh({windingRule:J.length>1?fi.POSITIVE:fi.ODD,elementType:Tn.POLYGONS,vertexSize:2,strict:!0,contours:[st.insetPoints,...b]})}catch{et=SA}if(!et)throw new Error("Error generating geometry for surface");d.length===0&&this._bevel<o&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let dt=0;dt<3*et.elementCount;dt+=3){let Y=this._buildSurfaceVert(et,et.elements[dt+0],K),ht=this._buildSurfaceVert(et,et.elements[dt+1],K),F=this._buildSurfaceVert(et,et.elements[dt+2],K);_.push(Y.top,ht.top,F.top),s===!1&&_.push(F.bottom,ht.bottom,Y.bottom)}}this.vertexCache={}}this._buffer.shrink();let x=new Ht(Uint32Array.from(_),1),w=new Ht(this._buffer.positions,3),S=new Ht(this._buffer.normals,3),T=new Ht(this._buffer.uvs,2);w.needsUpdate=!0,S.needsUpdate=!0,T.needsUpdate=!0,x.needsUpdate=!0,this.setAttribute("position",w),this.setAttribute("normal",S),this.setAttribute("uv",T),this.setIndex(x)}_computeBufferEstimatedSize(t){return 2*t.vertexCount*(2+this._bevelSegments)}_buildWall(t,e,i){let n=t[0];for(let r=0,a=n.boundary.vertexCount;r<a;r++){let s=this._buildBevelVert(e,n,r),o=this._buildBevelVert(e,n,(r+1)%a);i.push(o.topP,s.topN,s.bottomN),i.push(o.topP,s.bottomN,o.bottomP)}}_buildSurfaceVert(t,e,i){let n=e.toString();if(n in this.vertexCache)return this.vertexCache[n];let r=t.vertices[2*e+0],a=t.vertices[2*e+1],s=(r-this._minX)/this._width,o=(a-this._minY)/this._height;this.forPathBevel&&(o=1);let l=this._buffer.get(this.forPathBevel?1:2),c=3*l,h=2*l,d={top:l+0,bottom:l+1};return this._buffer.positions[c+0]=r,this._buffer.positions[c+1]=a,this._buffer.positions[c+2]=this.forPathBevel?this._bevel:this._depth-i,this._buffer.normals[c+0]=0,this._buffer.normals[c+1]=0,this._buffer.normals[c+2]=1,this._buffer.uvs[h+0]=s,this._buffer.uvs[h+1]=o,this.forPathBevel===!1&&(this._buffer.positions[c+3]=r,this._buffer.positions[c+4]=a,this._buffer.positions[c+5]=i,this._buffer.normals[c+3]=0,this._buffer.normals[c+4]=0,this._buffer.normals[c+5]=-1,this._buffer.uvs[h+2]=s,this._buffer.uvs[h+3]=o),this.vertexCache[n]=d,d}_buildBevelVert(t,e,i,n=1,r){let a=`${e.bevelI}:${i}`;if(a in this.vertexCache&&r!==0&&r!==1&&(!r||r===this.vertexCache[a].pathBevelUCoord))return this.vertexCache[a];let s,o,l,c,[h,d]=e.boundary.vertexIndices[i];h!==d?(o=h,s=d,c=!1,l=t.continuous[o]&&t.continuous[s]):(s=h,o=(s-1+t.count)%t.count,c=t.concave[s]&&e.bevelI>0,l=t.continuous[s]||c);let u=Math.cos(e.angle),p=Math.sin(e.angle),f=2*i,g=2*s,m=2*o,y=e.boundary.vertices[f+0],v=e.boundary.vertices[f+1],_=(1-p)*this._bevel,b=(y-this._minX)/this._width,x=(v-this._minY)/this._height;this.forPathBevel&&(r!==void 0&&(b=r),x=1);let w=t.normals[g+0],S=t.normals[g+1],T=t.normals[m+0],E=t.normals[m+1];if(c){w+=(T-w)*(1-n),S+=(E-S)*(1-n);let D=Math.sqrt(w*w+S*S);w/=D,S/=D}let P=this.forPathBevel?this._buffer.get(l?1:2):this._buffer.get(l?2:4),A=3*P,R=2*P,O={i,fi:s,topP:P+0,topN:P+0,bottomP:P+1,bottomN:P+1,pathBevelUCoord:r};return this._buffer.positions[A+0]=y,this._buffer.positions[A+1]=v,this._buffer.positions[A+2]=(this.forPathBevel?this._bevel:this._depth)-_,this._buffer.normals[A+0]=w*u,this._buffer.normals[A+1]=S*u,this._buffer.normals[A+2]=p,this._buffer.uvs[R+0]=b,this._buffer.uvs[R+1]=x,this.forPathBevel===!1&&(this._buffer.positions[A+3]=y,this._buffer.positions[A+4]=v,this._buffer.positions[A+5]=_,this._buffer.normals[A+3]=w*u,this._buffer.normals[A+4]=S*u,this._buffer.normals[A+5]=-p,this._buffer.uvs[R+2]=x,this._buffer.uvs[R+3]=b),l||(this.forPathBevel?(P+=1,A+=3,R+=2):(P+=2,A+=6,R+=4),O.topP=P+0,O.bottomP=P+1,this._buffer.positions[A+0]=y,this._buffer.positions[A+1]=v,this._buffer.positions[A+2]=(this.forPathBevel?this._bevel:this._depth)-_,this._buffer.normals[A+0]=T*u,this._buffer.normals[A+1]=E*u,this._buffer.normals[A+2]=p,this._buffer.uvs[R+0]=b,this._buffer.uvs[R+1]=x,this.forPathBevel===!1&&(this._buffer.positions[A+3]=y,this._buffer.positions[A+4]=v,this._buffer.positions[A+5]=_,this._buffer.normals[A+3]=T*u,this._buffer.normals[A+4]=E*u,this._buffer.normals[A+5]=-p,this._buffer.uvs[R+2]=x,this._buffer.uvs[R+3]=b)),this.vertexCache[a]=O,O}clone(){let t=new Y_(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=Ub(this.userData),t}}}),ak=k(()=>{rt(),Mp(),ti(),YC(),MA=class extends Gt{constructor(t,e=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=fi.ODD,this.elementType=Tn.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=t,this._curveSegments=e,this._triangulationOptions=Object.assign({windingRule:fi.ODD,elementType:Tn.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let n,r,a,s=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(u=>u.extractShapePointsToFlatArray([],this._curveSegments)),l=!0,c=!0;for(let u=0,p=s.length/2;u<p;u++){let f=2*u,g=s[f+0],m=s[f+1];if(r!==void 0&&g!==r&&(l=!1),a!==void 0&&m!==a&&(c=!1),r=g,a=m,!l&&!c)break}if(!l&&!c)try{n=eh({contours:[s,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{n=$_}let h=n?.vertexCount??1,d=n?.elementCount??1;if(this._positionAttribute=new Ht(new Float32Array(3*h),3),this._normalAttribute=new Ht(new Float32Array(3*h),3),this._uvAttribute=new Ht(new Float32Array(2*h),2),this._indexAttribute=new Ht(new Uint32Array(3*d),1),n){let u=1/0,p=-1/0,f=1/0,g=-1/0;for(let v=0,_=h;v<_;v++){let b=2*v,x=n.vertices[b+0],w=n.vertices[b+1];x<u&&(u=x),x>p&&(p=x),w<f&&(f=w),w>g&&(g=w)}let m=p-u,y=g-f;for(let v=0,_=h;v<_;v++){let b=2*v,x=n.vertices[b+0],w=n.vertices[b+1],S=(x-u)/m,T=(w-f)/y;this._positionAttribute.setXYZ(v,x,w,0),this._normalAttribute.setXYZ(v,0,0,1),this._uvAttribute.setXY(v,S,T)}for(let v=0,_=d;v<_;v++){let b=3*v,x=n.elements[b+0],w=n.elements[b+1],S=n.elements[b+2];this._indexAttribute.setX(b+0,x),this._indexAttribute.setX(b+1,w),this._indexAttribute.setX(b+2,S)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,3*(n?.elementCount??1))}clone(){let t=new MA(this._shape,this._curveSegments);return t.userData=Ub(this.userData),t}}}),T$=k(()=>{Mp(),ti(),YC(),EA=class extends Y_{constructor(t,e,i=0,n=12,r=3,a=fi.ODD){super(t,e,i,n,r,a),this.type="ShapeGeometry"}_computeBufferEstimatedSize(t){return 2*t.vertexCount*(2+this._bevelSegments)}_buildWall(t,e,i){let n=t[0];for(let r=0,a=n.boundary.vertexCount;r<a;r++){let s=this._buildBevelVert(e,n,r),o=this._buildBevelVert(e,n,(r+1)%a);i.push(o.topP,s.topN,s.bottomN),i.push(o.topP,s.bottomN,o.bottomP)}}clone(){let t=new EA(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=Ub(this.userData),t}}}),gh=k(()=>{Sh(),ak(),T$(),Mp(),Mh=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,n=Object.assign({},e?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:fi.ODD},t.parameters),r=Math.abs(n.width),a=Math.abs(n.height??n.width),s=Math.abs(n.depth??0),o=t.shape??e?.shape,l=o?.roundness??n.roundness;o!==void 0&&(o instanceof ki?(i=o,(i.width!==r||i.height!==a)&&i.applySize(r,a)):i=new ki(r,a).fromJSON(o),t.parameters?.roundness!==void 0&&t.parameters?.roundness>0&&i.update());let c=i??new ki(r,a);return{parameters:Object.assign(n,{width:r,height:a,depth:s,roundness:l}),shape:c}}static build(t){let e,{depth:i,extrudeBevelSize:n,extrudeBevelSegments:r,subdivisions:a,roundness:s,windingRule:o}=t.parameters;return t.shape.roundness=s,e=i<=0?new MA(t.shape,a,{windingRule:o}):new EA(t.shape,i,n,a,r,o),Object.assign(e,{userData:{...t,type:"VectorGeometry"}})}}});function C$(t,e,i,n,r,a){if(n>=ZC)return r>30||r%4==0?(function(h,d,u,p=0,f=0,g=0){let m=.5522847498,y=d*m,v=u*m;h.addPoint(Mv(f-d,g,f-d,g-v,f-d,g+v)),h.addPoint(Mv(f,g+u,f-y,g+u,f+y,g+u)),h.addPoint(Mv(f+d,g,f+d,g+v,f+d,g-v)),h.addPoint(Mv(f,g-u,f+y,g-u,f-y,g-u)),p>0&&ok(h,d,u,p)}(t,e,i,a),Math.round(r/4)):y4(t,n,r,e,i,a);let s={x:0,y:i},o=(n=Math.max(n,.001))+.5*Math.PI,l={x:Math.cos(o)*e,y:Math.sin(o)*i},c=function({px:h,py:d,cx:u,cy:p,rx:f,ry:g,largeArcFlag:m,sweepFlag:y}){let v=[];if(f===0||g===0)return[];let _=(h-u)/2,b=(d-p)/2;if(_===0&&b===0)return[];f=Math.abs(f),g=Math.abs(g);let x=Math.pow(_,2)/Math.pow(f,2)+Math.pow(b,2)/Math.pow(g,2);x>1&&(f*=Math.sqrt(x),g*=Math.sqrt(x));let w=function(O,D,I,U,N,G,H,J,K,tt){let ct=Math.pow(N,2),et=Math.pow(G,2),st=Math.pow(H,2),dt=Math.pow(J,2),Y=ct*et-ct*dt-et*st;Y<0&&(Y=0),Y/=ct*dt+et*st,Y=Math.sqrt(Y)*(K===tt?-1:1);let ht=Y*N/G*J,F=Y*-G/N*H,B=ht+(O+I)/2,j=F+(D+U)/2,Z=(H-ht)/N,L=(J-F)/G,W=(-H-ht)/N,X=(-J-F)/G,V=f4(1,0,Z,L),nt=f4(Z,L,W,X);return!tt&&nt>0&&(nt-=l1),tt&&nt<0&&(nt+=l1),{centerx:B,centery:j,ang1:V,ang2:nt}}(h,d,u,p,f,g,_,b,m,y),{ang1:S,ang2:T}=w,{centerx:E,centery:P}=w,A=Math.abs(T)/(l1/4);Math.abs(1-A)<1e-7&&(A=1);let R=Math.max(Math.ceil(A),1);T/=R;for(let O=0;O<R;O++)v.push(x$(S,T)),S+=T;return v.map(O=>{let{x:D,y:I}=RS(O[0],f,g,E,P),{x:U,y:N}=RS(O[1],f,g,E,P),{x:G,y:H}=RS(O[2],f,g,E,P);return{x1:D,y1:I,x2:U,y2:N,x:G,y:H}})}({px:s.x,py:s.y,cx:l.x,cy:l.y,rx:e,ry:i,largeArcFlag:n>Math.PI,sweepFlag:!0});return r>30||r%c.length===0?function(h,d,u,p,f,g,m,y){let v=Math.round(f/p.length);h.addPoint(Zu(d,u));for(let _=0,b=p.length;_<b;_++){let x=p[_],w=h.points[_],S=Zu(x.x,x.y);w.controls[1].position.set(x.x1,x.y1),S.controls[0].position.set(x.x2,x.y2),h.addPoint(S)}return y>0?sk(h,g,m,y):h.addPoint(Zu(0,0)),v}(t,s.x,s.y,c,r,e,i,a):y4(t,n,r,e,i,a)}function y4(t,e,i,n,r,a){let s=-e/i;for(let o=0;o<=i;o++){let l=s*o,c=Math.sin(l)*n,h=Math.cos(l)*r;t.addPoint(Zu(c,h))}return e<ZC?a>0?sk(t,n,r,a):t.addPoint(Zu(0,0)):(t.removePoint(t.points[t.points.length-1]),a>0&&ok(t,n,r,a)),1}function Zu(t,e){return new Vc(It.generateUUID(),new at(t,e))}function Mv(t,e,i,n,r,a){let s=Zu(t,e);return s.controls[0].position.set(i,n),s.controls[1].position.set(r,a),s}function sk(t,e,i,n){lk(t,e,i,n).forEach(r=>t.addPoint(r))}function ok(t,e,i,n){let r=lk(t,e,i,n),a=new ki;r.forEach(s=>a.addPoint(s)),a.isClosed=!0,t.shapeHoles.push(a)}function lk(t,e,i,n){let r=n*e/100,a=r*(Math.abs(i)/Math.abs(e)),s=new at(r/e,a/i),o=t.points.map(l=>{let c=l.clone();return c.uuid=It.generateUUID(),c}).reverse();return o.forEach(l=>{l.position.multiply(s);let c=l.controls[0].position.clone().multiply(s),h=l.controls[1].position.clone().multiply(s);l.controls[0].position.copy(h),l.controls[1].position.copy(c)}),o}var ZC,Kb,hk,zS,ck,Z_=k(()=>{Sh(),ek(),w$(),gh(),rt(),ZC=2*Math.PI,Kb=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return i.angle=It.clamp(i.angle,0,360),{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let e,{width:i,height:n,spikes:r,angle:a,innerRadius:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c}=t.parameters,h=t.shape,d=C$(h,.5*i,.5*n,a*Math.PI/180,r,s);return h.isClosed=!0,h.update(),a===0?(e=new Gt,e.setAttribute("position",new Ft([],3))):e=Mh.create({shape:h,parameters:{subdivisions:d,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c}}),Object.assign(e,{userData:{...t,type:"EllipseGeometry"}})}}}),_4=k(()=>{rt(),YF(),hk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:a,cornerSides:s}=t.parameters,o=r===0&&a!==0?new zS(.5*e,a,s):new oE(.5*e,r),l=i/e,c=n/e;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...t,type:"IcosahedronGeometry"}})}},zS=class extends q_{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r="IcosahedronGeometry";super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],r,t,e,i),this.type=r}static fromJSON(t){return new zS(t.radius,t.corner,t.cornerSides)}}}),b4=k(()=>{rt(),ck=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){(t.parameters?.points??[]).forEach(n=>{Array.isArray(n)&&(n.x=n[0],n.y=n[1])});let i=Object.assign({},e?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{points:e,segments:i,verticalSegments:n}=t.parameters,r=new wg;r.moveTo(e[0].x,e[0].y),r.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let a=new lE(r.extractPoints(n).shape,i);return a.rotateZ(Math.PI),Object.assign(a,{userData:{...t,type:"LatheGeometry"}})}}});function Fd(t,e){return Math.abs(e-t)/2+Math.min(t,e)}function P$(t){let{positions:e,faces:i,materialIndices:n,uvs:r}=t,a=e.length/3,s=i.length/3,o=r!==null&&s>0,l=3*s,c=new Uint32Array(l),h=new Uint32Array(l),d=new Uint32Array(l),u=new Uint32Array(l),p=new Uint32Array(l),f=0,g=8;for(;g<2*l;)g*=2;let m=g-1,y=new Int32Array(g).fill(-1),v=(D,I)=>{let U=(Math.imul(D,2654435761)^I)&m;for(;;){let N=y[U];if(N===-1)return y[U]=f,c[f]=D,h[f]=I,f++;if(c[N]===D&&h[N]===I)return N;U=U+1&m}},_=(D,I)=>{let U=D<I?D:I,N=D<I?I:D,G=(Math.imul(U,2654435761)^N)&m;for(;;){let H=y[G];if(c[H]===U&&h[H]===N)return H;G=G+1&m}},b=new Uint32Array(a),x=new Float64Array(3*a),w=(D,I,U)=>{let N=D<I?v(D,I):v(I,D),G=++d[N];G===1?u[N]=U:G===2&&(p[N]=U),b[D]++,b[I]++,x[3*D]+=e[3*I],x[3*D+1]+=e[3*I+1],x[3*D+2]+=e[3*I+2],x[3*I]+=e[3*D],x[3*I+1]+=e[3*D+1],x[3*I+2]+=e[3*D+2]};for(let D=0;D<s;D++){let I=i[3*D],U=i[3*D+1],N=i[3*D+2];w(I,U,N),w(U,N,I),w(N,I,U)}let S=new Float64Array(3*f);for(let D=0;D<f;D++){let I=3*c[D],U=3*h[D];if(d[D]===2){let N=3*u[D],G=3*p[D];S[3*D]=.375*(e[I]+e[U])+.125*(e[N]+e[G]),S[3*D+1]=.375*(e[I+1]+e[U+1])+.125*(e[N+1]+e[G+1]),S[3*D+2]=.375*(e[I+2]+e[U+2])+.125*(e[N+2]+e[G+2])}else S[3*D]=.5*(e[I]+e[U]),S[3*D+1]=.5*(e[I+1]+e[U+1]),S[3*D+2]=.5*(e[I+2]+e[U+2])}let T,E=new Float64Array(3*a);for(let D=0;D<a;D++){let I=b[D];I===3?T=3/16:I>3&&(T=3/(8*I));let U=1-I*Number(T),N=Number(T);I===2&&(U=3/4,N=1/8),E[3*D]=e[3*D]*U+x[3*D]*N,E[3*D+1]=e[3*D+1]*U+x[3*D+1]*N,E[3*D+2]=e[3*D+2]*U+x[3*D+2]*N}let P=new Float64Array(3*(a+f));P.set(E),P.set(S,3*a);let A=new Uint32Array(12*s),R=new Array(4*s),O=o?new Float64Array(24*s):null;for(let D=0;D<s;D++){let I=i[3*D],U=i[3*D+1],N=i[3*D+2],G=_(I,U)+a,H=_(U,N)+a,J=_(N,I)+a,K=12*D;A[K++]=G,A[K++]=H,A[K++]=J,A[K++]=I,A[K++]=G,A[K++]=J,A[K++]=U,A[K++]=H,A[K++]=G,A[K++]=N,A[K++]=J,A[K++]=H;let tt=n[D];if(R[4*D]=tt,R[4*D+1]=tt,R[4*D+2]=tt,R[4*D+3]=tt,O!==null){let ct=6*D,et=r[ct],st=r[ct+1],dt=r[ct+2],Y=r[ct+3],ht=r[ct+4],F=r[ct+5],B=Fd(et,dt),j=Fd(st,Y),Z=Fd(dt,ht),L=Fd(Y,F),W=Fd(et,ht),X=Fd(st,F),V=24*D;O[V++]=B,O[V++]=j,O[V++]=Z,O[V++]=L,O[V++]=W,O[V++]=X,O[V++]=et,O[V++]=st,O[V++]=B,O[V++]=j,O[V++]=W,O[V++]=X,O[V++]=dt,O[V++]=Y,O[V++]=Z,O[V++]=L,O[V++]=B,O[V++]=j,O[V++]=ht,O[V++]=F,O[V++]=W,O[V++]=X,O[V++]=Z,O[V++]=L}}return{positions:P,faces:A,materialIndices:R,uvs:O}}var Ev,dk,wn,uk,KC,D$=k(()=>{rt(),Ev=1e4,dk=class{constructor(t=1){this.subdivisions=t}modify(t){let e=function(n){let r=n.getAttribute("position");if(r===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let a=n.getAttribute("uv"),s=n.getIndex(),o=r.count,l=new Map,c=new Uint32Array(o),h=[],d=0;for(let v=0;v<o;v++){let _=r.getX(v),b=r.getY(v),x=r.getZ(v),w=Math.round(_*Ev),S=Math.round(b*Ev),T=Math.round(x*Ev),E=l.get(w);E===void 0&&(E=new Map,l.set(w,E));let P=E.get(S);P===void 0&&(P=new Map,E.set(S,P));let A=P.get(T);A===void 0&&(A=d++,P.set(T,A),h.push(_,b,x)),c[v]=A}let u=[],p=[],f=a===void 0?null:[],g=s!==null?s.count:o,m=(v,_)=>{let b=s!==null?s.getX(v):v,x=s!==null?s.getX(v+1):v+1,w=s!==null?s.getX(v+2):v+2;if(!(b<o&&x<o&&w<o))return;let S=c[b],T=c[x],E=c[w];S===T||T===E||E===S||(u.push(S,T,E),p.push(_),f!==null&&f.push(a.getX(b),a.getY(b),a.getX(x),a.getY(x),a.getX(w),a.getY(w)))},y=n.groups;if(y.length>0)for(let v=0;v<y.length;v++){let _=y[v],b=_.materialIndex===void 0?0:_.materialIndex,x=Math.max(_.start,0),w=Math.min(_.start+_.count,g);for(let S=x;S<w&&S+2<g;S+=3)m(S,b)}else for(let v=0;v+2<g;v+=3)m(v,0);return{positions:Float64Array.from(h),faces:Uint32Array.from(u),materialIndices:p,uvs:f===null?null:Float64Array.from(f)}}(t),i=this.subdivisions;for(;i-- >0;)e=P$(e);return function(n,r){let{positions:a,faces:s,materialIndices:o,uvs:l}=n,c=a.length/3,h=s.length/3,d=new Float64Array(3*c);for(let y=0;y<h;y++){let v=3*s[3*y],_=3*s[3*y+1],b=3*s[3*y+2],x=a[b]-a[_],w=a[b+1]-a[_+1],S=a[b+2]-a[_+2],T=a[v]-a[_],E=a[v+1]-a[_+1],P=a[v+2]-a[_+2],A=w*P-S*E,R=S*T-x*P,O=x*E-w*T;d[v]+=A,d[v+1]+=R,d[v+2]+=O,d[_]+=A,d[_+1]+=R,d[_+2]+=O,d[b]+=A,d[b+1]+=R,d[b+2]+=O}for(let y=0;y<c;y++){let v=d[3*y],_=d[3*y+1],b=d[3*y+2],x=Math.sqrt(v*v+_*_+b*b)||1;d[3*y]=v/x,d[3*y+1]=_/x,d[3*y+2]=b/x}let u=3*h,p=new Float32Array(3*u),f=new Float32Array(3*u),g=l!==null&&l.length>0?new Float32Array(2*u):null;for(let y=0;y<u;y++){let v=3*s[y];p[3*y]=a[v],p[3*y+1]=a[v+1],p[3*y+2]=a[v+2],f[3*y]=d[v],f[3*y+1]=d[v+1],f[3*y+2]=d[v+2]}g!==null&&g.set(l.subarray(0,2*u));let m=new Gt;m.setAttribute("position",new Ht(p,3)),u>0&&(m.setAttribute("normal",new Ht(f,3)),m.setAttribute("color",new Ht(new Float32Array(3*u).fill(1),3))),g!==null&&m.setAttribute("uv",new Ht(g,2));for(let y=0;y<h;){let v=o[y],_=y;do y++;while(y<h&&o[y]===v);m.addGroup(3*_,3*(y-_),v)}return r.boundingBox!==null&&(m.boundingBox=r.boundingBox.clone()),r.boundingSphere!==null&&(m.boundingSphere=r.boundingSphere.clone()),m}(e,t)}}}),x4=k(()=>{rt(),D$(),wn=new C,uk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,n=t.geometry??e?.geometry??new Gt().copy(new _s(100,100,100));e===void 0?(n.computeBoundingBox(),n.boundingBox.getSize(wn),i={width:wn.x,height:wn.y,depth:wn.z,subdivisions:0}):i=e.parameters;let r={...i,...t.parameters};return{parameters:{width:Math.abs(r.width),height:Math.abs(r.height),depth:Math.abs(r.depth),subdivisions:Math.abs(r.subdivisions)},geometry:n}}static build(t){let{width:e,height:i,depth:n,subdivisions:r}=t.parameters,a=t.geometry??new Gt().copy(new _s(100,100,100)),s=a.userData.parameters;s===void 0?(a.boundingBox=function(l){let c=new ci,h=l.attributes.position;return h?(c.setFromBufferAttribute(h),c):(c.makeEmpty(),c)}(a),a.boundingBox.getSize(wn)):wn.set(s.width,s.height,s.depth),(e!==wn.x||i!==wn.y||n!==wn.z)&&a.scale(wn.x===0?1:e/wn.x,wn.y===0?1:i/wn.y,wn.z===0?1:n/wn.z);let o=a.originalGeometry;try{r>0?(o===void 0||s?.subdivisions!==r)&&(o===void 0&&(o=a),a=new dk(r).modify(o)):(o!==void 0&&(a=o),o=void 0,a.getAttribute("normal")===void 0&&a.computeVertexNormals())}catch{o!==void 0&&(a=o),o=void 0,a.getAttribute("normal")===void 0&&a.computeVertexNormals()}return o!==void 0&&Object.assign(a,{originalGeometry:o}),delete t.geometry,Object.assign(a,{userData:{...t,type:"NonParametricGeometry"}})}static loadFromUrl(t,e,i){new rC(i).load(t,n=>{let r=this.normalizeInputs({geometry:n});n.boundingBox.getSize(wn);let a=100/wn.x;Object.assign(r.parameters,{width:100,height:wn.y*a,depth:wn.z*a}),e(this.build(r))})}}}),AA=k(()=>{Sh(),gh(),KC=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},t.parameters);return{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,spikes:n,cornerRadius:r,depth:a,extrudeBevelSize:s,extrudeBevelSegments:o}=t.parameters,l=t.shape,c=.5*e,h=.5*i,d=2*Math.PI/n;for(let p=0;p<n;p++){let f=d*p,g=0+Math.sin(f)*c,m=0+Math.cos(f)*h;l.addPoint(l.createPoint(g,m))}l.isClosed=!0;for(let p=0,f=l.points.length;p<f;p++)l.points[p].roundness=r;l.roundness=r,l.update();let u=Mh.create({shape:l,parameters:{roundness:r,depth:a,extrudeBevelSize:s,extrudeBevelSegments:o}});return Object.assign(u,{userData:{...t,type:"PolygonGeometry"}})}}});function If(t,e,i){i.x=t.x*e.x,i.y=t.y,i.z=t.x*e.y}function NS(t,e,i,n,r,a){let s=fk.copy(e).sub(t),o=mk.copy(i).sub(t),l=s.angleTo(o);if(s.normalize(),o.normalize(),n===r){let c=s.add(o).normalize();a.copy(t).addScaledVector(c,n/Math.sin(l/2))}else{let c=s.angleTo(o);a.copy(t),a.addScaledVector(s,r/Math.sin(c)),a.addScaledVector(o,n/Math.sin(c))}}function R$(t,e,i){let n=t.clone().sub(e),r=i.clone().sub(e);return n.projectOnVector(r),n.add(e)}var pk,fk,mk,w4,Qb,gk,vk,yk,S4,QC,_k,bk,xk,wk,M4=k(()=>{rt(),pk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,heightSegments:a,openEnded:s,cornerRadius:o,cornerSegments:l}=t.parameters,c=new w4(.5*e,i,r,a,s,o,l),h=n/e;return h!==1&&c.scale(1,1,h),Object.assign(c,{userData:{...t,type:"PyramidGeometry"}})}},fk=new C,mk=new C,w4=class extends Gt{constructor(t=.5,e=1,i=4,n=1,r=!1,a=0,s=4){super(),i=Math.floor(Math.max(3,i)),n=Math.floor(n),s=Math.floor(s);let o,l=[],c=[],h=[],d=[],u=0,p=e/2,f=Math.PI/i,g=t*Math.cos(Math.PI/i),m=2*Math.PI/i,y=(i-2)*Math.PI/i,v=Math.PI-y,_=new C(0,-p,0),b=new C(0,p,0),x=new at(t,-p),w=new at(g,-p),S=new at(0,b.y).sub(w),T=new at(0,b.y).sub(x),E=new at(S.y,-S.x).normalize(),P=new at(T.y,-T.x).normalize(),A=t*Math.cos(Math.PI/i)*Math.tan((Math.PI-S.angle())/2)-1e-8;a=Math.min(a,A);{let G=new C(E.x,E.y,0),H=new C(Math.cos(m)*G.x,G.y,Math.sin(m)*G.x);o=G.angleTo(H)}let R=a/Math.tan((Math.PI-S.angle())/2),O=a/Math.tan((Math.PI-o)/2),D=new C;if(!r){c.push(_.x,_.y,_.z),h.push(0,-1,0),d.push(0,0);let G=u++,H=[],J=x.clone(),K=R/Math.cos(Math.PI/i);J.x-=K;for(let tt=0;tt<i;tt++){let ct=tt/i*Math.PI*2+f;If(J,new at(Math.sin(ct),Math.cos(ct)),D),c.push(D.x,D.y,D.z),h.push(0,-1,0),d.push(0,0),H.push(u++)}for(let tt=0;tt<H.length;tt++)l.push(H[tt],G,H[(tt+1)%H.length])}let I=[];{let G=new C,H=new C,J=new C,K=new C,tt=new C,ct=new C;for(let et=0;et<i;et++){let st=et/i*Math.PI*2+f,dt=(et+.5)/i*Math.PI*2+f,Y=(et+1)/i*Math.PI*2+f,ht=new at(Math.sin(st),Math.cos(st)),F=new at(Math.sin(dt),Math.cos(dt)),B=new at(Math.sin(Y),Math.cos(Y));If(x,ht,H),If(x,B,J),If(E,F,G),NS(b,H,J,O,O,K),c.push(K.x,K.y,K.z),NS(H,b,J,O,R,tt),c.push(tt.x,tt.y,tt.z),NS(J,H,b,R,O,ct),c.push(ct.x,ct.y,ct.z),h.push(G.x,G.y,G.z),h.push(G.x,G.y,G.z),h.push(G.x,G.y,G.z),d.push(0,0),d.push(0,0),d.push(0,0);let j=u++,Z=u++,L=u++;if(l.push(j,Z,L),a>0){{let V=H.clone().add(J).multiplyScalar(.5),nt=b.clone().sub(V).normalize(),lt=_.clone().sub(V).normalize().add(nt).normalize().multiplyScalar(-1);U(V,ct.clone().sub(tt),lt,S.angle())}let W,X;{let V=new C;If(P,B,V);let nt=ct.clone().add(K).multiplyScalar(.5);nt=R$(nt,J,b);let lt=ct.clone().sub(K);[W,X]=U(nt,lt,V,o,K.y)}{let V=W,nt=V.clone().setY(0).normalize(),lt=new C(0,-1,0),ft=nt.clone().cross(lt);N(V,nt,lt,ft)}I.concat(X);{let V=S.angle(),nt=Math.PI-V,lt=b.clone();lt.y-=a/Math.sin(V-Math.PI/2);let ft=new C,pt=[];for(let bt=0;bt<s;bt++){let Rt=[],_t=Math.PI/2-nt*bt/s,$=Math.cos(_t),vt=Math.sin(_t),Dt=dt;for(let jt=0;jt<=bt;jt++){let Nt=Math.cos(Dt),_e=Math.sin(Dt);G.x=$*_e,G.y=vt,G.z=$*Nt,ft.copy(lt).addScaledVector(G,a),c.push(ft.x,ft.y,ft.z),h.push(G.x,G.y,G.z),d.push(0,0),Rt.push(u++),Dt+=2*Math.PI/bt/i}pt.push(Rt)}X.reverse(),pt.push(X);let Pt=pt.length-1;for(let bt=0;bt<Pt;bt++){let Rt=pt[bt],_t=pt[bt+1],$=Rt.length-1;l.push(_t[1],Rt[0],_t[0]);for(let vt=1;vt<=$;vt++)l.push(Rt[vt],Rt[vt-1],_t[vt]),l.push(_t[vt+1],Rt[vt],_t[vt])}}}}}function U(G,H,J,K,tt){let ct=-K/2,et=(Math.PI-K)/2,st=H.clone().normalize().cross(J);G.addScaledVector(J,-a/Math.sin(et));let dt=new C,Y=new C,ht=u,F=[];for(let B=0;B<=s;B++){let j=ct+B/s*K;Y.set(0,0,0),Y.addScaledVector(st,Math.sin(j)),Y.addScaledVector(J,Math.cos(j));for(let Z=0;Z<=1;Z++){let L=Z/1-.5;if(dt.copy(G),dt.addScaledVector(H,L),dt.addScaledVector(Y,a),tt!=null){let W=Math.max(0,dt.y-tt);dt.addScaledVector(H,-W/H.y)}c.push(dt.x,dt.y,dt.z),h.push(Y.x,Y.y,Y.z),d.push(0,0),Z===0&&F.push(u),u++}}for(let B=0;B<s;B++)for(let j=0;j<1;j++){let Z=ht+j+2*B,L=Z+2,W=L+1,X=Z+1;l.push(Z,L,X),l.push(L,W,X)}return[G.clone().addScaledVector(H,.5),F]}function N(G,H,J,K){let tt=Math.PI/2,ct=T.angle()-tt,et=[],st=new C,dt=new C;for(let ht=0;ht<=s;ht++){let F=[],B=ht/s;for(let j=0;j<=ht;j++){let Z=((ht?j/ht:0)-.5)*v,L=Math.cos(Z),W=Math.sin(Z),X=(tt+Math.atan(Math.tan(ct)*L))*B,V=Math.cos(X),nt=Math.sin(X);st.set(0,0,0),st.addScaledVector(H,nt*L),st.addScaledVector(J,V),st.addScaledVector(K,nt*W),dt.copy(G).addScaledVector(st,a),c.push(dt.x,dt.y,dt.z),h.push(st.x,st.y,st.z),d.push(0,0),F.push(u++)}et.push(F)}let Y=et.length-1;for(let ht=0;ht<Y;ht++){let F=et[ht],B=et[ht+1],j=F.length-1;l.push(F[0],B[1],B[0]);for(let Z=1;Z<=j;Z++)l.push(F[Z-1],F[Z],B[Z]),l.push(F[Z],B[Z+1],B[Z])}}this.setIndex(l),this.setAttribute("position",new Ft(c,3)),this.setAttribute("normal",new Ft(h,3)),this.setAttribute("uv",new Ft(d,2))}}}),K_=k(()=>{Sh(),gh(),Qb=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters),n=Object.assign(e?.ui??{enabledIndieCorners:!1},t.ui);return{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)}),ui:n}}static build(t){let e=t.shape,{width:i,height:n,cornerRadius:r,cornerType:a,depth:s,extrudeBevelSize:o,extrudeBevelSegments:l}=t.parameters,c={x:.5*i,y:.5*n},h={x:-c.x,y:-c.y},d={x:c.x,y:c.y};function u(b,x,w){return x>i&&w>n?Math.min(b*i/x,b*n/w):x>i?b*i/x:w>n?b*n/w:b}let p=[];p[0]=r[0]===0?0:u(r[0],r[0]+r[3],r[0]+r[1]),p[1]=r[1]===0?0:u(r[1],r[1]+r[2],r[1]+r[0]),p[2]=r[2]===0?0:u(r[2],r[2]+r[1],r[2]+r[3]),p[3]=r[3]===0?0:u(r[3],r[3]+r[0],r[3]+r[2]);let f=h.x,g=d.x,m=d.y,y=h.y;e.addPoint(e.createPoint(f,m)),e.addPoint(e.createPoint(g,m)),e.addPoint(e.createPoint(g,y)),e.addPoint(e.createPoint(f,y)),e.isClosed=!0;let v=!0;for(let b=0,x=e.points.length;b<x;b++)e.points[b].roundness=p[b],b>0&&p[b]!==p[b-1]&&(v=!1);v&&(e.roundness=p[0]),e.useCubicForRoundedCorners=a!==1,e.update();let _=Mh.create({shape:e,parameters:{depth:s,extrudeBevelSize:o,extrudeBevelSegments:l}});return Object.assign(_,{userData:{...t,type:"RectangleGeometry"}})}}}),E4=k(()=>{rt(),gk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},t.parameters);return i.thetaLength=It.clamp(i.thetaLength,0,180),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i=100,height:n=i,depth:r=i,widthSegments:a=64,heightSegments:s=64,phiStart:o,phiLength:l,thetaStart:c,thetaLength:h}=t.parameters;return h===0?(e=new Gt,e.setAttribute("position",new Ft([],3))):e=new lh(.5*i,a,s,o,l,c,h*It.DEG2RAD),e.scale(1,n/i,r/i),Object.assign(e,{userData:{...t,type:"SphereGeometry"}})}}}),A4=k(()=>{rt(),vk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(t){let{width:e=100,height:i=e,widthSegments:n=8,heightSegments:r=8}=t.parameters,a=new co(e,i,n,r);return a.scale(1,1,1),Object.assign(a,{userData:{...t,type:"PlaneGeometry"}})}}}),T4=k(()=>{rt(),yk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,angle:r,cornerRadius:a,cornerSegments:s}=t.parameters,o=new S4(e,i,n,r,a,s);return Object.assign(o,{userData:{...t,type:"BackdropGeometry"}})}},S4=class extends Gt{constructor(t=1,e=1,i=1,n=90,r=10,a=24){super(),this.type="BackdropGeometry";let s=[],o=[],l=[],c=.001;r==0&&(a=1),a=Math.max(1,Math.floor(a)),r=Math.min(r,100),n=Math.min(180-c,n),n*=Math.PI/180;let h=[],d=Math.PI/2,u=(dt=0,Y=0,ht=0)=>new C(dt,Y,ht),p=u(),f=u(),[g,m,y]=[e/2,t/2,i/2],v=-m,_=+m,[b,x,w]=[u(v,-g,+y),u(v,-g,-y),u(v,+g,-y)],S=(dt,Y=!1)=>Math.sin(dt-Math.PI/(+Y+1)),T=(dt,Y=!1)=>Math.cos(dt-Math.PI/(+Y+1));w.y=Math.sin(n)*e-g;let E=Math.cos(n)*e-y,P=b.z-c;n<=d?(w.z=Math.min(E,P),w.z==P&&(w.y-=(E-P)/Math.tan(d-n))):x.z=Math.min(x.z-E-y,b.z-c),p.subVectors(b,x),f.subVectors(w,x);let A=Math.min(p.length(),f.length())*r/100,R=A*Math.tan(n/2),O=A/Math.cos(n/2),D=p.clone().normalize().add(f.normalize()).setLength(O).add(x);p.set(0,S(n,!0),T(n,!0)),h.push([w,p.clone()]);let I=(Math.PI-n)/a;for(let dt=0;dt<=a;dt++){let Y=d+n+dt*I;p.set(0,Math.sin(Y)*R,Math.cos(Y)*R),p.add(D),f.set(0,S(Y),T(Y)),h.push([p.clone(),f.clone()])}h.push([b,u(0,1,0)]);let U=Math.sin(I/2)*R*2,N=h.length-1,G=h[0][0].distanceTo(h[1][0]),H=G+U*a+h[N-1][0].distanceTo(h[N][0]);h[0].push(1);for(let dt=0;dt<=a;dt++)h[dt+1].push(1-(G+dt*U)/H);h[N].push(0);let J,K,tt,[ct,et,st]=h[0];for(let dt=1;dt<h.length;dt++)[J,K,tt]=h[dt],s.push(v,ct.y,ct.z,v,J.y,J.z,_,ct.y,ct.z,_,ct.y,ct.z,v,J.y,J.z,_,J.y,J.z),o.push(0,et.y,et.z,0,K.y,K.z,0,et.y,et.z,0,et.y,et.z,0,K.y,K.z,0,K.y,K.z),l.push(0,st,0,tt,1,st,1,st,0,tt,1,tt),[ct,et,st]=[J,K,tt];this.setAttribute("position",new Ft(s,3)),this.setAttribute("normal",new Ft(o,3)),this.setAttribute("uv",new Ft(l,2))}}}),TA=k(()=>{Sh(),gh(),QC=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,innerRadiusPercent:n,spikes:r,cornerRadius:a,angle:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c}=t.parameters,h=t.shape,d=.5*e,u=.5*i,p=s*Math.PI/360/r,f=Math.PI/2*3*-1,g=d*n/100,m=u*n/100;if(r===3&&n===50){p=2*Math.PI/r;for(let v=0;v<r;v++){let _=p*v,b=0+Math.sin(_)*d,x=0+Math.cos(_)*u;h.addPoint(h.createPoint(b,x))}}else for(let v=0;v<r;v++){let _=0+Math.cos(f)*d,b=0+Math.sin(f)*u;h.addPoint(h.createPoint(_,b)),f+=p,_=0+Math.cos(f)*g,b=0+Math.sin(f)*m,h.addPoint(h.createPoint(_,b)),f+=p}h.isClosed=!0;for(let v=0,_=h.points.length;v<_;v++)h.points[v].roundness=a;h.roundness=a,h.update();let y=Mh.create({shape:h,parameters:{roundness:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(y,{userData:{...t,type:"StarGeometry"}})}}}),C4=k(()=>{rt(),_k=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i}=t.parameters,n=new co(e,i);return Object.assign(n,{userData:{...t,type:"TextFrameGeometry"}})}}}),P4=k(()=>{rt(),Og(),bk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??i.width);i.shapeBlendNode&&(r=n);let a=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:n,height:r,depth:a})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,tubularSegments:a,arc:s,cornerRadius:o,cornerSegments:l}=t.parameters,c=function(h,d,u,p,f,g,m,y,v,_,b){[d,u]=[u,d],m=d/2;let x=It.clamp(f/360,0,1);if(x===0){let w=new Gt;return w.setAttribute("position",new Ft([],3)),w}return x===1&&(_=0),new pA(!0,h,d,u,p,x,g,m,0,v,_,b)}(e,i,n,.5*e,s,a,0,0,r,o,l);return c.scale(1,i/e,1),Object.assign(c,{userData:{...t,type:"TorusGeometry"}})}}}),D4=k(()=>{rt(),xk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),tube:i.tube??.125*i.width})}}static build(t){let{width:e,tube:i,tubularSegments:n,radialSegments:r,p:a,q:s}=t.parameters,o=.5*e;o!==i&&(o-=i);let l=new hE(o,i,n,r,a,s);return Object.assign(l,{userData:{...t,type:"TorusKnotGeometry"}})}}}),R4=k(()=>{Sh(),gh(),wk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},t.parameters);return{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width*(i.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e=100,height:i,cornerRadius:n,depth:r,extrudeBevelSize:a,extrudeBevelSegments:s,isRect:o}=t.parameters,l=t.shape,c=.5*e,h=.5*i;o?(l.addPoint(l.createPoint(-c,h)),l.addPoint(l.createPoint(c,-h)),l.addPoint(l.createPoint(-c,-h))):(l.addPoint(l.createPoint(0,h)),l.addPoint(l.createPoint(c,-h)),l.addPoint(l.createPoint(-c,-h))),l.isClosed=!0;for(let u=0,p=l.points.length;u<p;u++)l.points[u].roundness=n;l.roundness=n,l.update();let d=Mh.create({shape:l,parameters:{roundness:n,depth:r,extrudeBevelSize:a,extrudeBevelSegments:s}});return Object.assign(d,{userData:{...t,type:"TriangleGeometry"}})}}}),O$=k(()=>{}),I$=k(()=>{rt(),new vr,new At,new Zo,new C,new C,new C,new C});function O4(){let t=new Gt;return t.setAttribute("position",new Ht(new Float32Array([]),3)),t.setIndex(new Ht(new Uint16Array([]),1)),t}var I4,CA,Sk=k(()=>{sr(),te(),Mp(),rt(),Wg(),Sh(),gh(),I4=O4().attributes,CA=class extends Gt{constructor(t,e){super(),this.isTextGeometry=!0,this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],Object.assign(this.attributes,I4),this.userData={parameters:t,type:"TextGeometry"};let i=e.getFont(t.font);i?.isLoaded?(this.font=i,this.update(t,e)):this.updateFont(t.font,e).then(()=>{this.update(t,e),e?.requestRender()})}async updateFont(t,e){let i=e.getFont(t);i&&(this.font=i,await i.loadingPromise)}update(t,e){let i=this.font;if(this.userData={parameters:t,type:"TextGeometry"},!i?.isLoaded)return void console.warn("Cannot update text because its font is not loaded");let{width:n,height:r,depth:a,extrudeBevelSize:s,extrudeBevelSegments:o,text:l,textTransform:c}=t,h=br.getDisplayedValue(l),d=function(b,x,w,S){let T=typeof b.width=="string"?Number(S.getVariable(b.width)):b.width,E=[""],P="";for(let A of w)P+=A,A===" "||A===`
|
|
4168
4168
|
`?(E[E.length-1]+=P,P="",A===`
|
|
4169
|
-
`&&E.push("")):x.getTextWidth(E[E.length-1]+P,b)>T&&(E[E.length-1].length&&E.push(""),x.getTextWidth(E[E.length-1]+P,b)>T&&(P.length===1?(E[E.length-1]+=P,P=""):(E[E.length-1]+=P.slice(0,-1),P=P[P.length-1],E.push(""))));return E[E.length-1]+=P,E}(t,i,c===2?h.toUpperCase():c===3?h.toLowerCase():h,e),{shapes:u,charWidths:p,charCoords:f}=i.generateShapes(d,t,e),g=.5*(typeof n=="number"?n:Number(e.getVariable(n))),m=.5*(typeof r=="number"?r:Number(e.getVariable(r))),y=u.map(b=>new ki().fromShape(b,!0));this.vectorShapes=y;let v=y.map(b=>Mh.create({shape:b,parameters:{depth:a,extrudeBevelSegments:o,extrudeBevelSize:s,windingRule:a<=0?fi.NONZERO:fi.ODD,subdivisions:this.isLowResolution&&a>0?1:12}})),_=v.length?Pc(v):O4();_.translate(-g,m,0),this.dispose(),this.wrappedText=d,this.charCoords=f,this.charWidths=p,this.deleteAttribute("extrudeNormal"),Object.entries(_.attributes).forEach(([b,x])=>{this.setAttribute(b,x)}),this.setIndex(_.index),this.computeBoundingSphere()}clone(){let t=ea(new Gt,CA.prototype);return t.copy(this),console.log("CloneGeometry",this,t),t}copy(t){return Object.entries(t.attributes).forEach(([e,i])=>{this.setAttribute(e,i)}),this.setIndex(t.index),this.userData={parameters:{...t.userData.parameters},type:"TextGeometry"},this}async setText(t,e){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:t}},e)}get text(){return this.userData.parameters.text??""}}});function L$(t){if(!PA)return L4||(L4=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.12/build",i=import("./process.js"),[n,r]=await Promise.all([i,fetch(`${e}/process.wasm`).then(o=>o.arrayBuffer())]),a=n.default,s=await a({wasmBinary:r});Mk(s),PA=!0}())}var Mk,JC,PA,L4,Jb=k(()=>{JC=new Promise(t=>{Mk=t}),PA=!1});function FS(t,e){if(Object.keys(t.morphAttributes).length>0||Object.keys(e.morphAttributes).length>0)return!1;let i=Object.keys(t.attributes),n=Object.keys(e.attributes);if(i.length!==n.length)return!1;for(let o of n){let l=t.attributes[o],c=e.attributes[o];if(l===void 0||l.isInterleavedBufferAttribute===!0||c.isInterleavedBufferAttribute===!0||l.itemSize!==c.itemSize||l.normalized!==c.normalized||l.array.constructor!==c.array.constructor||l.array.length!==c.array.length)return!1}let r=t.index,a=e.index;if(r===null!=(a===null))return!1;let s=!1;if(r!==null&&a!==null){if(r.array.length!==a.array.length)return!1;let o=r.array.constructor,l=a.array.constructor;if(o!==l){if(o!==Uint32Array||l!==Uint16Array)return!1;s=!0}}if(t.groups.length!==e.groups.length)return!1;for(let o=0;o<e.groups.length;o++){let l=t.groups[o],c=e.groups[o];if(l.start!==c.start||l.count!==c.count||l.materialIndex!==c.materialIndex)return!1}for(let o of n){let l=t.attributes[o],c=e.attributes[o];l.array.set(c.array),l.needsUpdate=!0}if(r!==null&&a!==null){if(s){let o=r.array,l=a.array;for(let c=0,h=l.length;c<h;c++){let d=l[c];o[c]=d===65535?4294967295:d}}else r.array.set(a.array);r.needsUpdate=!0}return t.drawRange.start=e.drawRange.start,t.drawRange.count=e.drawRange.count,t.userData=e.userData,t.boundingBox=null,t.boundingSphere=null,!0}function DA(t,e,i,n){let r,a,s,o=t.position.array,l=t.normal.array,c=Ek.makeScale(e,i,n).invert().elements;for(let h=0,d=o.length;h<d;h+=3)o[h]*=e,o[h+1]*=i,o[h+2]*=n,r=l[h],a=l[h+1],s=l[h+2],l[h]=c[0]*r+c[4]*a+c[8]*s,l[h+1]=c[1]*r+c[5]*a+c[9]*s,l[h+2]=c[2]*r+c[6]*a+c[10]*s;t.position.needsUpdate=!0,t.normal.needsUpdate=!0}var Ek,Ak=k(()=>{rt(),Ek=new At});function Tk(t){let e=Object.keys(t);return e.length===1&&e[0]==="subdivisions"}function t3(t,e){let i=e?e.count:t.count,n=0,r=1e4,a=new Map,s=new Uint32Array(i),o=[];for(let h=0;h<i;h++){let d=e?e.getX(h):h,u=t.getX(d),p=t.getY(d),f=t.getZ(d),g=Math.round(u*r),m=Math.round(p*r),y=Math.round(f*r),v=a.get(g);v===void 0&&(v=new Map,a.set(g,v));let _=v.get(m);_===void 0&&(_=new Map,v.set(m,_));let b=_.get(y);b===void 0&&(b=n++,_.set(y,b),o.push(u,p,f)),s[h]=b}let l=[],c=[];for(let h=0;h<s.length;h+=3)s[h]===s[h+1]||s[h]===s[h+2]||s[h+1]===s[h+2]||(l.push(s[h],s[h+1],s[h+2]),c.push(e?e.getX(h):h,e?e.getX(h+1):h+1,e?e.getX(h+2):h+2));return{positions:o,triIndices:l,triOriginals:c}}var Lf,ic,Qt,kS,VS,jS,Fi,Bf,Av,Tv,Cv,RA,h1,Ep=k(()=>{rt(),Jb(),te(),tx(),Ak(),Og(),Lf=new ci,ic=new C,JC.then(t=>{Qt=t}),kS=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),VS=new Uint32Array([0,1,2,3]),jS=new Uint8Array([4]),Fi=class extends Gt{constructor(t,e){super(),this.data=t,this.flatShading=e,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(t,e){this.freeSubdivPointer();let i=this.data.scaleBaked.map(s=>typeof s=="number"?s:1),n=ch.div(e.map(s=>typeof s=="number"?s:0),i);if(n.every(s=>s===1))return;this.subdividedGeometry&&DA(this.subdividedGeometry.attributes,...n),this.originalGeometry&&DA(this.originalGeometry.attributes,...n),this.data=t;let r=this.userData.parameters;this.userData.parameters={width:r.width*n[0],height:r.height*n[1],depth:r.depth*n[2]},this.originalGeometry.boundingSphere.center.multiply(ic.fromArray(n));let a=ic.set(r.width,r.height,r.depth).length();this.originalGeometry.boundingSphere.radius=a/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(t){this.freeSubdivPointer(),this.data=t;let e=t.phongAngle??35;this.flatShading&&(e=-1);let i=null;if(t.subdivisions>0){let r=0;try{r=Fi.allocate(t),i=Fi.buildRefined(r,t.subdivisions,e)}catch(a){console.error(a,t)}finally{r&&Fi.freeSubdivPointer(r)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let n=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=n}rebuild(){let t,e,i;try{({originalGeometry:t,subdividedGeometry:e,subdivPointer:i}=Fi.build(this.data,void 0,!this.flatShading,void 0))}catch{t=new _s(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=t,this.subdividedGeometry=e??void 0;let n=this.subdividedGeometry??this.originalGeometry;Object.assign(this,n),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Fi.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;Lf.setFromBufferAttribute(e),Lf.getCenter(i),t.boundingSphere.radius=i.distanceTo(Lf.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Lf.getSize(ic);let n={width:ic.x,height:ic.y,depth:ic.z};return this.userData.parameters=n,n}static build(t,e,i,n){let r,a,s=t?.phongAngle??35;i===!1&&(s=-1),e&&(Qt.free_bvh(e),Qt.free_subdivision_surface(e));try{r=Fi.allocate(t,n)}catch(l){console.error(l,t),r=Fi.allocate({positionWASM:kS,indexWASM:VS,verticesPerFaceWASM:jS},n)}Qt.set_destination_refinement_level(r,0);let o=Fi.buildLevel(r,!0,s);return a=t.subdivisions>0?Fi.buildRefined(r,t.subdivisions,s):null,{subdivPointer:r,originalGeometry:o,subdividedGeometry:a}}static buildRefined(t,e,i){try{return Qt.set_destination_refinement_level(t,e),Fi.buildLevel(t,!1,i)??null}catch{try{return Qt.set_destination_refinement_level(t,e-1),Fi.buildLevel(t,!1,i)??null}catch{return null}}}static primitiveToQuads(t,e,i){t.widthSegments>16&&(t.widthSegments=16),t.heightSegments>16&&(t.heightSegments=16),t.depthSegments>16&&(t.depthSegments=16),t.radialSegments>16&&(t.radialSegments=16),t.type==="DodecahedronGeometry"&&(t.detail=0);let n,r=t.shape!==void 0||t.path!==void 0?e.geometry:ih(t,i,!1,e);n=PF(t)?r.getClosedTorusIndicesForBooleanOrSubdiv():r.getIndex();let a,{positions:s,triIndices:o,triOriginals:l}=t3(r.getAttribute("position"),n);if(t.type==="CylinderGeometry"&&t.cornerRadius===0&&t.hollow===0&&t.openEnded===!1){let u=t.radialSegments*t.heightSegments*3*2;a=[u,u+3*t.radialSegments]}let{indices:c,verticesPerFace:h,uvs:d}=function(u,p,f,g,m){let y=[],v=[],_=m?f.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=T=>{if(b){let E=m[T];b.push(_.getX(E),_.getY(E))}};if(f.userData.shape!==void 0&&f.userData.parameters.depth===0&&f.userData.shape.shapeHoles.length===0){let T=f.userData.shape.extractShapePointsToFlatArray([]),E=f.userData.parameters.spikes;if(f.userData.type==="EllipseGeometry"&&E<=24&&E%4==0&&f.userData.parameters.angle>=360){let R=T.length/2/E;T=T.filter((O,D)=>Math.floor(D/2)%R===0)}let P=0;for(let R=0;R<T.length;R+=2)P+=(T[R]-T[(R===0?T.length:R)-2])*(T[R+1]+T[(R===0?T.length:R)-1]);u.length=0;let A=0;if(P<0)for(let R=0;R<T.length;R+=2)u.push(T[R],T[R+1],0),y.push(A++);else for(let R=T.length-2;R>=0;R-=2)u.push(T[R],T[R+1],0),y.push(A++);return v.push(A),{indices:y,verticesPerFace:v}}let w=new Float32Array([f.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(f.useNgonForTopBottomFaceDuringBake){let T=0;if((u[3*p[S]+2]===w||u[3*p[S]+2]===0)&&T++,(u[3*p[S+1]+2]===w||u[3*p[S+1]+2]===0)&&T++,(u[3*p[S+2]+2]===w||u[3*p[S+2]+2]===0)&&T++,T===3)break}if(p[S+1]===p[S+3]&&p[S+2]===p[S+5]||p[S+0]===p[S+3]&&p[S+2]===p[S+4]){Bf.set(u[3*p[S]],u[3*p[S]+1],u[3*p[S]+2]),Av.set(u[3*p[S+1]],u[3*p[S+1]+1],u[3*p[S+1]+2]),Tv.set(u[3*p[S+4]],u[3*p[S+4]+1],u[3*p[S+4]+2]),Cv.set(u[3*p[S+5]],u[3*p[S+5]+1],u[3*p[S+5]+2]),Av.sub(Bf).normalize(),Tv.sub(Bf).normalize(),Cv.sub(Bf).normalize();let T=Av.cross(Tv).dot(Cv),E=S;Math.abs(T)>.005||g&&g.some((P,A)=>A%2!=1&&E>=g[A]&&E<g[A+1])?(y.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),v.push(3),S+=3):(y.push(p[S],p[S+1],p[S+4],p[S+5]),x(S),x(S+1),x(S+4),x(S+5),v.push(4),S+=6)}else y.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),v.push(3),S+=3}if(f.useNgonForTopBottomFaceDuringBake){let T=[],E=[],P=0;for(let A=0,R=0;A<u.length;A+=3,R++)u[A+2]===0&&(T.push(R),P++),u[A+2]===w&&E.push(R);if(f.userData.parameters.extrudeBevelSize===0){let A=E[0];E[0]=E[1],E[1]=A}T.reverse(),y.push(...T,...E),v.push(P,P),b=void 0}return{indices:y,verticesPerFace:v,uvs:b}}(s,o,r,a,l);return{positions:s,indices:c,verticesPerFace:h,uvs:d}}static allocate(t,e){let i,n,r,a=[],s=[];t.positionWASM&&t.positionWASM.length>0?(i=t.positionWASM,n=t.indexWASM,r=t.verticesPerFaceWASM,Qt.alloc_subdivision_surface_uvs&&t.uvWASM&&t.uvWASM.length===2*n.length&&(s=t.uvWASM)):(i=kS,n=VS,r=jS);let o,l=i.length,c=n.length,h=r.length,d=i.length+a.length+s.length,u=n.length+r.length,p=d*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,f=d*Float32Array.BYTES_PER_ELEMENT,g=Qt._malloc(p),m=new Float32Array(Qt.HEAPF32.buffer,g,d),y=new Uint32Array(Qt.HEAPU32.buffer,g+f,u);m.set(i,0),m.set(a,i.length),m.set(s,i.length+a.length),y.set(n,0),y.set(r,n.length),t?.scaleBaked?.some(b=>b!==1)&&(o=new At().makeScale(...t.scaleBaked.map(b=>typeof b=="number"?b:1))),e&&(o?o.premultiply(e):o=e);let v=g+(i.length+a.length)*Float32Array.BYTES_PER_ELEMENT,_=s.length?o?Qt.alloc_subdivision_surface_uvs2(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h,v,s.length,o.elements):Qt.alloc_subdivision_surface_uvs(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h,v,s.length):o?Qt.alloc_subdivision_surface2(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h,o.elements):Qt.alloc_subdivision_surface(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h);return Qt._free(g),_}static buildLevel(t,e,i,n,r,a=!1){let s=r?Qt.get_mesh_data2(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i,r.elements):Qt.get_mesh_data(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i),o=Qt.HEAPU32.subarray(s>>2,10+(s>>2)),l=o.subarray(4,8),c=0,h=Qt.HEAPU32[o[c]>>2],d=Qt.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let u=Qt.HEAPU32[o[c]>>2],p=Qt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let f=Qt.HEAPU32[o[c]>>2],g=Qt.HEAPU32.subarray(f>>2,(f>>2)+l[c]);c++;let m,y=Qt.HEAPU32[o[c]>>2],v=Qt.HEAPU32.subarray(y>>2,(y>>2)+l[c]);if(c++,Qt.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=Qt.HEAPU32[o[8]>>2];m=Qt.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(n===void 0){let b=new Gt;if(b.setIndex(new oh(v,1)),b.setAttribute("position",new Ft(d,3)),b.setAttribute("normal",new Ft(p,3)),m&&b.setAttribute("uv",new Ft(m,2)),e){b.setAttribute("faceMap",new oh(g,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new Ht(x,4))}return Qt.free_mesh_data(s),b.userData.type="SubdivGeometry",b}if(n.getAttribute("position").copyArray(d),n.getAttribute("normal").copyArray(p),n.attributes.position.needsUpdate=!0,n.attributes.normal.needsUpdate=!0,a){let b=n.getIndex();b!==null&&b.array.length===v.length&&(b.copyArray(v),b.needsUpdate=!0)}let _=n.getAttribute("uv");m&&_&&_.array.length===m.length&&(_.copyArray(m),_.needsUpdate=!0),Qt.free_mesh_data(s)}static freeSubdivPointer(t){Qt.free_bvh(t),Qt.free_subdivision_surface(t)}static buildControlCageWireframe(t,e,i){let n=Qt.get_wireframe_data_for_base_level(t),r=Qt.HEAPU32.subarray(n>>2,4+(n>>2)),a=r.subarray(2,4),s=0,o=Qt.HEAPU32[r[s]>>2],l=Qt.HEAPF32.subarray(o>>2,(o>>2)+a[s]);s++;let c=Qt.HEAPU32[r[s]>>2],h=Qt.HEAPU32.subarray(c>>2,(c>>2)+a[s]);if(e===void 0){let d=new Gt;d.setAttribute("position",new Ft(l,3));let u=new Float32Array(l.length);for(let p=0,f=l.length;p<f;)u[p++]=i.r,u[p++]=i.g,u[p++]=i.b;return d.setAttribute("color",new Ht(u,3)),d.setIndex(new oh(h,1)),Qt.free_wireframe_data_for_base_level(n),d}e.getAttribute("position").copyArray(l),e.attributes.position.needsUpdate=!0,Qt.free_wireframe_data_for_base_level(n)}static updateCollabMesh(t,e,i){let n=e===0;n||Qt.set_destination_refinement_level(t,e);let r=i?Qt.get_topological_data2(t,n?Qt.Level.CONTROL:Qt.Level.REFINED,i.elements):Qt.get_topological_data(t,n?Qt.Level.CONTROL:Qt.Level.REFINED),a=Qt.HEAPU32.subarray(r>>2,8+(r>>2)),s=a.subarray(3,6),o=0,l=Qt.HEAPU32[a[o]>>2],c=new Float32Array(Qt.HEAPF32.subarray(l>>2,(l>>2)+s[o]));o++;let h=Qt.HEAPU32[a[o]>>2],d=new Uint32Array(Qt.HEAPU32.subarray(h>>2,(h>>2)+s[o]));o++;let u,p=Qt.HEAPU32[a[o]>>2],f=new Uint8Array(Qt.HEAPU32.subarray(p>>2,(p>>2)+s[o]));if(Qt.alloc_subdivision_surface_uvs){let g=a[7];if(g>0){let m=Qt.HEAPU32[a[6]>>2];u=new Float32Array(Qt.HEAPF32.subarray(m>>2,(m>>2)+g))}}return Qt.free_topological_data(r),{positions:c,indices:d,verticesPerFace:f,uvs:u}}},Bf=new C,Av=new C,Tv=new C,Cv=new C}),Ck=k(()=>{i4(),n4(),X_(),r4(),Z_(),Og(),_4(),b4(),x4(),AA(),M4(),K_(),E4(),A4(),T4(),TA(),C4(),P4(),D4(),R4(),gh(),ke(),i4(),n4(),X_(),r4(),Z_(),O$(),Og(),_4(),b4(),x4(),AA(),M4(),K_(),E4(),A4(),T4(),TA(),C4(),P4(),D4(),R4(),gh(),I$(),ak(),Sk(),Ep(),Jb(),Zb(),RA={ConeGeometry:qF,CubeGeometry:XF,CylinderGeometry:$C,DodecahedronGeometry:$F,EllipseGeometry:Kb,HelixGeometry:DF,IcosahedronGeometry:hk,LatheGeometry:ck,NonParametricGeometry:uk,PolygonGeometry:KC,PyramidGeometry:pk,RectangleGeometry:Qb,SphereGeometry:gk,PlaneGeometry:vk,BackdropGeometry:yk,StarGeometry:QC,TextFrameGeometry:_k,TorusGeometry:bk,TorusKnotGeometry:xk,TriangleGeometry:wk,VectorGeometry:Mh},h1=t=>{let e=RA[t.type]??_F(t.type);if(e===void 0)throw new Error(`No geometry factory registered for "${t.type}" \u2014 was its feature compiled out of this runtime build?`);return e.create(t)}});function ih(t,e,i,n){let r,a,s;t.type==="PathGeometry"?(a=JSON.parse(JSON.stringify(t)),s=[[],["extrusion"]]):(a={...t},s=[[]]);for(let c of s){let h=a;for(let d of c)h=h[d];for(r in h){let d=h[r];wO(d)&&!Pk.includes(r)&&(h[r]=e.getVariable(d,[n.uuid,"geometry",...c,r]),wO(h[r])&&(h[r]=1))}}let o,l={parameters:a,type:a.type};if(a.type==="PathGeometry")l.path=a.path;else if(a.type==="VectorGeometry"){let c=ki.createFromState(a.shape,a.width,a.height);l.shape=c}else if(a.type==="NonParametricGeometry"){if(a.data.groups&&a.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),l.geometry=new rC().parse(a),l.geometry.groups.length===0){let c=l.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else{if(a.type==="SubdivGeometry"){let c=new Fi(a,i);return c.data=t,c}if(a.type==="TextGeometry"||a.type==="InputGeometry"){let c=_F(a.type);if(c)return c.create(a,e);Gn("text",`a ${a.type}`);let h=ki.createFromState(Dg.defaultData(),100,100);return h1({...a,shape:h,type:"VectorGeometry"})}if(a.type==="UIGeometry")return Qb.create({parameters:{width:a.width,height:a.height,cornerRadius:a.cornerRadius,cornerType:a.cornerType}})}try{o=h1(l)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${l}`);let h=ki.createFromState(Dg.defaultData(),100,100);l.shape=h,l.type="VectorGeometry",o=h1(l)}return o}var Pk,B4,OA,tx=k(()=>{te(),rt(),Ck(),ke(),K_(),Sh(),Ep(),Pk=["font"]}),B$=k(()=>{tx(),B4=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,i){let n=this.objects.get(t);return n===void 0?(n=this.createObject(t,e,i),this.objects.set(t,n)):n.isShared=!0,n}forceDelete(t){let e=this.objects.get(t);e&&(this.disposeObject(e),this.objects.delete(t))}adopt(t,e){this.objects.set(t,e)}mutateIfUnique(t,e){let i=this.objects.get(t);if(i&&i.isShared!==!0)return this.objects.delete(t),this.objects.set(e,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){e===this.objects.get(t)&&this.unreachable.delete(t)}endGc(){this.unreachable.forEach(t=>{this.disposeObject(this.objects.get(t)),this.objects.delete(t)}),this.unreachable.clear()}dispose(){this.objects.forEach(t=>{this.disposeObject(t)}),this.objects.clear()}},OA=class extends B4{constructor(t){super(),this.flatShading=t}disposeObject(t){t.dispose()}createObject(t,e,i){let n=ih(t,e,this.flatShading,i);return n.computeBoundingSphere(),n}}});function Q_(){return ex}function Dk(){if(ex==="webgpu"){if(N4!==void 0)return N4;LA||(LA=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(IA===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return IA}function Rk(t,e){return Dk().createRootMaterial(t,e)}function U4(t,e,i){return Dk().createSharedMaterial(t,e,i)}function z4(t){return t.getLayersOfType===void 0&&Object.assign(t,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),t}function Ok(){return U$}var ex,N4,IA,LA,BA,U$,UA,Ik,Eh=k(()=>{ex="webgl",LA=!1}),z$=k(()=>{Ik={markNeedsUpdateRendererDirty:()=>{}}});function Bc(t,e){let i=0;if(!t.layers||t.layers.length===0)return!1;let n=t.layers?.find(r=>r.data.type==="light");if(n){let r=n.data,a=Number(e.getVariable(r.alphaOverride));if((typeof r.alphaOverride=="string"?a/100:r.alphaOverride)<1)return!0}for(let r of t.layers){if(r.data.type!=="displace"&&r.data.isMask)return!0;if(r.data.type!=="displace"&&"alpha"in r.data&&r.data.type!=="light"&&r.data.type!=="fresnel"&&r.data.type!=="cavity"&&r.data.type!=="dust"&&r.data.type!=="texture"&&r.data.type!=="matcap"&&r.data.type!=="rainbow"&&r.data.type!=="outline"&&r.data.type!=="pattern"){let a=r.data.visible?r.data.alpha:0;if(typeof a=="string"&&(a=Math.max(0,Math.min(1,Number(e.getVariable(a)??100)/100))),a===1&&r.data.type==="depth"||r.data.type==="gradient"){for(let s of r.data.colors)if(s[3]<1){a=s[3];break}}else if(a===1&&r.data.type==="noise"){let s=e.color(r.data.colorA).a,o=e.color(r.data.colorB).a,l=e.color(r.data.colorC).a,c=e.color(r.data.colorD).a,h=Math.min(s,Math.min(o,Math.min(l,c)));h<1&&(a=h)}i+=(1-i)*a}}return i<1}var e3=k(()=>{});function fp(t){return typeof t=="string"||typeof t=="number"&&t!==0}var vh,qt,ix,Lk,F4,k4,ba,sl=k(()=>{vh=(t,e,i)=>Math.max(0,Math.min(1,Number(e.getVariable(typeof t=="number"?100*t:t,i)??100)/100))??1,qt=(t,e,i)=>typeof t=="number"?t:e.getVariable(t,i),ix={noise:["noiseType"],texture:["projection","axis","projectionAxis","side"],video:["projection","axis","projectionAxis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"],reflection:["tracingMode","mirror"]},Lk={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Ap=k(()=>{rt(),$g(),F4=class extends Xb(bi){},k4=t=>t.type==="Mesh",ba=class extends F4{constructor(t){super(),this.object=t,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=t.hasNonUniformScale}raycast(t,e){}expand(){let t=0,e=this.object.entityChildren(t);for(;e;){let i=this.children[t];i?.object!==e&&(i&&this.remove(i),i=new ba(e),this.add(i),this.children.splice(t,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=e.matrix,i.hiddenMatrix=e.hiddenMatrix,i.pivotMatrix=e.pivotMatrix),i.expand(),t+=1,e=this.object.entityChildren(t)}for(;this.children.length>t;)this.remove(this.children[t]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let t=this.object.cloner;return(t===void 0||this.parent!==t||!t.instancingActive&&!t.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(t){}get castShadow(){return this.object.castShadow}set castShadow(t){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(t){}get isMesh(){return k4(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(t){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(t){}}});function V4(){return i3}var i3,n3,r3=k(()=>{i3=null,n3=null});function zA(t){return"variable_"+t}var GS,HS,WS,j4,qS,G4,H4,J_,a3=k(()=>{te(),FF(),jF(),HC(),xs(),WC(),XC(),B$(),Eh(),VF(),z$(),e3(),sl(),Wr(),Ap(),Ye(),rt(),r3(),ke(),GS=new At,HS=new C,WS=new Yt,j4=new C,qS=new Ti,G4=class extends zF{constructor(t){super(),this.shared=t}create(t){return new GC(t,this.shared)}},(J_=H4=class{constructor(t,e={},i=!0,n=!1){if(this.data=t,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=n,this.geometryCache=new OA(!0),this.geometryCache2=new OA(!1),this.imageHolderCache=new G4(this),this.thisContext={scene:Ik,shared:this},this.deletedImage=new Xo(tA.emptyImage,this),this.deletedVideo=new Xo(C_.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.timelineAnimations={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,e.images)for(let[r,a]of Object.entries(e.images))this.addImage(r,a);if(e.videos)for(let[r,a]of Object.entries(e.videos))this.addVideo(r,a);if(e.audios)for(let[r,a]of Object.entries(e.audios))this.addAudio(r,a);if(e.particles)for(let[r,a]of Object.entries(e.particles))this.addParticle(r,a);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=U4(Vi.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,i=!1){this.data=t,this.resetLib(t.lib);for(let{id:n,data:r}of t.variables)this.addVariableHolder(n,r),e&&this.updateVariableHolder(n,r);for(let[n,r]of Object.entries(t.userAPIs??{}))this.addUserAPI(n,r);for(let[n,r]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(n,r);if(!i){for(let[n,r]of Object.entries(t.images))this.addImage(n,r);for(let[n,r]of Object.entries(t.videos))this.addVideo(n,r)}for(let[n,r]of Object.entries(t.colors))this.addColor(n,r);for(let[n,r]of Object.entries(t.lib.materials))this.addMaterial(n,r.asset);for(let[n,r]of Object.entries(t.materials))this.addMaterial(n,r);for(let[n,r]of Object.entries(t.audios))this.addAudio(n,r);for(let[n,r]of Object.entries(t.particles))this.addParticle(n,r);for(let[n,r]of Object.entries(t.fonts))this.addFont(n,r);for(let[n,r]of Object.entries(t.timelineAnimations??{}))this.addAnimation(n,r)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:Vi.defaultTwoLayerData("phong").layers}),this.materials[t]){let i=this.materials[t];i.reset(e,this.thisContext),i.dispose()}else{let i=U4(e,this.thisContext,t);this.materials[t]=i}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){return this.materials[t]}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):(t.layers===void 0&&(t={...t,layers:Vi.defaultTwoLayerData("phong").layers}),Rk(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new Xo(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new Xo(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new Xo(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):(this.colors[t]=new Bg(e.r,e.g,e.b,"a"in e?e.a:1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[t];return this.colors[t].r=e.r??i.r,this.colors[t].g=e.g??i.g,this.colors[t].b=e.b??i.b,this.colors[t].a=e.a??i.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t!="string")return new vn(t.r,t.g,t.b,"a"in t?t.a:1);{let i=this.getColor(t);i?e=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new vn(0,0,0,0))}return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof Uu)return e;{let i=new Uu({src:e.data});return this.audios[t]=i,i}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof Uu&&e.dispose(),delete this.audios[t])}addFont(t,e){let i=qC;i!==null?(this.fonts[t]=new i(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())):Gn("text","a font asset")}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}addAnimation(t,e){this.timelineAnimations[t]=e}getAnimation(t){return this.timelineAnimations[t]}deleteAniamtion(t){this.timelineAnimations[t]&&delete this.timelineAnimations[t]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._requestRender=void 0,Object.values(this.audios).forEach(t=>{t instanceof Uu&&t.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let i=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let n=localStorage.getItem(zA(t));i=n!==null?JSON.parse(n):e.value}return this.variables[t]={value:i,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(zA(t),JSON.stringify(e));let i=e;for(;typeof i=="string";)i=this.variables[i].value;let n=this.entityOpContext.scene,r=!1;for(let a=this.variables[t].locations.length-1;a>=0;a--){let s=this.variables[t].locations[a];if(s[0]==="material"){let o=s[1],l=i,c={scene:n,shared:this},h=s.slice(2);n.traverseMaterial(u=>{let p=u.root??u;p.uuid===o&&p.onVariableUpdate(h,l,c)});let d=this.materials[o];d&&d.onVariableUpdate(h,l,c)}else{let o=n.find(s[0]);if(o===void 0){this.variables[t].locations.splice(a,1);continue}if(r=!0,s[1]!=="geometry"&&s[1]!=="particles"){for(let l=1;l<s.length-1;l++)o=o[s[l]];s[1]==="rotation"?o[s[s.length-1]]=i*It.DEG2RAD:o[s[s.length-1]]=i}if(o=n.find(s[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,s),Be.is(o))if(s[1]==="position"||s[1]==="rotation"||s[1]==="scale")o.onVariableUpdate();else if(s[1]==="geometry"){let l=o;o.component&&(l=o.component);let c=l.dataPatched;l.chooseGeoemtryCache(this).forceDelete(c.geometry),l.createGeometryDelayed(this.entityOpContext),l.onVariableUpdate(!0),l.invalidateDownstreamBooleanData(),l.instances.forEach(h=>{let d=h.dataPatched;h.chooseGeoemtryCache(this).forceDelete(d.geometry),h.createGeometryDelayed(this.entityOpContext),h.onVariableUpdate(!0),h.invalidateDownstreamBooleanData()})}else s[1]==="morphTargetInfluences"&&o.updateMorphInfluences(s[2],i)}}return r&&n.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||typeof r.type!="string"||r.type==="VectorGeometry"||r.type==="PathGeometry")return!1;let a=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),s=new Map;for(let c of Object.keys(r))s.set(a(c),c);let o={};for(let[c,h]of Object.entries(e??{})){let d=s.get(a(c));if(d===void 0||d==="type"||d==="font"||d==="shape"||d==="path"||d==="data")continue;if(d==="text"){(typeof h=="string"||typeof h=="number")&&(o[d]={textValue:String(h)});continue}let u=r[d];typeof h=="number"&&isFinite(h)&&(typeof u=="number"||typeof u=="string")&&(o[d]=h)}if(Object.keys(o).length===0)return!1;let l={...r,...o};return i.dataPatched={...n,geometry:l},this.transientGeometryKeys.has(r)&&i.chooseGeoemtryCache(this).forceDelete(n.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let i=e.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(i),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||r.type!=="NonParametricGeometry")return!1;let a=e?.vertices;if(a===void 0||typeof a.length!="number"||a.length<9||a.length%3!=0||a.length/3>H4.MAX_TRANSIENT_VERTICES)return!1;let s,o,l,c=a instanceof Float32Array?a:Float32Array.from(a),h=c.length/3;if(e.normals!==void 0){if(e.normals.length!==c.length)return!1;s=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}if(e.uvs!==void 0){if(e.uvs.length!==2*h)return!1;o=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}if(e.indices!==void 0){let x=h>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(x.length===0||x.length%3!=0)return!1;for(let w=0;w<x.length;w++)if(x[w]>=h)return!1;l={array:x,itemSize:1,type:x.constructor.name,normalized:!1}}else{let x=r.data,w=x?.index;if(w?.array?.length){if(h<(x?.attributes?.position?.array?.length??0)/3){let S=w.array;for(let T=0;T<S.length;T++)if(S[T]>=h)return!1}l=w}}let d=1/0,u=1/0,p=1/0,f=-1/0,g=-1/0,m=-1/0;for(let x=0;x<c.length;x+=3){let w=c[x],S=c[x+1],T=c[x+2];w<d&&(d=w),w>f&&(f=w),S<u&&(u=S),S>g&&(g=S),T<p&&(p=T),T>m&&(m=T)}let y=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),v={position:y(c,3)};s&&(v.normal=y(s,3)),o&&(v.uv=y(o,2));let _={...r,width:f-d,height:g-u,depth:m-p,data:{attributes:v,...l?{index:l}:{}}},b=this.transientGeometryKeys.has(r);return i.dataPatched={...n,geometry:_},this.transientGeometryKeys.add(_),i.applyTransientGeometryData(this.entityOpContext,b),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let i=t;i.component&&(i=i.component);let n=i.cloner;if(n===void 0)return-1;let r=n.children,a=Math.PI/180,s=!1;if(e===null)for(let o of r)o.transformOverride!==void 0&&(o.transformOverride=void 0,s=!0);else{if(!Array.isArray(e))return r.length;{let o=Math.min(e.length,r.length);for(let l=0;l<o;l++){let c=e[l],h=r[l];if(c==null){h.transformOverride!==void 0&&(h.transformOverride=void 0,s=!0);continue}let d=h.transformOverride??{position:[h.position.x,h.position.y,h.position.z],rotation:[h.rotation.x,h.rotation.y,h.rotation.z],scale:[h.scale.x,h.scale.y,h.scale.z]};c.position&&(typeof c.position.x=="number"&&(d.position[0]=c.position.x),typeof c.position.y=="number"&&(d.position[1]=c.position.y),typeof c.position.z=="number"&&(d.position[2]=c.position.z)),c.rotation&&(typeof c.rotation.x=="number"&&(d.rotation[0]=c.rotation.x*a),typeof c.rotation.y=="number"&&(d.rotation[1]=c.rotation.y*a),typeof c.rotation.z=="number"&&(d.rotation[2]=c.rotation.z*a)),c.scale&&(typeof c.scale.x=="number"&&(d.scale[0]=c.scale.x),typeof c.scale.y=="number"&&(d.scale[1]=c.scale.y),typeof c.scale.z=="number"&&(d.scale[2]=c.scale.z)),h.transformOverride=d,h.position.fromArray(d.position),h.rotation.fromArray(d.rotation),h.scale.fromArray(d.scale),h.updateMatrix(),h.hasNonUniformScale&&(h.updateMatrixWorld(),h.updateMatrixWorldRigid())}}}return s?n.update(this.entityOpContext):n.syncInstanceMatrices(),n.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let i=t.parent;if(i===null)return;let n=new ba(t);n.playModeVisible=e.visible!==!1,n.expand(),typeof e.name=="string"&&(n.name=e.name);let r=Math.PI/180;return n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(n.position.x=e.position.x),typeof e.position.y=="number"&&(n.position.y=e.position.y),typeof e.position.z=="number"&&(n.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(n.rotation.x=e.rotation.x*r),typeof e.rotation.y=="number"&&(n.rotation.y=e.rotation.y*r),typeof e.rotation.z=="number"&&(n.rotation.z=e.rotation.z*r)),e.scale&&(typeof e.scale.x=="number"&&(n.scale.x=e.scale.x),typeof e.scale.y=="number"&&(n.scale.y=e.scale.y),typeof e.scale.z=="number"&&(n.scale.z=e.scale.z)),n.updateMatrix(),i.add(n),n.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let i=t.material;if(!i)return!1;let n=[];for(let c of Array.isArray(i)?i:[i]){let h=c.root??c;h&&Array.isArray(h.layers)&&h.data&&!n.includes(h)&&n.push(h)}if(n.length===0)return!1;let r={scene:this.entityOpContext.scene,shared:this},a=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),s=c=>{if(typeof c=="string"){let h=new vn(1,1,1,1);try{h.set(c)}catch{return null}return{r:h.r,g:h.g,b:h.b,a:void 0}}if(c&&typeof c=="object"&&"r"in c){let h=c;if([h.r,h.g,h.b].some(u=>typeof u!="number"||!isFinite(u)))return null;let d=Math.max(h.r,h.g,h.b)>1?1/255:1;return{r:h.r*d,g:h.g*d,b:h.b*d,a:typeof h.a=="number"?Math.max(0,Math.min(h.a,1)):void 0}}return null},o=(c,h,d)=>{if(!c.hasValue(h))return!1;let u=c.getValue(h);if(!u||typeof u!="object"||!u.isColor)return!1;let p=d.a??(typeof u.a=="number"?u.a:1);return u instanceof Bg?c.setValue(h,new vn(d.r,d.g,d.b,p)):typeof u.setRGBA=="function"?u.setRGBA(d.r,d.g,d.b,p):u.setRGB(d.r,d.g,d.b),!0},l=!1;for(let c of n){let h=c.data.layers??[],d=u=>c.layers.find(p=>p.uuid===u);if(e.color!==void 0){let u=s(e.color),p=h.find(g=>g.data.type==="color"),f=p&&d(p.id);if(u&&f&&o(f,"color",u)&&(l=!0,u.a!==void 0)){let g=u.a<1||Bc(c.data,this);c.setTransparent?c.setTransparent(g,r.scene):c.transparent=g}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(c.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),r),l=!0);for(let u of e.layers??[]){if(!u||typeof u!="object")continue;let p=typeof u.id=="string"?h.find(y=>y.id===u.id):typeof u.index=="number"?h[u.index]:typeof u.type=="string"?h.find(y=>y.data.type===u.type):void 0,f=p&&d(p.id);if(!p||!f)continue;let g=ix[p.data.type]??[],m=Object.keys(p.data);for(let[y,v]of Object.entries(u)){if(y==="id"||y==="index"||y==="type")continue;let _=m.find(x=>x===y)??m.find(x=>a(x)===a(y))??y;if(g.includes(_))continue;let b=s(v);if(b&&o(f,_,b))l=!0;else if(typeof v=="number"&&isFinite(v))c.onVariableUpdate?.(["layer",p.id,_],v,r),l=!0;else if(Array.isArray(v)&&v.length<=3&&v.every(x=>typeof x=="number"&&isFinite(x))){let x=["x","y","z"];v.forEach((w,S)=>{c.onVariableUpdate?.(["layer",p.id,_,x[S]],w,r)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let i=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return i.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&i?.getPhysicsLocalMatrix?.(GS))return GS.decompose(HS,WS,j4),t[1]==="position"?HS[t[2]]:(qS.setFromQuaternion(WS,i.rotation.order),qS[t[2]]*It.RAD2DEG);for(let n=1;n<t.length;n++)i=i[t[n]];return t[1]==="rotation"&&(i*=It.RAD2DEG),i}for(let i in this.variables){if(e===void 0)break;let n=this.variables[i],r=n.locations?.findIndex(a=>jn.equal(a,e));r!==void 0&&r!==-1&&n.locations.splice(r,1)}if(typeof t=="string"){let i=t,n=t;do{if(n=i,this.variables[i]===void 0)break;let r=this.variables[i].value;e&&this.variables[n]!==void 0&&this.variables[n].locations.push(e),i=r}while(typeof i=="string");return i}return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,i]of Object.entries(t.images))this.addImage(e,i.asset);for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i.asset);for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i.asset);for(let[e,i]of Object.entries(t.colors))this.addColor(e,i.asset);for(let[e,i]of Object.entries(t.fonts))this.addFont(e,i.asset);for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i.asset);for(let[e,i]of Object.entries(t.variables))this.addVariableHolder(e,i.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,i){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(tr.drop(t,2),e.materials[t.path[1]],{shared:this,scene:i});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,i):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let n=e.userAPIs[t.path[1]];if(n){let r=t.type===0&&t.props.debounce===void 0,a=this.getUserAPI(t.path[1]);a!==void 0&&a===this.openAIRealtime?a.update(n):a?.update(n,this,r)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let n=e.userWebhooks[t.path[1]];n&&this.getUserWebhook(t.path[1])?.update(n)}}else t.path[0]==="lib"&&this.updateLibByOp(tr.drop(t,1),i)}updateFont(t,e,i){if(e.props.url){let n=this.getFont(t),r={...this.data.fonts[t],url:e.props.url};n.update(r),n.loadingPromise.then(()=>this.requestRender()),i.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let i=n3;return i===null?(Gn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(e,t,this),!1)}{let i=V4();return i===null?(Gn("api-services","a user API integration"),!1):(this.userAPIs[t]=i.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let i=V4();return i===null?(Gn("api-services","a user webhook"),!1):(this.userWebhooks[t]=i.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new J_(ka.emptyData())});function Bk(t){return W_(t)||t?.isTSLNodeMaterial===!0}var Hr,XS,$S,YS,W4,ZS,vi,Uk=k(()=>{jC()}),ed=k(()=>{te(),lr(),Eh(),Uk(),Ye(),sr(),Hr=class extends $i{setMaterialOverride(t,e){this.materialOverride=z4(t),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),e.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(t,e,i){if(super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.syncShadowCatcher(i),function(n,r){let a=[];if(r.length!==n.length)return null;{let s=0;for(;s<n.length;){if(r[s]==="*")a.push(n[s]);else if(n[s]!==r[s])return null;s+=1}}return a}(t.path,["materials"])!==null&&t.type===0&&Array.isArray(this.material))for(let[n,r]of Object.entries(t.props)){let a=this.material[Number(n)],s=i.shared.material(r);s!==a&&Hr.disposeOneMaterial(a),this.material[Number(n)]=s}else if(ri(t.path,["material"])){let n=this.material;!Array.isArray(n)&&typeof n?.updateByOp=="function"&&"material"in e&&typeof e.material!="string"&&n.updateByOp(tr.drop(t,1),e.material,i)}else if(ri(t.path,["materials","*"])&&Array.isArray(this.material)){let n=t.path[1];if("materials"in e&&n<this.material.length){let r=e.materials[n];typeof r!="string"&&this.material[n].updateByOp(tr.drop(t,2),r,i)}}}get needsAO(){return this.material!==void 0&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):512&this.layers.mask&&this.layers.set(0)}updateState(t,e){super.updateState(t,e),t.castShadow!==void 0&&(this.castShadow=t.castShadow),t.receiveShadow!==void 0&&(this.receiveShadow=t.receiveShadow);let i,n=this.dataPatched;this.syncShapeBlendNodeLayer(),this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(i={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let r=this.materialOverride!==void 0;!r&&t.geometry?.type!=="NonParametricGeometry"&&"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe,i),e.scene.markNeedsUpdateRendererDirty()),!r&&(t.geometry?.type==="NonParametricGeometry"||"materials"in t)&&("materials"in t&&t.materials!==void 0?(this.disposeMaterial(),this.material=t.materials.map(s=>e.shared.material(s).getFlavor(n.flatShading,n.side,n.wireframe)),e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=[e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe)],e.scene.markNeedsUpdateRendererDirty()));let a=this.data;if(!r&&a.geometry?.type!=="NonParametricGeometry"&&"materials"in a&&a.materials!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(a.materials[0]).getFlavor(n.flatShading,n.side,n.wireframe)),!r&&(t.flatShading!==void 0||t.wireframe!==void 0||t.side!==void 0))if(Array.isArray(this.material))for(let s=0;s<this.material.length;s++)this.material[s]=this.material[s].getFlavor(n.flatShading,n.side,n.wireframe);else this.material=this.material.getFlavor(n.flatShading,n.side,n.wireframe,i);this.syncShadowCatcher(e)}shadowCatcherActive(){let t=this.dataPatched,e=t.geometry?.type;return t.shadowCatcher===!0&&(e==="RectangleGeometry"||e==="PlaneGeometry")}syncShadowCatcher(t){let e=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=BA===void 0?null:z4(BA());if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=e.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,t.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.material=t.shared.material(e.material).getFlavor(e.flatShading,e.side,e.wireframe),t.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow)}static disposeOneMaterial(t){var e;Bk(t)&&!function(i){return i?.isClassicSharedMaterial===!0}(e=t)&&e?.isTSLSharedMaterial!==!0&&t.nodeMaterialDispose()}disposeMaterial(){this.material&&SN(this.material).forEach(t=>{Hr.disposeOneMaterial(t)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),la=k(()=>{te(),Ye(),a3(),ed(),rt(),tx(),Ep(),Ak(),XS=new C,$S=new ye,YS=new ye,W4=new C,ZS=new At,vi=class extends Hr{constructor(t,e,i){super(t,e),this.data=e,this.isSkinnedMesh=!1,this.localGeometry=void 0,e.bindMode&&e.bindMatrix&&(this.bindMode=e.bindMode,this.bindMatrix=new At().fromArray(e.bindMatrix),this.bindMatrixInverse=new At)}chooseGeoemtryCache(t){return t.geometryCache}supportsInPlaceGeometryUpdate(t){return t.isTextGeometry!==!0}markGeometryAsReachable(t){this.geometryCreateDeleyed instanceof Gt&&this.chooseGeoemtryCache(t).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof Gt?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof J_){let t=this.geometryCreateDeleyed,e=this.chooseGeoemtryCache(t),i=this.dataPatched.geometry;this.geometryCreateDeleyed=e.get(i,t,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(t){this.localGeometry=t}get is2DAndNoDepth(){let t=this.dataPatched.geometry;return O_.is2DParametricMesh(t.type)&&t.depth===0}get is2DType(){return O_.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.updateByPatchedOpGeometry(tr.drop(t,1),e.geometry,i)}removeInteractionGeometry(t){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(t,e){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let n,r,a,s=t;if(this.localGeometry===void 0){let d={...this.data.geometry,...s};this.localGeometry=ih(d,e,this.data.flatShading,this)}s.scaleBaked?[n,r,a]=s.scaleBaked:{width:n,height:r,depth:a}=s;let o=this.localGeometry.userData,l=typeof n=="number"?n:1,c=typeof r=="number"?r:1,h=typeof a=="number"?a:1;o.sxPrev!==void 0&&DA(this.localGeometry.attributes,l/o.sxPrev,c/o.syPrev,h/o.szPrev),o.sxPrev=l,o.syPrev=c,o.szPrev=h}else{let n=ih({...this.data.geometry,...t},e,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&FS(this.localGeometry,n)?n.dispose():(this.localGeometry?.dispose(),this.localGeometry=n)}}refreshAttachedClonersInteractions(t){for(let e of this.attachedSurfaceCloners)e.update(t)}refreshAttachedCloners(t){for(let e of this.attachedSurfaceCloners)t.scene.addPendingUpdateCloner(e.object)}refreshAttachedPaths(t){for(let e of this.attachedPaths)t.scene.addPendingCommand(()=>e.updateShape())}createGeometryDelayed(t){this.geometryCreateDeleyed=t.shared,this.refreshAttachedCloners(t),this.refreshAttachedPaths(t)}updateByPatchedOpGeometry(t,e,i){let n=!1;if(t.type===0&&t.path.length===0&&Object.keys(t.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Fi&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(e,t.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&Tk(t.props)&&this.geometryCreateDeleyed instanceof Fi&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(e),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&this.geometryCreateDeleyed instanceof Gt&&!(this.geometryCreateDeleyed instanceof Fi)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=i.shared,a=this.chooseGeoemtryCache(r),s=this.geometryCreateDeleyed;if(a.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let o=this.dataPatched.geometry,l=ih(o,r,this.data.flatShading,this);FS(s,l)?(l.dispose(),s.computeBoundingSphere(),a.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),a.forceDelete(this._geometryCacheKey),a.adopt(o,l),this.geometryCreateDeleyed=l),this._geometryCacheKey=o,n=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}n||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(t,e){this.createGeometryDelayed(e)}applyTransientGeometryData(t,e){let i=t.shared,n=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof Gt&&!(this.geometryCreateDeleyed instanceof Fi)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=this.chooseGeoemtryCache(i),a=this.geometryCreateDeleyed;if(r.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let s=ih(n,i,this.data.flatShading,this);return FS(a,s)?(s.dispose(),a.computeBoundingSphere(),r.mutateIfUnique(this._geometryCacheKey,n)):(s.computeBoundingSphere(),r.forceDelete(this._geometryCacheKey),r.adopt(n,s),this.geometryCreateDeleyed=s),this._geometryCacheKey=n,this.refreshAttachedCloners(t),void this.refreshAttachedPaths(t)}}e&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),t.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(t)}updateState(t,e){t.geometry!==void 0&&this.updateGeometryOnStateUpdate(t.geometry,e);let i=t.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:n,value:r}}of i)this.updateMorphInfluences(n,e.shared.getVariable(r,[this.uuid,"morphTargetInfluences",n]))}super.updateState(t,e)}updateMorphInfluences(t,e){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[t];i!==void 0&&(this.morphTargetInfluences[i]=e)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;this.is2DType?t.set(0,0,.5*i.depth):this.isNonParametric?(t.setScalar(0),this.geometry.boundingSphere&&t.copy(this.geometry.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?t.fromArray(i.centerOffset):t.setScalar(0),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(t,e){this.skeleton=t,this.isSkinnedMesh=!0,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(t){let e=new ye,i=this.geometry.attributes.skinWeight;for(let n=0,r=i.count;n<r;n++){e.fromBufferAttribute(i,n);let a=1/e.manhattanLength();a!==1/0?e.multiplyScalar(a):e.set(1,0,0,0),i.setXYZW(n,e.x,e.y,e.z,e.w)}}boneTransform(t,e){let i=this.skeleton;if(i===void 0)return;let n=this.geometry;$S.fromBufferAttribute(n.attributes.skinIndex,t),YS.fromBufferAttribute(n.attributes.skinWeight,t),XS.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){let a=YS.getComponent(r);if(a!==0){let s=$S.getComponent(r);ZS.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),e.addScaledVector(W4.copy(XS).applyMatrix4(ZS),a)}}return e.applyMatrix4(this.bindMatrixInverse)}}});function Ku(t){if(Array.isArray(t.material)){for(let e of t.material)if(e.getLayersOfType("outline").length===0)return}else if(!W_(t.material)||t.material.getLayersOfType("outline").length===0)return;t instanceof vi&&t.is2DAndNoDepth?function(e){if(e.geometry.attributes.extrudeNormals||!e.geometry.attributes.position)return;let i=e.geometry.attributes.position.array,n=new Float32Array(i.length),r=new C;for(let a=0;a<i.length;a+=3)r.set(i[a],i[a+1],i[a+2]).normalize(),n[a]=r.x,n[a+1]=r.y,n[a+2]=r.z;e.geometry.setAttribute("extrudeNormal",new Ft(n,3))}(t):function(e){if(e.geometry.attributes.extrudeNormal||!e.geometry.attributes.position||!e.geometry.attributes.normal)return;let i=new Map,n=e.geometry.attributes,r=n.position.array,a=n.normal.array,s=new Float32Array(r.length);for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=new C(a[o],a[o+1],a[o+2]);i.has(l)?i.get(l)?.normals.push(c):i.set(l,{normals:[c],result:new C})}i.forEach((o,l)=>{for(let c of o.normals)o.result.add(c);o.result.divideScalar(o.normals.length)});for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=i.get(l)?.result;c&&(s[o]=c.x,s[o+1]=c.y,s[o+2]=c.z)}e.geometry.setAttribute("extrudeNormal",new Ft(s,3))}(t)}function KS(t){return Math.min(2047,Math.max(1,Math.round(2048*t)))/2048}function Qu(t){if(!t.geometry.attributes.position)return;let e=t.geometry.attributes,i=e.position.array,n=e.randomColor;if(n!==void 0&&3*n.count===i.length)return;let r=new Float32Array(i.length),a=parseInt(t.uuid.replace(/\D/g,"")),s=[KS(It.seededRandom(a)),KS(It.seededRandom(a+1e4)),KS(It.seededRandom(a+2e4))];for(let o=0;o<i.length;o++)r[o]=s[o%3];t.geometry.setAttribute("randomColor",new Ht(r,3))}var nx=k(()=>{rt(),jC(),la()});function q4(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}function N$(t,e){let i=t.cloner;return i!==void 0&&i.parent===e?i:void 0}function X4(t,e,i,n){let r=16*(e.children.length+1);Lm.length<r&&(Lm=new Float32Array(r));let a=0,s=l=>{l.toArray(Lm,16*a),a++},o=e.parameters.hideBase!==!0;o&&s(n),NA.multiplyMatrices(t.hiddenMatrix,t.matrix);for(let l of e.children)!Dc(l)||l.playModeVisible===!1||(FA.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),c1.multiplyMatrices(NA,FA),(!o||!c1.equals(n))&&s(c1));try{return a===0?0:function(l,c){return kC(H_().instanced_union(FC(l),c))}(i,Lm.subarray(0,16*a))}finally{RF(i)}}var Co,$4,NA,FA,c1,Lm,dh,tb,rx,ms,io,eb,Yg=k(()=>{lr(),rt(),Zb(),nx(),ed(),Ui(),Co=new At,$4=new At,NA=new At,FA=new At,c1=new At,Lm=new Float32Array(0),dh=class extends Hr{constructor(t,e,i){super(t,e),this.data=e,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new Gt,this.onAfterRender=(n,r,a,s,o,l)=>{super.onAfterRender(n,r,a,s,o,l),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&t.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(t,e=!0){if(this.booleanMeshSetAddress!==-1&&!t)return;for(let n=0;n<this.children.length;n++){let r=this.children[n];r instanceof dh&&r.dataPatched.visible===!0&&r.recomputeBoolean(t===!0,e)}this.meshSetAddresses=[];for(let n=0;n<this.children.length;n++){let r=this.children[n];if(r instanceof $i&&r.dataPatched.visible===!0&&r.geometry.attributes.position?.count>0&&r.geometry.drawRange.count>0&&r.booleanMeshSetAddress!==0){Co.multiplyMatrices(r.hiddenMatrix,r.matrix).multiply(r.pivotMatrix);try{let a=N$(r,this);if(r.booleanMeshSetAddress===-1){if((r.geometry.index??r.geometry.getAttribute("position")).count/3<15e5){let s=r$(r.geometry,t===!0);r.booleanMeshSetAddress=a===void 0||s===-1?s:X4(r,a,s,Co)}if(r.booleanMeshSetAddress===-1)return;a===void 0&&PS(r.booleanMeshSetAddress,Co),r.booleanMatrixInvOld.copy(Co).invert(),r.booleanWasTransformed=!1}else r instanceof dh&&r.needsTransformForDownstream===!0?(a===void 0?PS(r.booleanMeshSetAddress,Co):r.booleanMeshSetAddress=X4(r,a,r.booleanMeshSetAddress,Co),r.needsTransformForDownstream=!1):r.booleanWasTransformed===!0&&(PS(r.booleanMeshSetAddress,$4.multiplyMatrices(Co,r.booleanMatrixInvOld)),r.booleanMatrixInvOld.copy(Co).invert(),r.booleanWasTransformed=!1)}catch(a){console.error(a),r.booleanMeshSetAddress=0,r.geometry.userData.booleanOperationDidFail=!0;continue}if(r.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(r.booleanMeshSetAddress),r.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let n=this.geometry;n.dispose(),this.geometry=new Gt,this.geometry.userData=n.userData,this.geometry.boundingSphere=n.boundingSphere,this.geometry.setAttribute("position",new Ft([],3))}return void this.geometry.setDrawRange(0,0)}if(t===!0)return function(n,r){let a=H_(),s=HI(n,r),o=a.mesh_topological_data(s),l=o.positions(),c=o.indices();return o.free(),s.free(),{positions:l,indices:c,verticesPerFace:new Uint8Array(c.length/3).fill(3)}}(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new Gt,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(n,r,a,s){let o=H_(),l=HI(n,r),c=o.mesh_render_data(l,Math.max(s,0));if(a.setAttribute("position",new Ft(c.positions(),3)),a.setAttribute("normal",new Ft(c.normals(),3)),c.free(),a.boundingSphere===null&&(a.boundingSphere=new vr),l.tri_count()===0)a.boundingSphere.center.set(0,0,0),a.boundingSphere.radius=0,a.userData.parameters={width:0,height:0,depth:0};else{let h=l.bounds();a.boundingSphere.center.set(h[0],h[1],h[2]),a.boundingSphere.radius=(h[3]**2+h[4]**2+h[5]**2)**.5,a.userData.parameters={width:2*h[3],height:2*h[4],depth:2*h[5]}}return kC(l)}(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(n){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(n)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Ku(this),Qu(this)}dispose(){super.dispose(),this.geometry.dispose()}}}),Zg=k(()=>{rt(),Wr(),td(),(tb||(tb={})).is=function(t){return Be.is(t)&&t instanceof bu},rx=(t,e)=>class extends Jc(t,e){updateState_Light(i,n){if(this.updateState_Entity(i,n),i.color!==void 0&&(this.color=n.shared.color(i.color)),i.intensity!==void 0&&(this.intensity=i.intensity*Math.PI),i.depth!==void 0){let r=this.shadow;r.camera.far=i.depth,r.needsUpdate=!0}i.shadows!==void 0&&(this.castShadow=i.shadows)}}}),Ah=k(()=>{Yg(),lr(),td(),ms=t=>t instanceof $i,io=t=>t!==null&&t instanceof dh,eb=t=>uA.is(t)});function mr(t,e){return e.color(t)}function Y4(t=new Date,e){let i=e.format,n=t.getSeconds(),r=t;e&&e.timeZone!==null&&(r=function(d,u){try{let p=new Intl.DateTimeFormat("en-US",{timeZone:u,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(d),f=g=>Number(p.find(m=>m.type===g)?.value);return new Date(f("year"),f("month")-1,f("day"),f("hour"),f("minute"),f("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,e.timeZone));let a,s=r.getHours(),o=r.getMinutes();e.format12h24h==="12ampm"&&(a=s>=12?"PM":"AM");let l,c,h=s;switch(e.format12h24h!=="24"&&(h=s%12,h===0&&(h=12)),i){case"HH:mm:ss":l=[h,o,n];break;case"HH:mm":l=[h,o];break;case"HH":l=[h],a=void 0;break;case"mm":l=[o],a=void 0;break;case"ss":l=[n],a=void 0;break;case"year":c=r.getFullYear();break;case"month":c=r.getMonth()+1;break;case"dayOfYear":c=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":c=r.getDate();break;case"secondOfDay":c=60*s*60+60*o+n;break;default:console.error("Unknown time format",i),c=0}return l!==void 0?{textValue:l,suffix:a}:c}var kA,zg,s3=k(()=>{}),F$=k(()=>{rt(),qg(),Xg(),kA=class extends xp(Hz){constructor(t,e=15,i=10066329){super(t,e,i),this.object=t,this.added=!1,this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,e){wp(this.object,kA.geometryHelper,t,e)}}}),ax=k(()=>{rt(),F$(),Zg(),zg=class extends rx(Fz,kA){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.top=1250,n.bottom=-1250,n.right=1250,n.left=-1250,n.near=-1e4,n.far=2500;let r=new Sg(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Sg&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&function(n,r){n.shadow.camera.right=r/2,n.shadow.camera.left=-r/2,n.shadow.camera.top=r/2,n.shadow.camera.bottom=-r/2,n.shadow.needsUpdate=!0}(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),i&&this.update()}}});function o3(t){return t instanceof Hr&&t.needsAO&&!mh(t)&&t.isDecalObject!==!0}function l3(t){let e=t.cloner;if(e&&Array.isArray(e.children))for(let i of e.children)i?.layers&&(i.layers.mask=t.layers.mask)}function h3(t){return t.getLayersOfType("reflection").filter(e=>e.data.visible).length}function Z4(t,e){let i={outline:!1,cavity:!1},n=t.layers.mask&sx,r=e.getLayersOfType("transmission"),a=e.getLayersOfType("outline"),s=h3(e),o=e.getLayersOfType("cavity");return(a.length>0||o.length>0)&&(t.layers.set(8),r.length>0&&t.layers.enable(3),s>0&&t.layers.enable(4),i.outline=a.length>0,i.cavity=o.length>0,Qu(t),Ku(t)),r.length===0&&a.length===0&&o.length===0&&s===0&&t.layers.set(0),n&&t.layers.set(9),!n&&o3(t)&&t.layers.enable(5),l3(t),i}function K4(t,e){if(!e.layers)return!1;let i=t.layers.mask&sx,n=!1,r=e.getLayersOfType("transmission").filter(l=>l.data.visible),a=e.getLayersOfType("outline").filter(l=>l.data.visible),s=h3(e),o=e.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(t.layers.set(3),(a.length>0||o.length>0)&&t.layers.enable(8),s>0&&t.layers.enable(4),n=!0),r.length===0&&a.length===0&&o.length===0&&s===0&&t.layers.set(0),i&&t.layers.set(9),!i&&o3(t)&&t.layers.enable(5),l3(t),n}function Q4(t,e){var i;if(!e.layers)return!1;let n=t.layers.mask&sx,r=!1,a=h3(e),s=e.getLayersOfType("transmission").filter(c=>c.data.visible),o=e.getLayersOfType("outline").filter(c=>c.data.visible),l=e.getLayersOfType("cavity").filter(c=>c.data.visible);return a>0&&((i=t.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),t.layers.set(4),s.length>0&&t.layers.enable(3),(o.length>0||l.length>0)&&t.layers.enable(8),r=!0),a===0&&s.length===0&&o.length===0&&l.length===0&&t.layers.set(0),n&&t.layers.set(9),!n&&o3(t)&&t.layers.enable(5),l3(t),r}function VA(t,e,i,n=!1){let r=t.cloner;if(r){let a=null;if(t.raycast===wi.prototype.raycast||t.raycast===$i.prototype.raycast){let s=t.geometry;s&&(s.boundingSphere===null&&s.computeBoundingSphere(),a=s.boundingSphere)}for(let s of r.children){if(a!==null&&(jA.copy(a).applyMatrix4(s.matrixWorld),!e.ray.intersectsSphere(jA)))continue;let o=Nk.copy(s.matrixWorld).invert(),l=Fk.copy(e.ray).applyMatrix4(o),c=t.matrixWorld;l.applyMatrix4(c);let h=zk;h.set(l.origin,l.direction),h.near=e.near,h.far=e.far,h.layers.mask=e.layers.mask;let d=h.intersectObject(t,!1);d.length>0&&i.push({...d[0],object:n?s:t})}}}var sx,zk,Nk,Fk,jA,Pv,kk,QS,JS,t2,Ng,pn,Vk=k(()=>{Ui(),nx(),lr(),ed(),rt(),sx=512,zk=new aC,Nk=new At,Fk=new Zo,jA=new vr}),k$=k(()=>{rt(),qg(),Xg(),Pv=class extends xp(jz){constructor(t,e=6710886){super(t,e),this.object=t,this.matrix=t.matrixWorld,this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,e){wp(this.object,Pv.geometryHelper,t,e)}update(){if(this.object!==void 0){let t=Pv._vector,e=this.object.distance?this.object.distance:1e3,i=e*Math.tan(this.object.angle);this.cone.scale.set(i,i,e),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let n=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let r=0,a=this.cone.material.length;r<a;r++)this.cone.material[r].color.set(n);else this.cone.material.color.set(n)}}},(kk=Pv)._vector=new C}),ox=k(()=>{rt(),k$(),Zg(),QS=new C,JS=new C,t2=new Yt,Ng=class extends rx(zz,kk){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=2*It.RAD2DEG*this.angle,n.aspect=1,n.near=100,n.far=2500;let r=new Sg(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Sg&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),JS.setFromMatrixPosition(this.matrixWorld),t2.setFromRotationMatrix(this.matrixWorld),QS.copy(this.up).applyQuaternion(t2).negate().multiplyScalar(this.distance),this.target.position.copy(JS).add(QS),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),hl=k(()=>{te(),qa(),rt(),Wr(),xs(),s3(),ll(),ax(),Ye(),Eh(),rt(),ed(),Ah(),Vk(),ox(),ke(),Yg(),pn=class extends $b(aa){constructor(t,e,i){if(super(),this.data=e,this.bgColor=new vn(1,1,1,1),this.fog=null,this.backupFog=new KM(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=er.getDensity({}),this.fogHeightFalloff=er.getHeightFalloff({}),this.fogHeightBase=er.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new Jt,this.penumbraSizeArrayCache=null,this.super_Entity(t,e),this.personalCamera=new tn(Qc,{...ng.defaultData,...e.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new Uz(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),e.uiScene){let n=oA();n===null?Gn("ui-2d","a page's 2D scene"):this.uiScene=new n.Scene2D((Array.isArray(t)?t[0]:t)+"-ui",e.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else e.uiFrame&&this.createUICanvas(e.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(t,e){let i=oA();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,e),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(t),this.uiCanvas?.applySize()})):Gn("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(t){this.bgColor=t,this.fogUseBGColor===!0&&(this.backupFog.color=t)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(t,e){t.color!==void 0&&(this.ambientLight.color=mr(t.color,e)),t.intensity!==void 0&&(this.ambientLight.intensity=t.intensity*Math.PI),t.enabled!==void 0&&(t.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(t){this.isActive=!0,t.fog=this.fog,this.traverseEntity(e=>{e instanceof dh&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(t=>{if(t instanceof Hr)if(Array.isArray(t.material))for(let e of t.material)e.needsUpdate=!0;else t.material.needsUpdate=!0,t.material.dispose()})}updateShadow(t){if(t.softShadowQuality===void 0&&t.type===void 0||!this.isActive)return;let e=this.data.shadow;var i,n;i=ig.isSoft(e),n=e?.softShadowQuality,UA!==void 0&&UA(i,n)&&this.forceMaterialsUpdate()}updateFog(t,e){t.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=mr(t.color,e),this.backupFog.near=t.near,this.backupFog.far=t.far,this.fogMode=er.getMode(t),this.fogDensity=er.getDensity(t),this.fogHeightFalloff=er.getHeightFalloff(t),this.fogHeightBase=er.getHeightBase(t)}updateSky(t,e){this.skyState=t??null,this.skyStateVersion++;let i=t?.hdri?.image;this.skyHdriHolder=i!=null?e.image(i):null}updateAo(t,e){t.aoColor!==void 0&&(this.aoColor=mr(t.aoColor,e))}updateByOp(t,e,i,n){let r=this.data.uiFrame;super.updateByOp(t,e,i,n);let a=e;ri(t.path,["fog"])?this.updateFog(a.fog,i.shared):ri(t.path,["sky"])?this.updateSky(a.sky,i.shared):ri(t.path,["grading"])?this.gradingState=a.grading??null:ri(t.path,["ao"])?this.updateAo(a.ao,i.shared):ri(t.path,["ambient"])?this.updateAmbientLight(a.ambient,i.shared):ri(t.path,["shadow"])?this.updateShadow(a.shadow):t.type===0&&t.path.length===0&&(t.props.uiFrame!==void 0||r!==a.uiFrame)&&this.updateUIFrame(t.props.uiFrame,i)}updateUIFrame(t,e){t?(this.uiCanvas||this.createUICanvas(t,e),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(t)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(t,e){this.updateState_Entity(t,e),t.backgroundColor!==void 0&&this.setBackgroundColor(mr(t.backgroundColor,e.shared)),t.fog!==void 0&&this.updateFog(t.fog,e.shared),t.sky!==void 0&&this.updateSky(t.sky,e.shared),t.grading!==void 0&&(this.gradingState=t.grading),t.ambient!==void 0&&this.updateAmbientLight(t.ambient,e.shared),t.ao!==void 0&&this.updateAo(t.ao,e.shared),t.shadow!==void 0&&this.updateShadow(t.shadow)}createFrame(t,e){}raycast(t,e){super.raycast(t,e)}switchActiveCamera(t){t&&t.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(al).fill(.5);let t=0,e=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof zg&&i.visible&&t<ag&&(this.penumbraSizeArrayCache[t]=i.data.penumbraSize??.5,t+=1),i instanceof Ng&&i.visible&&t<al-ag&&(this.penumbraSizeArrayCache[ag+e]=i.data.penumbraSize??.5,e+=1)})}raycastWithClones(t){let e=[],i=n=>{for(let r of n.children){let a=r.cloner;Be.is(r)&&(r.visible||a?.object.data.visible)&&((ms(r)||eb(r)&&this.scene.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,e),VA(r,t,e,!0)),i(r))}};return i(this),e}updateEntity2DByOp(t,e,i,n){this.uiCanvas?.updateEntity2DByOp(t,e,i,n)}}});function J4(){return jk}function e2(){if(ib===null)throw new Error('[spe] Classic (WebGL) particles are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return ib}function i2(t){return t?.isWebGPUSplineRenderer===!0}var jk,ib,Ju,Gk=k(()=>{jk=null,ib=null}),c3=k(()=>{rt(),Wb(),td(),Ju=class extends Jc(_p,pp){constructor(t,e,i){super(),this.super_Entity(t,e),this.context=i,this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e)}}}),V$=vp((t,e)=>{var i,n;i=t,n=function(){return r.importState=function(a){var s=new r;return s.importState(a),s},r;function r(){return function(a){var s=0,o=0,l=0,c=1;a.length==0&&(a=[+new Date]);var h=function(){var p=4022871197,f=function(g){g=g.toString();for(var m=0;m<g.length;m++){var y=.02519603282416938*(p+=g.charCodeAt(m));y-=p=y>>>0,p=(y*=p)>>>0,p+=4294967296*(y-=p)}return 23283064365386963e-26*(p>>>0)};return f.version="Mash 0.9",f}();s=h(" "),o=h(" "),l=h(" ");for(var d=0;d<a.length;d++)(s-=h(a[d]))<0&&(s+=1),(o-=h(a[d]))<0&&(o+=1),(l-=h(a[d]))<0&&(l+=1);h=null;var u=function(){var p=2091639*s+23283064365386963e-26*c;return s=o,o=l,l=p-(c=0|p)};return u.next=u,u.uint32=function(){return 4294967296*u()},u.fract53=function(){return u()+11102230246251565e-32*(2097152*u()|0)},u.version="Alea 0.9",u.args=a,u.exportState=function(){return[s,o,l,c]},u.importState=function(p){s=+p[0]||0,o=+p[1]||0,l=+p[2]||0,c=+p[3]||0},u}(Array.prototype.slice.call(arguments))}},typeof t=="object"?e.exports=n():typeof define=="function"&&define.amd?define(n):i.Alea=n()});function j$(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(e=!0)}),e}var es,kd,mp,Kg=k(()=>{lr(),rt(),Ep(),nx(),la(),es=new ci,kd=new C,mp=class extends vi{constructor(t,e,i){super(t,e,i),this.data=e,this.hiddenMatrixOld=new At,this.smoothShading=!0,this.skipReactionUpdate=!1}chooseGeoemtryCache(t){return this.dataPatched.flatShading?t.geometryCache:t.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;t.copy(this.originalGeometryNew.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}createGeometryByControls(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry?.uuid,{originalGeometry:i,subdividedGeometry:n,subdivPointer:r}=Fi.build(t,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=r,i!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=i),n!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=n??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ku(this),Qu(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}updateState(t,e){if(super.updateState(t,e),t.flatShading!==void 0){let i=this.material;this.material=Array.isArray(i)?i.map(n=>n.getFlavor(!1,n.side,n.wireframe)):i.getFlavor(!1,i.side,i.wireframe),this.smoothShading=!t.flatShading,this.createGeometryDelayed(e)}}updateMesh(t=!1,e=!1,i=!1){e&&this.subdividedGeometry||Fi.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0,i),this.subdividedGeometry&&Fi.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){let t=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Fi.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Fi.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ku(this),Qu(this),this.calcBoundingBox(),t&&(this.localGeometry.uuid=t)}raycast(t,e){let i=this.localGeometry;this.localGeometry=this.originalGeometryNew,$i.prototype.raycast.call(this,t,e),this.localGeometry=i}activateShearCompensation(){!this.hasNonUniformScale||(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateShearCompensation(){!this.hasNonUniformScale||(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;es.setFromBufferAttribute(e),es.getCenter(i),t.boundingSphere.radius=i.distanceTo(es.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),es.getSize(kd),this.hasNonUniformScale&&kd.divide(this.scale);let n={width:kd.x,height:kd.y,depth:kd.z};return this.geometry.userData.parameters=n,n}updateBoundingSphere(t){let e=this.originalGeometry;es.min.set(t[0],t[2],t[4]),es.max.set(t[1],t[3],t[5]),this.hasNonUniformScale&&(es.min.applyMatrix4(this.shearScaleInv),es.max.applyMatrix4(this.shearScaleInv)),e.boundingSphere===null&&(e.boundingSphere=new vr);let i=e.boundingSphere.center;es.getCenter(i),e.boundingSphere.radius=i.distanceTo(es.max)}freeSubdivPointer(){this.subdivPointer&&(Fi.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry,i=e?.uuid,n=e?.userData.parameters,r=t.subdivisions>0?Fi.buildRefined(this.subdivPointer,t.subdivisions,this.smoothShading?t.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ku(this),Qu(this),n!==void 0&&(this.localGeometry.userData.parameters=n),i&&(this.localGeometry.uuid=i)}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),this.localGeometry&&(t.type===0&&t.path.length===0&&Tk(t.props)&&this.subdivPointer?this.updateSubdivisionLevel(e):this.createGeometryByControls(e))}}});function d3(t){if(t.component){let e=t.component.instances.indexOf(t);e>=0&&t.component.instances.splice(e,1);for(let i of t.children)Be.is(i)&&d3(i)}}var hg,GA,nb,Hk=k(()=>{Wr()}),G$=vp((t,e)=>{function i(n,r,a,s){this.message=n,this.expected=r,this.found=a,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i)}(function(n,r){function a(){this.constructor=n}a.prototype=r.prototype,n.prototype=new a})(i,Error),i.buildMessage=function(n,r){var a,s={literal:function(d){return'"'+l(d.text)+'"'},class:function(d){var u,p="";for(u=0;u<d.parts.length;u++)p+=d.parts[u]instanceof Array?c(d.parts[u][0])+"-"+c(d.parts[u][1]):c(d.parts[u]);return"["+(d.inverted?"^":"")+p+"]"},any:function(d){return"any character"},end:function(d){return"end of input"},other:function(d){return d.description}};function o(d){return d.charCodeAt(0).toString(16).toUpperCase()}function l(d){return d.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function c(d){return d.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function h(d){return s[d.type](d)}return"Expected "+function(d){var u,p,f=new Array(d.length);for(u=0;u<d.length;u++)f[u]=h(d[u]);if(f.sort(),f.length>0){for(u=1,p=1;u<f.length;u++)f[u-1]!==f[u]&&(f[p]=f[u],p++);f.length=p}switch(f.length){case 1:return f[0];case 2:return f[0]+" or "+f[1];default:return f.slice(0,-1).join(", ")+", or "+f[f.length-1]}}(n)+" but "+((a=r)?'"'+l(a)+'"':"end of input")+" found."},e.exports={SyntaxError:i,parse:function(n,r){r=r!==void 0?r:{};var a,s={},o={svg_path:Pe},l=Pe,c=function(it){if(!it)return[];for(var Et=[],mt=0;mt<it.length;mt++)Et=Et.concat.apply(Et,it[mt]);var St=Et[0];return St&&St.code=="m"&&(delete St.relative,St.code="M"),Et},h=function(it,Et){return function(mt,St){if(!St)return[mt];for(var Ot=[mt],z=0,ot=St.length;z<ot;z++)Ot[z+1]=St[z][1];return Ot}(it,Et)},d=/^[Mm]/,u=be(["M","m"],!1,!1),p=function(it,Et,mt){var St=fo(it,[Et]);return mt&&(St=St.concat(fo(it=="M"?"L":"l",mt[1]))),St},f=/^[Zz]/,g=be(["Z","z"],!1,!1),m=function(){return fo("Z")},y=/^[Ll]/,v=be(["L","l"],!1,!1),_=function(it,Et){return fo(it,Et)},b=/^[Hh]/,x=be(["H","h"],!1,!1),w=function(it,Et){return fo(it,Et.map(function(mt){return{x:mt}}))},S=/^[Vv]/,T=be(["V","v"],!1,!1),E=function(it,Et){return fo(it,Et.map(function(mt){return{y:mt}}))},P=/^[Cc]/,A=be(["C","c"],!1,!1),R=function(it,Et,mt){return{x1:it.x,y1:it.y,x2:Et.x,y2:Et.y,x:mt.x,y:mt.y}},O=/^[Ss]/,D=be(["S","s"],!1,!1),I=function(it,Et){return{x2:it.x,y2:it.y,x:Et.x,y:Et.y}},U=/^[Qq]/,N=be(["Q","q"],!1,!1),G=function(it,Et){return{x1:it.x,y1:it.y,x:Et.x,y:Et.y}},H=/^[Tt]/,J=be(["T","t"],!1,!1),K=/^[Aa]/,tt=be(["A","a"],!1,!1),ct=function(it,Et,mt,St,Ot,z){return{rx:it,ry:Et,xAxisRotation:mt,largeArc:St,sweep:Ot,x:z.x,y:z.y}},et=function(it,Et){return{x:it,y:Et}},st=function(it){return 1*it},dt=function(it){return 1*it.join("")},Y=/^[01]/,ht=be(["0","1"],!1,!1),F=function(it){return it=="1"},B=function(){return""},j=",",Z=_e(",",!1),L=function(it){return it.join("")},W=".",X=_e(".",!1),V=/^[eE]/,nt=be(["e","E"],!1,!1),lt=/^[+\-]/,ft=be(["+","-"],!1,!1),pt=/^[0-9]/,Pt=be([["0","9"]],!1,!1),bt=function(it){return it.join("")},Rt=/^[ \t\n\r]/,_t=be([" "," ",`
|
|
4169
|
+
`&&E.push("")):x.getTextWidth(E[E.length-1]+P,b)>T&&(E[E.length-1].length&&E.push(""),x.getTextWidth(E[E.length-1]+P,b)>T&&(P.length===1?(E[E.length-1]+=P,P=""):(E[E.length-1]+=P.slice(0,-1),P=P[P.length-1],E.push(""))));return E[E.length-1]+=P,E}(t,i,c===2?h.toUpperCase():c===3?h.toLowerCase():h,e),{shapes:u,charWidths:p,charCoords:f}=i.generateShapes(d,t,e),g=.5*(typeof n=="number"?n:Number(e.getVariable(n))),m=.5*(typeof r=="number"?r:Number(e.getVariable(r))),y=u.map(b=>new ki().fromShape(b,!0));this.vectorShapes=y;let v=y.map(b=>Mh.create({shape:b,parameters:{depth:a,extrudeBevelSegments:o,extrudeBevelSize:s,windingRule:a<=0?fi.NONZERO:fi.ODD,subdivisions:this.isLowResolution&&a>0?1:12}})),_=v.length?Pc(v):O4();_.translate(-g,m,0),this.dispose(),this.wrappedText=d,this.charCoords=f,this.charWidths=p,this.deleteAttribute("extrudeNormal"),Object.entries(_.attributes).forEach(([b,x])=>{this.setAttribute(b,x)}),this.setIndex(_.index),this.computeBoundingSphere()}clone(){let t=ea(new Gt,CA.prototype);return t.copy(this),console.log("CloneGeometry",this,t),t}copy(t){return Object.entries(t.attributes).forEach(([e,i])=>{this.setAttribute(e,i)}),this.setIndex(t.index),this.userData={parameters:{...t.userData.parameters},type:"TextGeometry"},this}async setText(t,e){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:t}},e)}get text(){return this.userData.parameters.text??""}}});function L$(t){if(!PA)return L4||(L4=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.13/build",i=import("./process.js"),[n,r]=await Promise.all([i,fetch(`${e}/process.wasm`).then(o=>o.arrayBuffer())]),a=n.default,s=await a({wasmBinary:r});Mk(s),PA=!0}())}var Mk,JC,PA,L4,Jb=k(()=>{JC=new Promise(t=>{Mk=t}),PA=!1});function FS(t,e){if(Object.keys(t.morphAttributes).length>0||Object.keys(e.morphAttributes).length>0)return!1;let i=Object.keys(t.attributes),n=Object.keys(e.attributes);if(i.length!==n.length)return!1;for(let o of n){let l=t.attributes[o],c=e.attributes[o];if(l===void 0||l.isInterleavedBufferAttribute===!0||c.isInterleavedBufferAttribute===!0||l.itemSize!==c.itemSize||l.normalized!==c.normalized||l.array.constructor!==c.array.constructor||l.array.length!==c.array.length)return!1}let r=t.index,a=e.index;if(r===null!=(a===null))return!1;let s=!1;if(r!==null&&a!==null){if(r.array.length!==a.array.length)return!1;let o=r.array.constructor,l=a.array.constructor;if(o!==l){if(o!==Uint32Array||l!==Uint16Array)return!1;s=!0}}if(t.groups.length!==e.groups.length)return!1;for(let o=0;o<e.groups.length;o++){let l=t.groups[o],c=e.groups[o];if(l.start!==c.start||l.count!==c.count||l.materialIndex!==c.materialIndex)return!1}for(let o of n){let l=t.attributes[o],c=e.attributes[o];l.array.set(c.array),l.needsUpdate=!0}if(r!==null&&a!==null){if(s){let o=r.array,l=a.array;for(let c=0,h=l.length;c<h;c++){let d=l[c];o[c]=d===65535?4294967295:d}}else r.array.set(a.array);r.needsUpdate=!0}return t.drawRange.start=e.drawRange.start,t.drawRange.count=e.drawRange.count,t.userData=e.userData,t.boundingBox=null,t.boundingSphere=null,!0}function DA(t,e,i,n){let r,a,s,o=t.position.array,l=t.normal.array,c=Ek.makeScale(e,i,n).invert().elements;for(let h=0,d=o.length;h<d;h+=3)o[h]*=e,o[h+1]*=i,o[h+2]*=n,r=l[h],a=l[h+1],s=l[h+2],l[h]=c[0]*r+c[4]*a+c[8]*s,l[h+1]=c[1]*r+c[5]*a+c[9]*s,l[h+2]=c[2]*r+c[6]*a+c[10]*s;t.position.needsUpdate=!0,t.normal.needsUpdate=!0}var Ek,Ak=k(()=>{rt(),Ek=new At});function Tk(t){let e=Object.keys(t);return e.length===1&&e[0]==="subdivisions"}function t3(t,e){let i=e?e.count:t.count,n=0,r=1e4,a=new Map,s=new Uint32Array(i),o=[];for(let h=0;h<i;h++){let d=e?e.getX(h):h,u=t.getX(d),p=t.getY(d),f=t.getZ(d),g=Math.round(u*r),m=Math.round(p*r),y=Math.round(f*r),v=a.get(g);v===void 0&&(v=new Map,a.set(g,v));let _=v.get(m);_===void 0&&(_=new Map,v.set(m,_));let b=_.get(y);b===void 0&&(b=n++,_.set(y,b),o.push(u,p,f)),s[h]=b}let l=[],c=[];for(let h=0;h<s.length;h+=3)s[h]===s[h+1]||s[h]===s[h+2]||s[h+1]===s[h+2]||(l.push(s[h],s[h+1],s[h+2]),c.push(e?e.getX(h):h,e?e.getX(h+1):h+1,e?e.getX(h+2):h+2));return{positions:o,triIndices:l,triOriginals:c}}var Lf,ic,Qt,kS,VS,jS,Fi,Bf,Av,Tv,Cv,RA,h1,Ep=k(()=>{rt(),Jb(),te(),tx(),Ak(),Og(),Lf=new ci,ic=new C,JC.then(t=>{Qt=t}),kS=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),VS=new Uint32Array([0,1,2,3]),jS=new Uint8Array([4]),Fi=class extends Gt{constructor(t,e){super(),this.data=t,this.flatShading=e,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(t,e){this.freeSubdivPointer();let i=this.data.scaleBaked.map(s=>typeof s=="number"?s:1),n=ch.div(e.map(s=>typeof s=="number"?s:0),i);if(n.every(s=>s===1))return;this.subdividedGeometry&&DA(this.subdividedGeometry.attributes,...n),this.originalGeometry&&DA(this.originalGeometry.attributes,...n),this.data=t;let r=this.userData.parameters;this.userData.parameters={width:r.width*n[0],height:r.height*n[1],depth:r.depth*n[2]},this.originalGeometry.boundingSphere.center.multiply(ic.fromArray(n));let a=ic.set(r.width,r.height,r.depth).length();this.originalGeometry.boundingSphere.radius=a/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(t){this.freeSubdivPointer(),this.data=t;let e=t.phongAngle??35;this.flatShading&&(e=-1);let i=null;if(t.subdivisions>0){let r=0;try{r=Fi.allocate(t),i=Fi.buildRefined(r,t.subdivisions,e)}catch(a){console.error(a,t)}finally{r&&Fi.freeSubdivPointer(r)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let n=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=n}rebuild(){let t,e,i;try{({originalGeometry:t,subdividedGeometry:e,subdivPointer:i}=Fi.build(this.data,void 0,!this.flatShading,void 0))}catch{t=new _s(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=t,this.subdividedGeometry=e??void 0;let n=this.subdividedGeometry??this.originalGeometry;Object.assign(this,n),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Fi.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;Lf.setFromBufferAttribute(e),Lf.getCenter(i),t.boundingSphere.radius=i.distanceTo(Lf.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Lf.getSize(ic);let n={width:ic.x,height:ic.y,depth:ic.z};return this.userData.parameters=n,n}static build(t,e,i,n){let r,a,s=t?.phongAngle??35;i===!1&&(s=-1),e&&(Qt.free_bvh(e),Qt.free_subdivision_surface(e));try{r=Fi.allocate(t,n)}catch(l){console.error(l,t),r=Fi.allocate({positionWASM:kS,indexWASM:VS,verticesPerFaceWASM:jS},n)}Qt.set_destination_refinement_level(r,0);let o=Fi.buildLevel(r,!0,s);return a=t.subdivisions>0?Fi.buildRefined(r,t.subdivisions,s):null,{subdivPointer:r,originalGeometry:o,subdividedGeometry:a}}static buildRefined(t,e,i){try{return Qt.set_destination_refinement_level(t,e),Fi.buildLevel(t,!1,i)??null}catch{try{return Qt.set_destination_refinement_level(t,e-1),Fi.buildLevel(t,!1,i)??null}catch{return null}}}static primitiveToQuads(t,e,i){t.widthSegments>16&&(t.widthSegments=16),t.heightSegments>16&&(t.heightSegments=16),t.depthSegments>16&&(t.depthSegments=16),t.radialSegments>16&&(t.radialSegments=16),t.type==="DodecahedronGeometry"&&(t.detail=0);let n,r=t.shape!==void 0||t.path!==void 0?e.geometry:ih(t,i,!1,e);n=PF(t)?r.getClosedTorusIndicesForBooleanOrSubdiv():r.getIndex();let a,{positions:s,triIndices:o,triOriginals:l}=t3(r.getAttribute("position"),n);if(t.type==="CylinderGeometry"&&t.cornerRadius===0&&t.hollow===0&&t.openEnded===!1){let u=t.radialSegments*t.heightSegments*3*2;a=[u,u+3*t.radialSegments]}let{indices:c,verticesPerFace:h,uvs:d}=function(u,p,f,g,m){let y=[],v=[],_=m?f.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=T=>{if(b){let E=m[T];b.push(_.getX(E),_.getY(E))}};if(f.userData.shape!==void 0&&f.userData.parameters.depth===0&&f.userData.shape.shapeHoles.length===0){let T=f.userData.shape.extractShapePointsToFlatArray([]),E=f.userData.parameters.spikes;if(f.userData.type==="EllipseGeometry"&&E<=24&&E%4==0&&f.userData.parameters.angle>=360){let R=T.length/2/E;T=T.filter((O,D)=>Math.floor(D/2)%R===0)}let P=0;for(let R=0;R<T.length;R+=2)P+=(T[R]-T[(R===0?T.length:R)-2])*(T[R+1]+T[(R===0?T.length:R)-1]);u.length=0;let A=0;if(P<0)for(let R=0;R<T.length;R+=2)u.push(T[R],T[R+1],0),y.push(A++);else for(let R=T.length-2;R>=0;R-=2)u.push(T[R],T[R+1],0),y.push(A++);return v.push(A),{indices:y,verticesPerFace:v}}let w=new Float32Array([f.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(f.useNgonForTopBottomFaceDuringBake){let T=0;if((u[3*p[S]+2]===w||u[3*p[S]+2]===0)&&T++,(u[3*p[S+1]+2]===w||u[3*p[S+1]+2]===0)&&T++,(u[3*p[S+2]+2]===w||u[3*p[S+2]+2]===0)&&T++,T===3)break}if(p[S+1]===p[S+3]&&p[S+2]===p[S+5]||p[S+0]===p[S+3]&&p[S+2]===p[S+4]){Bf.set(u[3*p[S]],u[3*p[S]+1],u[3*p[S]+2]),Av.set(u[3*p[S+1]],u[3*p[S+1]+1],u[3*p[S+1]+2]),Tv.set(u[3*p[S+4]],u[3*p[S+4]+1],u[3*p[S+4]+2]),Cv.set(u[3*p[S+5]],u[3*p[S+5]+1],u[3*p[S+5]+2]),Av.sub(Bf).normalize(),Tv.sub(Bf).normalize(),Cv.sub(Bf).normalize();let T=Av.cross(Tv).dot(Cv),E=S;Math.abs(T)>.005||g&&g.some((P,A)=>A%2!=1&&E>=g[A]&&E<g[A+1])?(y.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),v.push(3),S+=3):(y.push(p[S],p[S+1],p[S+4],p[S+5]),x(S),x(S+1),x(S+4),x(S+5),v.push(4),S+=6)}else y.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),v.push(3),S+=3}if(f.useNgonForTopBottomFaceDuringBake){let T=[],E=[],P=0;for(let A=0,R=0;A<u.length;A+=3,R++)u[A+2]===0&&(T.push(R),P++),u[A+2]===w&&E.push(R);if(f.userData.parameters.extrudeBevelSize===0){let A=E[0];E[0]=E[1],E[1]=A}T.reverse(),y.push(...T,...E),v.push(P,P),b=void 0}return{indices:y,verticesPerFace:v,uvs:b}}(s,o,r,a,l);return{positions:s,indices:c,verticesPerFace:h,uvs:d}}static allocate(t,e){let i,n,r,a=[],s=[];t.positionWASM&&t.positionWASM.length>0?(i=t.positionWASM,n=t.indexWASM,r=t.verticesPerFaceWASM,Qt.alloc_subdivision_surface_uvs&&t.uvWASM&&t.uvWASM.length===2*n.length&&(s=t.uvWASM)):(i=kS,n=VS,r=jS);let o,l=i.length,c=n.length,h=r.length,d=i.length+a.length+s.length,u=n.length+r.length,p=d*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,f=d*Float32Array.BYTES_PER_ELEMENT,g=Qt._malloc(p),m=new Float32Array(Qt.HEAPF32.buffer,g,d),y=new Uint32Array(Qt.HEAPU32.buffer,g+f,u);m.set(i,0),m.set(a,i.length),m.set(s,i.length+a.length),y.set(n,0),y.set(r,n.length),t?.scaleBaked?.some(b=>b!==1)&&(o=new At().makeScale(...t.scaleBaked.map(b=>typeof b=="number"?b:1))),e&&(o?o.premultiply(e):o=e);let v=g+(i.length+a.length)*Float32Array.BYTES_PER_ELEMENT,_=s.length?o?Qt.alloc_subdivision_surface_uvs2(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h,v,s.length,o.elements):Qt.alloc_subdivision_surface_uvs(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h,v,s.length):o?Qt.alloc_subdivision_surface2(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h,o.elements):Qt.alloc_subdivision_surface(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h);return Qt._free(g),_}static buildLevel(t,e,i,n,r,a=!1){let s=r?Qt.get_mesh_data2(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i,r.elements):Qt.get_mesh_data(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i),o=Qt.HEAPU32.subarray(s>>2,10+(s>>2)),l=o.subarray(4,8),c=0,h=Qt.HEAPU32[o[c]>>2],d=Qt.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let u=Qt.HEAPU32[o[c]>>2],p=Qt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let f=Qt.HEAPU32[o[c]>>2],g=Qt.HEAPU32.subarray(f>>2,(f>>2)+l[c]);c++;let m,y=Qt.HEAPU32[o[c]>>2],v=Qt.HEAPU32.subarray(y>>2,(y>>2)+l[c]);if(c++,Qt.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=Qt.HEAPU32[o[8]>>2];m=Qt.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(n===void 0){let b=new Gt;if(b.setIndex(new oh(v,1)),b.setAttribute("position",new Ft(d,3)),b.setAttribute("normal",new Ft(p,3)),m&&b.setAttribute("uv",new Ft(m,2)),e){b.setAttribute("faceMap",new oh(g,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new Ht(x,4))}return Qt.free_mesh_data(s),b.userData.type="SubdivGeometry",b}if(n.getAttribute("position").copyArray(d),n.getAttribute("normal").copyArray(p),n.attributes.position.needsUpdate=!0,n.attributes.normal.needsUpdate=!0,a){let b=n.getIndex();b!==null&&b.array.length===v.length&&(b.copyArray(v),b.needsUpdate=!0)}let _=n.getAttribute("uv");m&&_&&_.array.length===m.length&&(_.copyArray(m),_.needsUpdate=!0),Qt.free_mesh_data(s)}static freeSubdivPointer(t){Qt.free_bvh(t),Qt.free_subdivision_surface(t)}static buildControlCageWireframe(t,e,i){let n=Qt.get_wireframe_data_for_base_level(t),r=Qt.HEAPU32.subarray(n>>2,4+(n>>2)),a=r.subarray(2,4),s=0,o=Qt.HEAPU32[r[s]>>2],l=Qt.HEAPF32.subarray(o>>2,(o>>2)+a[s]);s++;let c=Qt.HEAPU32[r[s]>>2],h=Qt.HEAPU32.subarray(c>>2,(c>>2)+a[s]);if(e===void 0){let d=new Gt;d.setAttribute("position",new Ft(l,3));let u=new Float32Array(l.length);for(let p=0,f=l.length;p<f;)u[p++]=i.r,u[p++]=i.g,u[p++]=i.b;return d.setAttribute("color",new Ht(u,3)),d.setIndex(new oh(h,1)),Qt.free_wireframe_data_for_base_level(n),d}e.getAttribute("position").copyArray(l),e.attributes.position.needsUpdate=!0,Qt.free_wireframe_data_for_base_level(n)}static updateCollabMesh(t,e,i){let n=e===0;n||Qt.set_destination_refinement_level(t,e);let r=i?Qt.get_topological_data2(t,n?Qt.Level.CONTROL:Qt.Level.REFINED,i.elements):Qt.get_topological_data(t,n?Qt.Level.CONTROL:Qt.Level.REFINED),a=Qt.HEAPU32.subarray(r>>2,8+(r>>2)),s=a.subarray(3,6),o=0,l=Qt.HEAPU32[a[o]>>2],c=new Float32Array(Qt.HEAPF32.subarray(l>>2,(l>>2)+s[o]));o++;let h=Qt.HEAPU32[a[o]>>2],d=new Uint32Array(Qt.HEAPU32.subarray(h>>2,(h>>2)+s[o]));o++;let u,p=Qt.HEAPU32[a[o]>>2],f=new Uint8Array(Qt.HEAPU32.subarray(p>>2,(p>>2)+s[o]));if(Qt.alloc_subdivision_surface_uvs){let g=a[7];if(g>0){let m=Qt.HEAPU32[a[6]>>2];u=new Float32Array(Qt.HEAPF32.subarray(m>>2,(m>>2)+g))}}return Qt.free_topological_data(r),{positions:c,indices:d,verticesPerFace:f,uvs:u}}},Bf=new C,Av=new C,Tv=new C,Cv=new C}),Ck=k(()=>{i4(),n4(),X_(),r4(),Z_(),Og(),_4(),b4(),x4(),AA(),M4(),K_(),E4(),A4(),T4(),TA(),C4(),P4(),D4(),R4(),gh(),ke(),i4(),n4(),X_(),r4(),Z_(),O$(),Og(),_4(),b4(),x4(),AA(),M4(),K_(),E4(),A4(),T4(),TA(),C4(),P4(),D4(),R4(),gh(),I$(),ak(),Sk(),Ep(),Jb(),Zb(),RA={ConeGeometry:qF,CubeGeometry:XF,CylinderGeometry:$C,DodecahedronGeometry:$F,EllipseGeometry:Kb,HelixGeometry:DF,IcosahedronGeometry:hk,LatheGeometry:ck,NonParametricGeometry:uk,PolygonGeometry:KC,PyramidGeometry:pk,RectangleGeometry:Qb,SphereGeometry:gk,PlaneGeometry:vk,BackdropGeometry:yk,StarGeometry:QC,TextFrameGeometry:_k,TorusGeometry:bk,TorusKnotGeometry:xk,TriangleGeometry:wk,VectorGeometry:Mh},h1=t=>{let e=RA[t.type]??_F(t.type);if(e===void 0)throw new Error(`No geometry factory registered for "${t.type}" \u2014 was its feature compiled out of this runtime build?`);return e.create(t)}});function ih(t,e,i,n){let r,a,s;t.type==="PathGeometry"?(a=JSON.parse(JSON.stringify(t)),s=[[],["extrusion"]]):(a={...t},s=[[]]);for(let c of s){let h=a;for(let d of c)h=h[d];for(r in h){let d=h[r];wO(d)&&!Pk.includes(r)&&(h[r]=e.getVariable(d,[n.uuid,"geometry",...c,r]),wO(h[r])&&(h[r]=1))}}let o,l={parameters:a,type:a.type};if(a.type==="PathGeometry")l.path=a.path;else if(a.type==="VectorGeometry"){let c=ki.createFromState(a.shape,a.width,a.height);l.shape=c}else if(a.type==="NonParametricGeometry"){if(a.data.groups&&a.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),l.geometry=new rC().parse(a),l.geometry.groups.length===0){let c=l.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else{if(a.type==="SubdivGeometry"){let c=new Fi(a,i);return c.data=t,c}if(a.type==="TextGeometry"||a.type==="InputGeometry"){let c=_F(a.type);if(c)return c.create(a,e);Gn("text",`a ${a.type}`);let h=ki.createFromState(Dg.defaultData(),100,100);return h1({...a,shape:h,type:"VectorGeometry"})}if(a.type==="UIGeometry")return Qb.create({parameters:{width:a.width,height:a.height,cornerRadius:a.cornerRadius,cornerType:a.cornerType}})}try{o=h1(l)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${l}`);let h=ki.createFromState(Dg.defaultData(),100,100);l.shape=h,l.type="VectorGeometry",o=h1(l)}return o}var Pk,B4,OA,tx=k(()=>{te(),rt(),Ck(),ke(),K_(),Sh(),Ep(),Pk=["font"]}),B$=k(()=>{tx(),B4=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,i){let n=this.objects.get(t);return n===void 0?(n=this.createObject(t,e,i),this.objects.set(t,n)):n.isShared=!0,n}forceDelete(t){let e=this.objects.get(t);e&&(this.disposeObject(e),this.objects.delete(t))}adopt(t,e){this.objects.set(t,e)}mutateIfUnique(t,e){let i=this.objects.get(t);if(i&&i.isShared!==!0)return this.objects.delete(t),this.objects.set(e,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){e===this.objects.get(t)&&this.unreachable.delete(t)}endGc(){this.unreachable.forEach(t=>{this.disposeObject(this.objects.get(t)),this.objects.delete(t)}),this.unreachable.clear()}dispose(){this.objects.forEach(t=>{this.disposeObject(t)}),this.objects.clear()}},OA=class extends B4{constructor(t){super(),this.flatShading=t}disposeObject(t){t.dispose()}createObject(t,e,i){let n=ih(t,e,this.flatShading,i);return n.computeBoundingSphere(),n}}});function Q_(){return ex}function Dk(){if(ex==="webgpu"){if(N4!==void 0)return N4;LA||(LA=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(IA===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return IA}function Rk(t,e){return Dk().createRootMaterial(t,e)}function U4(t,e,i){return Dk().createSharedMaterial(t,e,i)}function z4(t){return t.getLayersOfType===void 0&&Object.assign(t,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),t}function Ok(){return U$}var ex,N4,IA,LA,BA,U$,UA,Ik,Eh=k(()=>{ex="webgl",LA=!1}),z$=k(()=>{Ik={markNeedsUpdateRendererDirty:()=>{}}});function Bc(t,e){let i=0;if(!t.layers||t.layers.length===0)return!1;let n=t.layers?.find(r=>r.data.type==="light");if(n){let r=n.data,a=Number(e.getVariable(r.alphaOverride));if((typeof r.alphaOverride=="string"?a/100:r.alphaOverride)<1)return!0}for(let r of t.layers){if(r.data.type!=="displace"&&r.data.isMask)return!0;if(r.data.type!=="displace"&&"alpha"in r.data&&r.data.type!=="light"&&r.data.type!=="fresnel"&&r.data.type!=="cavity"&&r.data.type!=="dust"&&r.data.type!=="texture"&&r.data.type!=="matcap"&&r.data.type!=="rainbow"&&r.data.type!=="outline"&&r.data.type!=="pattern"){let a=r.data.visible?r.data.alpha:0;if(typeof a=="string"&&(a=Math.max(0,Math.min(1,Number(e.getVariable(a)??100)/100))),a===1&&r.data.type==="depth"||r.data.type==="gradient"){for(let s of r.data.colors)if(s[3]<1){a=s[3];break}}else if(a===1&&r.data.type==="noise"){let s=e.color(r.data.colorA).a,o=e.color(r.data.colorB).a,l=e.color(r.data.colorC).a,c=e.color(r.data.colorD).a,h=Math.min(s,Math.min(o,Math.min(l,c)));h<1&&(a=h)}i+=(1-i)*a}}return i<1}var e3=k(()=>{});function fp(t){return typeof t=="string"||typeof t=="number"&&t!==0}var vh,qt,ix,Lk,F4,k4,ba,sl=k(()=>{vh=(t,e,i)=>Math.max(0,Math.min(1,Number(e.getVariable(typeof t=="number"?100*t:t,i)??100)/100))??1,qt=(t,e,i)=>typeof t=="number"?t:e.getVariable(t,i),ix={noise:["noiseType"],texture:["projection","axis","projectionAxis","side"],video:["projection","axis","projectionAxis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"],reflection:["tracingMode","mirror"]},Lk={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Ap=k(()=>{rt(),$g(),F4=class extends Xb(bi){},k4=t=>t.type==="Mesh",ba=class extends F4{constructor(t){super(),this.object=t,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=t.hasNonUniformScale}raycast(t,e){}expand(){let t=0,e=this.object.entityChildren(t);for(;e;){let i=this.children[t];i?.object!==e&&(i&&this.remove(i),i=new ba(e),this.add(i),this.children.splice(t,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=e.matrix,i.hiddenMatrix=e.hiddenMatrix,i.pivotMatrix=e.pivotMatrix),i.expand(),t+=1,e=this.object.entityChildren(t)}for(;this.children.length>t;)this.remove(this.children[t]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let t=this.object.cloner;return(t===void 0||this.parent!==t||!t.instancingActive&&!t.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(t){}get castShadow(){return this.object.castShadow}set castShadow(t){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(t){}get isMesh(){return k4(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(t){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(t){}}});function V4(){return i3}var i3,n3,r3=k(()=>{i3=null,n3=null});function zA(t){return"variable_"+t}var GS,HS,WS,j4,qS,G4,H4,J_,a3=k(()=>{te(),FF(),jF(),HC(),xs(),WC(),XC(),B$(),Eh(),VF(),z$(),e3(),sl(),Wr(),Ap(),Ye(),rt(),r3(),ke(),GS=new At,HS=new C,WS=new Yt,j4=new C,qS=new Ti,G4=class extends zF{constructor(t){super(),this.shared=t}create(t){return new GC(t,this.shared)}},(J_=H4=class{constructor(t,e={},i=!0,n=!1){if(this.data=t,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=n,this.geometryCache=new OA(!0),this.geometryCache2=new OA(!1),this.imageHolderCache=new G4(this),this.thisContext={scene:Ik,shared:this},this.deletedImage=new Xo(tA.emptyImage,this),this.deletedVideo=new Xo(C_.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.timelineAnimations={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,e.images)for(let[r,a]of Object.entries(e.images))this.addImage(r,a);if(e.videos)for(let[r,a]of Object.entries(e.videos))this.addVideo(r,a);if(e.audios)for(let[r,a]of Object.entries(e.audios))this.addAudio(r,a);if(e.particles)for(let[r,a]of Object.entries(e.particles))this.addParticle(r,a);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=U4(Vi.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,i=!1){this.data=t,this.resetLib(t.lib);for(let{id:n,data:r}of t.variables)this.addVariableHolder(n,r),e&&this.updateVariableHolder(n,r);for(let[n,r]of Object.entries(t.userAPIs??{}))this.addUserAPI(n,r);for(let[n,r]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(n,r);if(!i){for(let[n,r]of Object.entries(t.images))this.addImage(n,r);for(let[n,r]of Object.entries(t.videos))this.addVideo(n,r)}for(let[n,r]of Object.entries(t.colors))this.addColor(n,r);for(let[n,r]of Object.entries(t.lib.materials))this.addMaterial(n,r.asset);for(let[n,r]of Object.entries(t.materials))this.addMaterial(n,r);for(let[n,r]of Object.entries(t.audios))this.addAudio(n,r);for(let[n,r]of Object.entries(t.particles))this.addParticle(n,r);for(let[n,r]of Object.entries(t.fonts))this.addFont(n,r);for(let[n,r]of Object.entries(t.timelineAnimations??{}))this.addAnimation(n,r)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:Vi.defaultTwoLayerData("phong").layers}),this.materials[t]){let i=this.materials[t];i.reset(e,this.thisContext),i.dispose()}else{let i=U4(e,this.thisContext,t);this.materials[t]=i}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){return this.materials[t]}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):(t.layers===void 0&&(t={...t,layers:Vi.defaultTwoLayerData("phong").layers}),Rk(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new Xo(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new Xo(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new Xo(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):(this.colors[t]=new Bg(e.r,e.g,e.b,"a"in e?e.a:1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[t];return this.colors[t].r=e.r??i.r,this.colors[t].g=e.g??i.g,this.colors[t].b=e.b??i.b,this.colors[t].a=e.a??i.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t!="string")return new vn(t.r,t.g,t.b,"a"in t?t.a:1);{let i=this.getColor(t);i?e=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new vn(0,0,0,0))}return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof Uu)return e;{let i=new Uu({src:e.data});return this.audios[t]=i,i}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof Uu&&e.dispose(),delete this.audios[t])}addFont(t,e){let i=qC;i!==null?(this.fonts[t]=new i(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())):Gn("text","a font asset")}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}addAnimation(t,e){this.timelineAnimations[t]=e}getAnimation(t){return this.timelineAnimations[t]}deleteAniamtion(t){this.timelineAnimations[t]&&delete this.timelineAnimations[t]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._requestRender=void 0,Object.values(this.audios).forEach(t=>{t instanceof Uu&&t.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let i=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let n=localStorage.getItem(zA(t));i=n!==null?JSON.parse(n):e.value}return this.variables[t]={value:i,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(zA(t),JSON.stringify(e));let i=e;for(;typeof i=="string";)i=this.variables[i].value;let n=this.entityOpContext.scene,r=!1;for(let a=this.variables[t].locations.length-1;a>=0;a--){let s=this.variables[t].locations[a];if(s[0]==="material"){let o=s[1],l=i,c={scene:n,shared:this},h=s.slice(2);n.traverseMaterial(u=>{let p=u.root??u;p.uuid===o&&p.onVariableUpdate(h,l,c)});let d=this.materials[o];d&&d.onVariableUpdate(h,l,c)}else{let o=n.find(s[0]);if(o===void 0){this.variables[t].locations.splice(a,1);continue}if(r=!0,s[1]!=="geometry"&&s[1]!=="particles"){for(let l=1;l<s.length-1;l++)o=o[s[l]];s[1]==="rotation"?o[s[s.length-1]]=i*It.DEG2RAD:o[s[s.length-1]]=i}if(o=n.find(s[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,s),Be.is(o))if(s[1]==="position"||s[1]==="rotation"||s[1]==="scale")o.onVariableUpdate();else if(s[1]==="geometry"){let l=o;o.component&&(l=o.component);let c=l.dataPatched;l.chooseGeoemtryCache(this).forceDelete(c.geometry),l.createGeometryDelayed(this.entityOpContext),l.onVariableUpdate(!0),l.invalidateDownstreamBooleanData(),l.instances.forEach(h=>{let d=h.dataPatched;h.chooseGeoemtryCache(this).forceDelete(d.geometry),h.createGeometryDelayed(this.entityOpContext),h.onVariableUpdate(!0),h.invalidateDownstreamBooleanData()})}else s[1]==="morphTargetInfluences"&&o.updateMorphInfluences(s[2],i)}}return r&&n.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||typeof r.type!="string"||r.type==="VectorGeometry"||r.type==="PathGeometry")return!1;let a=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),s=new Map;for(let c of Object.keys(r))s.set(a(c),c);let o={};for(let[c,h]of Object.entries(e??{})){let d=s.get(a(c));if(d===void 0||d==="type"||d==="font"||d==="shape"||d==="path"||d==="data")continue;if(d==="text"){(typeof h=="string"||typeof h=="number")&&(o[d]={textValue:String(h)});continue}let u=r[d];typeof h=="number"&&isFinite(h)&&(typeof u=="number"||typeof u=="string")&&(o[d]=h)}if(Object.keys(o).length===0)return!1;let l={...r,...o};return i.dataPatched={...n,geometry:l},this.transientGeometryKeys.has(r)&&i.chooseGeoemtryCache(this).forceDelete(n.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let i=e.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(i),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||r.type!=="NonParametricGeometry")return!1;let a=e?.vertices;if(a===void 0||typeof a.length!="number"||a.length<9||a.length%3!=0||a.length/3>H4.MAX_TRANSIENT_VERTICES)return!1;let s,o,l,c=a instanceof Float32Array?a:Float32Array.from(a),h=c.length/3;if(e.normals!==void 0){if(e.normals.length!==c.length)return!1;s=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}if(e.uvs!==void 0){if(e.uvs.length!==2*h)return!1;o=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}if(e.indices!==void 0){let x=h>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(x.length===0||x.length%3!=0)return!1;for(let w=0;w<x.length;w++)if(x[w]>=h)return!1;l={array:x,itemSize:1,type:x.constructor.name,normalized:!1}}else{let x=r.data,w=x?.index;if(w?.array?.length){if(h<(x?.attributes?.position?.array?.length??0)/3){let S=w.array;for(let T=0;T<S.length;T++)if(S[T]>=h)return!1}l=w}}let d=1/0,u=1/0,p=1/0,f=-1/0,g=-1/0,m=-1/0;for(let x=0;x<c.length;x+=3){let w=c[x],S=c[x+1],T=c[x+2];w<d&&(d=w),w>f&&(f=w),S<u&&(u=S),S>g&&(g=S),T<p&&(p=T),T>m&&(m=T)}let y=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),v={position:y(c,3)};s&&(v.normal=y(s,3)),o&&(v.uv=y(o,2));let _={...r,width:f-d,height:g-u,depth:m-p,data:{attributes:v,...l?{index:l}:{}}},b=this.transientGeometryKeys.has(r);return i.dataPatched={...n,geometry:_},this.transientGeometryKeys.add(_),i.applyTransientGeometryData(this.entityOpContext,b),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let i=t;i.component&&(i=i.component);let n=i.cloner;if(n===void 0)return-1;let r=n.children,a=Math.PI/180,s=!1;if(e===null)for(let o of r)o.transformOverride!==void 0&&(o.transformOverride=void 0,s=!0);else{if(!Array.isArray(e))return r.length;{let o=Math.min(e.length,r.length);for(let l=0;l<o;l++){let c=e[l],h=r[l];if(c==null){h.transformOverride!==void 0&&(h.transformOverride=void 0,s=!0);continue}let d=h.transformOverride??{position:[h.position.x,h.position.y,h.position.z],rotation:[h.rotation.x,h.rotation.y,h.rotation.z],scale:[h.scale.x,h.scale.y,h.scale.z]};c.position&&(typeof c.position.x=="number"&&(d.position[0]=c.position.x),typeof c.position.y=="number"&&(d.position[1]=c.position.y),typeof c.position.z=="number"&&(d.position[2]=c.position.z)),c.rotation&&(typeof c.rotation.x=="number"&&(d.rotation[0]=c.rotation.x*a),typeof c.rotation.y=="number"&&(d.rotation[1]=c.rotation.y*a),typeof c.rotation.z=="number"&&(d.rotation[2]=c.rotation.z*a)),c.scale&&(typeof c.scale.x=="number"&&(d.scale[0]=c.scale.x),typeof c.scale.y=="number"&&(d.scale[1]=c.scale.y),typeof c.scale.z=="number"&&(d.scale[2]=c.scale.z)),h.transformOverride=d,h.position.fromArray(d.position),h.rotation.fromArray(d.rotation),h.scale.fromArray(d.scale),h.updateMatrix(),h.hasNonUniformScale&&(h.updateMatrixWorld(),h.updateMatrixWorldRigid())}}}return s?n.update(this.entityOpContext):n.syncInstanceMatrices(),n.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let i=t.parent;if(i===null)return;let n=new ba(t);n.playModeVisible=e.visible!==!1,n.expand(),typeof e.name=="string"&&(n.name=e.name);let r=Math.PI/180;return n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(n.position.x=e.position.x),typeof e.position.y=="number"&&(n.position.y=e.position.y),typeof e.position.z=="number"&&(n.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(n.rotation.x=e.rotation.x*r),typeof e.rotation.y=="number"&&(n.rotation.y=e.rotation.y*r),typeof e.rotation.z=="number"&&(n.rotation.z=e.rotation.z*r)),e.scale&&(typeof e.scale.x=="number"&&(n.scale.x=e.scale.x),typeof e.scale.y=="number"&&(n.scale.y=e.scale.y),typeof e.scale.z=="number"&&(n.scale.z=e.scale.z)),n.updateMatrix(),i.add(n),n.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let i=t.material;if(!i)return!1;let n=[];for(let c of Array.isArray(i)?i:[i]){let h=c.root??c;h&&Array.isArray(h.layers)&&h.data&&!n.includes(h)&&n.push(h)}if(n.length===0)return!1;let r={scene:this.entityOpContext.scene,shared:this},a=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),s=c=>{if(typeof c=="string"){let h=new vn(1,1,1,1);try{h.set(c)}catch{return null}return{r:h.r,g:h.g,b:h.b,a:void 0}}if(c&&typeof c=="object"&&"r"in c){let h=c;if([h.r,h.g,h.b].some(u=>typeof u!="number"||!isFinite(u)))return null;let d=Math.max(h.r,h.g,h.b)>1?1/255:1;return{r:h.r*d,g:h.g*d,b:h.b*d,a:typeof h.a=="number"?Math.max(0,Math.min(h.a,1)):void 0}}return null},o=(c,h,d)=>{if(!c.hasValue(h))return!1;let u=c.getValue(h);if(!u||typeof u!="object"||!u.isColor)return!1;let p=d.a??(typeof u.a=="number"?u.a:1);return u instanceof Bg?c.setValue(h,new vn(d.r,d.g,d.b,p)):typeof u.setRGBA=="function"?u.setRGBA(d.r,d.g,d.b,p):u.setRGB(d.r,d.g,d.b),!0},l=!1;for(let c of n){let h=c.data.layers??[],d=u=>c.layers.find(p=>p.uuid===u);if(e.color!==void 0){let u=s(e.color),p=h.find(g=>g.data.type==="color"),f=p&&d(p.id);if(u&&f&&o(f,"color",u)&&(l=!0,u.a!==void 0)){let g=u.a<1||Bc(c.data,this);c.setTransparent?c.setTransparent(g,r.scene):c.transparent=g}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(c.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),r),l=!0);for(let u of e.layers??[]){if(!u||typeof u!="object")continue;let p=typeof u.id=="string"?h.find(y=>y.id===u.id):typeof u.index=="number"?h[u.index]:typeof u.type=="string"?h.find(y=>y.data.type===u.type):void 0,f=p&&d(p.id);if(!p||!f)continue;let g=ix[p.data.type]??[],m=Object.keys(p.data);for(let[y,v]of Object.entries(u)){if(y==="id"||y==="index"||y==="type")continue;let _=m.find(x=>x===y)??m.find(x=>a(x)===a(y))??y;if(g.includes(_))continue;let b=s(v);if(b&&o(f,_,b))l=!0;else if(typeof v=="number"&&isFinite(v))c.onVariableUpdate?.(["layer",p.id,_],v,r),l=!0;else if(Array.isArray(v)&&v.length<=3&&v.every(x=>typeof x=="number"&&isFinite(x))){let x=["x","y","z"];v.forEach((w,S)=>{c.onVariableUpdate?.(["layer",p.id,_,x[S]],w,r)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let i=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return i.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&i?.getPhysicsLocalMatrix?.(GS))return GS.decompose(HS,WS,j4),t[1]==="position"?HS[t[2]]:(qS.setFromQuaternion(WS,i.rotation.order),qS[t[2]]*It.RAD2DEG);for(let n=1;n<t.length;n++)i=i[t[n]];return t[1]==="rotation"&&(i*=It.RAD2DEG),i}for(let i in this.variables){if(e===void 0)break;let n=this.variables[i],r=n.locations?.findIndex(a=>jn.equal(a,e));r!==void 0&&r!==-1&&n.locations.splice(r,1)}if(typeof t=="string"){let i=t,n=t;do{if(n=i,this.variables[i]===void 0)break;let r=this.variables[i].value;e&&this.variables[n]!==void 0&&this.variables[n].locations.push(e),i=r}while(typeof i=="string");return i}return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,i]of Object.entries(t.images))this.addImage(e,i.asset);for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i.asset);for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i.asset);for(let[e,i]of Object.entries(t.colors))this.addColor(e,i.asset);for(let[e,i]of Object.entries(t.fonts))this.addFont(e,i.asset);for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i.asset);for(let[e,i]of Object.entries(t.variables))this.addVariableHolder(e,i.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,i){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(tr.drop(t,2),e.materials[t.path[1]],{shared:this,scene:i});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,i):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let n=e.userAPIs[t.path[1]];if(n){let r=t.type===0&&t.props.debounce===void 0,a=this.getUserAPI(t.path[1]);a!==void 0&&a===this.openAIRealtime?a.update(n):a?.update(n,this,r)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let n=e.userWebhooks[t.path[1]];n&&this.getUserWebhook(t.path[1])?.update(n)}}else t.path[0]==="lib"&&this.updateLibByOp(tr.drop(t,1),i)}updateFont(t,e,i){if(e.props.url){let n=this.getFont(t),r={...this.data.fonts[t],url:e.props.url};n.update(r),n.loadingPromise.then(()=>this.requestRender()),i.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let i=n3;return i===null?(Gn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(e,t,this),!1)}{let i=V4();return i===null?(Gn("api-services","a user API integration"),!1):(this.userAPIs[t]=i.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let i=V4();return i===null?(Gn("api-services","a user webhook"),!1):(this.userWebhooks[t]=i.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new J_(ka.emptyData())});function Bk(t){return W_(t)||t?.isTSLNodeMaterial===!0}var Hr,XS,$S,YS,W4,ZS,vi,Uk=k(()=>{jC()}),ed=k(()=>{te(),lr(),Eh(),Uk(),Ye(),sr(),Hr=class extends $i{setMaterialOverride(t,e){this.materialOverride=z4(t),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),e.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(t,e,i){if(super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.syncShadowCatcher(i),function(n,r){let a=[];if(r.length!==n.length)return null;{let s=0;for(;s<n.length;){if(r[s]==="*")a.push(n[s]);else if(n[s]!==r[s])return null;s+=1}}return a}(t.path,["materials"])!==null&&t.type===0&&Array.isArray(this.material))for(let[n,r]of Object.entries(t.props)){let a=this.material[Number(n)],s=i.shared.material(r);s!==a&&Hr.disposeOneMaterial(a),this.material[Number(n)]=s}else if(ri(t.path,["material"])){let n=this.material;!Array.isArray(n)&&typeof n?.updateByOp=="function"&&"material"in e&&typeof e.material!="string"&&n.updateByOp(tr.drop(t,1),e.material,i)}else if(ri(t.path,["materials","*"])&&Array.isArray(this.material)){let n=t.path[1];if("materials"in e&&n<this.material.length){let r=e.materials[n];typeof r!="string"&&this.material[n].updateByOp(tr.drop(t,2),r,i)}}}get needsAO(){return this.material!==void 0&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):512&this.layers.mask&&this.layers.set(0)}updateState(t,e){super.updateState(t,e),t.castShadow!==void 0&&(this.castShadow=t.castShadow),t.receiveShadow!==void 0&&(this.receiveShadow=t.receiveShadow);let i,n=this.dataPatched;this.syncShapeBlendNodeLayer(),this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(i={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let r=this.materialOverride!==void 0;!r&&t.geometry?.type!=="NonParametricGeometry"&&"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe,i),e.scene.markNeedsUpdateRendererDirty()),!r&&(t.geometry?.type==="NonParametricGeometry"||"materials"in t)&&("materials"in t&&t.materials!==void 0?(this.disposeMaterial(),this.material=t.materials.map(s=>e.shared.material(s).getFlavor(n.flatShading,n.side,n.wireframe)),e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=[e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe)],e.scene.markNeedsUpdateRendererDirty()));let a=this.data;if(!r&&a.geometry?.type!=="NonParametricGeometry"&&"materials"in a&&a.materials!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(a.materials[0]).getFlavor(n.flatShading,n.side,n.wireframe)),!r&&(t.flatShading!==void 0||t.wireframe!==void 0||t.side!==void 0))if(Array.isArray(this.material))for(let s=0;s<this.material.length;s++)this.material[s]=this.material[s].getFlavor(n.flatShading,n.side,n.wireframe);else this.material=this.material.getFlavor(n.flatShading,n.side,n.wireframe,i);this.syncShadowCatcher(e)}shadowCatcherActive(){let t=this.dataPatched,e=t.geometry?.type;return t.shadowCatcher===!0&&(e==="RectangleGeometry"||e==="PlaneGeometry")}syncShadowCatcher(t){let e=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=BA===void 0?null:z4(BA());if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=e.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,t.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.material=t.shared.material(e.material).getFlavor(e.flatShading,e.side,e.wireframe),t.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow)}static disposeOneMaterial(t){var e;Bk(t)&&!function(i){return i?.isClassicSharedMaterial===!0}(e=t)&&e?.isTSLSharedMaterial!==!0&&t.nodeMaterialDispose()}disposeMaterial(){this.material&&SN(this.material).forEach(t=>{Hr.disposeOneMaterial(t)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),la=k(()=>{te(),Ye(),a3(),ed(),rt(),tx(),Ep(),Ak(),XS=new C,$S=new ye,YS=new ye,W4=new C,ZS=new At,vi=class extends Hr{constructor(t,e,i){super(t,e),this.data=e,this.isSkinnedMesh=!1,this.localGeometry=void 0,e.bindMode&&e.bindMatrix&&(this.bindMode=e.bindMode,this.bindMatrix=new At().fromArray(e.bindMatrix),this.bindMatrixInverse=new At)}chooseGeoemtryCache(t){return t.geometryCache}supportsInPlaceGeometryUpdate(t){return t.isTextGeometry!==!0}markGeometryAsReachable(t){this.geometryCreateDeleyed instanceof Gt&&this.chooseGeoemtryCache(t).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof Gt?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof J_){let t=this.geometryCreateDeleyed,e=this.chooseGeoemtryCache(t),i=this.dataPatched.geometry;this.geometryCreateDeleyed=e.get(i,t,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(t){this.localGeometry=t}get is2DAndNoDepth(){let t=this.dataPatched.geometry;return O_.is2DParametricMesh(t.type)&&t.depth===0}get is2DType(){return O_.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.updateByPatchedOpGeometry(tr.drop(t,1),e.geometry,i)}removeInteractionGeometry(t){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(t,e){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let n,r,a,s=t;if(this.localGeometry===void 0){let d={...this.data.geometry,...s};this.localGeometry=ih(d,e,this.data.flatShading,this)}s.scaleBaked?[n,r,a]=s.scaleBaked:{width:n,height:r,depth:a}=s;let o=this.localGeometry.userData,l=typeof n=="number"?n:1,c=typeof r=="number"?r:1,h=typeof a=="number"?a:1;o.sxPrev!==void 0&&DA(this.localGeometry.attributes,l/o.sxPrev,c/o.syPrev,h/o.szPrev),o.sxPrev=l,o.syPrev=c,o.szPrev=h}else{let n=ih({...this.data.geometry,...t},e,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&FS(this.localGeometry,n)?n.dispose():(this.localGeometry?.dispose(),this.localGeometry=n)}}refreshAttachedClonersInteractions(t){for(let e of this.attachedSurfaceCloners)e.update(t)}refreshAttachedCloners(t){for(let e of this.attachedSurfaceCloners)t.scene.addPendingUpdateCloner(e.object)}refreshAttachedPaths(t){for(let e of this.attachedPaths)t.scene.addPendingCommand(()=>e.updateShape())}createGeometryDelayed(t){this.geometryCreateDeleyed=t.shared,this.refreshAttachedCloners(t),this.refreshAttachedPaths(t)}updateByPatchedOpGeometry(t,e,i){let n=!1;if(t.type===0&&t.path.length===0&&Object.keys(t.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Fi&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(e,t.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&Tk(t.props)&&this.geometryCreateDeleyed instanceof Fi&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(e),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&this.geometryCreateDeleyed instanceof Gt&&!(this.geometryCreateDeleyed instanceof Fi)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=i.shared,a=this.chooseGeoemtryCache(r),s=this.geometryCreateDeleyed;if(a.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let o=this.dataPatched.geometry,l=ih(o,r,this.data.flatShading,this);FS(s,l)?(l.dispose(),s.computeBoundingSphere(),a.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),a.forceDelete(this._geometryCacheKey),a.adopt(o,l),this.geometryCreateDeleyed=l),this._geometryCacheKey=o,n=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}n||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(t,e){this.createGeometryDelayed(e)}applyTransientGeometryData(t,e){let i=t.shared,n=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof Gt&&!(this.geometryCreateDeleyed instanceof Fi)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=this.chooseGeoemtryCache(i),a=this.geometryCreateDeleyed;if(r.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let s=ih(n,i,this.data.flatShading,this);return FS(a,s)?(s.dispose(),a.computeBoundingSphere(),r.mutateIfUnique(this._geometryCacheKey,n)):(s.computeBoundingSphere(),r.forceDelete(this._geometryCacheKey),r.adopt(n,s),this.geometryCreateDeleyed=s),this._geometryCacheKey=n,this.refreshAttachedCloners(t),void this.refreshAttachedPaths(t)}}e&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),t.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(t)}updateState(t,e){t.geometry!==void 0&&this.updateGeometryOnStateUpdate(t.geometry,e);let i=t.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:n,value:r}}of i)this.updateMorphInfluences(n,e.shared.getVariable(r,[this.uuid,"morphTargetInfluences",n]))}super.updateState(t,e)}updateMorphInfluences(t,e){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[t];i!==void 0&&(this.morphTargetInfluences[i]=e)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;this.is2DType?t.set(0,0,.5*i.depth):this.isNonParametric?(t.setScalar(0),this.geometry.boundingSphere&&t.copy(this.geometry.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?t.fromArray(i.centerOffset):t.setScalar(0),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(t,e){this.skeleton=t,this.isSkinnedMesh=!0,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(t){let e=new ye,i=this.geometry.attributes.skinWeight;for(let n=0,r=i.count;n<r;n++){e.fromBufferAttribute(i,n);let a=1/e.manhattanLength();a!==1/0?e.multiplyScalar(a):e.set(1,0,0,0),i.setXYZW(n,e.x,e.y,e.z,e.w)}}boneTransform(t,e){let i=this.skeleton;if(i===void 0)return;let n=this.geometry;$S.fromBufferAttribute(n.attributes.skinIndex,t),YS.fromBufferAttribute(n.attributes.skinWeight,t),XS.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){let a=YS.getComponent(r);if(a!==0){let s=$S.getComponent(r);ZS.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),e.addScaledVector(W4.copy(XS).applyMatrix4(ZS),a)}}return e.applyMatrix4(this.bindMatrixInverse)}}});function Ku(t){if(Array.isArray(t.material)){for(let e of t.material)if(e.getLayersOfType("outline").length===0)return}else if(!W_(t.material)||t.material.getLayersOfType("outline").length===0)return;t instanceof vi&&t.is2DAndNoDepth?function(e){if(e.geometry.attributes.extrudeNormals||!e.geometry.attributes.position)return;let i=e.geometry.attributes.position.array,n=new Float32Array(i.length),r=new C;for(let a=0;a<i.length;a+=3)r.set(i[a],i[a+1],i[a+2]).normalize(),n[a]=r.x,n[a+1]=r.y,n[a+2]=r.z;e.geometry.setAttribute("extrudeNormal",new Ft(n,3))}(t):function(e){if(e.geometry.attributes.extrudeNormal||!e.geometry.attributes.position||!e.geometry.attributes.normal)return;let i=new Map,n=e.geometry.attributes,r=n.position.array,a=n.normal.array,s=new Float32Array(r.length);for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=new C(a[o],a[o+1],a[o+2]);i.has(l)?i.get(l)?.normals.push(c):i.set(l,{normals:[c],result:new C})}i.forEach((o,l)=>{for(let c of o.normals)o.result.add(c);o.result.divideScalar(o.normals.length)});for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=i.get(l)?.result;c&&(s[o]=c.x,s[o+1]=c.y,s[o+2]=c.z)}e.geometry.setAttribute("extrudeNormal",new Ft(s,3))}(t)}function KS(t){return Math.min(2047,Math.max(1,Math.round(2048*t)))/2048}function Qu(t){if(!t.geometry.attributes.position)return;let e=t.geometry.attributes,i=e.position.array,n=e.randomColor;if(n!==void 0&&3*n.count===i.length)return;let r=new Float32Array(i.length),a=parseInt(t.uuid.replace(/\D/g,"")),s=[KS(It.seededRandom(a)),KS(It.seededRandom(a+1e4)),KS(It.seededRandom(a+2e4))];for(let o=0;o<i.length;o++)r[o]=s[o%3];t.geometry.setAttribute("randomColor",new Ht(r,3))}var nx=k(()=>{rt(),jC(),la()});function q4(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}function N$(t,e){let i=t.cloner;return i!==void 0&&i.parent===e?i:void 0}function X4(t,e,i,n){let r=16*(e.children.length+1);Lm.length<r&&(Lm=new Float32Array(r));let a=0,s=l=>{l.toArray(Lm,16*a),a++},o=e.parameters.hideBase!==!0;o&&s(n),NA.multiplyMatrices(t.hiddenMatrix,t.matrix);for(let l of e.children)!Dc(l)||l.playModeVisible===!1||(FA.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),c1.multiplyMatrices(NA,FA),(!o||!c1.equals(n))&&s(c1));try{return a===0?0:function(l,c){return kC(H_().instanced_union(FC(l),c))}(i,Lm.subarray(0,16*a))}finally{RF(i)}}var Co,$4,NA,FA,c1,Lm,dh,tb,rx,ms,io,eb,Yg=k(()=>{lr(),rt(),Zb(),nx(),ed(),Ui(),Co=new At,$4=new At,NA=new At,FA=new At,c1=new At,Lm=new Float32Array(0),dh=class extends Hr{constructor(t,e,i){super(t,e),this.data=e,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new Gt,this.onAfterRender=(n,r,a,s,o,l)=>{super.onAfterRender(n,r,a,s,o,l),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&t.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(t,e=!0){if(this.booleanMeshSetAddress!==-1&&!t)return;for(let n=0;n<this.children.length;n++){let r=this.children[n];r instanceof dh&&r.dataPatched.visible===!0&&r.recomputeBoolean(t===!0,e)}this.meshSetAddresses=[];for(let n=0;n<this.children.length;n++){let r=this.children[n];if(r instanceof $i&&r.dataPatched.visible===!0&&r.geometry.attributes.position?.count>0&&r.geometry.drawRange.count>0&&r.booleanMeshSetAddress!==0){Co.multiplyMatrices(r.hiddenMatrix,r.matrix).multiply(r.pivotMatrix);try{let a=N$(r,this);if(r.booleanMeshSetAddress===-1){if((r.geometry.index??r.geometry.getAttribute("position")).count/3<15e5){let s=r$(r.geometry,t===!0);r.booleanMeshSetAddress=a===void 0||s===-1?s:X4(r,a,s,Co)}if(r.booleanMeshSetAddress===-1)return;a===void 0&&PS(r.booleanMeshSetAddress,Co),r.booleanMatrixInvOld.copy(Co).invert(),r.booleanWasTransformed=!1}else r instanceof dh&&r.needsTransformForDownstream===!0?(a===void 0?PS(r.booleanMeshSetAddress,Co):r.booleanMeshSetAddress=X4(r,a,r.booleanMeshSetAddress,Co),r.needsTransformForDownstream=!1):r.booleanWasTransformed===!0&&(PS(r.booleanMeshSetAddress,$4.multiplyMatrices(Co,r.booleanMatrixInvOld)),r.booleanMatrixInvOld.copy(Co).invert(),r.booleanWasTransformed=!1)}catch(a){console.error(a),r.booleanMeshSetAddress=0,r.geometry.userData.booleanOperationDidFail=!0;continue}if(r.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(r.booleanMeshSetAddress),r.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let n=this.geometry;n.dispose(),this.geometry=new Gt,this.geometry.userData=n.userData,this.geometry.boundingSphere=n.boundingSphere,this.geometry.setAttribute("position",new Ft([],3))}return void this.geometry.setDrawRange(0,0)}if(t===!0)return function(n,r){let a=H_(),s=HI(n,r),o=a.mesh_topological_data(s),l=o.positions(),c=o.indices();return o.free(),s.free(),{positions:l,indices:c,verticesPerFace:new Uint8Array(c.length/3).fill(3)}}(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new Gt,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(n,r,a,s){let o=H_(),l=HI(n,r),c=o.mesh_render_data(l,Math.max(s,0));if(a.setAttribute("position",new Ft(c.positions(),3)),a.setAttribute("normal",new Ft(c.normals(),3)),c.free(),a.boundingSphere===null&&(a.boundingSphere=new vr),l.tri_count()===0)a.boundingSphere.center.set(0,0,0),a.boundingSphere.radius=0,a.userData.parameters={width:0,height:0,depth:0};else{let h=l.bounds();a.boundingSphere.center.set(h[0],h[1],h[2]),a.boundingSphere.radius=(h[3]**2+h[4]**2+h[5]**2)**.5,a.userData.parameters={width:2*h[3],height:2*h[4],depth:2*h[5]}}return kC(l)}(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(n){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(n)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Ku(this),Qu(this)}dispose(){super.dispose(),this.geometry.dispose()}}}),Zg=k(()=>{rt(),Wr(),td(),(tb||(tb={})).is=function(t){return Be.is(t)&&t instanceof bu},rx=(t,e)=>class extends Jc(t,e){updateState_Light(i,n){if(this.updateState_Entity(i,n),i.color!==void 0&&(this.color=n.shared.color(i.color)),i.intensity!==void 0&&(this.intensity=i.intensity*Math.PI),i.depth!==void 0){let r=this.shadow;r.camera.far=i.depth,r.needsUpdate=!0}i.shadows!==void 0&&(this.castShadow=i.shadows)}}}),Ah=k(()=>{Yg(),lr(),td(),ms=t=>t instanceof $i,io=t=>t!==null&&t instanceof dh,eb=t=>uA.is(t)});function mr(t,e){return e.color(t)}function Y4(t=new Date,e){let i=e.format,n=t.getSeconds(),r=t;e&&e.timeZone!==null&&(r=function(d,u){try{let p=new Intl.DateTimeFormat("en-US",{timeZone:u,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(d),f=g=>Number(p.find(m=>m.type===g)?.value);return new Date(f("year"),f("month")-1,f("day"),f("hour"),f("minute"),f("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,e.timeZone));let a,s=r.getHours(),o=r.getMinutes();e.format12h24h==="12ampm"&&(a=s>=12?"PM":"AM");let l,c,h=s;switch(e.format12h24h!=="24"&&(h=s%12,h===0&&(h=12)),i){case"HH:mm:ss":l=[h,o,n];break;case"HH:mm":l=[h,o];break;case"HH":l=[h],a=void 0;break;case"mm":l=[o],a=void 0;break;case"ss":l=[n],a=void 0;break;case"year":c=r.getFullYear();break;case"month":c=r.getMonth()+1;break;case"dayOfYear":c=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":c=r.getDate();break;case"secondOfDay":c=60*s*60+60*o+n;break;default:console.error("Unknown time format",i),c=0}return l!==void 0?{textValue:l,suffix:a}:c}var kA,zg,s3=k(()=>{}),F$=k(()=>{rt(),qg(),Xg(),kA=class extends xp(Hz){constructor(t,e=15,i=10066329){super(t,e,i),this.object=t,this.added=!1,this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,e){wp(this.object,kA.geometryHelper,t,e)}}}),ax=k(()=>{rt(),F$(),Zg(),zg=class extends rx(Fz,kA){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.top=1250,n.bottom=-1250,n.right=1250,n.left=-1250,n.near=-1e4,n.far=2500;let r=new Sg(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Sg&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&function(n,r){n.shadow.camera.right=r/2,n.shadow.camera.left=-r/2,n.shadow.camera.top=r/2,n.shadow.camera.bottom=-r/2,n.shadow.needsUpdate=!0}(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),i&&this.update()}}});function o3(t){return t instanceof Hr&&t.needsAO&&!mh(t)&&t.isDecalObject!==!0}function l3(t){let e=t.cloner;if(e&&Array.isArray(e.children))for(let i of e.children)i?.layers&&(i.layers.mask=t.layers.mask)}function h3(t){return t.getLayersOfType("reflection").filter(e=>e.data.visible).length}function Z4(t,e){let i={outline:!1,cavity:!1},n=t.layers.mask&sx,r=e.getLayersOfType("transmission"),a=e.getLayersOfType("outline"),s=h3(e),o=e.getLayersOfType("cavity");return(a.length>0||o.length>0)&&(t.layers.set(8),r.length>0&&t.layers.enable(3),s>0&&t.layers.enable(4),i.outline=a.length>0,i.cavity=o.length>0,Qu(t),Ku(t)),r.length===0&&a.length===0&&o.length===0&&s===0&&t.layers.set(0),n&&t.layers.set(9),!n&&o3(t)&&t.layers.enable(5),l3(t),i}function K4(t,e){if(!e.layers)return!1;let i=t.layers.mask&sx,n=!1,r=e.getLayersOfType("transmission").filter(l=>l.data.visible),a=e.getLayersOfType("outline").filter(l=>l.data.visible),s=h3(e),o=e.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(t.layers.set(3),(a.length>0||o.length>0)&&t.layers.enable(8),s>0&&t.layers.enable(4),n=!0),r.length===0&&a.length===0&&o.length===0&&s===0&&t.layers.set(0),i&&t.layers.set(9),!i&&o3(t)&&t.layers.enable(5),l3(t),n}function Q4(t,e){var i;if(!e.layers)return!1;let n=t.layers.mask&sx,r=!1,a=h3(e),s=e.getLayersOfType("transmission").filter(c=>c.data.visible),o=e.getLayersOfType("outline").filter(c=>c.data.visible),l=e.getLayersOfType("cavity").filter(c=>c.data.visible);return a>0&&((i=t.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),t.layers.set(4),s.length>0&&t.layers.enable(3),(o.length>0||l.length>0)&&t.layers.enable(8),r=!0),a===0&&s.length===0&&o.length===0&&l.length===0&&t.layers.set(0),n&&t.layers.set(9),!n&&o3(t)&&t.layers.enable(5),l3(t),r}function VA(t,e,i,n=!1){let r=t.cloner;if(r){let a=null;if(t.raycast===wi.prototype.raycast||t.raycast===$i.prototype.raycast){let s=t.geometry;s&&(s.boundingSphere===null&&s.computeBoundingSphere(),a=s.boundingSphere)}for(let s of r.children){if(a!==null&&(jA.copy(a).applyMatrix4(s.matrixWorld),!e.ray.intersectsSphere(jA)))continue;let o=Nk.copy(s.matrixWorld).invert(),l=Fk.copy(e.ray).applyMatrix4(o),c=t.matrixWorld;l.applyMatrix4(c);let h=zk;h.set(l.origin,l.direction),h.near=e.near,h.far=e.far,h.layers.mask=e.layers.mask;let d=h.intersectObject(t,!1);d.length>0&&i.push({...d[0],object:n?s:t})}}}var sx,zk,Nk,Fk,jA,Pv,kk,QS,JS,t2,Ng,pn,Vk=k(()=>{Ui(),nx(),lr(),ed(),rt(),sx=512,zk=new aC,Nk=new At,Fk=new Zo,jA=new vr}),k$=k(()=>{rt(),qg(),Xg(),Pv=class extends xp(jz){constructor(t,e=6710886){super(t,e),this.object=t,this.matrix=t.matrixWorld,this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,e){wp(this.object,Pv.geometryHelper,t,e)}update(){if(this.object!==void 0){let t=Pv._vector,e=this.object.distance?this.object.distance:1e3,i=e*Math.tan(this.object.angle);this.cone.scale.set(i,i,e),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let n=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let r=0,a=this.cone.material.length;r<a;r++)this.cone.material[r].color.set(n);else this.cone.material.color.set(n)}}},(kk=Pv)._vector=new C}),ox=k(()=>{rt(),k$(),Zg(),QS=new C,JS=new C,t2=new Yt,Ng=class extends rx(zz,kk){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=2*It.RAD2DEG*this.angle,n.aspect=1,n.near=100,n.far=2500;let r=new Sg(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Sg&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),JS.setFromMatrixPosition(this.matrixWorld),t2.setFromRotationMatrix(this.matrixWorld),QS.copy(this.up).applyQuaternion(t2).negate().multiplyScalar(this.distance),this.target.position.copy(JS).add(QS),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),hl=k(()=>{te(),qa(),rt(),Wr(),xs(),s3(),ll(),ax(),Ye(),Eh(),rt(),ed(),Ah(),Vk(),ox(),ke(),Yg(),pn=class extends $b(aa){constructor(t,e,i){if(super(),this.data=e,this.bgColor=new vn(1,1,1,1),this.fog=null,this.backupFog=new KM(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=er.getDensity({}),this.fogHeightFalloff=er.getHeightFalloff({}),this.fogHeightBase=er.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new Jt,this.penumbraSizeArrayCache=null,this.super_Entity(t,e),this.personalCamera=new tn(Qc,{...ng.defaultData,...e.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new Uz(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),e.uiScene){let n=oA();n===null?Gn("ui-2d","a page's 2D scene"):this.uiScene=new n.Scene2D((Array.isArray(t)?t[0]:t)+"-ui",e.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else e.uiFrame&&this.createUICanvas(e.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(t,e){let i=oA();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,e),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(t),this.uiCanvas?.applySize()})):Gn("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(t){this.bgColor=t,this.fogUseBGColor===!0&&(this.backupFog.color=t)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(t,e){t.color!==void 0&&(this.ambientLight.color=mr(t.color,e)),t.intensity!==void 0&&(this.ambientLight.intensity=t.intensity*Math.PI),t.enabled!==void 0&&(t.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(t){this.isActive=!0,t.fog=this.fog,this.traverseEntity(e=>{e instanceof dh&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(t=>{if(t instanceof Hr)if(Array.isArray(t.material))for(let e of t.material)e.needsUpdate=!0;else t.material.needsUpdate=!0,t.material.dispose()})}updateShadow(t){if(t.softShadowQuality===void 0&&t.type===void 0||!this.isActive)return;let e=this.data.shadow;var i,n;i=ig.isSoft(e),n=e?.softShadowQuality,UA!==void 0&&UA(i,n)&&this.forceMaterialsUpdate()}updateFog(t,e){t.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=mr(t.color,e),this.backupFog.near=t.near,this.backupFog.far=t.far,this.fogMode=er.getMode(t),this.fogDensity=er.getDensity(t),this.fogHeightFalloff=er.getHeightFalloff(t),this.fogHeightBase=er.getHeightBase(t)}updateSky(t,e){this.skyState=t??null,this.skyStateVersion++;let i=t?.hdri?.image;this.skyHdriHolder=i!=null?e.image(i):null}updateAo(t,e){t.aoColor!==void 0&&(this.aoColor=mr(t.aoColor,e))}updateByOp(t,e,i,n){let r=this.data.uiFrame;super.updateByOp(t,e,i,n);let a=e;ri(t.path,["fog"])?this.updateFog(a.fog,i.shared):ri(t.path,["sky"])?this.updateSky(a.sky,i.shared):ri(t.path,["grading"])?this.gradingState=a.grading??null:ri(t.path,["ao"])?this.updateAo(a.ao,i.shared):ri(t.path,["ambient"])?this.updateAmbientLight(a.ambient,i.shared):ri(t.path,["shadow"])?this.updateShadow(a.shadow):t.type===0&&t.path.length===0&&(t.props.uiFrame!==void 0||r!==a.uiFrame)&&this.updateUIFrame(t.props.uiFrame,i)}updateUIFrame(t,e){t?(this.uiCanvas||this.createUICanvas(t,e),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(t)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(t,e){this.updateState_Entity(t,e),t.backgroundColor!==void 0&&this.setBackgroundColor(mr(t.backgroundColor,e.shared)),t.fog!==void 0&&this.updateFog(t.fog,e.shared),t.sky!==void 0&&this.updateSky(t.sky,e.shared),t.grading!==void 0&&(this.gradingState=t.grading),t.ambient!==void 0&&this.updateAmbientLight(t.ambient,e.shared),t.ao!==void 0&&this.updateAo(t.ao,e.shared),t.shadow!==void 0&&this.updateShadow(t.shadow)}createFrame(t,e){}raycast(t,e){super.raycast(t,e)}switchActiveCamera(t){t&&t.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(al).fill(.5);let t=0,e=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof zg&&i.visible&&t<ag&&(this.penumbraSizeArrayCache[t]=i.data.penumbraSize??.5,t+=1),i instanceof Ng&&i.visible&&t<al-ag&&(this.penumbraSizeArrayCache[ag+e]=i.data.penumbraSize??.5,e+=1)})}raycastWithClones(t){let e=[],i=n=>{for(let r of n.children){let a=r.cloner;Be.is(r)&&(r.visible||a?.object.data.visible)&&((ms(r)||eb(r)&&this.scene.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,e),VA(r,t,e,!0)),i(r))}};return i(this),e}updateEntity2DByOp(t,e,i,n){this.uiCanvas?.updateEntity2DByOp(t,e,i,n)}}});function J4(){return jk}function e2(){if(ib===null)throw new Error('[spe] Classic (WebGL) particles are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return ib}function i2(t){return t?.isWebGPUSplineRenderer===!0}var jk,ib,Ju,Gk=k(()=>{jk=null,ib=null}),c3=k(()=>{rt(),Wb(),td(),Ju=class extends Jc(_p,pp){constructor(t,e,i){super(),this.super_Entity(t,e),this.context=i,this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e)}}}),V$=vp((t,e)=>{var i,n;i=t,n=function(){return r.importState=function(a){var s=new r;return s.importState(a),s},r;function r(){return function(a){var s=0,o=0,l=0,c=1;a.length==0&&(a=[+new Date]);var h=function(){var p=4022871197,f=function(g){g=g.toString();for(var m=0;m<g.length;m++){var y=.02519603282416938*(p+=g.charCodeAt(m));y-=p=y>>>0,p=(y*=p)>>>0,p+=4294967296*(y-=p)}return 23283064365386963e-26*(p>>>0)};return f.version="Mash 0.9",f}();s=h(" "),o=h(" "),l=h(" ");for(var d=0;d<a.length;d++)(s-=h(a[d]))<0&&(s+=1),(o-=h(a[d]))<0&&(o+=1),(l-=h(a[d]))<0&&(l+=1);h=null;var u=function(){var p=2091639*s+23283064365386963e-26*c;return s=o,o=l,l=p-(c=0|p)};return u.next=u,u.uint32=function(){return 4294967296*u()},u.fract53=function(){return u()+11102230246251565e-32*(2097152*u()|0)},u.version="Alea 0.9",u.args=a,u.exportState=function(){return[s,o,l,c]},u.importState=function(p){s=+p[0]||0,o=+p[1]||0,l=+p[2]||0,c=+p[3]||0},u}(Array.prototype.slice.call(arguments))}},typeof t=="object"?e.exports=n():typeof define=="function"&&define.amd?define(n):i.Alea=n()});function j$(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(e=!0)}),e}var es,kd,mp,Kg=k(()=>{lr(),rt(),Ep(),nx(),la(),es=new ci,kd=new C,mp=class extends vi{constructor(t,e,i){super(t,e,i),this.data=e,this.hiddenMatrixOld=new At,this.smoothShading=!0,this.skipReactionUpdate=!1}chooseGeoemtryCache(t){return this.dataPatched.flatShading?t.geometryCache:t.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;t.copy(this.originalGeometryNew.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}createGeometryByControls(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry?.uuid,{originalGeometry:i,subdividedGeometry:n,subdivPointer:r}=Fi.build(t,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=r,i!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=i),n!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=n??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ku(this),Qu(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}updateState(t,e){if(super.updateState(t,e),t.flatShading!==void 0){let i=this.material;this.material=Array.isArray(i)?i.map(n=>n.getFlavor(!1,n.side,n.wireframe)):i.getFlavor(!1,i.side,i.wireframe),this.smoothShading=!t.flatShading,this.createGeometryDelayed(e)}}updateMesh(t=!1,e=!1,i=!1){e&&this.subdividedGeometry||Fi.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0,i),this.subdividedGeometry&&Fi.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){let t=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Fi.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Fi.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ku(this),Qu(this),this.calcBoundingBox(),t&&(this.localGeometry.uuid=t)}raycast(t,e){let i=this.localGeometry;this.localGeometry=this.originalGeometryNew,$i.prototype.raycast.call(this,t,e),this.localGeometry=i}activateShearCompensation(){!this.hasNonUniformScale||(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateShearCompensation(){!this.hasNonUniformScale||(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;es.setFromBufferAttribute(e),es.getCenter(i),t.boundingSphere.radius=i.distanceTo(es.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),es.getSize(kd),this.hasNonUniformScale&&kd.divide(this.scale);let n={width:kd.x,height:kd.y,depth:kd.z};return this.geometry.userData.parameters=n,n}updateBoundingSphere(t){let e=this.originalGeometry;es.min.set(t[0],t[2],t[4]),es.max.set(t[1],t[3],t[5]),this.hasNonUniformScale&&(es.min.applyMatrix4(this.shearScaleInv),es.max.applyMatrix4(this.shearScaleInv)),e.boundingSphere===null&&(e.boundingSphere=new vr);let i=e.boundingSphere.center;es.getCenter(i),e.boundingSphere.radius=i.distanceTo(es.max)}freeSubdivPointer(){this.subdivPointer&&(Fi.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry,i=e?.uuid,n=e?.userData.parameters,r=t.subdivisions>0?Fi.buildRefined(this.subdivPointer,t.subdivisions,this.smoothShading?t.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ku(this),Qu(this),n!==void 0&&(this.localGeometry.userData.parameters=n),i&&(this.localGeometry.uuid=i)}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),this.localGeometry&&(t.type===0&&t.path.length===0&&Tk(t.props)&&this.subdivPointer?this.updateSubdivisionLevel(e):this.createGeometryByControls(e))}}});function d3(t){if(t.component){let e=t.component.instances.indexOf(t);e>=0&&t.component.instances.splice(e,1);for(let i of t.children)Be.is(i)&&d3(i)}}var hg,GA,nb,Hk=k(()=>{Wr()}),G$=vp((t,e)=>{function i(n,r,a,s){this.message=n,this.expected=r,this.found=a,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i)}(function(n,r){function a(){this.constructor=n}a.prototype=r.prototype,n.prototype=new a})(i,Error),i.buildMessage=function(n,r){var a,s={literal:function(d){return'"'+l(d.text)+'"'},class:function(d){var u,p="";for(u=0;u<d.parts.length;u++)p+=d.parts[u]instanceof Array?c(d.parts[u][0])+"-"+c(d.parts[u][1]):c(d.parts[u]);return"["+(d.inverted?"^":"")+p+"]"},any:function(d){return"any character"},end:function(d){return"end of input"},other:function(d){return d.description}};function o(d){return d.charCodeAt(0).toString(16).toUpperCase()}function l(d){return d.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function c(d){return d.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function h(d){return s[d.type](d)}return"Expected "+function(d){var u,p,f=new Array(d.length);for(u=0;u<d.length;u++)f[u]=h(d[u]);if(f.sort(),f.length>0){for(u=1,p=1;u<f.length;u++)f[u-1]!==f[u]&&(f[p]=f[u],p++);f.length=p}switch(f.length){case 1:return f[0];case 2:return f[0]+" or "+f[1];default:return f.slice(0,-1).join(", ")+", or "+f[f.length-1]}}(n)+" but "+((a=r)?'"'+l(a)+'"':"end of input")+" found."},e.exports={SyntaxError:i,parse:function(n,r){r=r!==void 0?r:{};var a,s={},o={svg_path:Pe},l=Pe,c=function(it){if(!it)return[];for(var Et=[],mt=0;mt<it.length;mt++)Et=Et.concat.apply(Et,it[mt]);var St=Et[0];return St&&St.code=="m"&&(delete St.relative,St.code="M"),Et},h=function(it,Et){return function(mt,St){if(!St)return[mt];for(var Ot=[mt],z=0,ot=St.length;z<ot;z++)Ot[z+1]=St[z][1];return Ot}(it,Et)},d=/^[Mm]/,u=be(["M","m"],!1,!1),p=function(it,Et,mt){var St=fo(it,[Et]);return mt&&(St=St.concat(fo(it=="M"?"L":"l",mt[1]))),St},f=/^[Zz]/,g=be(["Z","z"],!1,!1),m=function(){return fo("Z")},y=/^[Ll]/,v=be(["L","l"],!1,!1),_=function(it,Et){return fo(it,Et)},b=/^[Hh]/,x=be(["H","h"],!1,!1),w=function(it,Et){return fo(it,Et.map(function(mt){return{x:mt}}))},S=/^[Vv]/,T=be(["V","v"],!1,!1),E=function(it,Et){return fo(it,Et.map(function(mt){return{y:mt}}))},P=/^[Cc]/,A=be(["C","c"],!1,!1),R=function(it,Et,mt){return{x1:it.x,y1:it.y,x2:Et.x,y2:Et.y,x:mt.x,y:mt.y}},O=/^[Ss]/,D=be(["S","s"],!1,!1),I=function(it,Et){return{x2:it.x,y2:it.y,x:Et.x,y:Et.y}},U=/^[Qq]/,N=be(["Q","q"],!1,!1),G=function(it,Et){return{x1:it.x,y1:it.y,x:Et.x,y:Et.y}},H=/^[Tt]/,J=be(["T","t"],!1,!1),K=/^[Aa]/,tt=be(["A","a"],!1,!1),ct=function(it,Et,mt,St,Ot,z){return{rx:it,ry:Et,xAxisRotation:mt,largeArc:St,sweep:Ot,x:z.x,y:z.y}},et=function(it,Et){return{x:it,y:Et}},st=function(it){return 1*it},dt=function(it){return 1*it.join("")},Y=/^[01]/,ht=be(["0","1"],!1,!1),F=function(it){return it=="1"},B=function(){return""},j=",",Z=_e(",",!1),L=function(it){return it.join("")},W=".",X=_e(".",!1),V=/^[eE]/,nt=be(["e","E"],!1,!1),lt=/^[+\-]/,ft=be(["+","-"],!1,!1),pt=/^[0-9]/,Pt=be([["0","9"]],!1,!1),bt=function(it){return it.join("")},Rt=/^[ \t\n\r]/,_t=be([" "," ",`
|
|
4170
4170
|
`,"\r"],!1,!1),$=0,vt=[{line:1,column:1}],Dt=0,jt=[],Nt=0;if("startRule"in r){if(!(r.startRule in o))throw new Error(`Can't start parsing from rule "`+r.startRule+'".');l=o[r.startRule]}function _e(it,Et){return{type:"literal",text:it,ignoreCase:Et}}function be(it,Et,mt){return{type:"class",parts:it,inverted:Et,ignoreCase:mt}}function ji(it){var Et,mt=vt[it];if(mt)return mt;for(Et=it-1;!vt[Et];)Et--;for(mt={line:(mt=vt[Et]).line,column:mt.column};Et<it;)n.charCodeAt(Et)===10?(mt.line++,mt.column=1):mt.column++,Et++;return vt[it]=mt,mt}function oe(it,Et){var mt=ji(it),St=ji(Et);return{start:{offset:it,line:mt.line,column:mt.column},end:{offset:Et,line:St.line,column:St.column}}}function le(it){$<Dt||($>Dt&&(Dt=$,jt=[]),jt.push(it))}function Pe(){var it,Et,mt,St,Ot;for(it=$,Et=[],mt=Ie();mt!==s;)Et.push(mt),mt=Ie();if(Et!==s)if(mt=function(){var z,ot,xt,Mt,ut,wt;if(z=$,(ot=ai())!==s){for(xt=[],Mt=$,ut=[],wt=Ie();wt!==s;)ut.push(wt),wt=Ie();for(ut!==s&&(wt=ai())!==s?Mt=ut=[ut,wt]:($=Mt,Mt=s);Mt!==s;){for(xt.push(Mt),Mt=$,ut=[],wt=Ie();wt!==s;)ut.push(wt),wt=Ie();ut!==s&&(wt=ai())!==s?Mt=ut=[ut,wt]:($=Mt,Mt=s)}xt!==s?z=ot=h(ot,xt):($=z,z=s)}else $=z,z=s;return z}(),mt===s&&(mt=null),mt!==s){for(St=[],Ot=Ie();Ot!==s;)St.push(Ot),Ot=Ie();St!==s?it=Et=c(mt):($=it,it=s)}else $=it,it=s;else $=it,it=s;return it}function ai(){var it,Et,mt,St,Ot,z;if(it=$,Et=function(){var ot,xt,Mt,ut,wt,Lt,Xt;if(ot=$,d.test(n.charAt($))?(xt=n.charAt($),$++):(xt=s,Nt===0&&le(u)),xt!==s){for(Mt=[],ut=Ie();ut!==s;)Mt.push(ut),ut=Ie();Mt!==s&&(ut=_n())!==s?(wt=$,(Lt=xe())===s&&(Lt=null),Lt!==s&&(Xt=Di())!==s?wt=Lt=[Lt,Xt]:($=wt,wt=s),wt===s&&(wt=null),wt!==s?ot=xt=p(xt,ut,wt):($=ot,ot=s)):($=ot,ot=s)}else $=ot,ot=s;return ot}(),Et!==s){for(mt=[],St=$,Ot=[],z=Ie();z!==s;)Ot.push(z),z=Ie();for(Ot!==s&&(z=ze())!==s?St=Ot=[Ot,z]:($=St,St=s);St!==s;){for(mt.push(St),St=$,Ot=[],z=Ie();z!==s;)Ot.push(z),z=Ie();Ot!==s&&(z=ze())!==s?St=Ot=[Ot,z]:($=St,St=s)}mt!==s?it=Et=h(Et,mt):($=it,it=s)}else $=it,it=s;return it}function ze(){var it,Et;return f.test(n.charAt($))?(Et=n.charAt($),$++):(Et=s,Nt===0&&le(g)),Et!==s&&(Et=m()),(it=Et)===s&&(it=function(){var mt,St,Ot,z;if(mt=$,y.test(n.charAt($))?(St=n.charAt($),$++):(St=s,Nt===0&&le(v)),St!==s){for(Ot=[],z=Ie();z!==s;)Ot.push(z),z=Ie();Ot!==s&&(z=Di())!==s?mt=St=_(St,z):($=mt,mt=s)}else $=mt,mt=s;return mt}())===s&&(it=function(){var mt,St,Ot,z;if(mt=$,b.test(n.charAt($))?(St=n.charAt($),$++):(St=s,Nt===0&&le(x)),St!==s){for(Ot=[],z=Ie();z!==s;)Ot.push(z),z=Ie();Ot!==s&&(z=ui())!==s?mt=St=w(St,z):($=mt,mt=s)}else $=mt,mt=s;return mt}())===s&&(it=function(){var mt,St,Ot,z;if(mt=$,S.test(n.charAt($))?(St=n.charAt($),$++):(St=s,Nt===0&&le(T)),St!==s){for(Ot=[],z=Ie();z!==s;)Ot.push(z),z=Ie();Ot!==s&&(z=ui())!==s?mt=St=E(St,z):($=mt,mt=s)}else $=mt,mt=s;return mt}())===s&&(it=function(){var mt,St,Ot,z;if(mt=$,P.test(n.charAt($))?(St=n.charAt($),$++):(St=s,Nt===0&&le(A)),St!==s){for(Ot=[],z=Ie();z!==s;)Ot.push(z),z=Ie();Ot!==s?(z=function(){var ot,xt,Mt,ut,wt,Lt;if(ot=$,(xt=nn())!==s){for(Mt=[],ut=$,(wt=xe())===s&&(wt=null),wt!==s&&(Lt=nn())!==s?ut=wt=[wt,Lt]:($=ut,ut=s);ut!==s;)Mt.push(ut),ut=$,(wt=xe())===s&&(wt=null),wt!==s&&(Lt=nn())!==s?ut=wt=[wt,Lt]:($=ut,ut=s);Mt!==s?ot=xt=h(xt,Mt):($=ot,ot=s)}else $=ot,ot=s;return ot}(),z!==s?mt=St=_(St,z):($=mt,mt=s)):($=mt,mt=s)}else $=mt,mt=s;return mt}())===s&&(it=function(){var mt,St,Ot,z;if(mt=$,O.test(n.charAt($))?(St=n.charAt($),$++):(St=s,Nt===0&&le(D)),St!==s){for(Ot=[],z=Ie();z!==s;)Ot.push(z),z=Ie();Ot!==s?(z=function(){var ot,xt,Mt,ut,wt,Lt;if(ot=$,(xt=Zr())!==s){for(Mt=[],ut=$,(wt=xe())===s&&(wt=null),wt!==s&&(Lt=Zr())!==s?ut=wt=[wt,Lt]:($=ut,ut=s);ut!==s;)Mt.push(ut),ut=$,(wt=xe())===s&&(wt=null),wt!==s&&(Lt=Zr())!==s?ut=wt=[wt,Lt]:($=ut,ut=s);Mt!==s?ot=xt=h(xt,Mt):($=ot,ot=s)}else $=ot,ot=s;return ot}(),z!==s?mt=St=_(St,z):($=mt,mt=s)):($=mt,mt=s)}else $=mt,mt=s;return mt}())===s&&(it=function(){var mt,St,Ot,z;if(mt=$,U.test(n.charAt($))?(St=n.charAt($),$++):(St=s,Nt===0&&le(N)),St!==s){for(Ot=[],z=Ie();z!==s;)Ot.push(z),z=Ie();Ot!==s?(z=function(){var ot,xt,Mt,ut,wt,Lt;if(ot=$,(xt=yn())!==s){for(Mt=[],ut=$,(wt=xe())===s&&(wt=null),wt!==s&&(Lt=yn())!==s?ut=wt=[wt,Lt]:($=ut,ut=s);ut!==s;)Mt.push(ut),ut=$,(wt=xe())===s&&(wt=null),wt!==s&&(Lt=yn())!==s?ut=wt=[wt,Lt]:($=ut,ut=s);Mt!==s?ot=xt=h(xt,Mt):($=ot,ot=s)}else $=ot,ot=s;return ot}(),z!==s?mt=St=_(St,z):($=mt,mt=s)):($=mt,mt=s)}else $=mt,mt=s;return mt}())===s&&(it=function(){var mt,St,Ot,z;if(mt=$,H.test(n.charAt($))?(St=n.charAt($),$++):(St=s,Nt===0&&le(J)),St!==s){for(Ot=[],z=Ie();z!==s;)Ot.push(z),z=Ie();Ot!==s?(z=function(){var ot,xt,Mt,ut,wt,Lt;if(ot=$,(xt=_n())!==s){for(Mt=[],ut=$,(wt=xe())===s&&(wt=null),wt!==s&&(Lt=_n())!==s?ut=wt=[wt,Lt]:($=ut,ut=s);ut!==s;)Mt.push(ut),ut=$,(wt=xe())===s&&(wt=null),wt!==s&&(Lt=_n())!==s?ut=wt=[wt,Lt]:($=ut,ut=s);Mt!==s?ot=xt=h(xt,Mt):($=ot,ot=s)}else $=ot,ot=s;return ot}(),z!==s?mt=St=_(St,z):($=mt,mt=s)):($=mt,mt=s)}else $=mt,mt=s;return mt}())===s&&(it=function(){var mt,St,Ot,z;if(mt=$,K.test(n.charAt($))?(St=n.charAt($),$++):(St=s,Nt===0&&le(tt)),St!==s){for(Ot=[],z=Ie();z!==s;)Ot.push(z),z=Ie();Ot!==s?(z=function(){var ot,xt,Mt,ut,wt,Lt;if(ot=$,(xt=Kr())!==s){for(Mt=[],ut=$,(wt=xe())===s&&(wt=null),wt!==s&&(Lt=Kr())!==s?ut=wt=[wt,Lt]:($=ut,ut=s);ut!==s;)Mt.push(ut),ut=$,(wt=xe())===s&&(wt=null),wt!==s&&(Lt=Kr())!==s?ut=wt=[wt,Lt]:($=ut,ut=s);Mt!==s?ot=xt=h(xt,Mt):($=ot,ot=s)}else $=ot,ot=s;return ot}(),z!==s?mt=St=_(St,z):($=mt,mt=s)):($=mt,mt=s)}else $=mt,mt=s;return mt}()),it}function Di(){var it,Et,mt,St,Ot,z;if(it=$,(Et=_n())!==s){for(mt=[],St=$,(Ot=xe())===s&&(Ot=null),Ot!==s&&(z=_n())!==s?St=Ot=[Ot,z]:($=St,St=s);St!==s;)mt.push(St),St=$,(Ot=xe())===s&&(Ot=null),Ot!==s&&(z=_n())!==s?St=Ot=[Ot,z]:($=St,St=s);mt!==s?it=Et=h(Et,mt):($=it,it=s)}else $=it,it=s;return it}function ui(){var it,Et,mt,St,Ot,z;if(it=$,(Et=po())!==s){for(mt=[],St=$,(Ot=xe())===s&&(Ot=null),Ot!==s&&(z=po())!==s?St=Ot=[Ot,z]:($=St,St=s);St!==s;)mt.push(St),St=$,(Ot=xe())===s&&(Ot=null),Ot!==s&&(z=po())!==s?St=Ot=[Ot,z]:($=St,St=s);mt!==s?it=Et=h(Et,mt):($=it,it=s)}else $=it,it=s;return it}function nn(){var it,Et,mt,St,Ot,z;return it=$,(Et=_n())!==s?((mt=xe())===s&&(mt=null),mt!==s&&(St=_n())!==s?((Ot=xe())===s&&(Ot=null),Ot!==s&&(z=_n())!==s?it=Et=R(Et,St,z):($=it,it=s)):($=it,it=s)):($=it,it=s),it}function Zr(){var it,Et,mt,St;return it=$,(Et=_n())!==s?((mt=xe())===s&&(mt=null),mt!==s&&(St=_n())!==s?it=Et=I(Et,St):($=it,it=s)):($=it,it=s),it}function yn(){var it,Et,mt,St;return it=$,(Et=_n())!==s?((mt=xe())===s&&(mt=null),mt!==s&&(St=_n())!==s?it=Et=G(Et,St):($=it,it=s)):($=it,it=s),it}function Kr(){var it,Et,mt,St,Ot,z,ot,xt,Mt,ut,wt;return it=$,(Et=yt())!==s?((mt=xe())===s&&(mt=null),mt!==s&&(St=yt())!==s?((Ot=xe())===s&&(Ot=null),Ot!==s&&(z=po())!==s&&xe()!==s&&(ot=Up())!==s?((xt=xe())===s&&(xt=null),xt!==s&&(Mt=Up())!==s?((ut=xe())===s&&(ut=null),ut!==s&&(wt=_n())!==s?it=Et=ct(Et,St,z,ot,Mt,wt):($=it,it=s)):($=it,it=s)):($=it,it=s)):($=it,it=s)):($=it,it=s),it}function _n(){var it,Et,mt,St;return it=$,(Et=po())!==s?((mt=xe())===s&&(mt=null),mt!==s&&(St=po())!==s?it=Et=et(Et,St):($=it,it=s)):($=it,it=s),it}function yt(){var it;return(it=Np())===s&&(it=Ss()),it!==s&&(it=st(it)),it}function po(){var it,Et,mt;return it=$,(Et=hd())===s&&(Et=null),Et!==s&&(mt=Np())!==s?it=Et=[Et,mt]:($=it,it=s),it===s&&(it=$,(Et=hd())===s&&(Et=null),Et!==s&&(mt=Ss())!==s?it=Et=[Et,mt]:($=it,it=s)),it!==s&&(it=dt(it)),it}function Up(){var it;return Y.test(n.charAt($))?(it=n.charAt($),$++):(it=s,Nt===0&&le(ht)),it!==s&&(it=F(it)),it}function xe(){var it,Et,mt,St,Ot;if(it=$,Et=[],(mt=Ie())!==s)for(;mt!==s;)Et.push(mt),mt=Ie();else Et=s;if(Et!==s)if((mt=zp())===s&&(mt=null),mt!==s){for(St=[],Ot=Ie();Ot!==s;)St.push(Ot),Ot=Ie();St!==s?it=Et=[Et,mt,St]:($=it,it=s)}else $=it,it=s;else $=it,it=s;if(it===s){if(it=$,Et=$,(mt=zp())!==s){for(St=[],Ot=Ie();Ot!==s;)St.push(Ot),Ot=Ie();St!==s?Et=mt=[mt,St]:($=Et,Et=s)}else $=Et,Et=s;Et!==s&&(Et=B()),it=Et}return it}function zp(){var it;return n.charCodeAt($)===44?(it=j,$++):(it=s,Nt===0&&le(Z)),it}function Np(){var it,Et,mt;return it=$,Et=function(){var St,Ot,z,ot;return St=$,(Ot=Ss())===s&&(Ot=null),Ot!==s?(n.charCodeAt($)===46?(z=W,$++):(z=s,Nt===0&&le(X)),z!==s&&(ot=Ss())!==s?St=Ot=[Ot,z,ot]:($=St,St=s)):($=St,St=s),St===s&&(St=$,(Ot=Ss())!==s?(n.charCodeAt($)===46?(z=W,$++):(z=s,Nt===0&&le(X)),z!==s?St=Ot=[Ot,z]:($=St,St=s)):($=St,St=s)),St!==s&&(St=L(St)),St}(),Et!==s?((mt=Fp())===s&&(mt=null),mt!==s?it=Et=[Et,mt]:($=it,it=s)):($=it,it=s),it===s&&(it=$,(Et=Ss())!==s&&(mt=Fp())!==s?it=Et=[Et,mt]:($=it,it=s)),it!==s&&(it=L(it)),it}function Fp(){var it,Et,mt,St;return it=$,V.test(n.charAt($))?(Et=n.charAt($),$++):(Et=s,Nt===0&&le(nt)),Et!==s?((mt=hd())===s&&(mt=null),mt!==s&&(St=Ss())!==s?it=Et=[Et,mt,St]:($=it,it=s)):($=it,it=s),it!==s&&(it=L(it)),it}function hd(){var it;return lt.test(n.charAt($))?(it=n.charAt($),$++):(it=s,Nt===0&&le(ft)),it}function Ss(){var it,Et;if(it=[],pt.test(n.charAt($))?(Et=n.charAt($),$++):(Et=s,Nt===0&&le(Pt)),Et!==s)for(;Et!==s;)it.push(Et),pt.test(n.charAt($))?(Et=n.charAt($),$++):(Et=s,Nt===0&&le(Pt));else it=s;return it!==s&&(it=bt(it)),it}function Ie(){var it;return Rt.test(n.charAt($))?(it=n.charAt($),$++):(it=s,Nt===0&&le(_t)),it!==s&&(it=B()),it}var cd,dd,Ms,fl={m:"moveto",l:"lineto",h:"horizontal lineto",v:"vertical lineto",c:"curveto",s:"smooth curveto",q:"quadratic curveto",t:"smooth quadratic curveto",a:"elliptical arc",z:"closepath"};for(var kp in fl)fl[kp.toUpperCase()]=fl[kp];function fo(it,Et){Et||(Et=[{}]);for(var mt=Et.length;mt--;){var St={code:it,command:fl[it]};for(var Ot in it==it.toLowerCase()&&(St.relative=!0),Et[mt])St[Ot]=Et[mt][Ot];Et[mt]=St}return Et}if((a=l())!==s&&$===n.length)return a;throw a!==s&&$<n.length&&le({type:"end"}),cd=jt,dd=Dt<n.length?n.charAt(Dt):null,Ms=Dt<n.length?oe(Dt,Dt+1):oe(Dt,Dt),new i(i.buildMessage(cd,dd),cd,dd,Ms)}}}),u3=vp((t,e)=>{var i=G$().parse;i.parseSVG=i,i.makeAbsolute=function(n){var r,a={x:0,y:0},s={x:"x0",y:"y0",x1:"x0",y1:"y0",x2:"x0",y2:"y0"};return n.forEach(function(o){for(var l in o.command==="moveto"&&(r=o),o.x0=a.x,o.y0=a.y,s)l in o&&(o[l]+=o.relative?o[s[l]]:0);"x"in o||(o.x=a.x),"y"in o||(o.y=a.y),o.relative=!1,o.code=o.code.toUpperCase(),o.command=="closepath"&&(o.x=r.x,o.y=r.y),a=o}),n},e.exports=i}),Wk=k(()=>{hg=new Set}),H$=k(()=>{rt(),qg(),Xg(),GA=class extends xp(Gz){constructor(t,e=15,i=6710886){super(t,e,i),this.object=t,this.name=`PointLightHelper: ${t.uuid}`}raycast(t,e){wp(this.object,GA.geometryHelper,t,e)}}}),p3=k(()=>{rt(),H$(),Zg(),nb=class extends rx(Nz,GA){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=90,n.aspect=1,n.near=100,n.far=2500;let r=new C(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),a=new C(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z),s=new ci(r,a),o=new Mg(s,new Jt(16755200));o.visible=!1,this.gizmos.shadowmap=o,this.update()}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this.gizmos))for(let t in this.gizmos){let e=this.gizmos[t];if(e instanceof Mg){let i=this.shadow.camera,n=new C(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),r=new C(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z);e.box.set(n,r),e.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}});function tL(t){let e=HA.get(t);return e===void 0&&(e=qk++,HA.set(t,e)),e}function W$(t,e,i,n){let r=t,a=e;return[tL(i),tL(n),r.layers?.mask??0,r.renderOrder??0,(r.castShadow??a.castShadow)===!0?1:0,(r.receiveShadow??a.receiveShadow)===!0?1:0].join(":")}var HA,qk,WA,qA,Dv,Xk,q$=k(()=>{Ui(),HA=new WeakMap,qk=1}),X$=k(()=>{rt(),qA=(WA=[8,32,128,512])[WA.length-1],Dv=new At().makeScale(0,0,0),Xk=class extends Ib{constructor(t,e,i,n){super(t,e,i),this.isInstanceGroup=!0,this.members=new Array(i).fill(null),this.raycast=()=>{},this.matrixAutoUpdate=!1,this.frustumCulled=!1,this.adoptPassState(n);for(let r=0;r<i;r++)this.setMatrixAt(r,Dv);this.instanceMatrix.needsUpdate=!0}adoptPassState(t){this.layers.mask=t.layers.mask,this.renderOrder=t.renderOrder,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow}assign(t,e){this.members[t]=e}writeSlot(t,e,i){return i===!1?(this.setMatrixAt(t,Dv),!1):(this.setMatrixAt(t,e.matrixWorld),!0)}park(t){this.members[t]=null,this.setMatrixAt(t,Dv)}get memberCount(){let t=0;for(let e of this.members)e!==null&&t++;return t}}});function $k(t,e){let i=e.get(t);if(i!==void 0)return i;let n=t.visible&&(t.parent===null||$k(t.parent,e));return e.set(t,n),n}var Yk,$$=k(()=>{q$(),X$(),Yk=class{constructor(t=8){this.minGroupSize=t,this.groups=[],this.groupKeys=new WeakMap,this.placements=new Map,this.visibilityMemo=new Map,this.page=null,this.stats={instancingGroups:0,instancedDrawsSaved:0,instancingRegroups:0,instancingParks:0,instancingIneligible:{}}}update(t,e){this.page!==t&&(this.teardown(),this.page=t,e=!0),t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),e&&this.reconcile(t),this.refresh()}reconcile(t){let e={},i=new Map;t.traverse(a=>{if(a.isInstanceGroup===!0)return;let s=function(l){if(l.isMesh!==!0)return"not-a-mesh";if(mh(l)||Cr(l)||qc(l)||sg(l))return"excluded-type";let c=function(f){let g=Dc(f)?f.object:f;return g.geometry!==void 0?g:void 0}(l);if(c===void 0)return"not-a-mesh";let h=c.material;if(h===void 0)return"not-a-mesh";if(Array.isArray(h))return"array-material";let d=c.builtSharedGeometry;if(d===void 0)return"unrealized-geometry";if(!function(f){return f.isShared===!0}(d))return"unshared-geometry";if(d.attributes.position===void 0)return"empty-geometry";if(d.morphAttributes.position!==void 0)return"morph";if(c.isSkinnedMesh===!0)return"skinned";let u=c.morphTargetInfluences;if(u!==void 0&&u.length>0)return"morph";if(d.drawRange.start!==0||d.drawRange.count!==Number.POSITIVE_INFINITY)return"draw-range";let p=h;return p.positionNode!=null||p.castShadowPositionNode!=null?"position-node":p.transparent===!0?"transparent":c.userData?.__splinePlanarMirror!==void 0?"reflection":function(f){let g=f;for(;g!==null;){let m=g.states;if(m!==void 0&&Object.keys(m).length>0)return!0;g=g.parent}return!1}(c)?"interaction-states":{object:l,owner:c,geometry:d,material:h,key:W$(l,c,d,h)}}(a);if(typeof s=="string")return void(e[s]=(e[s]??0)+1);let o=i.get(s.key);o===void 0?i.set(s.key,[s]):o.push(s)});let n=new Map;for(let[a,s]of i)for(let o of s)n.set(o.object,a);let r=!1;for(let[a,s]of this.placements)n.get(a)!==this.groupKeys.get(s.group)&&this.parkPlacement(a,s);for(let a=this.groups.length-1;a>=0;a--){let s=this.groups[a];s.memberCount>=this.minGroupSize||(this.destroyGroup(s),this.groups.splice(a,1),r=!0)}for(let[a,s]of i){let o=s.filter(c=>!this.placements.has(c.object));if(o.length===0)continue;let l=0;for(let c of this.groups){if(l>=o.length)break;if(this.groupKeys.get(c)!==a)continue;let{members:h}=c;for(let d=0;d<h.length&&l<o.length;d++)h[d]===null&&this.place(c,d,o[l++].object)}for(;o.length-l>=this.minGroupSize;){let c=o.slice(l,l+qA);this.groups.push(this.createGroup(t,a,c)),l+=c.length,r=!0}}r&&this.stats.instancingRegroups++,this.publishGroupStats(),this.stats.instancingIneligible=e}createGroup(t,e,i){let n=i[0],r=new Xk(n.geometry,n.material,function(a){for(let s of WA)if(a<=s)return s;return qA}(i.length),n.object);this.groupKeys.set(r,e);for(let a=0;a<i.length;a++)this.place(r,a,i[a].object);return t.add(r),r}destroyGroup(t){for(let e=0;e<t.members.length;e++){let i=t.members[e];i!==null&&this.parkPlacement(i,{group:t,slot:e})}t.removeFromParent(),t.dispose()}place(t,e,i){t.assign(e,i),this.placements.set(i,{group:t,slot:e}),i.isDrawSuppressed=!0}parkPlacement(t,e){e.group.park(e.slot),e.group.instanceMatrix.needsUpdate=!0,this.placements.delete(t),t.isDrawSuppressed=!1,this.stats.instancingParks++}refresh(){this.visibilityMemo.clear();for(let t of this.groups){let{members:e}=t,i=null;for(let n=0;n<e.length;n++){let r=e[n];r!==null&&(i===null&&(i=r),t.writeSlot(n,r,$k(r,this.visibilityMemo)))}i!==null&&(t.adoptPassState(i),t.instanceMatrix.needsUpdate=!0)}}teardown(){for(let t of this.groups)this.destroyGroup(t);this.groups.length=0;for(let t of this.placements.keys())t.isDrawSuppressed=!1;this.placements.clear(),this.publishGroupStats()}dispose(){this.teardown(),this.page=null}publishGroupStats(){let t=0;for(let e of this.groups){let i=e.memberCount;i>0&&(t+=i-1)}this.stats.instancingGroups=this.groups.length,this.stats.instancedDrawsSaved=t}}});function Y$(t,e,i){i.length=0;let{axis:n,sign:r,limit:a}=e;for(let s=0;s<t.length;s++){let o=t[s],l=t[(s+1)%t.length],c=(n===0?o.px:n===1?o.py:o.pz)*r-a,h=(n===0?l.px:n===1?l.py:l.pz)*r-a,d=c<=0,u=h<=0;if(d&&i.push(o),d!==u){let p=c/(c-h);i.push({px:o.px+(l.px-o.px)*p,py:o.py+(l.py-o.py)*p,pz:o.pz+(l.pz-o.pz)*p,nx:o.nx+(l.nx-o.nx)*p,ny:o.ny+(l.ny-o.ny)*p,nz:o.nz+(l.nz-o.nz)*p})}}return i}function Z$(t,e,i,n,r,a,s,o,l){let c=t.geometry,h=c.getAttribute("position");if(h===void 0||h.count===0)return!0;let d=c.getAttribute("normal"),u=c.getIndex(),p=u!==null?u.count:h.count;if(p>Zk)return!0;let f=c.drawRange.start,g=f+(c.drawRange.count===1/0?p-f:Math.min(c.drawRange.count,p-f));Tu.copy(t.objectToDecal),Bm.getNormalMatrix(Tu);let m=[],y=[];for(let v=f;v+2<g;v+=3){let _=u!==null?u.getX(v):v,b=u!==null?u.getX(v+1):v+1,x=u!==null?u.getX(v+2):v+2;if(Gs.fromBufferAttribute(h,_).applyMatrix4(Tu),Uo.fromBufferAttribute(h,b).applyMatrix4(Tu),zo.fromBufferAttribute(h,x).applyMatrix4(Tu),Gs.z>i&&Uo.z>i&&zo.z>i||Gs.z<-i&&Uo.z<-i&&zo.z<-i)continue;Fr.subVectors(Uo,Gs),XA.subVectors(zo,Gs),Fl.crossVectors(Fr,XA);let w=Fl.length();if(!(w===0||Fl.z/w<=Qk)){if(m.length=0,d!==void 0)Fr.fromBufferAttribute(d,_).applyMatrix3(Bm),m.push({px:Gs.x,py:Gs.y,pz:Gs.z,nx:Fr.x,ny:Fr.y,nz:Fr.z}),Fr.fromBufferAttribute(d,b).applyMatrix3(Bm),m.push({px:Uo.x,py:Uo.y,pz:Uo.z,nx:Fr.x,ny:Fr.y,nz:Fr.z}),Fr.fromBufferAttribute(d,x).applyMatrix3(Bm),m.push({px:zo.x,py:zo.y,pz:zo.z,nx:Fr.x,ny:Fr.y,nz:Fr.z});else{Fl.divideScalar(w);for(let S of[Gs,Uo,zo])m.push({px:S.x,py:S.y,pz:S.z,nx:Fl.x,ny:Fl.y,nz:Fl.z})}for(let S of e){if(m.length===0)break;let T=Y$(m,S,y);y=m,m=T}if(!(m.length<3)){if(s.length/3+3*(m.length-2)>Kk)return!1;for(let S=1;S+1<m.length;S++)for(let T of[m[0],m[S],m[S+1]]){l.push(T.px*n+.5,T.py*r+.5);let E=T.nx,P=T.ny,A=T.nz,R=Math.hypot(E,P,A);R>0?(E/=R,P/=R,A/=R):(E=0,P=0,A=1),s.push(T.px+E*a,T.py+P*a,T.pz+A*a),o.push(E,P,A)}}}}return!0}var Zk,Kk,Qk,Tu,Bm,Gs,Uo,zo,Fr,XA,Fl,Rv,n2,r2,a2,$A,Jk,K$=k(()=>{rt(),Zk=15e5,Kk=3e5,Qk=.01,Tu=new At,Bm=new pe,Gs=new C,Uo=new C,zo=new C,Fr=new C,XA=new C,Fl=new C}),Q$=k(()=>{rt(),Ye(),ed(),lr(),Wr(),K$(),nx(),Rv=new ci,n2=new ci,r2=new At,a2=new C,$A=class extends Hr{constructor(t,e,i){super(t,e),this.data=e,this.geometry=new Gt,this.lastSignature=[],this.nextSignature=[],this.scanned=[],this.lastParams={width:0,height:0,depth:0,offset:0},this.context=i;let n=this.data.geometry;this.lastParams={width:this.resolveNumber(n.width,0),height:this.resolveNumber(n.height,0),depth:this.resolveNumber(n.depth,0),offset:n.offset??0},this.geometry.userData={type:"DecalGeometry",parameters:{...this.lastParams}}}get isLOD(){return this.updateDecal(),!1}get isDecalObject(){return!0}resolveNumber(t,e){if(typeof t=="number")return t;let i=Number(this.context.shared.getVariable(t));return Number.isFinite(i)?i:e}currentParams(){let t=this.dataPatched.geometry;return{width:this.resolveNumber(t.width,this.lastParams.width),height:this.resolveNumber(t.height,this.lastParams.height),depth:this.resolveNumber(t.depth,this.lastParams.depth),offset:t.offset??0}}projectionRoot(){let t=this.parent;for(;t!==null&&Be.is(t);){if(t.data?.type==="Page")return t;t=t.parent}return this.context.scene}scanTargets(t,e,i){let n=this.scanned;n.length=0;let r=this.projectionRoot();if(r===null)return n;Rv.makeEmpty();for(let a=0;a<8;a++)a2.set((1&a?.5:-.5)*t,(2&a?.5:-.5)*e,(4&a?.5:-.5)*i).applyMatrix4(this.matrixWorld),Rv.expandByPoint(a2);return r.traverse(a=>{if(a===this||!Be.is(a)||!(a instanceof $i)||a instanceof $A||a.dataPatched?.type!=="Mesh"||!a.visible||a.destroyedInAction||512&a.layers.mask)return;let s=a.geometry,o=s?.getAttribute("position");o===void 0||o.count===0||s.drawRange.count!==0&&(s.boundingBox===null&&s.computeBoundingBox(),n2.copy(s.boundingBox).applyMatrix4(a.matrixWorld),Rv.intersectsBox(n2)&&n.push(a))}),n}collectSignature(t,e,i){t.length=0,t.push(i.width,i.height,i.depth,i.offset);for(let n of this.matrixWorld.elements)t.push(n);for(let n of e){t.push(n.id,n.geometry.id);let r=n.geometry.getAttribute("position");t.push(r===void 0?-1:"version"in r?r.version:r.data.version);let a=n.geometry.getIndex();t.push(a!==null?a.version:-1),t.push(n.geometry.drawRange.count===1/0?-1:n.geometry.drawRange.count);for(let s of n.matrixWorld.elements)t.push(s)}}signaturesEqual(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}updateDecal(){if(this.disposed)return!1;this.updateWorldMatrix(!0,!1);let t=this.currentParams(),e=this.scanTargets(t.width,t.height,t.depth);if(this.collectSignature(this.nextSignature,e,t),this.signaturesEqual(this.nextSignature,this.lastSignature))return!1;let i=this.lastSignature;this.lastSignature=this.nextSignature,this.nextSignature=i,this.lastParams=t,r2.copy(this.matrixWorld).invert();let n=e.map(r=>({geometry:r.geometry,objectToDecal:new At().multiplyMatrices(r2,r.matrixWorld)}));return this.geometry.dispose(),this.geometry=function(r,a){let s=Math.max(Math.abs(a.width),1e-6),o=Math.max(Math.abs(a.height),1e-6),l=Math.max(Math.abs(a.depth),1e-6),c=[{axis:0,sign:1,limit:s/2},{axis:0,sign:-1,limit:s/2},{axis:1,sign:1,limit:o/2},{axis:1,sign:-1,limit:o/2},{axis:2,sign:1,limit:l/2},{axis:2,sign:-1,limit:l/2}],h=[],d=[],u=[];for(let f of r)if(!Z$(f,c,l/2,1/s,1/o,a.offset,h,d,u))break;let p=new Gt;return p.setAttribute("position",new Ft(h,3)),p.setAttribute("normal",new Ft(d,3)),p.setAttribute("uv",new Ft(u,2)),h.length===0?(p.setDrawRange(0,0),p.boundingSphere=new vr):p.computeBoundingSphere(),p}(n,t),this.geometry.userData={type:"DecalGeometry",parameters:{width:t.width,height:t.height,depth:t.depth}},Ku(this),Qu(this),this.resetBBoxNeedsUpdate(),!0}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.resetBBoxNeedsUpdate()}updateEntityBoxSize(t,e){let i=this.currentParams();t.setScalar(0),e.set(i.width,i.height,i.depth).multiplyScalar(.5)}dispose(){super.dispose(),this.geometry.dispose()}}}),J$=k(()=>{rt(),Wb(),td(),Jk=class extends Jc(eE,pp){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(t,e){this.updateState_Entity(t,e)}}});function f3(t,e,i){if(console.assert(e.type!==void 0),e.type==="Mesh")return function(n,r,a){let s;if(d1!==void 0&&r?.geometry&&"subdivisions"in r.geometry&&(r.geometry.subdivisions??0)>d1&&Object.assign(r.geometry,{subdivisions:d1}),r.geometry.type==="TextGeometry"||r.geometry.type==="InputGeometry"){let o=ES(r.geometry.type);return o?o(n,r,a):(Gn(r.geometry.type==="InputGeometry"?"textinputs":"text",`a Mesh with ${r.geometry.type}`),new vi(n,r,a))}if(r.geometry.type==="SubdivGeometry")s=new mp(n,r,a);else if(r.geometry.type==="PathGeometry"||r.geometry.type==="VectorGeometry"||r.geometry.type==="ShapeBlendGeometry"){let o=ES(r.geometry.type);o?s=o(n,r,a):(Gn(r.geometry.type==="ShapeBlendGeometry"?"shape-blends":r.geometry.type==="PathGeometry"?"3d-paths":"vector-shapes",`a Mesh with ${r.geometry.type}`),s=new vi(n,r,a))}else if(r.geometry.type==="BooleanGeometry")s=new dh(n,r,a);else if(r.geometry.type==="DecalGeometry")s=new $A(n,r,a);else if(r.geometry.type==="UIGeometry"){let o=ES("UIGeometry");o?s=o(n,r,a):(Gn("ui-2d","a Mesh with UIGeometry"),s=new vi(n,r,a))}else s=new vi(n,r,a);return s}(t,e,i);if(e.type==="Empty")return new Zs(t,e);if(e.type==="Particle"){let n=MS("Particle");return n?n(t,e,i):(Gn("particles","a Particle system"),new Zs(t,e))}if(e.type==="ParticleCollider")return new Ju(t,e,i);if(e.type==="Hair"){let n=MS("Hair");return n?n(t,e,i):(Gn("hair","a Hair System"),new Zs(t,e))}if(e.type==="Splat")return new Zs(t,e);if(e.type==="Bone")return new Jk(t,e);if(e.type==="Page")return new pn(t,e,i);if(e.type==="PointLight")return new nb(t,e,i);if(e.type==="SpotLight")return new Ng(t,e,i);if(e.type==="DirectionalLight")return new zg(t,e,i);if(e.type==="Component"||e.type==="Instance"){let n=MS(e.type);return n?n(t,e,i):(Gn("components",`a ${e.type}`),new Zs(t,e))}return Wc.is(e.type)?new tn(t,e):(console.error(e),new Zs(t,e))}function tY(t,e,i){let n=f3(t.identity,e,i),r=t.children,a=t.attachedPaths,s=t.parent,o=t.component,l=t.instances,c=t.overrideData,h=t.uuid,d=t.stateSelection;t.dispose();for(let u of Object.keys(t))delete t[u];Object.setPrototypeOf(t,Object.getPrototypeOf(n));for(let u of Object.keys(n))t[u]=n[u];t.children=[...t.children,...r],t.attachedPaths=a,t.parent=s,t.component=o,t.instances=l,t.uuid=h,t.overrideData=c,t.updateState(t.data,i),d&&t.changeSelectedState(d,i),t.resetBBoxNeedsUpdate()}var d1,t6,e6,i6,nh,u1,n6,YA,eY=k(()=>{te(),Kg(),Yg(),Q$(),la(),Yb(),p3(),ox(),ax(),qa(),V_(),J$(),hl(),c3(),ke(),d1=function(){try{let t=window.location.href;if(t.includes("reducesubdiv=")){let e=t.indexOf("reducesubdiv=")+13;return parseInt(t.slice(e,e+1))}}catch{}}(),il.createEntity=f3,il.changeEntityProptotype=tY}),iY=k(()=>{t6=class{constructor(){this._constraints=new Map}setConstraint(t,e){e===null?this._constraints.delete(t):this._constraints.set(t,e)}removeDependencies(t){this._constraints.delete(t)}applyConstraints(t){let e=new Set;this._constraints.forEach((i,n)=>{let r=[n,i],a=i;for(;this._constraints.has(a);){if(a=this._constraints.get(a),r.includes(a)){console.warn(`circular dependency detected: ${r.join(" -> ")}`);break}e.has(a)||r.push(a)}for(let s=r.length-2;s>=0;s--)if(!e.has(r[s])){let o=t.find(r[s]);o?o.applyPathSnapping(t):console.warn(`missing entity ${r[s]}`),e.add(r[s])}})}findDependency(t,e){let i=t;for(;this._constraints.has(i);)if(i=this._constraints.get(i),i===e)return!0;return!1}}}),nY=k(()=>{e6="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"}),rY=k(()=>{i6=`
|
|
4171
4171
|
function sortWorker(self) {
|
|
4172
4172
|
let wasmInstance;
|
|
@@ -9842,11 +9842,11 @@ void main() {
|
|
|
9842
9842
|
void main() {
|
|
9843
9843
|
vec4 texel = texture2D( tDiffuse, vUv );
|
|
9844
9844
|
gl_FragColor = texel;
|
|
9845
|
-
}`}),eJ=new class{constructor(t){this._mesh=new wi(tJ,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,JQ)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}(XV),H2=null,W2=null,iJ=ge.identity(),$V=class{constructor(t,e,i,n){var r;this.uuid=t,this.width=e,this.height=i,this.context=n,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||hg.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let a=this.width,s=this.height;this.renderer.dpr=aB(a,s,this.dpr,this.isScreenSpace),this.renderer.setSize(a,s)},this.onFrameOverrideObjectEvent=a=>{if(a.target?.uuid!==void 0){let s=this.frameRoot?.find(a.target.uuid);s&&s.dispatchEvent({...a,target:s})}},this.scene2d=new U3(It.generateUUID(),iA.defaultData,{dpr:window.devicePixelRatio,shared:n.shared}),this.canvas=(H2===null&&(H2=document.createElement("canvas")),H2),this.renderer=(r=this.canvas,W2===null&&(W2=new qQ(r)),W2),this.promise=this.init(),this.renderTarget=new Fe(1,1,{type:$n,stencilBuffer:!1,depthBuffer:!1}),n.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=n.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new Tz(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(t){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,t.blitTextureToTarget)t.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{XV.uniforms.tDiffuse.value=this.canvasTexture;let e=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.clear(),eJ.render(t),t.setRenderTarget(e)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(t,e,i,n){this.scene2d.updateEntityByOp(t,e,i,n),this.applySize()}updateTreeByOp(t,e){this.scene2d.updateTreeByOp(t,e),this.applySize()}applyOverrides(t){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let e=t?.width??this.width,i=t?.height??this.height;this.frameOverride.width=e,this.frameOverride.height=i,this.frameOverride.localMatrix=iJ,this.isScreenSpace&&(this.frameOverride.fill.color=Je.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:e,height:i},YV({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(t,e=window.devicePixelRatio){let i=Math.max(1,t?.width??this.width),n=Math.max(1,t?.height??this.height);this.dpr=e,this.width=i,this.height=n,this._innerApplySize();let r=function(a,s,o,l){let c=aB(a,s,o,l),h=Math.max(o,512/Math.min(a,s)),d=Math.min(h,c);return{width:Math.max(1,Math.ceil(a*d)),height:Math.max(1,Math.ceil(s*d))}}(i,n,e,this.isScreenSpace);this.renderTarget.setSize(r.width,r.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(t),this.frameOverride?.requestRender()}applyFrame(t){let e=this.context.scene.find2D(t);if(e&&e instanceof oo)return this.disposeFrameOverride(),this.frameRoot=e,this.frameOverride=e.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(i=>{i.addEventListener("beginState",this.onFrameOverrideObjectEvent),i.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),e}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(t){return this.scene2d.find(t)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(t=>{t.removeEventListener("beginState",this.onFrameOverrideObjectEvent),t.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function YV({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:a}){if(t instanceof oo&&e instanceof oo||t instanceof uh&&e instanceof uh)for(let s=0,o=t.children.length;s<o;s++){let l=t.children[s],c=e.children[s];l&&c&&l.uuid===c.uuid&&nJ({objectOverride:l,objectRoot:c,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:a})}}function nJ({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:a}){let[s,o]=function(d){if(q2(d))return[d.width,d.height];if(d instanceof gb){let[u,p]=d.getHalfSize();return[2*u,2*p]}if(d instanceof uh){let[u,p]=d.recursiveBBox.getHalfSize();return[2*u,2*p]}return[0,0]}(e),{width:l,height:c,position:h}=qV({constraints:t.data,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:a,objectInitialWidth:s,objectInitialHeight:o,objectInitialPosition:e.position});if(t.position=h,t.data={...t.data,position:h},t.states)for(let d in t.states)rJ({stateId:d,objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:a});if(q2(t)||t instanceof uh)q2(t)&&(t.width=l,t.height=c,t.data={...t.data,width:l,height:c}),YV({objectOverride:t,objectRoot:e,newParentWidth:l,newParentHeight:c,initialParentWidth:s,initialParentHeight:o});else if(t instanceof gb){let d=e,u=s!==0?l/s:1,p=o!==0?c/o:1;t.path=function(f,g=1,m=1){if(g<=0||m<=0)return f;if(HV(f))return console.warn("Cannot scale invalid path",f),G2([]);if(g===1&&m===1)return f;try{return G2((0,QQ.parseSVG)(f).map(y=>{let v={...y};return"x"in v&&(v.x=v.x*g),"y"in v&&(v.y=v.y*m),"x1"in v&&(v.x1=v.x1*g),"x2"in v&&(v.x2=v.x2*g),"y1"in v&&(v.y1=v.y1*m),"y2"in v&&(v.y2=v.y2*m),"rx"in v&&(v.rx=v.rx*g),"ry"in v&&(v.ry=v.ry*m),v}))}catch(y){return console.warn("Error parsing SVG path",y),G2([])}}(d.path,u,p),t.data={...t.data,path:t.path}}}function rJ({stateId:t,objectOverride:e,objectRoot:i,newParentWidth:n,newParentHeight:r,initialParentWidth:a,initialParentHeight:s}){let o=e.states?.[t],l=i.states?.[t];if(o&&l){let{width:c,height:h,position:d}=qV({constraints:e.data,newParentWidth:n,newParentHeight:r,initialParentWidth:a,initialParentHeight:s,objectInitialWidth:kc.isResizeable(l)?l.width:0,objectInitialHeight:kc.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(e.states[t],{position:d}),kc.isResizeable(o)&&Object.assign(e.states[t],{width:c,height:h})}}function q2(t){return t instanceof t0||t instanceof oo||t instanceof L3||t instanceof B3}tx();var sB,aJ=class extends vi{constructor(t,e,i){super(t,e,i),this.isUIObject=!0,this.uiCanvas=new $V(t+"-canvas",e.geometry.width,e.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),t.type===0&&(t.props.frame!==void 0&&this.applyFrame(t.props.frame,i.shared),(t.props.width!==void 0||t.props.height!==void 0)&&this.applySize(t.props,i.shared))}applySize(t,e){let i=t?.width??this.dataPatched.geometry.width,n=t?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:n}),this.applyGeometryParametersFromFrame(e)}applyFrame(t,e){this.uiCanvas.applyFrame(t),this.applyGeometryParametersFromFrame(e),this.applyMaterialParametersFromFrame({shared:e})}applyGeometryParametersFromFrame(t){let e=this.frame;e&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=ih(this.dataPatched.geometry,t,this.data.flatShading,this))}applyMaterialParametersFromFrame(t){let e=this.frame;if(e){let i=e.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,t,!0)}}updateEntity2DByOp(t,e,i,n){this.uiCanvas.updateEntity2DByOp(t,e,i,n),t===this.frameId&&e.type===0&&(e.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(n):ri(e.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:n}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(t){super.removeInteractionGeometry(t),this.applySize({},t)}updateGeometryInteractions(t,e){super.updateGeometryInteractions(t,e),this.applySize({width:t.width,height:t.height},e);let i={...this.data.geometry,...t};this.localGeometry?.dispose(),this.localGeometry=ih(i,e,this.data.flatShading,this)}};ke(),Sp("UIGeometry",(t,e,i)=>new aJ(t,e,i)),qb=sB={Scene2D:U3,UICanvas:$V,loadHanaUIRUNTIME:function(){return pb||(pb=async()=>async function(t,e){return await t.default(e?{module_or_path:e}:void 0),Object.getOwnPropertyDescriptor(t.Engine.prototype,"scene")||Object.defineProperty(t.Engine.prototype,"scene",{get:function(){let i=Object.create(t.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>t.Engine.create(i,JSON.parse('{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}'),!0)}}(await Promise.resolve().then(()=>(vD(),gD)),q5??function(){let t=typeof process<"u"?"2.0.12":void 0;return`https://cdn.spline.design/@splinetool/runtime${t?`@${t}`:""}/build/hana-ui.wasm`}())),jV().then(()=>{})},setHanaUIWasmUrl:function(t){q5=t}},G_!==null&&sB.setHanaUIWasmUrl(G_),Si("ui-2d"),Sk(),rt();var ZV,X2,sJ=class{constructor(){this.type="ShapePath",this.color=new Jt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Qm,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath?.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,a){return this.currentPath?.bezierCurveTo(t,e,i,n,r,a),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let t={loc:0,t:0};function e(c,h,d,u){let p=c.x,f=h.x,g=d.x,m=u.x,y=c.y,v=h.y,_=d.y,b=u.y,x=(m-g)*(y-_)-(b-_)*(p-g),w=(b-_)*(f-p)-(m-g)*(v-y),S=x/w,T=((f-p)*(y-_)-(v-y)*(p-g))/w;if(w===0&&x!==0||S<=0||S>=1||T<0||T>1)return null;if(x===0&&w===0){for(let E=0;E<2;E++){if(i(E===0?d:u,c,h),t.loc===0){let P=E===0?d:u;return{x:P.x,y:P.y,t:t.t}}if(t.loc===2)return{x:+(p+t.t*(f-p)).toPrecision(10),y:+(y+t.t*(v-y)).toPrecision(10),t:t.t}}return null}for(let E=0;E<2;E++)if(i(E===0?d:u,c,h),t.loc===0){let P=E===0?d:u;return{x:P.x,y:P.y,t:t.t}}return{x:+(p+S*(f-p)).toPrecision(10),y:+(y+S*(v-y)).toPrecision(10),t:S}}function i(c,h,d){let u,p=d.x-h.x,f=d.y-h.y,g=c.x-h.x,m=c.y-h.y,y=p*m-g*f;return c.x===h.x&&c.y===h.y?(t.loc=0,void(t.t=0)):c.x===d.x&&c.y===d.y?(t.loc=1,void(t.t=1)):void(y<-Number.EPSILON?t.loc=3:y>Number.EPSILON?t.loc=4:p*g<0||f*m<0?t.loc=5:Math.sqrt(p*p+f*f)<Math.sqrt(g*g+m*m)?t.loc=6:(u=p!==0?g/p:m/f,t.loc=2,t.t=u))}let n=0,r=999999999,a=-999999999,s=[];this.subPaths.forEach(c=>{let h=c.getPoints(),d=-999999999,u=999999999,p=-999999999,f=999999999;for(let g=0;g<h.length;g++){let m=h[g];m.y>d&&(d=m.y),m.y<u&&(u=m.y),m.x>p&&(p=m.x),m.x<f&&(f=m.x)}a<=p&&(a=p+1),r>=f&&(r=f-1),h.length&&s.push({curves:c.curves,points:h,isCW:sE.isClockWise(h),identifier:n++,boundingBox:new Lb(new at(f,u),new at(p,d))})});let o=s.map(c=>function(h,d,u,p,f){(f==null||f==="")&&(f="nonzero");let g=new at;h.boundingBox.getCenter(g);let m=function(w,S,T){let E=new at;S.getCenter(E);let P=[];return T.forEach(A=>{A.boundingBox.containsPoint(E)&&function(R,O){let D=[],I=[];for(let U=1;U<R.length;U++){let N=R[U-1],G=R[U];for(let H=1;H<O.length;H++){let J=e(N,G,O[H-1],O[H]);J!==null&&D.find(K=>K.t<=J.t+Number.EPSILON&&K.t>=J.t-Number.EPSILON)===void 0&&(D.push(J),I.push(new at(J.x,J.y)))}}return I}(w,A.points).forEach(R=>{P.push({identifier:A.identifier,isCW:A.isCW,point:R})})}),P.sort((A,R)=>A.point.x-R.point.x),P}([new at(u,g.y),new at(p,g.y)],h.boundingBox,d);m.sort((w,S)=>w.point.x-S.point.x);let y=[],v=[];m.forEach(w=>{w.identifier===h.identifier?y.push(w):v.push(w)});let _=y[0].point.x,b=[],x=0;for(;x<v.length&&v[x].point.x<_;)b.length>0&&b[b.length-1]===v[x].identifier?b.pop():b.push(v[x].identifier),x++;if(b.push(h.identifier),f==="evenodd"){let w=b.length%2==0,S=b[b.length-2];return{identifier:h.identifier,isHole:w,for:S}}if(f==="nonzero"){let w=!0,S=null,T=null;for(let E=0;E<b.length;E++){let P=b[E];d[P]&&(w?(T=d[P].isCW,w=!1,S=P):T!==d[P].isCW&&(T=d[P].isCW,w=!0))}return{identifier:h.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+f+'" is currently not implemented.')}(c,s,r,a,this.userData?.style.fillRule)),l=[];return s.forEach(c=>{let h=o[c.identifier];if(h&&!h.isHole){let d=new wg;d.curves=c.curves,o.filter(u=>u?.isHole&&u.for===c.identifier).forEach(u=>{if(u){let p=s[u.identifier],f=new Qm;f.curves=p.curves,d.holes.push(f)}}),l.push(d)}}),l}},KV=!1,oB=new Promise(t=>{ZV=t}),lB=!1;function hB(){if(KV=!0,!lB)return X2||(X2=async function(){let t=await import("./opentype.js");ZV(t),lB=!0}(),X2)}var oJ=new class{async load(t,e,i=()=>{}){let{load:n}=await oB;n(t,(r,a)=>{r||!a?i(r??"Something went wrong"):e(a)})}async parse(t){let{parse:e,Bidi:i}=await oB;try{let n=e(t),r=new i,a=s=>n.charToGlyphIndex(s.char);return r.registerModifier("glyphIndex",null,a),r.applyFeatures(n,n.defaultRenderOptions.features),{font:n,bidi:r}}catch(n){console.error(n)}}};function lJ(t,e){return e.state.glyphIndex===t||e.state.fina===t||e.state.medi===t||e.state.init===t}rt(),XC(),ke(),Sp("TextGeometry",(t,e,i)=>new I3(t,e,i));var cB={create:(t,e)=>new CA(t,e)};sA("TextGeometry",cB),sA("InputGeometry",cB),qC=class{constructor(t){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}update(t){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}async load(t){try{this._layoutErrorWarned=!1;let e=await async function(i){let n,r,a=!1;if(i.url?(n=await async function(s){let o;try{o=await fetch(s)}catch(l){throw new Error(`could not fetch the font at ${s}: ${l}`)}if(!o.ok)throw new Error(`${o.status} ${o.statusText} fetching the font at ${s}`);return await o.arrayBuffer()}(i.url),r=i.url,a=i.url.startsWith("/")):i.data&&(n=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),n){if(!KV)return{font:void 0,url:r,intercepted:a,arr:n,bidi:null};{let s=await oJ.parse(n);if(s)return{font:s.font,url:r,intercepted:a,arr:n,bidi:s.bidi}}}}(t);e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)}catch(e){console.warn(`Could not load the font "${t.url??"(inline data)"}"`,e)}}warnLayoutError(t){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,t))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(t,e,i){if(!this._bidi)return[];let n=this._bidi;n.getTextGlyphs(e);let r=n.tokenizer.tokens,a=[],s=0,o=i.length===r.length;for(let l=0;l<i.length;l++){let c=i[l].index,h=String.fromCharCode(i[l].unicode),d=r[s];if(lJ(c,d)||o)a.push({char:h,index:c,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),s++;else{let u=d.char,p="",f=[d.state.glyphIndex],g=[],m=!1;for(;!m;)s++,p=e.charAt(s),u+=p,f.push(t.charToGlyphIndex(p)),g=t.stringToGlyphs(u),g.length===1&&g[0].index===c&&(m=!0),s>e.length&&(m=!0);a.push({char:h,index:c,replacements:f,replacementChars:Array.from(u)}),s++}}return a}generateShapes(t,e,i){if(!this._isLoaded)return;let n=this.font,r=e.fontSize/this.unitsPerEm,a=e.fontSize*e.lineHeight,s=t.map(y=>this.getTextWidth(y,e)),o=typeof e.width=="string"?Number(i.getVariable(e.width)):e.width,l=typeof e.height=="string"?Number(i.getVariable(e.height)):e.height,c=this.getCharWidth(`
|
|
9845
|
+
}`}),eJ=new class{constructor(t){this._mesh=new wi(tJ,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,JQ)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}(XV),H2=null,W2=null,iJ=ge.identity(),$V=class{constructor(t,e,i,n){var r;this.uuid=t,this.width=e,this.height=i,this.context=n,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||hg.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let a=this.width,s=this.height;this.renderer.dpr=aB(a,s,this.dpr,this.isScreenSpace),this.renderer.setSize(a,s)},this.onFrameOverrideObjectEvent=a=>{if(a.target?.uuid!==void 0){let s=this.frameRoot?.find(a.target.uuid);s&&s.dispatchEvent({...a,target:s})}},this.scene2d=new U3(It.generateUUID(),iA.defaultData,{dpr:window.devicePixelRatio,shared:n.shared}),this.canvas=(H2===null&&(H2=document.createElement("canvas")),H2),this.renderer=(r=this.canvas,W2===null&&(W2=new qQ(r)),W2),this.promise=this.init(),this.renderTarget=new Fe(1,1,{type:$n,stencilBuffer:!1,depthBuffer:!1}),n.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=n.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new Tz(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(t){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,t.blitTextureToTarget)t.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{XV.uniforms.tDiffuse.value=this.canvasTexture;let e=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.clear(),eJ.render(t),t.setRenderTarget(e)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(t,e,i,n){this.scene2d.updateEntityByOp(t,e,i,n),this.applySize()}updateTreeByOp(t,e){this.scene2d.updateTreeByOp(t,e),this.applySize()}applyOverrides(t){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let e=t?.width??this.width,i=t?.height??this.height;this.frameOverride.width=e,this.frameOverride.height=i,this.frameOverride.localMatrix=iJ,this.isScreenSpace&&(this.frameOverride.fill.color=Je.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:e,height:i},YV({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(t,e=window.devicePixelRatio){let i=Math.max(1,t?.width??this.width),n=Math.max(1,t?.height??this.height);this.dpr=e,this.width=i,this.height=n,this._innerApplySize();let r=function(a,s,o,l){let c=aB(a,s,o,l),h=Math.max(o,512/Math.min(a,s)),d=Math.min(h,c);return{width:Math.max(1,Math.ceil(a*d)),height:Math.max(1,Math.ceil(s*d))}}(i,n,e,this.isScreenSpace);this.renderTarget.setSize(r.width,r.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(t),this.frameOverride?.requestRender()}applyFrame(t){let e=this.context.scene.find2D(t);if(e&&e instanceof oo)return this.disposeFrameOverride(),this.frameRoot=e,this.frameOverride=e.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(i=>{i.addEventListener("beginState",this.onFrameOverrideObjectEvent),i.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),e}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(t){return this.scene2d.find(t)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(t=>{t.removeEventListener("beginState",this.onFrameOverrideObjectEvent),t.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function YV({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:a}){if(t instanceof oo&&e instanceof oo||t instanceof uh&&e instanceof uh)for(let s=0,o=t.children.length;s<o;s++){let l=t.children[s],c=e.children[s];l&&c&&l.uuid===c.uuid&&nJ({objectOverride:l,objectRoot:c,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:a})}}function nJ({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:a}){let[s,o]=function(d){if(q2(d))return[d.width,d.height];if(d instanceof gb){let[u,p]=d.getHalfSize();return[2*u,2*p]}if(d instanceof uh){let[u,p]=d.recursiveBBox.getHalfSize();return[2*u,2*p]}return[0,0]}(e),{width:l,height:c,position:h}=qV({constraints:t.data,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:a,objectInitialWidth:s,objectInitialHeight:o,objectInitialPosition:e.position});if(t.position=h,t.data={...t.data,position:h},t.states)for(let d in t.states)rJ({stateId:d,objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:a});if(q2(t)||t instanceof uh)q2(t)&&(t.width=l,t.height=c,t.data={...t.data,width:l,height:c}),YV({objectOverride:t,objectRoot:e,newParentWidth:l,newParentHeight:c,initialParentWidth:s,initialParentHeight:o});else if(t instanceof gb){let d=e,u=s!==0?l/s:1,p=o!==0?c/o:1;t.path=function(f,g=1,m=1){if(g<=0||m<=0)return f;if(HV(f))return console.warn("Cannot scale invalid path",f),G2([]);if(g===1&&m===1)return f;try{return G2((0,QQ.parseSVG)(f).map(y=>{let v={...y};return"x"in v&&(v.x=v.x*g),"y"in v&&(v.y=v.y*m),"x1"in v&&(v.x1=v.x1*g),"x2"in v&&(v.x2=v.x2*g),"y1"in v&&(v.y1=v.y1*m),"y2"in v&&(v.y2=v.y2*m),"rx"in v&&(v.rx=v.rx*g),"ry"in v&&(v.ry=v.ry*m),v}))}catch(y){return console.warn("Error parsing SVG path",y),G2([])}}(d.path,u,p),t.data={...t.data,path:t.path}}}function rJ({stateId:t,objectOverride:e,objectRoot:i,newParentWidth:n,newParentHeight:r,initialParentWidth:a,initialParentHeight:s}){let o=e.states?.[t],l=i.states?.[t];if(o&&l){let{width:c,height:h,position:d}=qV({constraints:e.data,newParentWidth:n,newParentHeight:r,initialParentWidth:a,initialParentHeight:s,objectInitialWidth:kc.isResizeable(l)?l.width:0,objectInitialHeight:kc.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(e.states[t],{position:d}),kc.isResizeable(o)&&Object.assign(e.states[t],{width:c,height:h})}}function q2(t){return t instanceof t0||t instanceof oo||t instanceof L3||t instanceof B3}tx();var sB,aJ=class extends vi{constructor(t,e,i){super(t,e,i),this.isUIObject=!0,this.uiCanvas=new $V(t+"-canvas",e.geometry.width,e.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),t.type===0&&(t.props.frame!==void 0&&this.applyFrame(t.props.frame,i.shared),(t.props.width!==void 0||t.props.height!==void 0)&&this.applySize(t.props,i.shared))}applySize(t,e){let i=t?.width??this.dataPatched.geometry.width,n=t?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:n}),this.applyGeometryParametersFromFrame(e)}applyFrame(t,e){this.uiCanvas.applyFrame(t),this.applyGeometryParametersFromFrame(e),this.applyMaterialParametersFromFrame({shared:e})}applyGeometryParametersFromFrame(t){let e=this.frame;e&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=ih(this.dataPatched.geometry,t,this.data.flatShading,this))}applyMaterialParametersFromFrame(t){let e=this.frame;if(e){let i=e.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,t,!0)}}updateEntity2DByOp(t,e,i,n){this.uiCanvas.updateEntity2DByOp(t,e,i,n),t===this.frameId&&e.type===0&&(e.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(n):ri(e.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:n}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(t){super.removeInteractionGeometry(t),this.applySize({},t)}updateGeometryInteractions(t,e){super.updateGeometryInteractions(t,e),this.applySize({width:t.width,height:t.height},e);let i={...this.data.geometry,...t};this.localGeometry?.dispose(),this.localGeometry=ih(i,e,this.data.flatShading,this)}};ke(),Sp("UIGeometry",(t,e,i)=>new aJ(t,e,i)),qb=sB={Scene2D:U3,UICanvas:$V,loadHanaUIRUNTIME:function(){return pb||(pb=async()=>async function(t,e){return await t.default(e?{module_or_path:e}:void 0),Object.getOwnPropertyDescriptor(t.Engine.prototype,"scene")||Object.defineProperty(t.Engine.prototype,"scene",{get:function(){let i=Object.create(t.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>t.Engine.create(i,JSON.parse('{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}'),!0)}}(await Promise.resolve().then(()=>(vD(),gD)),q5??function(){let t=typeof process<"u"?"2.0.13":void 0;return`https://cdn.spline.design/@splinetool/runtime${t?`@${t}`:""}/build/hana-ui.wasm`}())),jV().then(()=>{})},setHanaUIWasmUrl:function(t){q5=t}},G_!==null&&sB.setHanaUIWasmUrl(G_),Si("ui-2d"),Sk(),rt();var ZV,X2,sJ=class{constructor(){this.type="ShapePath",this.color=new Jt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Qm,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath?.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,a){return this.currentPath?.bezierCurveTo(t,e,i,n,r,a),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let t={loc:0,t:0};function e(c,h,d,u){let p=c.x,f=h.x,g=d.x,m=u.x,y=c.y,v=h.y,_=d.y,b=u.y,x=(m-g)*(y-_)-(b-_)*(p-g),w=(b-_)*(f-p)-(m-g)*(v-y),S=x/w,T=((f-p)*(y-_)-(v-y)*(p-g))/w;if(w===0&&x!==0||S<=0||S>=1||T<0||T>1)return null;if(x===0&&w===0){for(let E=0;E<2;E++){if(i(E===0?d:u,c,h),t.loc===0){let P=E===0?d:u;return{x:P.x,y:P.y,t:t.t}}if(t.loc===2)return{x:+(p+t.t*(f-p)).toPrecision(10),y:+(y+t.t*(v-y)).toPrecision(10),t:t.t}}return null}for(let E=0;E<2;E++)if(i(E===0?d:u,c,h),t.loc===0){let P=E===0?d:u;return{x:P.x,y:P.y,t:t.t}}return{x:+(p+S*(f-p)).toPrecision(10),y:+(y+S*(v-y)).toPrecision(10),t:S}}function i(c,h,d){let u,p=d.x-h.x,f=d.y-h.y,g=c.x-h.x,m=c.y-h.y,y=p*m-g*f;return c.x===h.x&&c.y===h.y?(t.loc=0,void(t.t=0)):c.x===d.x&&c.y===d.y?(t.loc=1,void(t.t=1)):void(y<-Number.EPSILON?t.loc=3:y>Number.EPSILON?t.loc=4:p*g<0||f*m<0?t.loc=5:Math.sqrt(p*p+f*f)<Math.sqrt(g*g+m*m)?t.loc=6:(u=p!==0?g/p:m/f,t.loc=2,t.t=u))}let n=0,r=999999999,a=-999999999,s=[];this.subPaths.forEach(c=>{let h=c.getPoints(),d=-999999999,u=999999999,p=-999999999,f=999999999;for(let g=0;g<h.length;g++){let m=h[g];m.y>d&&(d=m.y),m.y<u&&(u=m.y),m.x>p&&(p=m.x),m.x<f&&(f=m.x)}a<=p&&(a=p+1),r>=f&&(r=f-1),h.length&&s.push({curves:c.curves,points:h,isCW:sE.isClockWise(h),identifier:n++,boundingBox:new Lb(new at(f,u),new at(p,d))})});let o=s.map(c=>function(h,d,u,p,f){(f==null||f==="")&&(f="nonzero");let g=new at;h.boundingBox.getCenter(g);let m=function(w,S,T){let E=new at;S.getCenter(E);let P=[];return T.forEach(A=>{A.boundingBox.containsPoint(E)&&function(R,O){let D=[],I=[];for(let U=1;U<R.length;U++){let N=R[U-1],G=R[U];for(let H=1;H<O.length;H++){let J=e(N,G,O[H-1],O[H]);J!==null&&D.find(K=>K.t<=J.t+Number.EPSILON&&K.t>=J.t-Number.EPSILON)===void 0&&(D.push(J),I.push(new at(J.x,J.y)))}}return I}(w,A.points).forEach(R=>{P.push({identifier:A.identifier,isCW:A.isCW,point:R})})}),P.sort((A,R)=>A.point.x-R.point.x),P}([new at(u,g.y),new at(p,g.y)],h.boundingBox,d);m.sort((w,S)=>w.point.x-S.point.x);let y=[],v=[];m.forEach(w=>{w.identifier===h.identifier?y.push(w):v.push(w)});let _=y[0].point.x,b=[],x=0;for(;x<v.length&&v[x].point.x<_;)b.length>0&&b[b.length-1]===v[x].identifier?b.pop():b.push(v[x].identifier),x++;if(b.push(h.identifier),f==="evenodd"){let w=b.length%2==0,S=b[b.length-2];return{identifier:h.identifier,isHole:w,for:S}}if(f==="nonzero"){let w=!0,S=null,T=null;for(let E=0;E<b.length;E++){let P=b[E];d[P]&&(w?(T=d[P].isCW,w=!1,S=P):T!==d[P].isCW&&(T=d[P].isCW,w=!0))}return{identifier:h.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+f+'" is currently not implemented.')}(c,s,r,a,this.userData?.style.fillRule)),l=[];return s.forEach(c=>{let h=o[c.identifier];if(h&&!h.isHole){let d=new wg;d.curves=c.curves,o.filter(u=>u?.isHole&&u.for===c.identifier).forEach(u=>{if(u){let p=s[u.identifier],f=new Qm;f.curves=p.curves,d.holes.push(f)}}),l.push(d)}}),l}},KV=!1,oB=new Promise(t=>{ZV=t}),lB=!1;function hB(){if(KV=!0,!lB)return X2||(X2=async function(){let t=await import("./opentype.js");ZV(t),lB=!0}(),X2)}var oJ=new class{async load(t,e,i=()=>{}){let{load:n}=await oB;n(t,(r,a)=>{r||!a?i(r??"Something went wrong"):e(a)})}async parse(t){let{parse:e,Bidi:i}=await oB;try{let n=e(t),r=new i,a=s=>n.charToGlyphIndex(s.char);return r.registerModifier("glyphIndex",null,a),r.applyFeatures(n,n.defaultRenderOptions.features),{font:n,bidi:r}}catch(n){console.error(n)}}};function lJ(t,e){return e.state.glyphIndex===t||e.state.fina===t||e.state.medi===t||e.state.init===t}rt(),XC(),ke(),Sp("TextGeometry",(t,e,i)=>new I3(t,e,i));var cB={create:(t,e)=>new CA(t,e)};sA("TextGeometry",cB),sA("InputGeometry",cB),qC=class{constructor(t){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}update(t){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}async load(t){try{this._layoutErrorWarned=!1;let e=await async function(i){let n,r,a=!1;if(i.url?(n=await async function(s){let o;try{o=await fetch(s)}catch(l){throw new Error(`could not fetch the font at ${s}: ${l}`)}if(!o.ok)throw new Error(`${o.status} ${o.statusText} fetching the font at ${s}`);return await o.arrayBuffer()}(i.url),r=i.url,a=i.url.startsWith("/")):i.data&&(n=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),n){if(!KV)return{font:void 0,url:r,intercepted:a,arr:n,bidi:null};{let s=await oJ.parse(n);if(s)return{font:s.font,url:r,intercepted:a,arr:n,bidi:s.bidi}}}}(t);e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)}catch(e){console.warn(`Could not load the font "${t.url??"(inline data)"}"`,e)}}warnLayoutError(t){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,t))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(t,e,i){if(!this._bidi)return[];let n=this._bidi;n.getTextGlyphs(e);let r=n.tokenizer.tokens,a=[],s=0,o=i.length===r.length;for(let l=0;l<i.length;l++){let c=i[l].index,h=String.fromCharCode(i[l].unicode),d=r[s];if(lJ(c,d)||o)a.push({char:h,index:c,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),s++;else{let u=d.char,p="",f=[d.state.glyphIndex],g=[],m=!1;for(;!m;)s++,p=e.charAt(s),u+=p,f.push(t.charToGlyphIndex(p)),g=t.stringToGlyphs(u),g.length===1&&g[0].index===c&&(m=!0),s>e.length&&(m=!0);a.push({char:h,index:c,replacements:f,replacementChars:Array.from(u)}),s++}}return a}generateShapes(t,e,i){if(!this._isLoaded)return;let n=this.font,r=e.fontSize/this.unitsPerEm,a=e.fontSize*e.lineHeight,s=t.map(y=>this.getTextWidth(y,e)),o=typeof e.width=="string"?Number(i.getVariable(e.width)):e.width,l=typeof e.height=="string"?Number(i.getVariable(e.height)):e.height,c=this.getCharWidth(`
|
|
9846
9846
|
`,e),h=e.horizontalAlign===1?c:0,d=this.getLineInitialOffsetX(s[0],o,e.horizontalAlign,t[0],c),u=this.getLineInitialOffsetY(a,t.length,l,r,e.verticalAlign),p=[],f=t.map(()=>[]),g=t.map(()=>[]);for(let y=0;y<t.length;y++){let v=t[y],_={features:{liga:!0},letterSpacing:e.letterSpacing},b=[];try{b=n.stringToGlyphs(v,_)}catch(E){this.warnLayoutError(E)}d=this.getLineInitialOffsetX(s[y],o,e.horizontalAlign,v,c);let x=[];try{x=this.reverseLigaturesTable(n,v,b)}catch(E){this.warnLayoutError(E)}let w=this.computeSpaceWidthForLine(t,y,e,i),S=0,T=b[0];T&&e.horizontalAlign===2&&T.leftSideBearing!==void 0&&(d-=T.leftSideBearing*r);try{this.font?.forEachGlyph(v,d,u,e.fontSize,_,(E,P,A,R,O)=>{let D=E.index===0?`
|
|
9847
9847
|
`:E.unicode?String.fromCharCode(E.unicode):void 0,I=x[S],U=0;if(D===`
|
|
9848
9848
|
`)U=h;else if(D===" ")U=w;else{let N=this.createPath(E,r,P,A,e);N&&(U=N.offsetX,p.push(N.path))}if(I&&I.replacements.length!==1){let N=I.replacements.map(K=>(n.glyphs.get(K).advanceWidth??0)*r),G=N.reduce((K,tt)=>K+tt,0),H=N.map(K=>K/G),J=P;for(let K=0;K<H.length;K++){let tt=U*H[K];g[y].push([J,A]),f[y].push(tt),J+=tt}}else g[y].push([P,A]),f[y].push(U);S++})}catch(E){this.warnLayoutError(E)}u-=a}let m=[];for(let y=0,v=p.length;y<v;y++)m.push(...p[y].toShapes());return{shapes:m,charWidths:f,lineWidths:s,charCoords:g}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){return this.font?.ascender??0}get descender(){return this.font?.descender??0}get familyName(){return this.font?.names.fontFamily??""}get subfamilyName(){return this.font?.names.fontSubfamily??""}get unitsPerEm(){return this.font?.unitsPerEm??1}getLineInitialOffsetX(t,e,i,n,r){return(i===3||i===2)&&n.indexOf(`
|
|
9849
|
-
`)>=0&&(t-=r),i===3?.5*e-.5*t:i===2?e-t:0}getLineInitialOffsetY(t,e,i,n,r){let a=e*t,s=t-Math.abs(this.ascender-this.descender)*n,o=-this.ascender*n-s/2;return r===3?-(i-a-o):r===2?-(.5*i-.5*a-o):o}createPath(t,e,i,n,r){let a=t.getPath(i,-n,r.fontSize,{kerning:!1,letterSpacing:r.letterSpacing});if(!a)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");let s=new sJ,o=(t.advanceWidth??1)*e;if(t)for(let l of a.commands){let c=s.currentPath?.currentPoint;if(!c||l.type==="Z"||c.x!==l.x||-c.y!==l.y)switch(l.type){case"M":s.moveTo(l.x,-l.y);break;case"L":s.lineTo(l.x,-l.y);break;case"Q":s.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":s.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return s.subPaths.forEach(l=>{let c=function(h){if(h.length){let d=h[0];if(d instanceof ma)return d.v1;if(d instanceof Fa||d instanceof Ho)return d.v0}}(l.curves);c!==void 0&&l.currentPoint.distanceTo(c)>0&&l.lineTo(c.x,c.y)}),{offsetX:o,path:s}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(t,e,i,n){let r=this.getCharWidth(" ",i),a=t[e];if(a){let s=this.countSpaces(a.trimEnd());if(i.horizontalAlign===4&&e<t.length-1&&s)return((typeof i.width=="string"?Number(n.getVariable(i.width)):i.width)-(this.getTextWidth(a,i)-s*r))/s}return r}countSpaces(t){return(t.match(/ /g)||[]).length}},Si("text"),te();var QV=null;function dB(){return QV}function hJ(t){let e=!1;return t.scene.objects.forEach(i=>{i.data.type==="Page"&&!e&&i.data.publish.gameControlObject&&up.traverseModuleInstances(t,i.id,(n,r,a)=>{for(let s of a)s.data.type==="GameControl"&&s.data.navmesh.enabled&&(e=!0)})}),e}ti();var oy=(t,e)=>{let i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)},$2=t=>t*(Math.PI/180),ly=new Map,vb=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let a=0;a<r.length;a+=1)n=r[a],t.addEventListener?t.addEventListener(n,i,!1):t.attachEvent&&t.attachEvent(n,i)},yb=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let a=0;a<r.length;a+=1)n=r[a],t.removeEventListener?t.removeEventListener(n,i):t.detachEvent&&t.detachEvent(n,i)},JV=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),uB=()=>{if(!(typeof window>"u"))return{x:window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},Y2=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},Z2=(t,e,i)=>{let n=tj(t);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof e=="string")n[r]=e+" "+i;else{let a="";for(let s=0,o=e.length;s<o;s+=1)a+=e[s]+" "+i+", ";n[r]=a.slice(0,-2)}return n},tj=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},K2=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},ST=(t,e)=>{if(t.length)for(let i=0,n=t.length;i<n;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(ej="ontouchstart"in window,ij=!!window.PointerEvent,nj=!!window.MSPointerEvent);var ej,ij,nj,Kd,pB={start:"mousedown",move:"mousemove",end:"mouseup"},Kf={};function bc(){}ij?Kd={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:nj?Kd={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:ej?(Kd={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},Kf=pB):Kd=pB,bc.prototype.on=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var a=0;a<r.length;a+=1)i=r[a],n._handlers_[i]=n._handlers_[i]||[],n._handlers_[i].push(e);return n},bc.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},t===void 0?i._handlers_={}:e===void 0?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},bc.prototype.trigger=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var a=0;a<r.length;a+=1)i=r[a],n._handlers_[i]&&n._handlers_[i].length&&n._handlers_[i].forEach(function(s){s.call(n,{type:i,target:n},e)})},bc.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((i,n)=>{let r={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&Object.prototype.hasOwnProperty.call(n,a)?r[a]=n[a]:Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a]);return r})(e.options,t))},bc.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){typeof i["on"+e]=="function"?i["on"+e].apply(i,arguments):console.warn('[WARNING] : Missing "on'+e+'" handler.')},vb(t,Kd[e],i._domHandlers_[e]),Kf[e]&&vb(t,Kf[e],i._domHandlers_[e]),i},bc.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},yb(t,Kd[e],i._domHandlers_[e]),Kf[e]&&yb(t,Kf[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var z3=bc;function Fn(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(e),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=Fn.id,Fn.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}Fn.prototype=new z3,Fn.constructor=Fn,Fn.id=0,Fn.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},Fn.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let r=tj("borderRadius");for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&(r[a]="50%");return r})(),i=Z2("transition","opacity",t),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},n.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},K2(n.el,i),this.options.shape==="circle"&&K2(n.back,e),K2(n.front,e),this.applyStyles(n),this},Fn.prototype.applyStyles=function(t){for(var e in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},Fn.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},Fn.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},Fn.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null},Fn.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),typeof t=="function"&&t.call(this)},e.options.fadeTime)),e},Fn.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i=e.options.mode==="dynamic"?"none":"block";e.ui.el.style.display=i,typeof t=="function"&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,n={};n.x=i===!0||i.x!==!1?0:e.instance.frontPosition.x,n.y=i===!0||i.y!==!1?0:e.instance.frontPosition.y,e.setPosition(t,n)}return e},Fn.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var n=i.options.fadeTime+"ms",r={};r.front=Z2("transition",["top","left"],n);var a={front:{}};a.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(r),i.applyStyles(a),i.restTimeout=setTimeout(function(){typeof t=="function"&&t.call(i),i.restCallback()},i.options.fadeTime)},Fn.prototype.restCallback=function(){var t=this,e={};e.front=Z2("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},Fn.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},Fn.prototype.computeDirection=function(t){var e,i,n,r=t.angle.radian,a=Math.PI/4,s=Math.PI/2;if(r>a&&r<3*a&&!t.lockX?e="up":r>-a&&r<=a&&!t.lockY?e="left":r>3*-a&&r<=-a&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=r>-s&&r<s?"left":"right"),t.lockX||(n=r>0?"up":"down"),t.force>this.options.threshold){var o,l={};for(o in this.direction)Object.prototype.hasOwnProperty.call(this.direction,o)&&(l[o]=this.direction[o]);var c={};for(o in this.direction={x:i,y:n,angle:e},t.direction=this.direction,l)l[o]===this.direction[o]&&(c[o]=!0);if(c.x&&c.y&&c.angle)return t;(!c.x||!c.y)&&this.trigger("plain",t),c.x||this.trigger("plain:"+i,t),c.y||this.trigger("plain:"+n,t),c.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var cJ=Fn;function hn(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=hn.id,hn.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(e),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let n=getComputedStyle(i.options.zone.parentElement);return n&&n.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}hn.prototype=new z3,hn.constructor=hn,hn.id=0,hn.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(i){if(i===void 0)return e[0];for(var n=0,r=e.length;n<r;n+=1)if(e[n].identifier===i)return e[n];return!1}},hn.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},hn.prototype.begin=function(){var t=this,e=t.options;if(e.mode==="static"){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},hn.prototype.createNipple=function(t,e){var i=this,n=i.manager.scroll,r={},a=i.options,s=i.parentIsFlex?n.x:n.x+i.box.left,o=i.parentIsFlex?n.y:n.y+i.box.top;if(t.x&&t.y)r={x:t.x-s,y:t.y-o};else if(t.top||t.right||t.bottom||t.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=t.top,l.style.right=t.right,l.style.bottom=t.bottom,l.style.left=t.left,l.style.position="absolute",a.zone.appendChild(l);var c=l.getBoundingClientRect();a.zone.removeChild(l),r=t,t={x:c.left+n.x,y:c.top+n.y}}var h=new cJ(i,{color:a.color,size:a.size,threshold:a.threshold,fadeTime:a.fadeTime,dataOnly:a.dataOnly,restJoystick:a.restJoystick,restOpacity:a.restOpacity,mode:a.mode,identifier:e,position:t,zone:a.zone,frontPosition:{x:0,y:0},shape:a.shape});return a.dataOnly||(Y2(h.ui.el,r),Y2(h.ui.front,h.frontPosition)),i.nipples.push(h),i.trigger("added "+h.identifier+":added",h),i.manager.trigger("added "+h.identifier+":added",h),i.bindNipple(h),h},hn.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},hn.prototype.bindNipple=function(t){var e,i=this,n=function(r,a){e=r.type+" "+a.id+":"+r.type,i.trigger(e,a)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},hn.prototype.pressureFn=function(t,e,i){var n=this,r=0;clearInterval(n.pressureIntervals[i]),n.pressureIntervals[i]=setInterval(function(){var a=t.force||t.pressure||t.webkitForce||0;a!==r&&(e.trigger("pressure",a),n.trigger("pressure "+e.identifier+":pressure",a),r=a)}.bind(n),100)},hn.prototype.onstart=function(t){var e=this,i=e.options,n=t;return t=JV(t),e.updateBox(),ST(t,function(r){e.actives.length<i.maxNumberOfNipples?e.processOnStart(r):n.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(a){if(Object.values(n.touches).findIndex(function(o){return o.identifier===a})<0){var s=[t[0]];s.identifier=a,e.processOnEnd(s)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(r))}),e.manager.bindDocument(),!1},hn.prototype.processOnStart=function(t){var e,i=this,n=i.options,r=i.manager.getIdentifier(t),a=t.force||t.pressure||t.webkitForce||0,s={x:t.pageX,y:t.pageY},o=i.getOrCreate(r,s);o.identifier!==r&&i.manager.removeIdentifier(o.identifier),o.identifier=r;var l=function(c){c.trigger("start",c),i.trigger("start "+c.id+":start",c),c.show(),a>0&&i.pressureFn(t,c,c.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(o))>=0&&i.idles.splice(e,1),i.actives.push(o),i.ids.push(o.identifier),n.mode!=="semi")l(o);else{if(!(oy(s,o.position)<=n.catchDistance))return o.destroy(),void i.processOnStart(t);l(o)}return o},hn.prototype.getOrCreate=function(t,e){var i,n=this,r=n.options;return/(semi|static)/.test(r.mode)?(i=n.idles[0])?(n.idles.splice(0,1),i):r.mode==="semi"?n.createNipple(e,t):(console.warn("Coudln't find the needed nipple."),!1):i=n.createNipple(e,t)},hn.prototype.processOnMove=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),a=e.manager.scroll;if((_=>isNaN(_.buttons)?_.pressure!==0:_.buttons!==0)(t)){if(!r)return console.error("Found zombie joystick with ID "+n),void e.manager.removeIdentifier(n);if(i.dynamicPage){var s=r.el.getBoundingClientRect();r.position={x:a.x+s.left,y:a.y+s.top}}r.identifier=n;var o=r.options.size/2,l={x:t.pageX,y:t.pageY};i.lockX&&(l.y=r.position.y),i.lockY&&(l.x=r.position.x);var c,h,d=oy(l,r.position),u=((_,b)=>{let x=b.x-_.x,w=b.y-_.y;return(S=>S*(180/Math.PI))(Math.atan2(w,x))})(l,r.position),p=$2(u),f=d/o,g={distance:d,position:l};if(r.options.shape==="circle"?(c=Math.min(d,o),h=((_,b,x)=>{let w={x:0,y:0};return x=$2(x),w.x=_.x-b*Math.cos(x),w.y=_.y-b*Math.sin(x),w})(r.position,c,u)):(h=((_,b,x)=>({x:Math.min(Math.max(_.x,b.x-x),b.x+x),y:Math.min(Math.max(_.y,b.y-x),b.y+x)}))(l,r.position,o),c=oy(h,r.position)),i.follow){if(d>o){let _=l.x-h.x,b=l.y-h.y;r.position.x+=_,r.position.y+=b,r.el.style.top=r.position.y-(e.box.top+a.y)+"px",r.el.style.left=r.position.x-(e.box.left+a.x)+"px",d=oy(l,r.position)}}else l=h,d=c;var m=l.x-r.position.x,y=l.y-r.position.y;r.frontPosition={x:m,y},i.dataOnly||Y2(r.ui.front,r.frontPosition);var v={identifier:r.identifier,position:l,force:f,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:u},vector:{x:m/o,y:-y/o},raw:g,instance:r,lockX:i.lockX,lockY:i.lockY};(v=r.computeDirection(v)).angle={radian:$2(180-u),degree:180-u},r.trigger("move",v),e.trigger("move "+r.id+":move",v)}else this.processOnEnd(t)},hn.prototype.processOnEnd=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),a=e.manager.removeIdentifier(r.identifier);!r||(i.dataOnly||r.hide(function(){i.mode==="dynamic"&&(r.trigger("removed",r),e.trigger("removed "+r.id+":removed",r),e.manager.trigger("removed "+r.id+":removed",r),r.destroy())}),clearInterval(e.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),e.trigger("end "+r.id+":end",r),e.ids.indexOf(r.identifier)>=0&&e.ids.splice(e.ids.indexOf(r.identifier),1),e.actives.indexOf(r)>=0&&e.actives.splice(e.actives.indexOf(r),1),/(semi|static)/.test(i.mode)?e.idles.push(r):e.nipples.indexOf(r)>=0&&e.nipples.splice(e.nipples.indexOf(r),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[a.id]=a.identifier))},hn.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},hn.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(i){i.destroy()}),t.pressureIntervals)Object.prototype.hasOwnProperty.call(t.pressureIntervals,e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off(),t.pressureIntervals={},t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.manager=null};var dJ=hn;function Mn(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=uB(),e._windowBound=!1,e.config(t),e.prepareCollections();var i=function(){var n;e.collections.forEach(function(r){r.forEach(function(a){n=a.el.getBoundingClientRect(),a.position={x:e.scroll.x+n.left,y:e.scroll.y+n.top}})})};return e._onResize=function(){(n=>{ly.has(n)&&clearTimeout(ly.get(n)),ly.set(n,setTimeout(function(){ly.delete(n),n()},100))})(i)},e._onScroll=function(){e.scroll=uB()},e.collections}Mn.prototype=new z3,Mn.constructor=Mn,Mn.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(n){return!(i=n.get(e))}),i}},Mn.prototype.create=function(t){return this.createCollection(t)},Mn.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,vb(window,"resize",t._onResize),vb(window,"scroll",t._onScroll))},Mn.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,yb(window,"resize",t._onResize),yb(window,"scroll",t._onScroll))},Mn.prototype.createCollection=function(t){var e=this,i=new dJ(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},Mn.prototype.bindCollection=function(t){var e,i=this,n=function(r,a){e=r.type+" "+a.id+":"+r.type,i.trigger(e,a)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},Mn.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},Mn.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||t===!0)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},Mn.prototype.getIdentifier=function(t){var e;return t?(e=t.identifier===void 0?t.pointerId:t.identifier)===void 0&&(e=this.latest||0):e=this.index,this.ids[e]===void 0&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},Mn.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},Mn.prototype.onmove=function(t){return this.onAny("move",t),!1},Mn.prototype.onend=function(t){return this.onAny("end",t),!1},Mn.prototype.oncancel=function(t){return this.onAny("end",t),!1},Mn.prototype.onAny=function(t,e){var i,n=this,r="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=JV(e);var a=function(s,o,l){l.ids.indexOf(o)>=0&&(l[r](s),s._found_=!0)};return ST(e,function(s){i=n.getIdentifier(s),ST(n.collections,a.bind(null,s,i)),s._found_||n.removeIdentifier(i)}),!1},Mn.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.unbindWindowEvents(),t.ids={},t.index=0,t.collections.forEach(function(e){e.destroy()}),t.collections=[],t.off()},Mn.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1),i.collections.length===0&&i.unbindWindowEvents()};var uJ=Mn,np=null;function fB(){return np||(np=new uJ),np}var pJ={create:function(t){return fB().create(t)},destroy:function(){np&&(np.destroy(),np=null)},get factory(){return fB()}},fJ=pJ;ti(),te(),rt(),qa(),Wr(),te();var rj=null;function Q2(){return rj}var aj,J2,mJ=new Promise(t=>{aj=t});function gJ(t){return J2||(J2=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.12/build",i=import("./physics.js"),[n,r]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(a=>a.arrayBuffer())]);await n.init(r),aj(n)}(),J2)}function sj(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,n=e[4]**2+e[5]**2+e[6]**2,r=e[8]**2+e[9]**2+e[10]**2,a=e[0]**2+e[4]**2+e[8]**2,s=e[1]**2+e[5]**2+e[9]**2,o=e[2]**2+e[6]**2+e[10]**2,l=1e-8;return i<l||n<l||r<l||a<l||s<l||o<l}function jo(t,e){let i=new Gt;if(e&&sj(e))return i.setAttribute("position",new Ft([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new Ft([],3)),i.setIndex([]),i;let{positions:n,triIndices:r}=t3(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new Ft(n,3)),i.setIndex(r),e&&i.applyMatrix4(e),i}Ui(),Wr(),ke(),c3(),rt(),rt(),Ep(),Wg();var Ge,vJ=class{constructor(t,e,i,n,r,a){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=Rn(e,e.actions,n,r,a,i),this.target=e.target}disconnect(){nr(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Animation.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}},mB=class{constructor(t,e,i,n,r,a){this.id=t,this.data=e,this.object=i,this.page=n,this.currentIntersectedObjects=[],this.actions=Rn(e,e.actions,n,r,a,i),this.target=e.target,this.triggeringObjects=[];for(let s of e.triggeringObjects){let o=n.scene.find(s);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(t){return this.target==="all"||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){nr(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};Ui(),mJ.then(t=>Ge=t);var Sn=new C,La=new Yt,Ol=new C,gB=(new Ti(0,0,0,"YXZ"),new Ti(0,0,0,"XYZ")),rs=new C,tM=new C,eM=new C(1,1,1),Qd=new Yt,hy=new At,vB=new At,yJ={type:"updateMatrix"},yB=new Yt,iM=new vr,nM=.01,MT={type:"beginEvent",eventName:"Collision"},_J={type:"beginEvent",eventName:"Trigger"},_b=t=>t.states.some(e=>e.data.position!==void 0||e.data.rotation!==void 0||e.data.hiddenMatrix!==void 0||e.data.cloner!==void 0||e.data.pathSnapping!==void 0);function Jd(t){return function(e){return typeof e=="object"&&e!==null&&"booleanOp"in e}(Dc(t)?t.object:t)}var bJ=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=e=>{if(e.bodyType()!==Ge.RigidBodyType.Dynamic)return;e.isSleeping()||this.nActiveRigidBodies++;let[i,n,r]=this.rigidBodyToMesh.get(e.handle);if(Sn.copy(e.translation()).multiplyScalar(this.pixelsPerMeter),La.copy(e.rotation()),i.matrixWorld.compose(Sn,La,n),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(yJ),r){let a=i.cloner;if(a&&a.objectForSample===void 0){a.matrixWorld.copy(i.matrixWorld);for(let s of a.children)s.updateMatrixWorld(!0)}for(let s of i.children)s.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(e,i,n)=>{if(n===!1)return;let r,a;if(this.sensorToTriggerEvent[e]?(r=this.sensorToTriggerEvent[e],a=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(r=this.sensorToTriggerEvent[i],a=this.sharedGameControlGlobals.colliderToEntity.get(e)),r&&a&&r.isValidTriggeringObject(a))r.dispatch();else{for(let s=this.sharedGameControlGlobals.createdObjects.length-1;s>=0;s--){let o=this.sharedGameControlGlobals.createdObjects[s];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===e||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(s,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let s=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,s,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let s=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,s,e)}else{let s=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(o!==void 0)for(let h of o)h.data.target==="scene"&&this.dispatchCollisionEvent(h,s,e);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let h of c)h.data.target==="scene"&&this.dispatchCollisionEvent(h,l,i)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events){if(i.data.disabled===!0)continue;let n=i.data.actions?.find(r=>r.data.type==="Destroy")?.data;if(n)for(let r of n.objects){let a=this.page.scene.find(r);a&&(a.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let n of i.data.objects){let r=this.page.scene.find(n);r&&(r.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(Q2()===null)return void Gn("collision-bvh","trigger/collision detection");let t=[],e=[];if(this.page.traverseChildren(i=>{let n,r=i instanceof Ju,a=sg(i);if(Bu(i)||r||a)return;n=Dc(i)?i.object:i;let s=n.dataPatched;if(s.physics?.enabled==="visibility"?!s.visible:!s.physics?.enabled)return!0;let o=i.geometry,l=n.userData.hasDestroy===!0,c=n.userData.hasDrag===!0;if(_b(s)||l||c||n.dataPatched.events.some(h=>h.data.disabled!==!0&&(h.data.type==="GameControl"||h.data.type==="Follow")))return i.updateMatrixWorldRigid(),this.addBoundsTree(i),!0;if(o){let h=o.getAttribute("position");if(h!==void 0&&h.count>0){t.push({geometry:o,matrixWorld:i.matrixWorld}),e.push(o.id,this._staticBVHIdOf(h),h.version,o.index!==null?this._staticBVHIdOf(o.index):-1,o.index!==null?o.index.version:-1);for(let d of i.matrixWorld.elements)e.push(d)}}return!!Jd(i)||void 0}),t.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===e.length&&i.signature.every((a,s)=>a===e[s]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let n=Pc(t.map(a=>jo(a.geometry,a.matrixWorld)),!1),r=new(Q2())(n);this._staticBVHCache={signature:e,bvh:r},this.sharedGameControlGlobals.staticMeshBVH=r}}addRigidBody(t,e,i){if(sj(t.matrixWorld))return;let n=[],r="geometry"in t?t.geometry:void 0,a=e.dataPatched;if(r?.getAttribute("position")!==void 0&&n.push(jo(r,t.shearScale)),a.physics.fusedBody){let s=this.gatherChildrenGeom(t,n);t.traverseObject(s),t.children.forEach(l=>l.updateMatrixWorld(!0));let o=t.cloner;o&&o.objectForSample===void 0&&a.physics.rigidBody==="dynamic"&&(o.traverseObject(s),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(n.length>0){let s,o=!1,l=!i.fromCreate&&a.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(s=Ge.RigidBodyDesc.dynamic(),s.setLinearDamping(a.physics.damping).setAngularDamping(a.physics.damping).setAdditionalMass(1e-9).setGravityScale(a.physics.gravityScale).enabledRotations(...a.physics.enabledRotation).enabledTranslations(...a.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(s=Ge.RigidBodyDesc.kinematicPositionBased(),o=!0):s=Ge.RigidBodyDesc.fixed();let c=Pc(n);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(Sn,La,Ol),t.position0=Sn.clone().divideScalar(this.pixelsPerMeter),t.rotation0=La.clone(),Sn.divideScalar(this.pixelsPerMeter),s.setTranslation(Sn.x,Sn.y,Sn.z).setRotation(La),r?c?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):c?.scale(Ol.x/this.pixelsPerMeter,Ol.y/this.pixelsPerMeter,Ol.z/this.pixelsPerMeter);let h=this.sharedGameControlGlobals.rapierWorld.createRigidBody(s),d=!(a.geometry===void 0||a.geometry.type==="SubdivGeometry"||a.geometry.type==="NonParametricGeometry"||a.geometry.type==="BooleanGeometry"||a.geometry.type==="VectorGeometry"||a.geometry.type==="StarGeometry"||a.geometry.type==="RectangleGeometry"||a.geometry.type==="EllipseGeometry"||a.geometry.type==="TriangleGeometry"||a.geometry.type==="TorusGeometry"||a.geometry.type==="HelixGeometry");try{this.addCollider(h,a.physics,c,e,d)}catch{try{this.addCollider(h,a.physics,c,e,!1)}catch(u){console.error(u)}}if(h.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(h);l?this.rigidBodyToMesh.set(h.handle,[t,Ol.clone(),a.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(h.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,h,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=h}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(jo(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(i=>i.updateMatrixWorld(!0)),e.length>0){let i=Pc(e,!1);t.bvhGeometry=i,i.getAttribute("position").count>0&&(t.bvhGeometry.boundsTree=new(Q2())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t))}}addCollider(t,e,i,n,r=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let a;i&&(a=e.colliderType==="trimesh"?Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Ge.ColliderDesc.convexMesh(i.getAttribute("position").array,r?i.getIndex().array:void 0)),a.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setRestitutionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let s=this.sharedGameControlGlobals.rapierWorld.createCollider(a,t);this.sharedGameControlGlobals.colliderToEntity.set(s.handle,n),this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid]?.some(o=>o.target==="scene")&&s.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=Jd(t);return(n,r)=>{if(r===0)return;if(i&&n.parent===t)return!0;let a;if(Bu(n)){if(!n.objectForSample)return n.object.dataPatched.physics.fusedBody===!0&&n.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(n.objectForSample.dataPatched.physics.fusedBody)return;a=n.object}else if(Dc(n))a=n.object;else if(a=n,a.dataPatched.cloner?.hideBase)return!0;let s=a.dataPatched;if(s.physics.enabled==="visibility"?!s.visible:!s.physics.enabled)return!0;r===1?t.hasNonUniformScale?n.matrixWorld.multiplyMatrices(t.shearScale,n.hiddenMatrix):n.matrixWorld.copy(n.hiddenMatrix):n.matrixWorld.multiplyMatrices(n.parent.matrixWorld,n.hiddenMatrix),n.matrixWorld.multiply(n.matrix);let o=n.geometry;return o?.getAttribute("position")!==void 0&&e.push(jo(o,n.matrixWorld)),!!Jd(n)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(s=>{for(let o of s.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let n=dB();if(n!==null?i=n.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&Gn("game-controls","the scene's game controls"),i===!1){let{enableRotate:s,enablePan:o,enableZoom:l,autoRotate:c,hoverRotatePanMode:h}=this.eventManager.publish.orbitControls;(s||o||l||c||h!==0)&&(this.orbitControls=new DV(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let r=this.renderer.domElement.width/this.renderer.getPixelRatio(),a=this.renderer.domElement.height/this.renderer.getPixelRatio();dB()?.createJoysticks(this,r,a),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(s=>s.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new Ge.World(new Ge.Vector3(0,this.gravity,0)),this.events=new Ge.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(s=>{let o;if(Bu(s)){if(!s.objectForSample)return s.object.dataPatched.physics.fusedBody===!0&&s.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(s.objectForSample.dataPatched.physics.fusedBody)return;o=s.object}else if(Dc(s))o=s.object;else{if(sg(s)||qc(s)||s instanceof Ju)return;if(o=s,o.dataPatched.cloner?.disabled===!1&&o.dataPatched.cloner?.hideBase&&o.dataPatched.physics?.fusedBody!==!0)return!0}let l,c=o.dataPatched;for(let m of c.events)m.data.disabled!==!0&&m.data.type==="GameControl"&&(l=m.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;s.updateMatrixWorldRigid();let h=_b(c),d=!1,u=o.userData.hasDestroy,p=o.userData.hasDrag,f=!1;for(let m of c.events)if(m.data.disabled!==!0){if(m.data.type==="Collision"){d=!0;let y=new vJ(m.id,m.data,o,this.page,this.sharedAssets,this.eventManager);y.initialDisabled=!0,this.collisionEvents.push(y),this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].every(v=>v.id!==m.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(y):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[y]}else if(m.data.type==="Follow"){f=!0;let y=m.data.target;s.traverseVisible(v=>{v.userData.isFollowingObj=y})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(s.matrixWorldFusedFalse=s.matrixWorld.clone());let g=s.geometry;if(l!==void 0){let m=Ge.RigidBodyDesc.kinematicPositionBased();(s.hasNonUniformScale?s.matrixWorldRigid:s.matrixWorld).decompose(Sn,La,Ol),s.position0=Sn.clone().divideScalar(this.pixelsPerMeter),s.rotation0=La.clone(),Sn.divideScalar(this.pixelsPerMeter),m.setTranslation(Sn.x,Sn.y,Sn.z).setRotation(La);let y,v=this.sharedGameControlGlobals.rapierWorld.createRigidBody(m);s.rigidBody=v,y=l.collider.type==="sphere"?Ge.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Ge.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Ge.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),y.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(Ge.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(y,v);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),Sn.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(Ol.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(Sn);let b=new Yt().setFromEuler(new Ti().setFromVector3(new C().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else c.physics.rigidBody==="dynamic"||h||f||u||p||d?(this.addRigidBody(s,o,{hasFollow:f,hasTransformAnim:h,hasDrag:p}),this.generateSensorColliderDescs(o,c.physics.fusedBody)):(g&&t.push(jo(g,s.matrixWorld)),c.physics.fusedBody&&!Jd(s)&&s.traverseObject((m,y)=>{if(y===0)return;let v;if(Bu(m)){if(!m.objectForSample)return m.object.dataPatched.physics.fusedBody===!0&&m.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(m.objectForSample.dataPatched.physics.fusedBody)return;v=m.object}else{if(sg(m)||qc(m)||m instanceof Ju)return;if(Dc(m))v=m.object;else if(v=m,v.dataPatched.cloner?.hideBase)return!0}let _=v.dataPatched;if(_.physics.enabled==="visibility"?!_.visible:!_.physics.enabled)return!0;let b=m.geometry;return b?.getAttribute("position")!==void 0&&t.push(jo(b,m.matrixWorld)),!!Jd(m)||void 0}),this.generateSensorColliderDescs(o,c.physics.fusedBody,e));return!(c.physics?.fusedBody!==!0&&!l&&!Jd(s))||void 0}),t.length===0)return;let i=Pc(t),n=i.getIndex().count>0;if(!n&&e.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let r=Ge.RigidBodyDesc.fixed(),a=this.sharedGameControlGlobals.rapierWorld.createRigidBody(r);if(n){let s=Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Ge.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Ge.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(s,a)}for(let[s,o]of e){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(s,a);this.sensorToTriggerEvent[l.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let i=new mB(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),n=new At().compose(rs.fromArray(e.data.position.map(r=>typeof r=="number"?r:0)),Qd.setFromEuler(gB.fromArray(e.data.rotation.map(r=>typeof r=="number"?r:0))),eM);if(e.data.triggerZone==="box"){let r=new ci;r.min.fromArray(e.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(-.5),r.max.fromArray(e.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([r,n,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,n,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let n=t/1e3;n<i&&n>.55*i&&(n=i),this.accumulator+=n;let r=performance.now(),a=0,s=6;for(;this.accumulator>=i&&a<s&&(e=this.stepPhysics()&&e,this.accumulator-=i,a++,!(performance.now()-r>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(Sn,La,Ol);let e=t;e.prevQ===void 0?(e.prevQ=La.clone(),e.prevT=Sn.clone()):(e.prevQ.copy(La),e.prevT.copy(Sn))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,n]=this.fixedBodiesToWatch[t];(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(n)||(i.setBodyType(Ge.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),n=t.translation(),r=Math.hypot(i.x,i.z);for(let a=0;a<t.numColliders();a++){let s=t.collider(a);e.contactPairsWith(s,o=>{let l=o.parent();if(l===null||!l.isDynamic())return;let c=l.translation(),h=-1/0,d=0,u=0;if(e.contactPair(s,o,y=>{let v=y.normal(),_=v.x*(c.x-n.x)+v.y*(c.y-n.y)+v.z*(c.z-n.z)<0?-1:1;if(Math.abs(v.y)>.7)return;let b=_*v.x,x=_*v.z,w=Math.hypot(b,x);if(w<1e-4)return;let S=(i.x*b+i.z*x)/w;S>h&&(h=S,d=b/w,u=x/w)}),h===-1/0)return;let p=i.x*d+i.z*u;if(p<-nM)return;let f=l.linvel();if(r>nM&&p>nM){let y=f.x*d+f.z*u;if(y<=0)return;let v=Math.min(y,p);return void l.setLinvel({x:d*v,y:f.y,z:u*v},!0)}let g=f.x*d+f.z*u-Math.max(0,p);if(g<=0)return;let m=.5*g;l.setLinvel({x:f.x-d*m,y:f.y,z:f.z-u*m},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let t of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(t),t.rigidBody.setNextKinematicTranslation(Sn.divideScalar(this.pixelsPerMeter)),t.rigidBody.setNextKinematicRotation(La);for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim)t.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(t);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let n,r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner){for(let a of e.cloner.children)if(a.rigidBody===r){n=a;break}}t.dispatch(n),e.dispatchEvent(MT)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let n=vB.copy(t.matrixWorld).invert();t.traverseEntity((r,a)=>{if(e===!1&&a===1)return!0;for(let s of r.dataPatched.events)if(s.data.type==="Trigger"&&s.data.disabled!==!0){let o,l=new mB(s.id,s.data,r,this.page,this.sharedAssets,this.eventManager);if(o=s.data.triggerZone==="box"?Ge.ColliderDesc.cuboid(...s.data.size.map(c=>(typeof c=="number"?c:1)/(2*this.pixelsPerMeter))):Ge.ColliderDesc.ball(s.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),rs.fromArray(s.data.position.map(c=>typeof c=="number"?c:0)),Qd.setFromEuler(gB.fromArray(s.data.rotation.map(c=>typeof c=="number"?c:0))),hy.compose(rs,Qd,eM).premultiply(r.matrixWorld),i?(hy.decompose(rs,Qd,tM),o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED)):(hy.premultiply(n).decompose(rs,Qd,tM),t.rigidBody.bodyType()===Ge.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===Ge.RigidBodyType.Fixed?o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Ge.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),rs.divideScalar(this.pixelsPerMeter),o.setTranslation(rs.x,rs.y,rs.z),o.setRotation(Qd),i)i.push([o,l]);else{let c=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t.rigidBody);this.sensorToTriggerEvent[c.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,n,r,a]=this.sharedGameControlGlobals.triggers[e];for(let s=0;s<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;s++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[s];if(r===o||a.isValidTriggeringObject(Be.is(o)?o:o.object)===!1)continue;let l=vB.copy(r.matrixWorld).decompose(rs,yB,tM).compose(rs,yB,eM).multiply(n),c=hy.copy(o.matrixWorld).invert().multiply(l),h=o.bvhGeometry.boundsTree;i instanceof ci?t=h.intersectsBox(i,c):(iM.radius=i,iM.center.setFromMatrixPosition(c),t=h.intersectsSphere(iM)),t?a.currentIntersectedObjects.indexOf(o)===-1&&(a.currentIntersectedObjects.push(o),a.dispatch(),r.dispatchEvent(_J)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(d=>d!==o)}}}};Ap(),rt(),X_(),Ye(),Eh();var rM=.02,_B=new C,bB=new C,xJ=new C,Er=new C,Oo=new C,tu=new C,aM=new At,xB=new At,wJ=new At,pa=new Yt,cc=new Yt,eu=new Ti(0,0,0,"YXZ"),SJ=new C(1,0,0),Vs=new C(0,1,0),MJ=new C(0,0,1),wB=new C(1,1,1),SB=[],MB=t=>SB[t]??(SB[t]=new C),sM=new C,EJ=new C,AJ=new C,TJ=new C,EB=new Yt,CJ=new C,AB=new Yt,Kn=new _a,Ba=new ci,PJ={type:"requestRender"},DJ={type:"updateMatrix"},ET=class extends Vn{constructor(t,e,i,n,r,a,s,o,l){super(),this.object=t,this.domElement=e,this.data=i,this.gloabalPhysics=n,this.controlsManager=r,this.cameraFollow=a,this.camera=s,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new At,this.target0=new C,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new Ti(0,0,0,"YXZ"),this.position0Cam=new C,this.quat0Cam=new Yt,this.scale0Cam=new C,this.hiddenMatrix0Cam=new At,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new _a(new C(0,-40,0),new C(0,40,0)),matrix:new At,position:new C,rotation:new Yt},this.euler=new Ti(0,0,0,"YXZ"),this.eulerDelta=new C,this.lastPosition=new C,this.lastCameraQuaternion=new Yt,this.lastCameraPosition=new C,this.PI_2=Math.PI/2,this.prevMouse=new at,this.velocityTarget=new C,this.velocity=new C,this.directionXZ=new C,this.rotVelocityStick=new C,this.rotVelocityTarget=new C,this.rotVelocity=new C,this.rotDirection=new C,this.nonColliderRotOffset=new At,this.nonColliderPosOffset=new At,this.firstPointerId=-1,this.rot=new C,this.path=[],this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.onObject=!1,this.actionState={},this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]],this.collisionEnabled=!0,this.offsetMatrix=new At,this.objectToTarget=new C,this.objectToTarget0=new C,this.objectToCamXZ=new C,this.objectToCamXZ0=new C,this.targetToCamera=new C,this.targetToCamera0=new C,this.cameraPolarAxis0=new C,this.targetPos=new C,this.targetQuat=new Yt,this.lerpFactorPos=new C().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new Yt,this.objXZQuatInv=new Yt,this.objXZRotMat=new At,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new C,this.pushedVelocity=new C,this.groundYRotation=0,this.objectRealQuat=new Yt,this.colliderWorldQuat=new Yt,this.groundNormal=new C,this.groundTilt=new Yt,this.groundTiltInv=new Yt,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new C,this.quaternion=new Yt,this.scale=new C,this.initialAction=!0,this.onPointerDown=f=>{!(f.target===this.domElement||f.target instanceof HTMLElement&&f.target.tagName==="SPLINE-VIEWER"&&f.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=f.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!sa&&!xE&&this.domElement.requestPointerLock(),this.prevMouse.set(f.clientX,f.clientY))},this.onPointerUp=f=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),f.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=f=>{if(f.pointerId!==this.firstPointerId)return;let g=f.clientX-this.prevMouse.x,m=f.clientY-this.prevMouse.y;this.prevMouse.set(f.clientX,f.clientY),f.pointerType==="mouse"&&this.rotBy!=="keys"&&(xE&&_N<15.5&&!sa?(this.eulerDelta.y=-g*this.mouseOrbitSensitivity,this.eulerDelta.x=-m*this.mouseOrbitSensitivity):(this.eulerDelta.y=-f.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-f.movementY*this.mouseOrbitSensitivity)),f.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-g*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-m*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=f=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?ET.isLocked=!0:ET.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let f in this.movementState)this.movementState[f]=0},this.onKeyDown=f=>{!(f.target instanceof HTMLInputElement)&&(f.code==="ArrowLeft"||f.code==="ArrowUp"||f.code==="ArrowRight"||f.code==="ArrowDown"||f.code==="Space")&&f.preventDefault();for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]){this.movementState[g[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=f=>{for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]||f.code.slice(3,f.code.length).toUpperCase()===g[1]){this.movementState[g[0]]=0;break}},this.copyVRGamePadValues=(f,g)=>{for(let m=2;m<4;m++){let y=f.axes[m];g===0?m===2?this.movementState.movePosX=y:this.movementState.movePosZ=y:(f.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,m===2?this.movementState.rotPosY=y:this.moveMode==="fly"&&(this.movementState.moveNegY=y))}},this.sharedGameControlGlobals=r.sharedGameControlGlobals,t===s&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let c=this.euler0.clone(),h=c.y;if(this.objectRealQuat.copy(this.quaternion),c.y=0,this.quaternion.setFromEuler(c),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),c.set(0,h,0),this.quaternion.setFromEuler(c),this.rot.setFromEuler(c),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let f,g=new C(0,0,-1).applyQuaternion(this.camera.quaternion),m=new C().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(m),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(g.y)<1e-6?(m.y=0,g.y=0,f=m.projectOnVector(g)):f=m.y/g.y>0?g.multiplyScalar(m.y/g.y):g.multiplyScalar(m.length()),this.targetToCamera0.copy(f).negate();let y=this.camera.position.clone().add(f);this.objectToTarget0.subVectors(y,this.position);let v=new Ti().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-v.x,v.x=0,v.z=0,v.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(v)}if(this.object instanceof tn&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=i.rotByTouch??"joystick",this.rotBy=i.rotBy??"keys",this.rotationMode=i.rotationMode??"normal",this.moveMode=i.moveMode??"walk",this.collisionEnabled=i.collisionEnabled,this.speedTranslate=1*(i.speedTranslate??250),this.speedOrbit=.025*(i.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(i.speedRotate??100),this.keyAssignments=i.keyAssignments.map(f=>{let g=[f[0],f[1]];return g[1]==="\u25B2"?g[1]="ArrowUp":g[1]==="\u25C0"?g[1]="ArrowLeft":g[1]==="\u25BC"?g[1]="ArrowDown":g[1]==="\u25B6"?g[1]="ArrowRight":g[1]==="\u21E7"?g[1]="Shift":g[1]==="\u21B5"?g[1]="Enter":g[1]==="Space"?g[1]=" ":g[1]==="\u2318"?g[1]="Meta":g[1]==="Ctrl"?g[1]="Control":g[1]==="Esc"&&(g[1]="Escape"),g}),i.rotBy==="mouse"){let f;f=this.keyAssignments.findIndex(g=>g[0]==="rotNegX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosY"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotNegY"),f!==-1&&(this.keyAssignments[f][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(i.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(i.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(i.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(i.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(i.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(i.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??$u.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??$u.defaultData.usePhysics,this.jumpPower=20*i.jumpPower,this.resetYPosition=this.position.y+Math.abs(i.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=i.alignToGround??!1,this.orientMode=i.autoOrientMove?i.orientMode:"none",this.orientWith=i.orientWith??F_.defaultDataThirdPerson.orientWith,this.slopeThresh=65*Math.PI/180,i.collider.type==="capsule"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=i.collider.height/2-i.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=i.collider.height*rM/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height):i.collider.type==="sphere"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*i.collider.radius*rM/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*rM/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new C().fromArray(i.collider.position.map(f=>typeof f=="number"?f:0)),u=new Yt().setFromEuler(new Ti().fromArray([...i.collider.rotation.map(f=>typeof f=="number"?f:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(u),this.collider.matrix.compose(d,u,wB),i.cameraXAxis!==void 0&&(this.cameraXAxis=i.cameraXAxis,this.cameraYAxis=i.cameraYAxis,this.minPolarAngle=i.cameraRotXLimits[0],this.maxPolarAngle=i.cameraRotXLimits[1],this.minAzimuthAngleRel=i.cameraRotYLimits[0],this.maxAzimuthAngleRel=i.cameraRotYLimits[1]),this.forwardDir=i.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=i.runMultiplier??2;let p=2*i.navmesh.destinationHelperRadius;if(p>0){let f=new Vt;f.push({fi:0,data:{...Qi.defaultData("light","phong"),alpha:0},id:"layer1"}),f.push({fi:0,data:{...Qi.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let g=Rk({layers:f},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new wi($C.create({parameters:{width:p,height:p/10,hollow:.7}}),g),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let e=new Ti().setFromQuaternion(this.quaternion,"YXZ"),i=e.y;this.objectRealQuat.copy(this.quaternion),e.y=0,this.quaternion.setFromEuler(e),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),e.set(0,i,0),this.quaternion.setFromEuler(e),this.rot.setFromEuler(e),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof tn?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let t=this.data,e=this.sharedAssets;t.gameActions!==void 0&&(this.actions={},N_.list.forEach(i=>{this.actions[i]=Rn({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),nr(this.actions.idle),nr(this.actions.move),nr(this.actions.run),nr(this.actions.jump)}dispatchStartEvent(t){this.actions[t]!==void 0&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(e=>{e.play()}),this.actions[t].Animation.forEach(e=>{e.play(this.initialAction===!1)}),this.actions[t].TimelineAnimation.forEach(e=>{e.play()}),this.actions[t].Create.forEach(e=>{e.dispatchStart()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("start")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("start")})))}dispatchStopEvent(t){this.actions[t]!==void 0&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(e=>{e.stop(),e.object.currentState!==null&&e.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].TimelineAnimation.forEach(e=>{e.stop()}),this.actions[t].Create.forEach(e=>{e.dispatchStop()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("stop")})))}get colliderWorldPosition(){return Er.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let e=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*e,n=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let a=Oo.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*e,0).divideScalar(this.pixelsPerMeter),s=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(s){this.onObject=!0,this.groundNormal.set(s.normal2.x,s.normal2.y,s.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(n=!0),s.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let o=s.collider.parent(),l=o!==null&&o.isKinematic()?o:null,c=l===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(l.handle);if(l!==null&&c?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition(Er).add(this.collider.position).divideScalar(this.pixelsPerMeter),d=l.velocityAtPoint(h);this.groundVelocity.set(d.x,d.y,d.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=l.angvel().y*e}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*i),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let a=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let s=Er.subVectors(this.path[1],this.position),o=Oo.subVectors(this.path[1],this.path[0]);s.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),a.opacity=a.userData.opacity0}else a.opacity-=.05*a.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**i),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**i),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**i)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let r=xJ.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let a=Oo.copy(r);a.y=0,r.set(0,r.y,a.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let a=Er;this.camera.getWorldDirection(a);let s=tu.copy(Vs).multiplyScalar(a.dot(Vs));a.sub(s);let o=Oo.copy(this.directionXZ);o.x*=-1,this.rot.y=a.angleTo(o)*(a.cross(o).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(eu.setFromVector3(this.rot),this.moveMode==="walk"&&(eu.x=0),r.applyEuler(eu),n&&(cc.setFromUnitVectors(Vs,this.groundNormal),r.applyQuaternion(cc)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let a=0;for(let s of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(s.rigidBody===void 0||s.prevQ===void 0)continue;(s.hasNonUniformScale?s.matrixWorldRigid:s.matrixWorld).decompose(sM,EB,EJ);let o=this.object.getWorldPosition(AJ).add(this.collider.position).sub(sM);AB.copy(s.prevQ).invert().premultiply(EB);let l=tu.subVectors(sM,s.prevT).add(TJ.copy(o).applyQuaternion(AB).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),c=s.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),Er.copy(r).divideScalar(this.pixelsPerMeter),0,e,!1);l.multiplyScalar(this.pixelsPerMeter);let h=Be.is(s)?s:s.object;if(c!==null&&this.lastHitObj!==h){let d;s instanceof ba&&(d=s);let u=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(u)for(let p of u)p.data.target==="character"&&(p.dispatch(d),h.dispatchEvent(MT));this.lastHitObj=h}c!==null&&(Math.abs(l.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=l.x),Math.abs(l.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=l.y),Math.abs(l.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=l.z),MB(a++).copy(c.normal1).applyQuaternion(s.quaternion))}if(a>0){for(let s=0;s<a;s++){let o=MB(s),l=o.dot(r);l<0&&r.addScaledVector(o,-l)}r.add(this.pushedVelocity)}else r.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(e),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**i):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**i),this.euler.x+=this.rotVelocity.x*e,this.euler.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*e),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(Vs,this.euler.y-this.euler0.y);let a=Oo.copy(this.objectToCamXZ).normalize(),s=tu.copy(r).multiplyScalar(e);s.y=0;let o=s.sub(Er.copy(a).multiplyScalar(s.dot(a))).cross(a).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=It.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=It.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=It.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(eu.copy(this.euler),eu.y=0,this.nonColliderRotOffset.makeRotationFromEuler(eu)),pa.setFromAxisAngle(SJ,this.rot.x),cc.setFromAxisAngle(Vs,this.rot.y),cc.multiply(pa),pa.setFromAxisAngle(MJ,this.rot.z),cc.multiply(pa),this.quaternion.copy(cc),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let a=Oo.copy(r).multiplyScalar(e/this.pixelsPerMeter),s=null;this.didHit=!1;let o=new C;for(let h=0;h<5;h++){let d=a.length(),u=tu.copy(a).normalize();if(s=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,u,this.object.rigidBody.collider(0).shape,0,d,!1,12,void 0,void 0,this.object.rigidBody),s===null){h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),o.add(a);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(s.collider.handle);if(p!==this.lastHitObj&&h===0){this.lastHitObj=p;let y=this.sharedGameControlGlobals.entityToCollisionEvents[p?.uuid];if(y){for(let v of y)if(v.data.target==="character"){let _,b=(this.sharedGameControlGlobals.rapierWorld?.getCollider(s.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===b){_=x;break}}v.dispatch(_),p.dispatchEvent(MT)}}}let f=_B.set(s.normal2.x,s.normal2.y,s.normal2.z).applyQuaternion(this.colliderWorldQuat),g=bB.copy(u).multiplyScalar(s.time_of_impact).dot(f),m=s.time_of_impact;if(m===0&&(this.position.y+=this.offset*this.pixelsPerMeter),g>this.offset&&(m=s.time_of_impact*(g-this.offset)/g,o.addScaledVector(u,m)),a.copy(u).multiplyScalar(d-m),Math.acos(-f.y)>this.slopeThresh){let y=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),v=tu.copy(s.witness2).applyQuaternion(this.colliderWorldQuat);v.y=0;let _=y.add(v);_.y+=this.stepThresh;let b=this.sharedGameControlGlobals.rapierWorld.castShape(_,this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);b!==null&&b.time_of_impact===0&&(f.y=0,f.normalize())}a.addScaledVector(f,-a.dot(f))}}this.position.addScaledVector(o,this.pixelsPerMeter),Er.copy(this.position).divideScalar(this.pixelsPerMeter),pa.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,c=l!==void 0&&CJ.copy(Er).sub(l.translation()).lengthSq()>1;l!==void 0&&(c?(l.setTranslation(Er,!0),l.setRotation(pa,!0)):(l.setNextKinematicTranslation(Er),l.setNextKinematicRotation(pa)))}else{let a=this.onObject?1:5,s=r.multiplyScalar(e/a);for(let o=0;o<a;o++)this.position.add(s),this.collisionAdjustment(e/a)}else this.position.addScaledVector(r,e);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let a=this.objectToTarget.add(this.position),s=this.targetToCamera.add(a);aM.lookAt(s,a,Vs).setPosition(s),aM.decompose(this.targetPos,this.targetQuat,Er),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**i),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**i),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=It.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=It.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(DJ),!(this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)||(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(PJ),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=pa.setFromAxisAngle(Vs,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?It.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e),t=this.cameraXAxis==="Limit"?It.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):It.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=Er.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(e);let n=cc.setFromAxisAngle(i,t);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(n)}groundTiltAdjustment(t){180*Vs.angleTo(t)/Math.PI<15||180*Vs.angleTo(t)/Math.PI>85?pa.identity():pa.setFromUnitVectors(Vs,t),this.groundTilt.slerp(pa,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=bB.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=aM.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Er,pa,Oo).compose(Er,pa,wB);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(r=>{if(r===this.object||r.isDescendantOf(this.object)||!r.bvhGeometry||!r.bvhGeometry.boundsTree)return;Ba.makeEmpty(),r.updateMatrixWorldRigid();let a=r.matrixWorldRigid,s=xB.copy(a).invert(),o=wJ.copy(xB).multiply(i);Kn.copy(this.collider.segment),Kn.start.applyMatrix4(o),Kn.end.applyMatrix4(o);let l=_B.copy(this.position).applyMatrix4(s);Ba.expandByPoint(Kn.start),Ba.expandByPoint(Kn.end),Ba.min.addScalar(-this.collider.radius),Ba.max.addScalar(this.collider.radius),r.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:c=>c.distanceToPoint(Kn.end),intersectsBounds:c=>c.intersectsBox(Ba),intersectsTriangle:c=>{let h=Er,d=Oo,u=c.closestPointToSegment(Kn,h,d);if(u<this.collider.radius){let p=this.collider.radius-u,f=d.sub(h).normalize(),g=tu.copy(l);g.addScaledVector(f,p);let m=g.applyMatrix4(a).sub(this.position);e.add(m),Kn.start.addScaledVector(f,p),Kn.end.addScaledVector(f,p)}}})}),Ba.makeEmpty(),Kn.copy(this.collider.segment),Kn.start.applyMatrix4(i),Kn.end.applyMatrix4(i),Ba.expandByPoint(Kn.start),Ba.expandByPoint(Kn.end),Ba.min.addScalar(-this.collider.radius),Ba.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:r=>r.distanceToPoint(Kn.end),intersectsBounds:r=>r.intersectsBox(Ba),intersectsTriangle:r=>{let a=Er,s=Oo,o=r.closestPointToSegment(Kn,a,s);if(o<this.collider.radius){let l=this.collider.radius-o,c=s.sub(a).normalize();this.alignToGround&&this.groundTiltAdjustment(c),e.addScaledVector(c,l),Kn.start.addScaledVector(c,l),Kn.end.addScaledVector(c,l)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let n=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(n),this.position.add(e)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},oj=ET;oj.isLocked=!1,rt(),Wg(),Ap(),Ep();var lj,hj,oM,RJ=new Promise(t=>{lj=t});function OJ(t){return oM||(oM=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.12/build";typeof window<"u"&&(hj=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[n,r]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(o=>o.arrayBuffer())]),a=n.default,s=await a({wasmBinary:r});lj(s)}(),oM)}ti();var cj,Ne,pr,IJ=t=>`
|
|
9849
|
+
`)>=0&&(t-=r),i===3?.5*e-.5*t:i===2?e-t:0}getLineInitialOffsetY(t,e,i,n,r){let a=e*t,s=t-Math.abs(this.ascender-this.descender)*n,o=-this.ascender*n-s/2;return r===3?-(i-a-o):r===2?-(.5*i-.5*a-o):o}createPath(t,e,i,n,r){let a=t.getPath(i,-n,r.fontSize,{kerning:!1,letterSpacing:r.letterSpacing});if(!a)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");let s=new sJ,o=(t.advanceWidth??1)*e;if(t)for(let l of a.commands){let c=s.currentPath?.currentPoint;if(!c||l.type==="Z"||c.x!==l.x||-c.y!==l.y)switch(l.type){case"M":s.moveTo(l.x,-l.y);break;case"L":s.lineTo(l.x,-l.y);break;case"Q":s.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":s.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return s.subPaths.forEach(l=>{let c=function(h){if(h.length){let d=h[0];if(d instanceof ma)return d.v1;if(d instanceof Fa||d instanceof Ho)return d.v0}}(l.curves);c!==void 0&&l.currentPoint.distanceTo(c)>0&&l.lineTo(c.x,c.y)}),{offsetX:o,path:s}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(t,e,i,n){let r=this.getCharWidth(" ",i),a=t[e];if(a){let s=this.countSpaces(a.trimEnd());if(i.horizontalAlign===4&&e<t.length-1&&s)return((typeof i.width=="string"?Number(n.getVariable(i.width)):i.width)-(this.getTextWidth(a,i)-s*r))/s}return r}countSpaces(t){return(t.match(/ /g)||[]).length}},Si("text"),te();var QV=null;function dB(){return QV}function hJ(t){let e=!1;return t.scene.objects.forEach(i=>{i.data.type==="Page"&&!e&&i.data.publish.gameControlObject&&up.traverseModuleInstances(t,i.id,(n,r,a)=>{for(let s of a)s.data.type==="GameControl"&&s.data.navmesh.enabled&&(e=!0)})}),e}ti();var oy=(t,e)=>{let i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)},$2=t=>t*(Math.PI/180),ly=new Map,vb=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let a=0;a<r.length;a+=1)n=r[a],t.addEventListener?t.addEventListener(n,i,!1):t.attachEvent&&t.attachEvent(n,i)},yb=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let a=0;a<r.length;a+=1)n=r[a],t.removeEventListener?t.removeEventListener(n,i):t.detachEvent&&t.detachEvent(n,i)},JV=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),uB=()=>{if(!(typeof window>"u"))return{x:window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},Y2=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},Z2=(t,e,i)=>{let n=tj(t);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof e=="string")n[r]=e+" "+i;else{let a="";for(let s=0,o=e.length;s<o;s+=1)a+=e[s]+" "+i+", ";n[r]=a.slice(0,-2)}return n},tj=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},K2=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},ST=(t,e)=>{if(t.length)for(let i=0,n=t.length;i<n;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(ej="ontouchstart"in window,ij=!!window.PointerEvent,nj=!!window.MSPointerEvent);var ej,ij,nj,Kd,pB={start:"mousedown",move:"mousemove",end:"mouseup"},Kf={};function bc(){}ij?Kd={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:nj?Kd={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:ej?(Kd={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},Kf=pB):Kd=pB,bc.prototype.on=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var a=0;a<r.length;a+=1)i=r[a],n._handlers_[i]=n._handlers_[i]||[],n._handlers_[i].push(e);return n},bc.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},t===void 0?i._handlers_={}:e===void 0?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},bc.prototype.trigger=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var a=0;a<r.length;a+=1)i=r[a],n._handlers_[i]&&n._handlers_[i].length&&n._handlers_[i].forEach(function(s){s.call(n,{type:i,target:n},e)})},bc.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((i,n)=>{let r={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&Object.prototype.hasOwnProperty.call(n,a)?r[a]=n[a]:Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a]);return r})(e.options,t))},bc.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){typeof i["on"+e]=="function"?i["on"+e].apply(i,arguments):console.warn('[WARNING] : Missing "on'+e+'" handler.')},vb(t,Kd[e],i._domHandlers_[e]),Kf[e]&&vb(t,Kf[e],i._domHandlers_[e]),i},bc.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},yb(t,Kd[e],i._domHandlers_[e]),Kf[e]&&yb(t,Kf[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var z3=bc;function Fn(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(e),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=Fn.id,Fn.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}Fn.prototype=new z3,Fn.constructor=Fn,Fn.id=0,Fn.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},Fn.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let r=tj("borderRadius");for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&(r[a]="50%");return r})(),i=Z2("transition","opacity",t),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},n.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},K2(n.el,i),this.options.shape==="circle"&&K2(n.back,e),K2(n.front,e),this.applyStyles(n),this},Fn.prototype.applyStyles=function(t){for(var e in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},Fn.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},Fn.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},Fn.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null},Fn.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),typeof t=="function"&&t.call(this)},e.options.fadeTime)),e},Fn.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i=e.options.mode==="dynamic"?"none":"block";e.ui.el.style.display=i,typeof t=="function"&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,n={};n.x=i===!0||i.x!==!1?0:e.instance.frontPosition.x,n.y=i===!0||i.y!==!1?0:e.instance.frontPosition.y,e.setPosition(t,n)}return e},Fn.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var n=i.options.fadeTime+"ms",r={};r.front=Z2("transition",["top","left"],n);var a={front:{}};a.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(r),i.applyStyles(a),i.restTimeout=setTimeout(function(){typeof t=="function"&&t.call(i),i.restCallback()},i.options.fadeTime)},Fn.prototype.restCallback=function(){var t=this,e={};e.front=Z2("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},Fn.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},Fn.prototype.computeDirection=function(t){var e,i,n,r=t.angle.radian,a=Math.PI/4,s=Math.PI/2;if(r>a&&r<3*a&&!t.lockX?e="up":r>-a&&r<=a&&!t.lockY?e="left":r>3*-a&&r<=-a&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=r>-s&&r<s?"left":"right"),t.lockX||(n=r>0?"up":"down"),t.force>this.options.threshold){var o,l={};for(o in this.direction)Object.prototype.hasOwnProperty.call(this.direction,o)&&(l[o]=this.direction[o]);var c={};for(o in this.direction={x:i,y:n,angle:e},t.direction=this.direction,l)l[o]===this.direction[o]&&(c[o]=!0);if(c.x&&c.y&&c.angle)return t;(!c.x||!c.y)&&this.trigger("plain",t),c.x||this.trigger("plain:"+i,t),c.y||this.trigger("plain:"+n,t),c.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var cJ=Fn;function hn(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=hn.id,hn.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(e),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let n=getComputedStyle(i.options.zone.parentElement);return n&&n.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}hn.prototype=new z3,hn.constructor=hn,hn.id=0,hn.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(i){if(i===void 0)return e[0];for(var n=0,r=e.length;n<r;n+=1)if(e[n].identifier===i)return e[n];return!1}},hn.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},hn.prototype.begin=function(){var t=this,e=t.options;if(e.mode==="static"){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},hn.prototype.createNipple=function(t,e){var i=this,n=i.manager.scroll,r={},a=i.options,s=i.parentIsFlex?n.x:n.x+i.box.left,o=i.parentIsFlex?n.y:n.y+i.box.top;if(t.x&&t.y)r={x:t.x-s,y:t.y-o};else if(t.top||t.right||t.bottom||t.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=t.top,l.style.right=t.right,l.style.bottom=t.bottom,l.style.left=t.left,l.style.position="absolute",a.zone.appendChild(l);var c=l.getBoundingClientRect();a.zone.removeChild(l),r=t,t={x:c.left+n.x,y:c.top+n.y}}var h=new cJ(i,{color:a.color,size:a.size,threshold:a.threshold,fadeTime:a.fadeTime,dataOnly:a.dataOnly,restJoystick:a.restJoystick,restOpacity:a.restOpacity,mode:a.mode,identifier:e,position:t,zone:a.zone,frontPosition:{x:0,y:0},shape:a.shape});return a.dataOnly||(Y2(h.ui.el,r),Y2(h.ui.front,h.frontPosition)),i.nipples.push(h),i.trigger("added "+h.identifier+":added",h),i.manager.trigger("added "+h.identifier+":added",h),i.bindNipple(h),h},hn.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},hn.prototype.bindNipple=function(t){var e,i=this,n=function(r,a){e=r.type+" "+a.id+":"+r.type,i.trigger(e,a)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},hn.prototype.pressureFn=function(t,e,i){var n=this,r=0;clearInterval(n.pressureIntervals[i]),n.pressureIntervals[i]=setInterval(function(){var a=t.force||t.pressure||t.webkitForce||0;a!==r&&(e.trigger("pressure",a),n.trigger("pressure "+e.identifier+":pressure",a),r=a)}.bind(n),100)},hn.prototype.onstart=function(t){var e=this,i=e.options,n=t;return t=JV(t),e.updateBox(),ST(t,function(r){e.actives.length<i.maxNumberOfNipples?e.processOnStart(r):n.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(a){if(Object.values(n.touches).findIndex(function(o){return o.identifier===a})<0){var s=[t[0]];s.identifier=a,e.processOnEnd(s)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(r))}),e.manager.bindDocument(),!1},hn.prototype.processOnStart=function(t){var e,i=this,n=i.options,r=i.manager.getIdentifier(t),a=t.force||t.pressure||t.webkitForce||0,s={x:t.pageX,y:t.pageY},o=i.getOrCreate(r,s);o.identifier!==r&&i.manager.removeIdentifier(o.identifier),o.identifier=r;var l=function(c){c.trigger("start",c),i.trigger("start "+c.id+":start",c),c.show(),a>0&&i.pressureFn(t,c,c.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(o))>=0&&i.idles.splice(e,1),i.actives.push(o),i.ids.push(o.identifier),n.mode!=="semi")l(o);else{if(!(oy(s,o.position)<=n.catchDistance))return o.destroy(),void i.processOnStart(t);l(o)}return o},hn.prototype.getOrCreate=function(t,e){var i,n=this,r=n.options;return/(semi|static)/.test(r.mode)?(i=n.idles[0])?(n.idles.splice(0,1),i):r.mode==="semi"?n.createNipple(e,t):(console.warn("Coudln't find the needed nipple."),!1):i=n.createNipple(e,t)},hn.prototype.processOnMove=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),a=e.manager.scroll;if((_=>isNaN(_.buttons)?_.pressure!==0:_.buttons!==0)(t)){if(!r)return console.error("Found zombie joystick with ID "+n),void e.manager.removeIdentifier(n);if(i.dynamicPage){var s=r.el.getBoundingClientRect();r.position={x:a.x+s.left,y:a.y+s.top}}r.identifier=n;var o=r.options.size/2,l={x:t.pageX,y:t.pageY};i.lockX&&(l.y=r.position.y),i.lockY&&(l.x=r.position.x);var c,h,d=oy(l,r.position),u=((_,b)=>{let x=b.x-_.x,w=b.y-_.y;return(S=>S*(180/Math.PI))(Math.atan2(w,x))})(l,r.position),p=$2(u),f=d/o,g={distance:d,position:l};if(r.options.shape==="circle"?(c=Math.min(d,o),h=((_,b,x)=>{let w={x:0,y:0};return x=$2(x),w.x=_.x-b*Math.cos(x),w.y=_.y-b*Math.sin(x),w})(r.position,c,u)):(h=((_,b,x)=>({x:Math.min(Math.max(_.x,b.x-x),b.x+x),y:Math.min(Math.max(_.y,b.y-x),b.y+x)}))(l,r.position,o),c=oy(h,r.position)),i.follow){if(d>o){let _=l.x-h.x,b=l.y-h.y;r.position.x+=_,r.position.y+=b,r.el.style.top=r.position.y-(e.box.top+a.y)+"px",r.el.style.left=r.position.x-(e.box.left+a.x)+"px",d=oy(l,r.position)}}else l=h,d=c;var m=l.x-r.position.x,y=l.y-r.position.y;r.frontPosition={x:m,y},i.dataOnly||Y2(r.ui.front,r.frontPosition);var v={identifier:r.identifier,position:l,force:f,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:u},vector:{x:m/o,y:-y/o},raw:g,instance:r,lockX:i.lockX,lockY:i.lockY};(v=r.computeDirection(v)).angle={radian:$2(180-u),degree:180-u},r.trigger("move",v),e.trigger("move "+r.id+":move",v)}else this.processOnEnd(t)},hn.prototype.processOnEnd=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),a=e.manager.removeIdentifier(r.identifier);!r||(i.dataOnly||r.hide(function(){i.mode==="dynamic"&&(r.trigger("removed",r),e.trigger("removed "+r.id+":removed",r),e.manager.trigger("removed "+r.id+":removed",r),r.destroy())}),clearInterval(e.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),e.trigger("end "+r.id+":end",r),e.ids.indexOf(r.identifier)>=0&&e.ids.splice(e.ids.indexOf(r.identifier),1),e.actives.indexOf(r)>=0&&e.actives.splice(e.actives.indexOf(r),1),/(semi|static)/.test(i.mode)?e.idles.push(r):e.nipples.indexOf(r)>=0&&e.nipples.splice(e.nipples.indexOf(r),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[a.id]=a.identifier))},hn.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},hn.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(i){i.destroy()}),t.pressureIntervals)Object.prototype.hasOwnProperty.call(t.pressureIntervals,e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off(),t.pressureIntervals={},t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.manager=null};var dJ=hn;function Mn(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=uB(),e._windowBound=!1,e.config(t),e.prepareCollections();var i=function(){var n;e.collections.forEach(function(r){r.forEach(function(a){n=a.el.getBoundingClientRect(),a.position={x:e.scroll.x+n.left,y:e.scroll.y+n.top}})})};return e._onResize=function(){(n=>{ly.has(n)&&clearTimeout(ly.get(n)),ly.set(n,setTimeout(function(){ly.delete(n),n()},100))})(i)},e._onScroll=function(){e.scroll=uB()},e.collections}Mn.prototype=new z3,Mn.constructor=Mn,Mn.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(n){return!(i=n.get(e))}),i}},Mn.prototype.create=function(t){return this.createCollection(t)},Mn.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,vb(window,"resize",t._onResize),vb(window,"scroll",t._onScroll))},Mn.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,yb(window,"resize",t._onResize),yb(window,"scroll",t._onScroll))},Mn.prototype.createCollection=function(t){var e=this,i=new dJ(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},Mn.prototype.bindCollection=function(t){var e,i=this,n=function(r,a){e=r.type+" "+a.id+":"+r.type,i.trigger(e,a)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},Mn.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},Mn.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||t===!0)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},Mn.prototype.getIdentifier=function(t){var e;return t?(e=t.identifier===void 0?t.pointerId:t.identifier)===void 0&&(e=this.latest||0):e=this.index,this.ids[e]===void 0&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},Mn.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},Mn.prototype.onmove=function(t){return this.onAny("move",t),!1},Mn.prototype.onend=function(t){return this.onAny("end",t),!1},Mn.prototype.oncancel=function(t){return this.onAny("end",t),!1},Mn.prototype.onAny=function(t,e){var i,n=this,r="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=JV(e);var a=function(s,o,l){l.ids.indexOf(o)>=0&&(l[r](s),s._found_=!0)};return ST(e,function(s){i=n.getIdentifier(s),ST(n.collections,a.bind(null,s,i)),s._found_||n.removeIdentifier(i)}),!1},Mn.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.unbindWindowEvents(),t.ids={},t.index=0,t.collections.forEach(function(e){e.destroy()}),t.collections=[],t.off()},Mn.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1),i.collections.length===0&&i.unbindWindowEvents()};var uJ=Mn,np=null;function fB(){return np||(np=new uJ),np}var pJ={create:function(t){return fB().create(t)},destroy:function(){np&&(np.destroy(),np=null)},get factory(){return fB()}},fJ=pJ;ti(),te(),rt(),qa(),Wr(),te();var rj=null;function Q2(){return rj}var aj,J2,mJ=new Promise(t=>{aj=t});function gJ(t){return J2||(J2=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.13/build",i=import("./physics.js"),[n,r]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(a=>a.arrayBuffer())]);await n.init(r),aj(n)}(),J2)}function sj(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,n=e[4]**2+e[5]**2+e[6]**2,r=e[8]**2+e[9]**2+e[10]**2,a=e[0]**2+e[4]**2+e[8]**2,s=e[1]**2+e[5]**2+e[9]**2,o=e[2]**2+e[6]**2+e[10]**2,l=1e-8;return i<l||n<l||r<l||a<l||s<l||o<l}function jo(t,e){let i=new Gt;if(e&&sj(e))return i.setAttribute("position",new Ft([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new Ft([],3)),i.setIndex([]),i;let{positions:n,triIndices:r}=t3(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new Ft(n,3)),i.setIndex(r),e&&i.applyMatrix4(e),i}Ui(),Wr(),ke(),c3(),rt(),rt(),Ep(),Wg();var Ge,vJ=class{constructor(t,e,i,n,r,a){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=Rn(e,e.actions,n,r,a,i),this.target=e.target}disconnect(){nr(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Animation.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}},mB=class{constructor(t,e,i,n,r,a){this.id=t,this.data=e,this.object=i,this.page=n,this.currentIntersectedObjects=[],this.actions=Rn(e,e.actions,n,r,a,i),this.target=e.target,this.triggeringObjects=[];for(let s of e.triggeringObjects){let o=n.scene.find(s);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(t){return this.target==="all"||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){nr(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};Ui(),mJ.then(t=>Ge=t);var Sn=new C,La=new Yt,Ol=new C,gB=(new Ti(0,0,0,"YXZ"),new Ti(0,0,0,"XYZ")),rs=new C,tM=new C,eM=new C(1,1,1),Qd=new Yt,hy=new At,vB=new At,yJ={type:"updateMatrix"},yB=new Yt,iM=new vr,nM=.01,MT={type:"beginEvent",eventName:"Collision"},_J={type:"beginEvent",eventName:"Trigger"},_b=t=>t.states.some(e=>e.data.position!==void 0||e.data.rotation!==void 0||e.data.hiddenMatrix!==void 0||e.data.cloner!==void 0||e.data.pathSnapping!==void 0);function Jd(t){return function(e){return typeof e=="object"&&e!==null&&"booleanOp"in e}(Dc(t)?t.object:t)}var bJ=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=e=>{if(e.bodyType()!==Ge.RigidBodyType.Dynamic)return;e.isSleeping()||this.nActiveRigidBodies++;let[i,n,r]=this.rigidBodyToMesh.get(e.handle);if(Sn.copy(e.translation()).multiplyScalar(this.pixelsPerMeter),La.copy(e.rotation()),i.matrixWorld.compose(Sn,La,n),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(yJ),r){let a=i.cloner;if(a&&a.objectForSample===void 0){a.matrixWorld.copy(i.matrixWorld);for(let s of a.children)s.updateMatrixWorld(!0)}for(let s of i.children)s.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(e,i,n)=>{if(n===!1)return;let r,a;if(this.sensorToTriggerEvent[e]?(r=this.sensorToTriggerEvent[e],a=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(r=this.sensorToTriggerEvent[i],a=this.sharedGameControlGlobals.colliderToEntity.get(e)),r&&a&&r.isValidTriggeringObject(a))r.dispatch();else{for(let s=this.sharedGameControlGlobals.createdObjects.length-1;s>=0;s--){let o=this.sharedGameControlGlobals.createdObjects[s];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===e||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(s,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let s=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,s,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let s=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,s,e)}else{let s=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(o!==void 0)for(let h of o)h.data.target==="scene"&&this.dispatchCollisionEvent(h,s,e);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let h of c)h.data.target==="scene"&&this.dispatchCollisionEvent(h,l,i)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events){if(i.data.disabled===!0)continue;let n=i.data.actions?.find(r=>r.data.type==="Destroy")?.data;if(n)for(let r of n.objects){let a=this.page.scene.find(r);a&&(a.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let n of i.data.objects){let r=this.page.scene.find(n);r&&(r.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(Q2()===null)return void Gn("collision-bvh","trigger/collision detection");let t=[],e=[];if(this.page.traverseChildren(i=>{let n,r=i instanceof Ju,a=sg(i);if(Bu(i)||r||a)return;n=Dc(i)?i.object:i;let s=n.dataPatched;if(s.physics?.enabled==="visibility"?!s.visible:!s.physics?.enabled)return!0;let o=i.geometry,l=n.userData.hasDestroy===!0,c=n.userData.hasDrag===!0;if(_b(s)||l||c||n.dataPatched.events.some(h=>h.data.disabled!==!0&&(h.data.type==="GameControl"||h.data.type==="Follow")))return i.updateMatrixWorldRigid(),this.addBoundsTree(i),!0;if(o){let h=o.getAttribute("position");if(h!==void 0&&h.count>0){t.push({geometry:o,matrixWorld:i.matrixWorld}),e.push(o.id,this._staticBVHIdOf(h),h.version,o.index!==null?this._staticBVHIdOf(o.index):-1,o.index!==null?o.index.version:-1);for(let d of i.matrixWorld.elements)e.push(d)}}return!!Jd(i)||void 0}),t.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===e.length&&i.signature.every((a,s)=>a===e[s]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let n=Pc(t.map(a=>jo(a.geometry,a.matrixWorld)),!1),r=new(Q2())(n);this._staticBVHCache={signature:e,bvh:r},this.sharedGameControlGlobals.staticMeshBVH=r}}addRigidBody(t,e,i){if(sj(t.matrixWorld))return;let n=[],r="geometry"in t?t.geometry:void 0,a=e.dataPatched;if(r?.getAttribute("position")!==void 0&&n.push(jo(r,t.shearScale)),a.physics.fusedBody){let s=this.gatherChildrenGeom(t,n);t.traverseObject(s),t.children.forEach(l=>l.updateMatrixWorld(!0));let o=t.cloner;o&&o.objectForSample===void 0&&a.physics.rigidBody==="dynamic"&&(o.traverseObject(s),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(n.length>0){let s,o=!1,l=!i.fromCreate&&a.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(s=Ge.RigidBodyDesc.dynamic(),s.setLinearDamping(a.physics.damping).setAngularDamping(a.physics.damping).setAdditionalMass(1e-9).setGravityScale(a.physics.gravityScale).enabledRotations(...a.physics.enabledRotation).enabledTranslations(...a.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(s=Ge.RigidBodyDesc.kinematicPositionBased(),o=!0):s=Ge.RigidBodyDesc.fixed();let c=Pc(n);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(Sn,La,Ol),t.position0=Sn.clone().divideScalar(this.pixelsPerMeter),t.rotation0=La.clone(),Sn.divideScalar(this.pixelsPerMeter),s.setTranslation(Sn.x,Sn.y,Sn.z).setRotation(La),r?c?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):c?.scale(Ol.x/this.pixelsPerMeter,Ol.y/this.pixelsPerMeter,Ol.z/this.pixelsPerMeter);let h=this.sharedGameControlGlobals.rapierWorld.createRigidBody(s),d=!(a.geometry===void 0||a.geometry.type==="SubdivGeometry"||a.geometry.type==="NonParametricGeometry"||a.geometry.type==="BooleanGeometry"||a.geometry.type==="VectorGeometry"||a.geometry.type==="StarGeometry"||a.geometry.type==="RectangleGeometry"||a.geometry.type==="EllipseGeometry"||a.geometry.type==="TriangleGeometry"||a.geometry.type==="TorusGeometry"||a.geometry.type==="HelixGeometry");try{this.addCollider(h,a.physics,c,e,d)}catch{try{this.addCollider(h,a.physics,c,e,!1)}catch(u){console.error(u)}}if(h.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(h);l?this.rigidBodyToMesh.set(h.handle,[t,Ol.clone(),a.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(h.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,h,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=h}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(jo(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(i=>i.updateMatrixWorld(!0)),e.length>0){let i=Pc(e,!1);t.bvhGeometry=i,i.getAttribute("position").count>0&&(t.bvhGeometry.boundsTree=new(Q2())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t))}}addCollider(t,e,i,n,r=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let a;i&&(a=e.colliderType==="trimesh"?Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Ge.ColliderDesc.convexMesh(i.getAttribute("position").array,r?i.getIndex().array:void 0)),a.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setRestitutionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let s=this.sharedGameControlGlobals.rapierWorld.createCollider(a,t);this.sharedGameControlGlobals.colliderToEntity.set(s.handle,n),this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid]?.some(o=>o.target==="scene")&&s.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=Jd(t);return(n,r)=>{if(r===0)return;if(i&&n.parent===t)return!0;let a;if(Bu(n)){if(!n.objectForSample)return n.object.dataPatched.physics.fusedBody===!0&&n.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(n.objectForSample.dataPatched.physics.fusedBody)return;a=n.object}else if(Dc(n))a=n.object;else if(a=n,a.dataPatched.cloner?.hideBase)return!0;let s=a.dataPatched;if(s.physics.enabled==="visibility"?!s.visible:!s.physics.enabled)return!0;r===1?t.hasNonUniformScale?n.matrixWorld.multiplyMatrices(t.shearScale,n.hiddenMatrix):n.matrixWorld.copy(n.hiddenMatrix):n.matrixWorld.multiplyMatrices(n.parent.matrixWorld,n.hiddenMatrix),n.matrixWorld.multiply(n.matrix);let o=n.geometry;return o?.getAttribute("position")!==void 0&&e.push(jo(o,n.matrixWorld)),!!Jd(n)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(s=>{for(let o of s.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let n=dB();if(n!==null?i=n.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&Gn("game-controls","the scene's game controls"),i===!1){let{enableRotate:s,enablePan:o,enableZoom:l,autoRotate:c,hoverRotatePanMode:h}=this.eventManager.publish.orbitControls;(s||o||l||c||h!==0)&&(this.orbitControls=new DV(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let r=this.renderer.domElement.width/this.renderer.getPixelRatio(),a=this.renderer.domElement.height/this.renderer.getPixelRatio();dB()?.createJoysticks(this,r,a),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(s=>s.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new Ge.World(new Ge.Vector3(0,this.gravity,0)),this.events=new Ge.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(s=>{let o;if(Bu(s)){if(!s.objectForSample)return s.object.dataPatched.physics.fusedBody===!0&&s.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(s.objectForSample.dataPatched.physics.fusedBody)return;o=s.object}else if(Dc(s))o=s.object;else{if(sg(s)||qc(s)||s instanceof Ju)return;if(o=s,o.dataPatched.cloner?.disabled===!1&&o.dataPatched.cloner?.hideBase&&o.dataPatched.physics?.fusedBody!==!0)return!0}let l,c=o.dataPatched;for(let m of c.events)m.data.disabled!==!0&&m.data.type==="GameControl"&&(l=m.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;s.updateMatrixWorldRigid();let h=_b(c),d=!1,u=o.userData.hasDestroy,p=o.userData.hasDrag,f=!1;for(let m of c.events)if(m.data.disabled!==!0){if(m.data.type==="Collision"){d=!0;let y=new vJ(m.id,m.data,o,this.page,this.sharedAssets,this.eventManager);y.initialDisabled=!0,this.collisionEvents.push(y),this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].every(v=>v.id!==m.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(y):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[y]}else if(m.data.type==="Follow"){f=!0;let y=m.data.target;s.traverseVisible(v=>{v.userData.isFollowingObj=y})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(s.matrixWorldFusedFalse=s.matrixWorld.clone());let g=s.geometry;if(l!==void 0){let m=Ge.RigidBodyDesc.kinematicPositionBased();(s.hasNonUniformScale?s.matrixWorldRigid:s.matrixWorld).decompose(Sn,La,Ol),s.position0=Sn.clone().divideScalar(this.pixelsPerMeter),s.rotation0=La.clone(),Sn.divideScalar(this.pixelsPerMeter),m.setTranslation(Sn.x,Sn.y,Sn.z).setRotation(La);let y,v=this.sharedGameControlGlobals.rapierWorld.createRigidBody(m);s.rigidBody=v,y=l.collider.type==="sphere"?Ge.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Ge.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Ge.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),y.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(Ge.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(y,v);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),Sn.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(Ol.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(Sn);let b=new Yt().setFromEuler(new Ti().setFromVector3(new C().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else c.physics.rigidBody==="dynamic"||h||f||u||p||d?(this.addRigidBody(s,o,{hasFollow:f,hasTransformAnim:h,hasDrag:p}),this.generateSensorColliderDescs(o,c.physics.fusedBody)):(g&&t.push(jo(g,s.matrixWorld)),c.physics.fusedBody&&!Jd(s)&&s.traverseObject((m,y)=>{if(y===0)return;let v;if(Bu(m)){if(!m.objectForSample)return m.object.dataPatched.physics.fusedBody===!0&&m.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(m.objectForSample.dataPatched.physics.fusedBody)return;v=m.object}else{if(sg(m)||qc(m)||m instanceof Ju)return;if(Dc(m))v=m.object;else if(v=m,v.dataPatched.cloner?.hideBase)return!0}let _=v.dataPatched;if(_.physics.enabled==="visibility"?!_.visible:!_.physics.enabled)return!0;let b=m.geometry;return b?.getAttribute("position")!==void 0&&t.push(jo(b,m.matrixWorld)),!!Jd(m)||void 0}),this.generateSensorColliderDescs(o,c.physics.fusedBody,e));return!(c.physics?.fusedBody!==!0&&!l&&!Jd(s))||void 0}),t.length===0)return;let i=Pc(t),n=i.getIndex().count>0;if(!n&&e.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let r=Ge.RigidBodyDesc.fixed(),a=this.sharedGameControlGlobals.rapierWorld.createRigidBody(r);if(n){let s=Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Ge.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Ge.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(s,a)}for(let[s,o]of e){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(s,a);this.sensorToTriggerEvent[l.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let i=new mB(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),n=new At().compose(rs.fromArray(e.data.position.map(r=>typeof r=="number"?r:0)),Qd.setFromEuler(gB.fromArray(e.data.rotation.map(r=>typeof r=="number"?r:0))),eM);if(e.data.triggerZone==="box"){let r=new ci;r.min.fromArray(e.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(-.5),r.max.fromArray(e.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([r,n,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,n,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let n=t/1e3;n<i&&n>.55*i&&(n=i),this.accumulator+=n;let r=performance.now(),a=0,s=6;for(;this.accumulator>=i&&a<s&&(e=this.stepPhysics()&&e,this.accumulator-=i,a++,!(performance.now()-r>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(Sn,La,Ol);let e=t;e.prevQ===void 0?(e.prevQ=La.clone(),e.prevT=Sn.clone()):(e.prevQ.copy(La),e.prevT.copy(Sn))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,n]=this.fixedBodiesToWatch[t];(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(n)||(i.setBodyType(Ge.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),n=t.translation(),r=Math.hypot(i.x,i.z);for(let a=0;a<t.numColliders();a++){let s=t.collider(a);e.contactPairsWith(s,o=>{let l=o.parent();if(l===null||!l.isDynamic())return;let c=l.translation(),h=-1/0,d=0,u=0;if(e.contactPair(s,o,y=>{let v=y.normal(),_=v.x*(c.x-n.x)+v.y*(c.y-n.y)+v.z*(c.z-n.z)<0?-1:1;if(Math.abs(v.y)>.7)return;let b=_*v.x,x=_*v.z,w=Math.hypot(b,x);if(w<1e-4)return;let S=(i.x*b+i.z*x)/w;S>h&&(h=S,d=b/w,u=x/w)}),h===-1/0)return;let p=i.x*d+i.z*u;if(p<-nM)return;let f=l.linvel();if(r>nM&&p>nM){let y=f.x*d+f.z*u;if(y<=0)return;let v=Math.min(y,p);return void l.setLinvel({x:d*v,y:f.y,z:u*v},!0)}let g=f.x*d+f.z*u-Math.max(0,p);if(g<=0)return;let m=.5*g;l.setLinvel({x:f.x-d*m,y:f.y,z:f.z-u*m},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let t of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(t),t.rigidBody.setNextKinematicTranslation(Sn.divideScalar(this.pixelsPerMeter)),t.rigidBody.setNextKinematicRotation(La);for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim)t.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(t);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let n,r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner){for(let a of e.cloner.children)if(a.rigidBody===r){n=a;break}}t.dispatch(n),e.dispatchEvent(MT)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let n=vB.copy(t.matrixWorld).invert();t.traverseEntity((r,a)=>{if(e===!1&&a===1)return!0;for(let s of r.dataPatched.events)if(s.data.type==="Trigger"&&s.data.disabled!==!0){let o,l=new mB(s.id,s.data,r,this.page,this.sharedAssets,this.eventManager);if(o=s.data.triggerZone==="box"?Ge.ColliderDesc.cuboid(...s.data.size.map(c=>(typeof c=="number"?c:1)/(2*this.pixelsPerMeter))):Ge.ColliderDesc.ball(s.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),rs.fromArray(s.data.position.map(c=>typeof c=="number"?c:0)),Qd.setFromEuler(gB.fromArray(s.data.rotation.map(c=>typeof c=="number"?c:0))),hy.compose(rs,Qd,eM).premultiply(r.matrixWorld),i?(hy.decompose(rs,Qd,tM),o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED)):(hy.premultiply(n).decompose(rs,Qd,tM),t.rigidBody.bodyType()===Ge.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===Ge.RigidBodyType.Fixed?o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Ge.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),rs.divideScalar(this.pixelsPerMeter),o.setTranslation(rs.x,rs.y,rs.z),o.setRotation(Qd),i)i.push([o,l]);else{let c=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t.rigidBody);this.sensorToTriggerEvent[c.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,n,r,a]=this.sharedGameControlGlobals.triggers[e];for(let s=0;s<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;s++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[s];if(r===o||a.isValidTriggeringObject(Be.is(o)?o:o.object)===!1)continue;let l=vB.copy(r.matrixWorld).decompose(rs,yB,tM).compose(rs,yB,eM).multiply(n),c=hy.copy(o.matrixWorld).invert().multiply(l),h=o.bvhGeometry.boundsTree;i instanceof ci?t=h.intersectsBox(i,c):(iM.radius=i,iM.center.setFromMatrixPosition(c),t=h.intersectsSphere(iM)),t?a.currentIntersectedObjects.indexOf(o)===-1&&(a.currentIntersectedObjects.push(o),a.dispatch(),r.dispatchEvent(_J)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(d=>d!==o)}}}};Ap(),rt(),X_(),Ye(),Eh();var rM=.02,_B=new C,bB=new C,xJ=new C,Er=new C,Oo=new C,tu=new C,aM=new At,xB=new At,wJ=new At,pa=new Yt,cc=new Yt,eu=new Ti(0,0,0,"YXZ"),SJ=new C(1,0,0),Vs=new C(0,1,0),MJ=new C(0,0,1),wB=new C(1,1,1),SB=[],MB=t=>SB[t]??(SB[t]=new C),sM=new C,EJ=new C,AJ=new C,TJ=new C,EB=new Yt,CJ=new C,AB=new Yt,Kn=new _a,Ba=new ci,PJ={type:"requestRender"},DJ={type:"updateMatrix"},ET=class extends Vn{constructor(t,e,i,n,r,a,s,o,l){super(),this.object=t,this.domElement=e,this.data=i,this.gloabalPhysics=n,this.controlsManager=r,this.cameraFollow=a,this.camera=s,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new At,this.target0=new C,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new Ti(0,0,0,"YXZ"),this.position0Cam=new C,this.quat0Cam=new Yt,this.scale0Cam=new C,this.hiddenMatrix0Cam=new At,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new _a(new C(0,-40,0),new C(0,40,0)),matrix:new At,position:new C,rotation:new Yt},this.euler=new Ti(0,0,0,"YXZ"),this.eulerDelta=new C,this.lastPosition=new C,this.lastCameraQuaternion=new Yt,this.lastCameraPosition=new C,this.PI_2=Math.PI/2,this.prevMouse=new at,this.velocityTarget=new C,this.velocity=new C,this.directionXZ=new C,this.rotVelocityStick=new C,this.rotVelocityTarget=new C,this.rotVelocity=new C,this.rotDirection=new C,this.nonColliderRotOffset=new At,this.nonColliderPosOffset=new At,this.firstPointerId=-1,this.rot=new C,this.path=[],this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.onObject=!1,this.actionState={},this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]],this.collisionEnabled=!0,this.offsetMatrix=new At,this.objectToTarget=new C,this.objectToTarget0=new C,this.objectToCamXZ=new C,this.objectToCamXZ0=new C,this.targetToCamera=new C,this.targetToCamera0=new C,this.cameraPolarAxis0=new C,this.targetPos=new C,this.targetQuat=new Yt,this.lerpFactorPos=new C().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new Yt,this.objXZQuatInv=new Yt,this.objXZRotMat=new At,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new C,this.pushedVelocity=new C,this.groundYRotation=0,this.objectRealQuat=new Yt,this.colliderWorldQuat=new Yt,this.groundNormal=new C,this.groundTilt=new Yt,this.groundTiltInv=new Yt,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new C,this.quaternion=new Yt,this.scale=new C,this.initialAction=!0,this.onPointerDown=f=>{!(f.target===this.domElement||f.target instanceof HTMLElement&&f.target.tagName==="SPLINE-VIEWER"&&f.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=f.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!sa&&!xE&&this.domElement.requestPointerLock(),this.prevMouse.set(f.clientX,f.clientY))},this.onPointerUp=f=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),f.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=f=>{if(f.pointerId!==this.firstPointerId)return;let g=f.clientX-this.prevMouse.x,m=f.clientY-this.prevMouse.y;this.prevMouse.set(f.clientX,f.clientY),f.pointerType==="mouse"&&this.rotBy!=="keys"&&(xE&&_N<15.5&&!sa?(this.eulerDelta.y=-g*this.mouseOrbitSensitivity,this.eulerDelta.x=-m*this.mouseOrbitSensitivity):(this.eulerDelta.y=-f.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-f.movementY*this.mouseOrbitSensitivity)),f.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-g*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-m*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=f=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?ET.isLocked=!0:ET.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let f in this.movementState)this.movementState[f]=0},this.onKeyDown=f=>{!(f.target instanceof HTMLInputElement)&&(f.code==="ArrowLeft"||f.code==="ArrowUp"||f.code==="ArrowRight"||f.code==="ArrowDown"||f.code==="Space")&&f.preventDefault();for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]){this.movementState[g[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=f=>{for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]||f.code.slice(3,f.code.length).toUpperCase()===g[1]){this.movementState[g[0]]=0;break}},this.copyVRGamePadValues=(f,g)=>{for(let m=2;m<4;m++){let y=f.axes[m];g===0?m===2?this.movementState.movePosX=y:this.movementState.movePosZ=y:(f.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,m===2?this.movementState.rotPosY=y:this.moveMode==="fly"&&(this.movementState.moveNegY=y))}},this.sharedGameControlGlobals=r.sharedGameControlGlobals,t===s&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let c=this.euler0.clone(),h=c.y;if(this.objectRealQuat.copy(this.quaternion),c.y=0,this.quaternion.setFromEuler(c),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),c.set(0,h,0),this.quaternion.setFromEuler(c),this.rot.setFromEuler(c),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let f,g=new C(0,0,-1).applyQuaternion(this.camera.quaternion),m=new C().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(m),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(g.y)<1e-6?(m.y=0,g.y=0,f=m.projectOnVector(g)):f=m.y/g.y>0?g.multiplyScalar(m.y/g.y):g.multiplyScalar(m.length()),this.targetToCamera0.copy(f).negate();let y=this.camera.position.clone().add(f);this.objectToTarget0.subVectors(y,this.position);let v=new Ti().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-v.x,v.x=0,v.z=0,v.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(v)}if(this.object instanceof tn&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=i.rotByTouch??"joystick",this.rotBy=i.rotBy??"keys",this.rotationMode=i.rotationMode??"normal",this.moveMode=i.moveMode??"walk",this.collisionEnabled=i.collisionEnabled,this.speedTranslate=1*(i.speedTranslate??250),this.speedOrbit=.025*(i.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(i.speedRotate??100),this.keyAssignments=i.keyAssignments.map(f=>{let g=[f[0],f[1]];return g[1]==="\u25B2"?g[1]="ArrowUp":g[1]==="\u25C0"?g[1]="ArrowLeft":g[1]==="\u25BC"?g[1]="ArrowDown":g[1]==="\u25B6"?g[1]="ArrowRight":g[1]==="\u21E7"?g[1]="Shift":g[1]==="\u21B5"?g[1]="Enter":g[1]==="Space"?g[1]=" ":g[1]==="\u2318"?g[1]="Meta":g[1]==="Ctrl"?g[1]="Control":g[1]==="Esc"&&(g[1]="Escape"),g}),i.rotBy==="mouse"){let f;f=this.keyAssignments.findIndex(g=>g[0]==="rotNegX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosY"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotNegY"),f!==-1&&(this.keyAssignments[f][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(i.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(i.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(i.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(i.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(i.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(i.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??$u.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??$u.defaultData.usePhysics,this.jumpPower=20*i.jumpPower,this.resetYPosition=this.position.y+Math.abs(i.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=i.alignToGround??!1,this.orientMode=i.autoOrientMove?i.orientMode:"none",this.orientWith=i.orientWith??F_.defaultDataThirdPerson.orientWith,this.slopeThresh=65*Math.PI/180,i.collider.type==="capsule"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=i.collider.height/2-i.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=i.collider.height*rM/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height):i.collider.type==="sphere"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*i.collider.radius*rM/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*rM/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new C().fromArray(i.collider.position.map(f=>typeof f=="number"?f:0)),u=new Yt().setFromEuler(new Ti().fromArray([...i.collider.rotation.map(f=>typeof f=="number"?f:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(u),this.collider.matrix.compose(d,u,wB),i.cameraXAxis!==void 0&&(this.cameraXAxis=i.cameraXAxis,this.cameraYAxis=i.cameraYAxis,this.minPolarAngle=i.cameraRotXLimits[0],this.maxPolarAngle=i.cameraRotXLimits[1],this.minAzimuthAngleRel=i.cameraRotYLimits[0],this.maxAzimuthAngleRel=i.cameraRotYLimits[1]),this.forwardDir=i.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=i.runMultiplier??2;let p=2*i.navmesh.destinationHelperRadius;if(p>0){let f=new Vt;f.push({fi:0,data:{...Qi.defaultData("light","phong"),alpha:0},id:"layer1"}),f.push({fi:0,data:{...Qi.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let g=Rk({layers:f},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new wi($C.create({parameters:{width:p,height:p/10,hollow:.7}}),g),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let e=new Ti().setFromQuaternion(this.quaternion,"YXZ"),i=e.y;this.objectRealQuat.copy(this.quaternion),e.y=0,this.quaternion.setFromEuler(e),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),e.set(0,i,0),this.quaternion.setFromEuler(e),this.rot.setFromEuler(e),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof tn?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let t=this.data,e=this.sharedAssets;t.gameActions!==void 0&&(this.actions={},N_.list.forEach(i=>{this.actions[i]=Rn({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),nr(this.actions.idle),nr(this.actions.move),nr(this.actions.run),nr(this.actions.jump)}dispatchStartEvent(t){this.actions[t]!==void 0&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(e=>{e.play()}),this.actions[t].Animation.forEach(e=>{e.play(this.initialAction===!1)}),this.actions[t].TimelineAnimation.forEach(e=>{e.play()}),this.actions[t].Create.forEach(e=>{e.dispatchStart()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("start")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("start")})))}dispatchStopEvent(t){this.actions[t]!==void 0&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(e=>{e.stop(),e.object.currentState!==null&&e.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].TimelineAnimation.forEach(e=>{e.stop()}),this.actions[t].Create.forEach(e=>{e.dispatchStop()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("stop")})))}get colliderWorldPosition(){return Er.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let e=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*e,n=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let a=Oo.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*e,0).divideScalar(this.pixelsPerMeter),s=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(s){this.onObject=!0,this.groundNormal.set(s.normal2.x,s.normal2.y,s.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(n=!0),s.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let o=s.collider.parent(),l=o!==null&&o.isKinematic()?o:null,c=l===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(l.handle);if(l!==null&&c?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition(Er).add(this.collider.position).divideScalar(this.pixelsPerMeter),d=l.velocityAtPoint(h);this.groundVelocity.set(d.x,d.y,d.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=l.angvel().y*e}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*i),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let a=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let s=Er.subVectors(this.path[1],this.position),o=Oo.subVectors(this.path[1],this.path[0]);s.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),a.opacity=a.userData.opacity0}else a.opacity-=.05*a.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**i),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**i),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**i)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let r=xJ.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let a=Oo.copy(r);a.y=0,r.set(0,r.y,a.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let a=Er;this.camera.getWorldDirection(a);let s=tu.copy(Vs).multiplyScalar(a.dot(Vs));a.sub(s);let o=Oo.copy(this.directionXZ);o.x*=-1,this.rot.y=a.angleTo(o)*(a.cross(o).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(eu.setFromVector3(this.rot),this.moveMode==="walk"&&(eu.x=0),r.applyEuler(eu),n&&(cc.setFromUnitVectors(Vs,this.groundNormal),r.applyQuaternion(cc)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let a=0;for(let s of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(s.rigidBody===void 0||s.prevQ===void 0)continue;(s.hasNonUniformScale?s.matrixWorldRigid:s.matrixWorld).decompose(sM,EB,EJ);let o=this.object.getWorldPosition(AJ).add(this.collider.position).sub(sM);AB.copy(s.prevQ).invert().premultiply(EB);let l=tu.subVectors(sM,s.prevT).add(TJ.copy(o).applyQuaternion(AB).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),c=s.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),Er.copy(r).divideScalar(this.pixelsPerMeter),0,e,!1);l.multiplyScalar(this.pixelsPerMeter);let h=Be.is(s)?s:s.object;if(c!==null&&this.lastHitObj!==h){let d;s instanceof ba&&(d=s);let u=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(u)for(let p of u)p.data.target==="character"&&(p.dispatch(d),h.dispatchEvent(MT));this.lastHitObj=h}c!==null&&(Math.abs(l.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=l.x),Math.abs(l.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=l.y),Math.abs(l.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=l.z),MB(a++).copy(c.normal1).applyQuaternion(s.quaternion))}if(a>0){for(let s=0;s<a;s++){let o=MB(s),l=o.dot(r);l<0&&r.addScaledVector(o,-l)}r.add(this.pushedVelocity)}else r.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(e),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**i):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**i),this.euler.x+=this.rotVelocity.x*e,this.euler.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*e),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(Vs,this.euler.y-this.euler0.y);let a=Oo.copy(this.objectToCamXZ).normalize(),s=tu.copy(r).multiplyScalar(e);s.y=0;let o=s.sub(Er.copy(a).multiplyScalar(s.dot(a))).cross(a).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=It.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=It.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=It.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(eu.copy(this.euler),eu.y=0,this.nonColliderRotOffset.makeRotationFromEuler(eu)),pa.setFromAxisAngle(SJ,this.rot.x),cc.setFromAxisAngle(Vs,this.rot.y),cc.multiply(pa),pa.setFromAxisAngle(MJ,this.rot.z),cc.multiply(pa),this.quaternion.copy(cc),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let a=Oo.copy(r).multiplyScalar(e/this.pixelsPerMeter),s=null;this.didHit=!1;let o=new C;for(let h=0;h<5;h++){let d=a.length(),u=tu.copy(a).normalize();if(s=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,u,this.object.rigidBody.collider(0).shape,0,d,!1,12,void 0,void 0,this.object.rigidBody),s===null){h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),o.add(a);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(s.collider.handle);if(p!==this.lastHitObj&&h===0){this.lastHitObj=p;let y=this.sharedGameControlGlobals.entityToCollisionEvents[p?.uuid];if(y){for(let v of y)if(v.data.target==="character"){let _,b=(this.sharedGameControlGlobals.rapierWorld?.getCollider(s.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===b){_=x;break}}v.dispatch(_),p.dispatchEvent(MT)}}}let f=_B.set(s.normal2.x,s.normal2.y,s.normal2.z).applyQuaternion(this.colliderWorldQuat),g=bB.copy(u).multiplyScalar(s.time_of_impact).dot(f),m=s.time_of_impact;if(m===0&&(this.position.y+=this.offset*this.pixelsPerMeter),g>this.offset&&(m=s.time_of_impact*(g-this.offset)/g,o.addScaledVector(u,m)),a.copy(u).multiplyScalar(d-m),Math.acos(-f.y)>this.slopeThresh){let y=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),v=tu.copy(s.witness2).applyQuaternion(this.colliderWorldQuat);v.y=0;let _=y.add(v);_.y+=this.stepThresh;let b=this.sharedGameControlGlobals.rapierWorld.castShape(_,this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);b!==null&&b.time_of_impact===0&&(f.y=0,f.normalize())}a.addScaledVector(f,-a.dot(f))}}this.position.addScaledVector(o,this.pixelsPerMeter),Er.copy(this.position).divideScalar(this.pixelsPerMeter),pa.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,c=l!==void 0&&CJ.copy(Er).sub(l.translation()).lengthSq()>1;l!==void 0&&(c?(l.setTranslation(Er,!0),l.setRotation(pa,!0)):(l.setNextKinematicTranslation(Er),l.setNextKinematicRotation(pa)))}else{let a=this.onObject?1:5,s=r.multiplyScalar(e/a);for(let o=0;o<a;o++)this.position.add(s),this.collisionAdjustment(e/a)}else this.position.addScaledVector(r,e);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let a=this.objectToTarget.add(this.position),s=this.targetToCamera.add(a);aM.lookAt(s,a,Vs).setPosition(s),aM.decompose(this.targetPos,this.targetQuat,Er),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**i),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**i),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=It.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=It.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(DJ),!(this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)||(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(PJ),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=pa.setFromAxisAngle(Vs,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?It.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e),t=this.cameraXAxis==="Limit"?It.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):It.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=Er.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(e);let n=cc.setFromAxisAngle(i,t);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(n)}groundTiltAdjustment(t){180*Vs.angleTo(t)/Math.PI<15||180*Vs.angleTo(t)/Math.PI>85?pa.identity():pa.setFromUnitVectors(Vs,t),this.groundTilt.slerp(pa,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=bB.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=aM.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Er,pa,Oo).compose(Er,pa,wB);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(r=>{if(r===this.object||r.isDescendantOf(this.object)||!r.bvhGeometry||!r.bvhGeometry.boundsTree)return;Ba.makeEmpty(),r.updateMatrixWorldRigid();let a=r.matrixWorldRigid,s=xB.copy(a).invert(),o=wJ.copy(xB).multiply(i);Kn.copy(this.collider.segment),Kn.start.applyMatrix4(o),Kn.end.applyMatrix4(o);let l=_B.copy(this.position).applyMatrix4(s);Ba.expandByPoint(Kn.start),Ba.expandByPoint(Kn.end),Ba.min.addScalar(-this.collider.radius),Ba.max.addScalar(this.collider.radius),r.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:c=>c.distanceToPoint(Kn.end),intersectsBounds:c=>c.intersectsBox(Ba),intersectsTriangle:c=>{let h=Er,d=Oo,u=c.closestPointToSegment(Kn,h,d);if(u<this.collider.radius){let p=this.collider.radius-u,f=d.sub(h).normalize(),g=tu.copy(l);g.addScaledVector(f,p);let m=g.applyMatrix4(a).sub(this.position);e.add(m),Kn.start.addScaledVector(f,p),Kn.end.addScaledVector(f,p)}}})}),Ba.makeEmpty(),Kn.copy(this.collider.segment),Kn.start.applyMatrix4(i),Kn.end.applyMatrix4(i),Ba.expandByPoint(Kn.start),Ba.expandByPoint(Kn.end),Ba.min.addScalar(-this.collider.radius),Ba.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:r=>r.distanceToPoint(Kn.end),intersectsBounds:r=>r.intersectsBox(Ba),intersectsTriangle:r=>{let a=Er,s=Oo,o=r.closestPointToSegment(Kn,a,s);if(o<this.collider.radius){let l=this.collider.radius-o,c=s.sub(a).normalize();this.alignToGround&&this.groundTiltAdjustment(c),e.addScaledVector(c,l),Kn.start.addScaledVector(c,l),Kn.end.addScaledVector(c,l)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let n=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(n),this.position.add(e)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},oj=ET;oj.isLocked=!1,rt(),Wg(),Ap(),Ep();var lj,hj,oM,RJ=new Promise(t=>{lj=t});function OJ(t){return oM||(oM=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.13/build";typeof window<"u"&&(hj=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[n,r]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(o=>o.arrayBuffer())]),a=n.default,s=await a({wasmBinary:r});lj(s)}(),oM)}ti();var cj,Ne,pr,IJ=t=>`
|
|
9850
9850
|
(async function() {
|
|
9851
9851
|
const [wasmImport, wasmBinary] = await Promise.all([
|
|
9852
9852
|
import('${t}' + 'navmesh.js'),
|
|
@@ -9856,7 +9856,7 @@ void main() {
|
|
|
9856
9856
|
self.module = await wasmModule({ wasmBinary });
|
|
9857
9857
|
postMessage('ready');
|
|
9858
9858
|
})();
|
|
9859
|
-
`,LJ={cs:6,ch:2,walkableSlopeAngle:90,walkableHeight:20,walkableClimb:5,walkableRadius:0,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};RJ.then(t=>{cj=t,Ne=new t.Vec3,pr=new t.Vec3});var BJ=new C,UJ=class{constructor(t=!1,e=!1){this.usePhysics=t,this.isExport=e,this.onPointerDown=i=>{if(se.length!==1)return;let{raycaster:n,page:r}=this.eventContext;this.eventContext.updateRaycaster(i);let a=r.raycastWithClones(n);if(a.length!==0){if(this.gameControl){let s=BJ.copy(this.gameControl.colliderWorldPosition);s.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(s,a[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,n)=>r=>{let a;if(r instanceof jc){if(!r.objectForSample)return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(r.objectForSample.dataPatched.physics.fusedBody)return;a=r.object}else if(r instanceof ba)a=r.object;else if(a=r,a.dataPatched.cloner?.disabled===!1&&a.dataPatched.cloner?.hideBase&&a.dataPatched.physics?.fusedBody!==!0)return!0;if(n&&!a.userData.navmesh)return;let s=a.dataPatched;if(!s.visible&&s.physics?.enabled!==!0)return!0;r.updateMatrixWorldRigid();let o=_b(s),l=a.userData.hasDestroy,c=a.userData.hasDrag,h=!1,d=!1;for(let u of s.events)u.data.disabled!==!0&&(u.data.type==="GameControl"?h=!0:u.data.type==="Follow"&&(d=!0));if(h||o||d||l||c)return!0;if(this.usePhysics&&s.physics?.rigidBody==="dynamic"){if(this.usePhysics&&s.physics?.fusedBody)return!0}else if("geometry"in r&&r.geometry&&i.push(jo(r.geometry,r.matrixWorld)),this.usePhysics&&s.physics?.fusedBody)return r.traverseObject((u,p)=>{if(p===0)return;let f;if(u instanceof jc){if(!u.objectForSample)return u.object.dataPatched.physics.fusedBody===!0&&u.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(u.objectForSample.dataPatched.physics.fusedBody)return;f=u.object}else if(u instanceof ba)f=u.object;else if(f=u,u.dataPatched.cloner?.hideBase)return!0;let g=f.dataPatched;if(!g.visible&&g.physics?.enabled!==!0)return!0;"geometry"in u&&u.geometry&&i.push(jo(u.geometry,u.matrixWorld))}),!0},this.traverseNoPhysics=(i,n)=>r=>{let a;if(r instanceof jc)return;a=r instanceof ba?r.object:r;let s=a.dataPatched;if(s.physics.enabled==="visibility"?!s.visible:!s.physics.enabled)return!0;if(n&&!a.userData.navmesh)return;let o=r.geometry,l=a.userData.hasDestroy===!0,c=a.userData.hasDrag===!0;if(_b(s)||l||c||a.dataPatched.events.some(h=>h.data.disabled!==!0&&h.data.type==="GameControl"))return!0;o&&i.push(jo(o,r.matrixWorld))},this.navmeshWasm=cj,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(e?IJ(hj??"https://cdn.spline.design/@splinetool/runtime@2.0.
|
|
9859
|
+
`,LJ={cs:6,ch:2,walkableSlopeAngle:90,walkableHeight:20,walkableClimb:5,walkableRadius:0,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};RJ.then(t=>{cj=t,Ne=new t.Vec3,pr=new t.Vec3});var BJ=new C,UJ=class{constructor(t=!1,e=!1){this.usePhysics=t,this.isExport=e,this.onPointerDown=i=>{if(se.length!==1)return;let{raycaster:n,page:r}=this.eventContext;this.eventContext.updateRaycaster(i);let a=r.raycastWithClones(n);if(a.length!==0){if(this.gameControl){let s=BJ.copy(this.gameControl.colliderWorldPosition);s.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(s,a[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,n)=>r=>{let a;if(r instanceof jc){if(!r.objectForSample)return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(r.objectForSample.dataPatched.physics.fusedBody)return;a=r.object}else if(r instanceof ba)a=r.object;else if(a=r,a.dataPatched.cloner?.disabled===!1&&a.dataPatched.cloner?.hideBase&&a.dataPatched.physics?.fusedBody!==!0)return!0;if(n&&!a.userData.navmesh)return;let s=a.dataPatched;if(!s.visible&&s.physics?.enabled!==!0)return!0;r.updateMatrixWorldRigid();let o=_b(s),l=a.userData.hasDestroy,c=a.userData.hasDrag,h=!1,d=!1;for(let u of s.events)u.data.disabled!==!0&&(u.data.type==="GameControl"?h=!0:u.data.type==="Follow"&&(d=!0));if(h||o||d||l||c)return!0;if(this.usePhysics&&s.physics?.rigidBody==="dynamic"){if(this.usePhysics&&s.physics?.fusedBody)return!0}else if("geometry"in r&&r.geometry&&i.push(jo(r.geometry,r.matrixWorld)),this.usePhysics&&s.physics?.fusedBody)return r.traverseObject((u,p)=>{if(p===0)return;let f;if(u instanceof jc){if(!u.objectForSample)return u.object.dataPatched.physics.fusedBody===!0&&u.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(u.objectForSample.dataPatched.physics.fusedBody)return;f=u.object}else if(u instanceof ba)f=u.object;else if(f=u,u.dataPatched.cloner?.hideBase)return!0;let g=f.dataPatched;if(!g.visible&&g.physics?.enabled!==!0)return!0;"geometry"in u&&u.geometry&&i.push(jo(u.geometry,u.matrixWorld))}),!0},this.traverseNoPhysics=(i,n)=>r=>{let a;if(r instanceof jc)return;a=r instanceof ba?r.object:r;let s=a.dataPatched;if(s.physics.enabled==="visibility"?!s.visible:!s.physics.enabled)return!0;if(n&&!a.userData.navmesh)return;let o=r.geometry,l=a.userData.hasDestroy===!0,c=a.userData.hasDrag===!0;if(_b(s)||l||c||a.dataPatched.events.some(h=>h.data.disabled!==!0&&h.data.type==="GameControl"))return!0;o&&i.push(jo(o,r.matrixWorld))},this.navmeshWasm=cj,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(e?IJ(hj??"https://cdn.spline.design/@splinetool/runtime@2.0.13/build/"):`
|
|
9860
9860
|
(async function() {
|
|
9861
9861
|
const [wasmImport, wasmBinary] = await Promise.all([
|
|
9862
9862
|
import(self.location.origin + '/_libraries/navmesh.js'),
|
|
@@ -9933,7 +9933,7 @@ onmessage = function(messageEvent) {
|
|
|
9933
9933
|
[${S1}] { pointer-events: none; }
|
|
9934
9934
|
[${S1}] > * { pointer-events: auto; }
|
|
9935
9935
|
[${S1}] [data-spline-passthrough] { pointer-events: none; }
|
|
9936
|
-
`,jj=class{constructor(t,e,i,n,r){this.container=t,this.host=e,this.observer=i,this.previousSplineGlobal=n,this.removeLateLifecycleShim=r}static mount(t,e,i,n){if(typeof document>"u")return null;let r=e.parentElement;if(!r)return null;getComputedStyle(r).position==="static"&&(r.style.position="relative");let a=document.createElement("div");a.setAttribute(S1,"");let s=a.style;s.position="absolute",s.overflow="hidden";let o=()=>{s.left=`${e.offsetLeft}px`,s.top=`${e.offsetTop}px`,s.width=`${e.offsetWidth}px`,s.height=`${e.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(e),l.observe(r);let c=document.createElement("style");c.textContent=Qet,a.appendChild(c);let h=new DOMParser().parseFromString(i,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let v of d)v.remove();for(let v of Array.from(h.head.children))(v.tagName==="STYLE"||v.tagName==="LINK"&&v.rel==="stylesheet")&&a.appendChild(v);for(;h.body.firstChild;)a.appendChild(h.body.firstChild);r.insertBefore(a,e.nextSibling);let u=new Map,p=new uC(kj(t,e,n),(v,_)=>{v==="warn"?console.warn(`[spline html] ${_}`):v==="error"&&console.error(`[spline html] ${_}`)},(v,_)=>{let b=u.get(v);if(b)for(let x of b)try{x(_)}catch(w){console.error(w)}}),f=(v,_)=>{try{return Promise.resolve(p.execute(v,_))}catch(b){return Promise.reject(b)}},g={ready:Promise.resolve(),setVariable:(v,_)=>f("setVariable",[v,_]),setVariables:v=>f("setVariables",[v]),getVariable:v=>f("getVariable",[v]),getVariables:()=>f("getVariables",[]),getAllObjects:()=>f("getAllObjects",[]),findObjectByName:v=>f("findObjectByName",[v]),findObjectById:v=>f("findObjectById",[v]),getGeometry:(v,_)=>f("getGeometry",[v,_??{}]),updateObject:(v,_)=>f("updateObject",[v,_]),createObject:(v,_)=>f("createObject",[v,_??{}]),createCustomMaterial:v=>f("createCustomMaterial",[v]),setMaterial:(v,_)=>f("setMaterial",[v,_]),cloneObject:(v,_)=>f("cloneObject",[v,_??{}]),removeObject:v=>f("removeObject",[v]),spawnObject:(v,_)=>f("spawnObject",[v,_??{}]),destroyObject:v=>f("destroyObject",[v]),setInstanceTransforms:(v,_)=>f("setInstanceTransforms",[v,_??null]),emitEvent:(v,_)=>f("emitEvent",[v,_]),emitEventReverse:(v,_)=>f("emitEventReverse",[v,_]),requestRender:()=>f("requestRender",[]),addEventListener:(v,_)=>{if(typeof _!="function")return;let b=u.get(v);b||(b=new Set,u.set(v,b),f("listenEvent",[v])),b.add(_)},removeEventListener:(v,_)=>{let b=u.get(v);!b||(b.delete(_),b.size===0&&(u.delete(v),f("unlistenEvent",[v])))}},m=window.spline;window.spline=g;let y=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let v=[],_=(x,w)=>{let S=new Set,T=x.addEventListener.bind(x),E=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(P,A,R)=>{if(T(P,A,R),!w.includes(P)||A==null)return;let O={type:P,listener:A};S.add(O),queueMicrotask(()=>{!S.delete(O)||((D,I,U)=>{let N=new Event(U);try{typeof I=="function"?I.call(D,N):I.handleEvent?.(N)}catch(G){console.error(G)}})(x,O.listener,O.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(P,A,R)=>{E(P,A,R);for(let O of S)O.type===P&&O.listener===A&&S.delete(O)}}),v.push(()=>{delete x.addEventListener,delete x.removeEventListener,S.clear()})};_(document,["DOMContentLoaded"]),_(window,["load"]);let b=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:x=>{typeof x=="function"&&queueMicrotask(()=>{try{x.call(window,new Event("load"))}catch(w){console.error(w)}})}}),v.push(()=>{b?Object.defineProperty(window,"onload",b):delete window.onload}),()=>{for(let x of v)x()}}();for(let v of d){let _=document.createElement("script");for(let b of Array.from(v.attributes))_.setAttribute(b.name,b.value);v.src?_.async=!1:_.textContent=v.textContent,a.appendChild(_)}return new jj(a,p,l,m,y)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};function Gj(t){return typeof t=="object"&&t!==null&&t.isMaterial===!0}function IU(t){if(typeof t.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!Gj(t.material))return{options:t};let e=t.material;if(e.isNodeMaterial===!0){let i=Ok()?.NodeMaterial;if(i!==void 0&&e instanceof i)return{options:{...t,material:void 0},material:e};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(e.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...t,material:void 0},material:e}}te(),Ye(),rt(),Ck(),xs(),Ye(),te(),KX(),Eh();var Jet=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),LU="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",tit={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},eit={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},iit={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data \u2014 clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime \u2014 clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto \u2014 clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame \u2014 clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor \u2014 clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},nit={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},rit={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function Vg(t,e){return t===void 0?[e[0],e[1],e[2]]:Array.isArray(t)?[t[0]??e[0],t[1]??e[1],t[2]??e[2]]:[t.x??e[0],t.y??e[1],t.z??e[2]]}function Hj(t){return typeof t=="number"?[t,t,t]:Vg(t,[1,1,1])}function $T(t){let e=new vn(0,0,0,1);return e.setStyle(t),{r:e.r,g:e.g,b:e.b}}function BU(t,e){let i=t.material??(t.color!==void 0?{color:t.color}:void 0);if(i===void 0)return Vi.defaultColorMaterial(UU(Rr),"physical","layer1","layer2");if(typeof i=="string"){for(let[s,o]of Object.entries(e.shared.materials))if(s===i||o.name===i)return s;if(function(s){let o=s.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||Jt.NAMES[o]!==void 0}(i))return Vi.defaultColorMaterial($T(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(s){let o=Object.entries(s.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(e)}) and is not a valid CSS color.`)}if(typeof i=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(Gj(i))throw new Error("createObject: a three.js material instance cannot be stored in the document \u2014 this entry point does not support it.");let n=i.color!==void 0?$T(i.color):UU(Rr),r=Vi.defaultColorMaterial(n,"physical","layer1","layer2"),a=r.layers.find(s=>s.data.type==="light");if(a){let s={};i.roughness!==void 0&&(s.roughness=i.roughness),i.metalness!==void 0&&(s.metalness=i.metalness),i.reflectivity!==void 0&&(s.reflectivity=i.reflectivity),Object.assign(a.data,s)}if(i.alpha!==void 0){let s=r.layers.find(o=>o.data.type==="color");s&&Object.assign(s.data,{alpha:i.alpha})}return r}function UU(t){return{r:(t>>16&255)/255,g:(t>>8&255)/255,b:(255&t)/255}}function ait(t){let e=Wo.defaultData("TextGeometry"),{text:i,...n}=t,r=n.fontSize;return r!==void 0&&n.width===void 0&&(n.width=350*r/16),r!==void 0&&n.height===void 0&&(n.height=50*r/16),Object.assign(e,n),i!==void 0&&Object.assign(e,{text:{textValue:String(i)}}),e}function Oy(t){return Array.isArray(t)?t:!ArrayBuffer.isView(t)||t instanceof DataView?null:Array.from(t)}function sit(t,e){return mF({userData:{type:t,...RA[t].normalizeInputs({parameters:e})}})}function oit(t,e,i){let{objectType:n,geometryType:r}=t,a=function(l){let c={};for(let[h,d]of Object.entries(l))!Jet.has(h)&&d!==void 0&&(c[h]=d);return c}(e),s={states:new Vt,events:new Vt,timelineAnimations:new $t};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=function(h){let d=Oy(h.vertices);if(!d||d.length<9||d.length%3!=0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let u=d.length/3;if(u>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${u}); keep it under 60000.`);let p=Oy(h.indices);if(p&&p.length){let _=p.find(b=>!Number.isInteger(b)||b<0||b>=u);if(_!==void 0)throw new Error(`createObject('CustomMesh'): index ${_} is out of range (mesh has ${u} vertices).`)}else p=null;let f=new Gt;f.setAttribute("position",new Ft(d,3));let g=Oy(h.normals),m=g!==null&&g.length===d.length;m&&f.setAttribute("normal",new Ft(g,3));let y=Oy(h.uvs);y&&y.length===2*u&&f.setAttribute("uv",new Ft(y,2));let v=!1;if(!m){let _=p??Array.from({length:u},(w,S)=>S),{closed:b,inverted:x}=function(w,S){let T=w.length/3,E=new Map,P=new Array(T);for(let D=0;D<T;D++){let I=`${Math.round(1e4*w[3*D])},${Math.round(1e4*w[3*D+1])},${Math.round(1e4*w[3*D+2])}`,U=E.get(I);U===void 0?(E.set(I,D),P[D]=D):P[D]=U}let A=new Map;for(let D=0;D+2<S.length;D+=3){let I=P[S[D]],U=P[S[D+1]],N=P[S[D+2]];for(let[G,H]of[[I,U],[U,N],[N,I]]){if(G===H)continue;let J=G<H?G+"_"+H:H+"_"+G;A.set(J,(A.get(J)??0)+1)}}let R=A.size>0;for(let D of A.values())if(D!==2){R=!1;break}if(!R)return{closed:!1,inverted:!1};let O=0;for(let D=0;D+2<S.length;D+=3){let I=3*S[D],U=3*S[D+1],N=3*S[D+2],G=w[I],H=w[I+1],J=w[I+2],K=w[U],tt=w[U+1],ct=w[U+2],et=w[N],st=w[N+1],dt=w[N+2];O+=G*(tt*dt-ct*st)+H*(ct*et-K*dt)+J*(K*st-tt*et)}return{closed:!0,inverted:O<0}}(d,_);if(b&&x){for(let w=0;w+2<_.length;w+=3){let S=_[w+1];_[w+1]=_[w+2],_[w+2]=S}p=_}else b||(v=!0)}return p&&f.setIndex(p),m||f.computeVertexNormals(),{geometry:mF({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:f.toJSON().data}),doubleSide:v}}(a);Object.assign(s,Ws.defaultData,{geometry:l,materials:[BU(e,i)]}),c&&(s.side=2)}else Object.assign(s,Ws.defaultData,{geometry:r==="TextGeometry"?ait(a):sit(r,a),material:BU(e,i)});e.castShadow!==void 0&&(s.castShadow=e.castShadow),e.receiveShadow!==void 0&&(s.receiveShadow=e.receiveShadow)}else n==="Empty"?Object.assign(s,L_.defaultData):(Object.assign(s,B_.defaultData(n),a),e.color!==void 0&&(s.color=$T(e.color)));s.visible=e.visible??!0,s.position=Vg(e.position,[0,0,0]),s.rotation=Vg(e.rotation,[0,0,0]),s.scale=Hj(e.scale);let o=(r&&nit[r])??rit[n]??n;return s.name=e.name??Wj(o,i.scene.objects),s}function Wj(t,e){let i=new Set;if(e.traverse((r,a)=>{i.add(a.name??"")}),!i.has(t))return t;let n=2;for(;i.has(`${t} ${n}`);)n++;return`${t} ${n}`}function qj(t,e){let i=It.generateUUID();if(t.data.type==="Component")return{data:{...tl.fromComponentData(t),name:t.data.name+" Instance"},id:i,fi:t.fi,children:[]};e[t.id]=i;let n=t.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:n.animations.map(([r,a,s])=>{let o=It.generateUUID(),l=s.indexOf(r);return[o,a,l!==-1?s.slice(0,l)+o+s.slice(l+r.length):s]})}),{...t,id:i,data:n,children:t.children.map(r=>qj(r,e))}}function lit(t){let e={};return function(i,n){return Hu(i,n,null)??i}(qj(t,e),e)}function hit(t){let e=Array.isArray(t)?t[0]:t,i=e.layers?.map(cit)??[],n=e.layers?.find(r=>r.type==="light");return{layers:i,alpha:n?.node.alphaOverride?.value??1}}function cit(t){return t.type==="texture"||t.type==="video"||t.type==="matcap"?{...t.data,updateTexture:e=>t.color.texture.image.updateSrc(e)}:{...t.data}}Eh(),Ui(),WC(),xs();var cm=new vn(0,0,0,1),dit={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]};te(),te();var uit=new at;function zU(t){let e=new vn(0,0,0,1);try{e.setStyle(t)}catch(i){console.error(i)}return e}var Xj=class{constructor(t,{renderOnDemand:e,renderMode:i="auto",wasmPath:n,renderer:r,htmlContentMode:a="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=s=>{if(this.time=s,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<yF?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),qc(o)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&o.warnClassicFallbackOnce(),o.isSimulating&&(o.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let o=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=o,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=s=>{if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=uit.set(this._viewportWidth,this._viewportHeight)),s){let o=this._viewportWidth,l=this._viewportHeight;this._renderer.setSize(o-1,l-1,!1),this._renderer.setSize(o,l,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);if(this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera){let o=Object.values(this._data?.frames??{})[0].preset??"fullscreen";this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(o!=="fullscreen"),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()}this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=Tg(this._resize,10),this._onScroll=s=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=t,this._htmlContentMode=a,this.renderMode=e?"auto":i,n!==void 0&&(this._wasmPath=function(s){let o=s.length;for(;o>0&&"/".includes(s[o-1]);)o--;return s.slice(0,o)}(n)),this._rendererBackend=r??"webgl",r===void 0){let s=null;try{s=new URLSearchParams(window.location.search).get("renderer")}catch{}s==="webgpu"||s==="webgl"||s==="webgl2"?this._rendererBackend=s==="webgl2"?"webgl":s:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(kY(),O6)).then(({Perfs:s})=>{this._perfs=new s({x:10,y:10})}),function(s){s.addEventListener("pointerdown",HR,!0),s.addEventListener("pointerdown",J0,!0),s.addEventListener("pointermove",J0,!0),s.addEventListener("pointerup",Od,!0),s.addEventListener("pointercancel",Od,!0),s.addEventListener("pointerleave",Od,!0),window.addEventListener("keydown",WR,!0),window.addEventListener("keyup",qR,!0)}(t)}async _createRenderer(){this._rendererBackend,this._rendererBackend;{let{SplineRenderer:t,rendererGlobals:e}=await Promise.resolve().then(()=>(a5(),dT));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(e.taaEnabled.value=!1)}catch{}return new t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=i*t;let n=this.canvas.getContext("2d");n&&(n.scale(t,t),n.fillStyle="rgba(127, 127, 127, 0.85)",n.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",n.textAlign="center",n.textBaseline="middle",n.fillText("This scene requires a WebGPU-capable browser.",e/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,i){(function(r){let a="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";r.endsWith(".spline")?console.warn(a+" The .spline files are only meant to be used by the Editor."):r.endsWith(".splinecode")||console.warn(a)})(t),this.disposed=!1;let n=await(await fetch(t,i)).arrayBuffer();await this.start(n,{variables:e})}async start(t,{interactive:e=!0,variables:i}={}){if(this.disposed)return;fh.init();let n=await async function(u){let[p,f]=Em(Cg.deserialize(new Uint8Array(u)));if((p.schema??0)!==130){let{updateDocumentSchema:g}=await Promise.resolve().then(()=>(Hb(),hF));g(p)}return f.result().data}(t);this._data=n;let r=function(u){let p=[];return u.scene.objects.traverse((f,g)=>{g.type==="Mesh"&&g.geometry.type==="NonParametricGeometry"&&g.geometry.data.draco!==void 0&&p.push(g)}),p}(n);n.version&&(0,Zet.default)(n.version,"2.0.12")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),function(u){QA=u}(this._wasmPath));let a=async function(){}();await Promise.all([a,r.length&&DU(this._wasmPath),q4(n)&&n$(this._wasmPath),j$(n)&&L$(this._wasmPath),up.physicsEnabled(n.scene.objects)&&gJ(this._wasmPath),JI(n)&&hB(),eL(n)&&lY(),p$(n)&&u$(),eB(n)&&a.then(()=>oA()?.loadHanaUIRUNTIME()),hJ(n)&&OJ(this._wasmPath)].filter(Boolean)),r.length&&await RU(r),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let s=n.scene.publish.renderer;if(this._rendererAuto&&s==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&s==="webgpu")return void this._failWebGPURequired();let o=function(u){let p=new Set;return u.scene.objects.traverse((f,g)=>{if(g.type!=="Page")return;let m=g.postprocessing;if(m&&typeof m=="object"&&m.enabled===!0)for(let[y,v]of Object.entries(m))y!=="enabled"&&v&&typeof v=="object"&&v.enabled===!0&&p.add(y)}),[...p]}(n);this._rendererBackend,this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(a5(),dT)),Yet(o)]),function(u){ex=u}((this._rendererBackend,"webgl"));let l=new Het(n);if(l.resetPersonalCameraFromDocumentData(),this._scene=l.scene,this._sharedAssetsManager=l.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:u}=await Promise.resolve().then(()=>(xK(),fV)),p=performance.now();u(n,l.scene);let f=performance.now();console.log("Merged geometries in ",f-p," ms")}q4(n)&&this._scene.traverse(u=>{io(u)&&u.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(u=>{Bu(u)&&u.pendingMediaLoad&&u.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(u=>{u.type==="ParticleSystem"&&(u.wakeUp(),u.data.autoPlay?u.start():u.stop()),qc(u)&&u.setPlayMode(!0)});let c=Object.keys(n.shared.fonts).map(u=>this._sharedAssetsManager.getFont(u).loadingPromise);if(Promise.all(c).then(()=>{this.disposed||(l.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),JI(n)&&function(u){if(up.physicsEnabled(u.scene.objects))return!0;let p=!1;return u.scene.objects.traverse((f,g)=>{if(g.events){if(Array.isArray(g.events)){for(let m of g.events)if(m.data.disabled!==!0&&m.data.type==="GameControl"&&m.data.collisionEnabled){p=!0;break}}else for(let m of Object.values(g.events))if(m.disabled!==!0&&m.type==="GameControl"&&m.collisionEnabled){p=!0;break}}}),p}(n)&&await Promise.all(c),eB(n)){let u=[];this._scene.traverseEntity(p=>{(Cr(p)||p instanceof pn)&&p.uiCanvas&&u.push(p.uiCanvas)}),await Promise.all(u.map(p=>p.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),G3(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=n.scene.publish.hdTransmission===!0;let u=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),p=this._getPixelRatio(u()?n.scene.publish.settings.web.pixelRatioMobile:n.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(p),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),n.shared.images.SplineWatermark){let f=this._sharedAssetsManager.getImage("SplineWatermark");await f.loadPromise;let g=f.getTexture(1001);this._renderer.pipeline.setWatermark(g)}}eL(n)&&this._scene.initializeSplatViewer(),n.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(n.scene.blueNoiseTextureData);let h=Object.values(n.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(h.preset==="fullscreen"?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=h.size[0],this._viewportHeight=h.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new iQ(this._renderer,this._camera,new at(this._viewportWidth,this._viewportHeight),new at(window.innerWidth,window.innerHeight)),this._frameView.enableResponsive=(h.allowResponsive??!1)&&h.preset==="fullscreen"),e){let u=new BK(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,h);this._scene.updateMatrixWorld(!0),this._controls=new bJ(u),this._animationControls=new Xet(this._scene,this._requestRenderAutoMode),this._eventManager=new ZK(n.scene.publish,this._controls,this._animationControls,u,n.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),i!==void 0&&this.setVariables(i),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0;let d=n.scene.publish.htmlContent?.html;if(e&&d&&this._htmlContentMode!=="none"){let u={shared:this._sharedAssetsManager,findEntity:p=>this._scene?.getObjectByProperty("uuid",p)??this._scene?.getObjectByName(p)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?jj.mount(this,this.canvas,d,u):Vj.mount(this,this.canvas,d,u))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[i,n]of e)this.setVariable(i,n)}}setVariable(t,e){let i=this._getVariableByName(t);if(i&&!("dynamicVariableType"in i.data)){let n=e;typeof i.data.value=="number"?n=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e):typeof i.data.value=="boolean"?n=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()!=="false"&&!!e:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(n=e.toString());let r=typeof n=="string"?{textValue:n}:n;this._sharedAssetsManager?.updateVariable(i.id,r),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let i=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(i)}}_getVariableValue(t){return typeof t!="string"&&br.isTextValue(t)?br.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(i=>i.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(!(e.uuid===Qc||this._scene.isInvisibleObjects(e)||e instanceof pn)){let i=this._createProxyObject(e);i&&t.push(i)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof DV&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=zU(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,lg&&lg.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{D2.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,function(t){t.removeEventListener("pointerdown",HR,!0),t.removeEventListener("pointerdown",J0,!0),t.removeEventListener("pointermove",J0,!0),t.removeEventListener("pointerup",Od,!0),t.removeEventListener("pointercancel",Od,!0),t.removeEventListener("pointerleave",Od,!0),window.removeEventListener("keydown",WR,!0),window.removeEventListener("keyup",qR,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),fh.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e,i=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);t.traverseAncestors(h=>{h instanceof pn&&(e=h.name)});let n=this._sharedAssetsManager,r={shared:n,scene:this._scene},a=h=>{if(h===null||h==="Base State")return null;if(h&&t.data.states){let d=t.data.states.find(u=>u.data.name===h);return d?d.id:void 0}},s="material"in t?t.material:void 0,o=t.materialOverride,l={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:e,material:o??(s?hit(s):void 0),parentUuid:t.parent instanceof pn||t instanceof lx?void 0:t.parent?.uuid,emitEvent(h){t.dispatchEvent({type:"userEvent",eventName:h})},emitEventReverse(h){t.dispatchEvent({type:"userEvent",eventName:h,reverse:!0})},hide(){t.visible&&(t.visible=!1,r.shared.requestRender())},show(){t.visible||(t.visible=!0,r.shared.requestRender())},get state(){let h=t.stateSelection;if(h!==null)return t.data.states.find(({id:d})=>d===h)?.data.name},set state(h){let d;if(h!==void 0){let u=typeof h=="string"?t.data.states.find(({id:p})=>p===h):t.data.states[h];if(u)d=u.id;else{let p=typeof h=="string"?a(h):void 0;p&&(d=p)}}t.changeSelectedState(d??null,r),t.currentState=d??null,t.dispatchEvent({type:"completeState",state:d??null}),r.shared.requestRender()},transition(h){let d=Fj;if(d===null)return Gn("transitions","obj.transition()"),{transition(m){return this},play(){return this},pause(){return this},reset(){return this},seek(m){return this}};let u,p=this,f=fh.timeline({autoplay:h.autoPlay??!0}),g={transition({from:m,to:y,duration:v,delay:_,...b}){let x=a(m);x===void 0&&(x=u);let w=a(y);u=w;let S=new d(t,x,w,{state:w,repeat:0,delay:_??0,delayDirection:"start-once",direction:"normal",duration:v??1e3,...b,...b.easing===6?b_.defaultData:b.easing===5?x_.defaultData:{}},n,!1,i.activePage);return f.add({...S.params,begin:()=>{(m&&x||m==="Base State"&&!x)&&(p.state=x??void 0)},complete:()=>{p.state=w??void 0}},f.duration),this},play(){return f.play(),this},pause(){return f.pause(),this},reset(){return f.reset(),this},seek(m){return f.seek(m),this}};return g.transition(h),g},set color(h){let d=zU(h);if(tb.is(t))return void(t.color=d);if(!(t.type==="Mesh"&&"material"in t&&t instanceof Hr))return;let u={r:d.r,g:d.g,b:d.b,a:d.a},p=t.materialOverride;if(p!==void 0){let m=p.color;return void(m?.isColor===!0&&typeof m.setStyle=="function"&&(m.setStyle(h),r.shared.requestRender()))}let f=Array.isArray(t.material)?t.material[0]:t.material,g=f.data.layers.find(m=>m.data.type==="color")?.id;if(g)f.updateByOp({type:0,path:["layers",g],props:{color:{...u}}},f.data,r);else{let m=f.data,y=m.layers.find(S=>S.data.type==="light");if(!y)return;let v=m.layers.indexOf(y)===0?y:null,_=m.layers.at(v?m.layers.indexOf(v)+1:0),b={type:4,fi:v?v.fi+(_?(_.fi-v.fi)/2:1):_?_.fi/2:1,id:It.generateUUID(),data:{...Qi.defaultData("color"),color:u},localIndex:0},x=m.layers.insertAfterHelper(v?.id??null,1),w=m.layers.runOp({...b,fi:x[0]}).data;Object.assign(f.data,{layers:w}),f.updateByOp({...b,path:["layers"]},f.data,r)}}},c=D2(l,(h,d)=>{let u=t[h],p=function(f){return f.split(".")}(h);p[0]==="material"&&s&&o===void 0&&function(f,g,m){let y=Array.isArray(m)?m[0]:m;if(f[0]==="layers"){let v=parseInt(f[1]),_=y.layers[v],b=f[2];_&&b&&function(x,w,S){let T=x[0];try{if(function(E,P){return!!dit[P]?.includes(E)}(T,S.type,x.slice(1)))if(T==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let E=parseInt(x[1]),P=S.getValue(T)?.[E];if(!P)throw new Error("Color index out of range");cm.setStyle(w),P.set(cm.r,cm.g,cm.b,cm.a)}else S.getValue(T)?.setStyle(w);else if(T==="texture"||T==="video"){let E=S.color;(function(P,A,R,O){let D=P[0];if(D==="repeat"||D==="offset"||D==="rotation"){let I=O.getNode("mat"),U=I&&typeof I.updateMatrix=="function"?I:O.getValue("mat");if(!U)return;if(D==="rotation")U.rotation=parseFloat(A);else{let N=P[1];if(N===void 0)A instanceof Array&&A.length===2&&Object.assign(U,{[D]:A});else{let G=U[D],H=parseInt(N)===0?[parseFloat(A),G[1]]:[G[0],parseFloat(A)];Object.assign(U,{[D]:H})}}U.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?R.texture.wrap=A:R.texture[D]=A:D==="image"&&P[1]==="data"&&R.texture.image.updateSrc(A)})(x.slice(1),w,E,S)}else{let E=x[1],P=S.getValue(T);P?.isVector3&&E!==void 0||P?.isVector2&&E!==void 0?P.setComponent(parseInt(E),w):S.setValue(T,w)}}catch(E){console.error("Error setting material value",E)}}(f.slice(2),g,_)}else f[0]==="alpha"&&y.layers.forEach(v=>{v.type==="light"&&v.node.alphaOverride!==void 0&&(v.node.alphaOverride.value=g,g<1&&(y.transparent=!0))})}(p.slice(1),d,s),typeof u!="object"&&Object.getOwnPropertyDescriptor(t,h)?.writable&&(t[h]=d),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,c),c}setUIWasmUrl(t){(function(e){G_=e,qb?.setHanaUIWasmUrl(e)})(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let i;if(typeof e=="string"){if(!e.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(e)).arrayBuffer();i=new Uint8Array(l)}}else i=e;let n=Cg.deserialize(i),r="data"in n&&n.data.draco!==void 0;r&&await DU(this._wasmPath);let a=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!a)return void console.warn(`Object ${t} not found`);if(a.data.type!=="Mesh"||!(a instanceof Hr))return void console.warn(`Object ${t} is not a mesh`);let s=a,o={...s.data,geometry:n};r&&await RU([o]),s.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let l of s.data.states){let c={...l.data};s.states||(s.states={}),s.states[l.id]=th.patch(o,c)}return i}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let i=e.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,i=this._findEntity(e);if(!i)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=Ok();if(e===void 0&&e===void 0)throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let i=t(e);if(typeof i!="object"||i===null||i.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return i}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let i=this._scene;if(!i)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let n=typeof t=="string"?t:t.uuid,r=this._findEntity(n);if(!r)throw new Error(`setMaterial: '${n}' \u2014 no object with that name or uuid in the scene.`);if(!(r instanceof Hr))throw new Error(`setMaterial: '${n}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let a=typeof e=="function"?await this.createCustomMaterial(e):e;if(Q_()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let s=IU({material:a});if(s.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return r.setMaterialOverride(s.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(r.uuid),this._requestRenderAutoMode(),s.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let r=function(m){if(typeof m!="string"||m.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${LU}.`);let y=m.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),v=eit[y];if(v)return{objectType:v};let _=tit[y];if(_)return{objectType:"Mesh",geometryType:_};let b=iit[y];throw b?new Error(`createObject: '${m}' is not supported \u2014 ${b}`):new Error(`createObject: '${m}' is not a creatable Spline type \u2014 use one of ${LU}, e.g. createObject('Cube', { width: 200 }).`)}(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let a,s,{options:o,material:l}=IU(e);if(l!==void 0){if(r.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(Q_()!=="webgpu")throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}if(r.geometryType==="TextGeometry"){if(!BC.has("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature \u2014 re-export the scene with a Text object present, or load the full runtime build.");if(await hB(),s=e.font??Su,n.shared.fonts[s]===void 0){if(s!==Su){let m=Object.keys(n.shared.fonts).join(", ");throw new Error(`createObject: font '${s}' is not in this document \u2014 available fonts: ${m||"(none)"}.`)}a={name:Su,url:XN}}}let c=this._resolveParentId(e.parent),h=oit(r,o,n),d=It.generateUUID(),[u,p]=Em(n);a&&(u.shared.fonts[Su]=a),u.scene.objects.insertAfter(c,null,[{id:d,data:h,children:[]}]);let f=p.result();if(a&&this._sharedAssetsManager.addFont(Su,a),s!==void 0){let m=this._sharedAssetsManager.getFont(s);m&&await m.loadingPromise}this._applyDocumentTransaction(f);let g=i.find(d);return l!==void 0&&g.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(g)}cloneObject(t,e={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t?.uuid,a=r?this._findEntity(r):void 0;if(!a)throw new Error(`cloneObject: '${r}' \u2014 no object with that name or uuid in the scene.`);if(a instanceof pn)throw new Error("cloneObject: pages cannot be cloned.");let s=n.scene.objects.get(a.uuid);if(!s)throw new Error(`cloneObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let o=function(p,f,g){let m={...p.data};return f.position!==void 0&&(m.position=Vg(f.position,[0,0,0])),f.rotation!==void 0&&(m.rotation=Vg(f.rotation,[0,0,0])),f.scale!==void 0&&(m.scale=Hj(f.scale)),f.visible!==void 0&&(m.visible=f.visible),m.name=f.name??Wj(`${p.data.name??"Object"} Copy`,g),{...p,data:m}}(lit(s),e,n.scene.objects),l=e.parent!==void 0?this._resolveParentId(e.parent):n.scene.objects.parent(a.uuid)??null,c=e.parent!==void 0?null:a.uuid,[h,d]=Em(n);h.scene.objects.insertAfter(l,c,[o]),this._applyDocumentTransaction(d.result());let u=i.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(u)}removeObject(t){let e=this._scene,i=this._data;if(this.disposed||!e||!i)return!1;let n=typeof t=="string"?t:t?.uuid,r=n?this._findEntity(n):void 0;if(!r)return!1;if(r instanceof pn)throw new Error("removeObject: pages cannot be removed.");if(r.data.type==="PerspectiveCamera"||r.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(r.uuid)===void 0)throw new Error(`removeObject: '${n}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let a=[];r.traverseEntity(l=>{a.push(l.uuid)});let[s,o]=Em(i);s.scene.objects.delete(r.uuid),this._applyDocumentTransaction(o.result());for(let l of a){let c=this._proxyObjectCache.get(l);c&&(D2.unsubscribe(c),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var _x=window,bx=_x.ShadowRoot&&(_x.ShadyCSS===void 0||_x.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Q3=Symbol(),$j=new WeakMap,e0=class{constructor(e,i,n){if(this._$cssResult$=!0,n!==Q3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=i}get styleSheet(){let e=this.o,i=this.t;if(bx&&e===void 0){let n=i!==void 0&&i.length===1;n&&(e=$j.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&$j.set(i,e))}return e}toString(){return this.cssText}},Yj=t=>new e0(typeof t=="string"?t:t+"",void 0,Q3),J3=(t,...e)=>{let i=t.length===1?t[0]:e.reduce((n,r,a)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[a+1],t[0]);return new e0(i,t,Q3)},tP=(t,e)=>{bx?t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):e.forEach(i=>{let n=document.createElement("style"),r=_x.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=i.cssText,t.appendChild(n)})},xx=bx?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(let n of e.cssRules)i+=n.cssText;return Yj(i)})(t):t;var eP,wx=window,Zj=wx.trustedTypes,pit=Zj?Zj.emptyScript:"",Kj=wx.reactiveElementPolyfillSupport,nP={toAttribute(t,e){switch(e){case Boolean:t=t?pit:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},Qj=(t,e)=>e!==t&&(e==e||t==t),iP={attribute:!0,type:String,converter:nP,reflect:!1,hasChanged:Qj},rP="finalized",pl=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((i,n)=>{let r=this._$Ep(n,i);r!==void 0&&(this._$Ev.set(r,n),e.push(r))}),e}static createProperty(e,i=iP){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(e,i),!i.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,r=this.getPropertyDescriptor(e,n,i);r!==void 0&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,i,n){return{get(){return this[i]},set(r){let a=this[e];this[i]=r,this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||iP}static finalize(){if(this.hasOwnProperty(rP))return!1;this[rP]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,n=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let r of n)this.createProperty(r,i[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let i=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)i.unshift(xx(r))}else e!==void 0&&i.push(xx(e));return i}static _$Ep(e,i){let n=i.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(i=>i(this))}addController(e){var i,n;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var e;let i=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return tP(i,this.constructor.elementStyles),i}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostConnected)===null||n===void 0?void 0:n.call(i)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostDisconnected)===null||n===void 0?void 0:n.call(i)})}attributeChangedCallback(e,i,n){this._$AK(e,n)}_$EO(e,i,n=iP){var r;let a=this.constructor._$Ep(e,n);if(a!==void 0&&n.reflect===!0){let s=(((r=n.converter)===null||r===void 0?void 0:r.toAttribute)!==void 0?n.converter:nP).toAttribute(i,n.type);this._$El=e,s==null?this.removeAttribute(a):this.setAttribute(a,s),this._$El=null}}_$AK(e,i){var n;let r=this.constructor,a=r._$Ev.get(e);if(a!==void 0&&this._$El!==a){let s=r.getPropertyOptions(a),o=typeof s.converter=="function"?{fromAttribute:s.converter}:((n=s.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?s.converter:nP;this._$El=a,this[a]=o.fromAttribute(i,s.type),this._$El=null}}requestUpdate(e,i,n){let r=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Qj)(this[e],i)?(this._$AL.has(e)||this._$AL.set(e,i),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):r=!1),!this.isUpdatePending&&r&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((r,a)=>this[a]=r),this._$Ei=void 0);let i=!1,n=this._$AL;try{i=this.shouldUpdate(n),i?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var a;return(a=r.hostUpdate)===null||a===void 0?void 0:a.call(r)}),this.update(n)):this._$Ek()}catch(r){throw i=!1,this._$Ek(),r}i&&this._$AE(n)}willUpdate(e){}_$AE(e){var i;(i=this._$ES)===null||i===void 0||i.forEach(n=>{var r;return(r=n.hostUpdated)===null||r===void 0?void 0:r.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((i,n)=>this._$EO(n,this[n],i)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};pl[rP]=!0,pl.elementProperties=new Map,pl.elementStyles=[],pl.shadowRootOptions={mode:"open"},Kj?.({ReactiveElement:pl}),((eP=wx.reactiveElementVersions)!==null&&eP!==void 0?eP:wx.reactiveElementVersions=[]).push("1.6.3");var aP,Sx=window,Ip=Sx.trustedTypes,Jj=Ip?Ip.createPolicy("lit-html",{createHTML:t=>t}):void 0,oP="$lit$",Ph=`lit$${(Math.random()+"").slice(9)}$`,s9="?"+Ph,fit=`<${s9}>`,ad=document,n0=()=>ad.createComment(""),r0=t=>t===null||typeof t!="object"&&typeof t!="function",o9=Array.isArray,mit=t=>o9(t)||typeof t?.[Symbol.iterator]=="function",sP=`[
|
|
9936
|
+
`,jj=class{constructor(t,e,i,n,r){this.container=t,this.host=e,this.observer=i,this.previousSplineGlobal=n,this.removeLateLifecycleShim=r}static mount(t,e,i,n){if(typeof document>"u")return null;let r=e.parentElement;if(!r)return null;getComputedStyle(r).position==="static"&&(r.style.position="relative");let a=document.createElement("div");a.setAttribute(S1,"");let s=a.style;s.position="absolute",s.overflow="hidden";let o=()=>{s.left=`${e.offsetLeft}px`,s.top=`${e.offsetTop}px`,s.width=`${e.offsetWidth}px`,s.height=`${e.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(e),l.observe(r);let c=document.createElement("style");c.textContent=Qet,a.appendChild(c);let h=new DOMParser().parseFromString(i,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let v of d)v.remove();for(let v of Array.from(h.head.children))(v.tagName==="STYLE"||v.tagName==="LINK"&&v.rel==="stylesheet")&&a.appendChild(v);for(;h.body.firstChild;)a.appendChild(h.body.firstChild);r.insertBefore(a,e.nextSibling);let u=new Map,p=new uC(kj(t,e,n),(v,_)=>{v==="warn"?console.warn(`[spline html] ${_}`):v==="error"&&console.error(`[spline html] ${_}`)},(v,_)=>{let b=u.get(v);if(b)for(let x of b)try{x(_)}catch(w){console.error(w)}}),f=(v,_)=>{try{return Promise.resolve(p.execute(v,_))}catch(b){return Promise.reject(b)}},g={ready:Promise.resolve(),setVariable:(v,_)=>f("setVariable",[v,_]),setVariables:v=>f("setVariables",[v]),getVariable:v=>f("getVariable",[v]),getVariables:()=>f("getVariables",[]),getAllObjects:()=>f("getAllObjects",[]),findObjectByName:v=>f("findObjectByName",[v]),findObjectById:v=>f("findObjectById",[v]),getGeometry:(v,_)=>f("getGeometry",[v,_??{}]),updateObject:(v,_)=>f("updateObject",[v,_]),createObject:(v,_)=>f("createObject",[v,_??{}]),createCustomMaterial:v=>f("createCustomMaterial",[v]),setMaterial:(v,_)=>f("setMaterial",[v,_]),cloneObject:(v,_)=>f("cloneObject",[v,_??{}]),removeObject:v=>f("removeObject",[v]),spawnObject:(v,_)=>f("spawnObject",[v,_??{}]),destroyObject:v=>f("destroyObject",[v]),setInstanceTransforms:(v,_)=>f("setInstanceTransforms",[v,_??null]),emitEvent:(v,_)=>f("emitEvent",[v,_]),emitEventReverse:(v,_)=>f("emitEventReverse",[v,_]),requestRender:()=>f("requestRender",[]),addEventListener:(v,_)=>{if(typeof _!="function")return;let b=u.get(v);b||(b=new Set,u.set(v,b),f("listenEvent",[v])),b.add(_)},removeEventListener:(v,_)=>{let b=u.get(v);!b||(b.delete(_),b.size===0&&(u.delete(v),f("unlistenEvent",[v])))}},m=window.spline;window.spline=g;let y=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let v=[],_=(x,w)=>{let S=new Set,T=x.addEventListener.bind(x),E=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(P,A,R)=>{if(T(P,A,R),!w.includes(P)||A==null)return;let O={type:P,listener:A};S.add(O),queueMicrotask(()=>{!S.delete(O)||((D,I,U)=>{let N=new Event(U);try{typeof I=="function"?I.call(D,N):I.handleEvent?.(N)}catch(G){console.error(G)}})(x,O.listener,O.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(P,A,R)=>{E(P,A,R);for(let O of S)O.type===P&&O.listener===A&&S.delete(O)}}),v.push(()=>{delete x.addEventListener,delete x.removeEventListener,S.clear()})};_(document,["DOMContentLoaded"]),_(window,["load"]);let b=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:x=>{typeof x=="function"&&queueMicrotask(()=>{try{x.call(window,new Event("load"))}catch(w){console.error(w)}})}}),v.push(()=>{b?Object.defineProperty(window,"onload",b):delete window.onload}),()=>{for(let x of v)x()}}();for(let v of d){let _=document.createElement("script");for(let b of Array.from(v.attributes))_.setAttribute(b.name,b.value);v.src?_.async=!1:_.textContent=v.textContent,a.appendChild(_)}return new jj(a,p,l,m,y)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};function Gj(t){return typeof t=="object"&&t!==null&&t.isMaterial===!0}function IU(t){if(typeof t.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!Gj(t.material))return{options:t};let e=t.material;if(e.isNodeMaterial===!0){let i=Ok()?.NodeMaterial;if(i!==void 0&&e instanceof i)return{options:{...t,material:void 0},material:e};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(e.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...t,material:void 0},material:e}}te(),Ye(),rt(),Ck(),xs(),Ye(),te(),KX(),Eh();var Jet=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),LU="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",tit={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},eit={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},iit={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data \u2014 clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime \u2014 clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto \u2014 clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame \u2014 clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor \u2014 clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},nit={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},rit={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function Vg(t,e){return t===void 0?[e[0],e[1],e[2]]:Array.isArray(t)?[t[0]??e[0],t[1]??e[1],t[2]??e[2]]:[t.x??e[0],t.y??e[1],t.z??e[2]]}function Hj(t){return typeof t=="number"?[t,t,t]:Vg(t,[1,1,1])}function $T(t){let e=new vn(0,0,0,1);return e.setStyle(t),{r:e.r,g:e.g,b:e.b}}function BU(t,e){let i=t.material??(t.color!==void 0?{color:t.color}:void 0);if(i===void 0)return Vi.defaultColorMaterial(UU(Rr),"physical","layer1","layer2");if(typeof i=="string"){for(let[s,o]of Object.entries(e.shared.materials))if(s===i||o.name===i)return s;if(function(s){let o=s.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||Jt.NAMES[o]!==void 0}(i))return Vi.defaultColorMaterial($T(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(s){let o=Object.entries(s.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(e)}) and is not a valid CSS color.`)}if(typeof i=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(Gj(i))throw new Error("createObject: a three.js material instance cannot be stored in the document \u2014 this entry point does not support it.");let n=i.color!==void 0?$T(i.color):UU(Rr),r=Vi.defaultColorMaterial(n,"physical","layer1","layer2"),a=r.layers.find(s=>s.data.type==="light");if(a){let s={};i.roughness!==void 0&&(s.roughness=i.roughness),i.metalness!==void 0&&(s.metalness=i.metalness),i.reflectivity!==void 0&&(s.reflectivity=i.reflectivity),Object.assign(a.data,s)}if(i.alpha!==void 0){let s=r.layers.find(o=>o.data.type==="color");s&&Object.assign(s.data,{alpha:i.alpha})}return r}function UU(t){return{r:(t>>16&255)/255,g:(t>>8&255)/255,b:(255&t)/255}}function ait(t){let e=Wo.defaultData("TextGeometry"),{text:i,...n}=t,r=n.fontSize;return r!==void 0&&n.width===void 0&&(n.width=350*r/16),r!==void 0&&n.height===void 0&&(n.height=50*r/16),Object.assign(e,n),i!==void 0&&Object.assign(e,{text:{textValue:String(i)}}),e}function Oy(t){return Array.isArray(t)?t:!ArrayBuffer.isView(t)||t instanceof DataView?null:Array.from(t)}function sit(t,e){return mF({userData:{type:t,...RA[t].normalizeInputs({parameters:e})}})}function oit(t,e,i){let{objectType:n,geometryType:r}=t,a=function(l){let c={};for(let[h,d]of Object.entries(l))!Jet.has(h)&&d!==void 0&&(c[h]=d);return c}(e),s={states:new Vt,events:new Vt,timelineAnimations:new $t};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=function(h){let d=Oy(h.vertices);if(!d||d.length<9||d.length%3!=0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let u=d.length/3;if(u>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${u}); keep it under 60000.`);let p=Oy(h.indices);if(p&&p.length){let _=p.find(b=>!Number.isInteger(b)||b<0||b>=u);if(_!==void 0)throw new Error(`createObject('CustomMesh'): index ${_} is out of range (mesh has ${u} vertices).`)}else p=null;let f=new Gt;f.setAttribute("position",new Ft(d,3));let g=Oy(h.normals),m=g!==null&&g.length===d.length;m&&f.setAttribute("normal",new Ft(g,3));let y=Oy(h.uvs);y&&y.length===2*u&&f.setAttribute("uv",new Ft(y,2));let v=!1;if(!m){let _=p??Array.from({length:u},(w,S)=>S),{closed:b,inverted:x}=function(w,S){let T=w.length/3,E=new Map,P=new Array(T);for(let D=0;D<T;D++){let I=`${Math.round(1e4*w[3*D])},${Math.round(1e4*w[3*D+1])},${Math.round(1e4*w[3*D+2])}`,U=E.get(I);U===void 0?(E.set(I,D),P[D]=D):P[D]=U}let A=new Map;for(let D=0;D+2<S.length;D+=3){let I=P[S[D]],U=P[S[D+1]],N=P[S[D+2]];for(let[G,H]of[[I,U],[U,N],[N,I]]){if(G===H)continue;let J=G<H?G+"_"+H:H+"_"+G;A.set(J,(A.get(J)??0)+1)}}let R=A.size>0;for(let D of A.values())if(D!==2){R=!1;break}if(!R)return{closed:!1,inverted:!1};let O=0;for(let D=0;D+2<S.length;D+=3){let I=3*S[D],U=3*S[D+1],N=3*S[D+2],G=w[I],H=w[I+1],J=w[I+2],K=w[U],tt=w[U+1],ct=w[U+2],et=w[N],st=w[N+1],dt=w[N+2];O+=G*(tt*dt-ct*st)+H*(ct*et-K*dt)+J*(K*st-tt*et)}return{closed:!0,inverted:O<0}}(d,_);if(b&&x){for(let w=0;w+2<_.length;w+=3){let S=_[w+1];_[w+1]=_[w+2],_[w+2]=S}p=_}else b||(v=!0)}return p&&f.setIndex(p),m||f.computeVertexNormals(),{geometry:mF({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:f.toJSON().data}),doubleSide:v}}(a);Object.assign(s,Ws.defaultData,{geometry:l,materials:[BU(e,i)]}),c&&(s.side=2)}else Object.assign(s,Ws.defaultData,{geometry:r==="TextGeometry"?ait(a):sit(r,a),material:BU(e,i)});e.castShadow!==void 0&&(s.castShadow=e.castShadow),e.receiveShadow!==void 0&&(s.receiveShadow=e.receiveShadow)}else n==="Empty"?Object.assign(s,L_.defaultData):(Object.assign(s,B_.defaultData(n),a),e.color!==void 0&&(s.color=$T(e.color)));s.visible=e.visible??!0,s.position=Vg(e.position,[0,0,0]),s.rotation=Vg(e.rotation,[0,0,0]),s.scale=Hj(e.scale);let o=(r&&nit[r])??rit[n]??n;return s.name=e.name??Wj(o,i.scene.objects),s}function Wj(t,e){let i=new Set;if(e.traverse((r,a)=>{i.add(a.name??"")}),!i.has(t))return t;let n=2;for(;i.has(`${t} ${n}`);)n++;return`${t} ${n}`}function qj(t,e){let i=It.generateUUID();if(t.data.type==="Component")return{data:{...tl.fromComponentData(t),name:t.data.name+" Instance"},id:i,fi:t.fi,children:[]};e[t.id]=i;let n=t.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:n.animations.map(([r,a,s])=>{let o=It.generateUUID(),l=s.indexOf(r);return[o,a,l!==-1?s.slice(0,l)+o+s.slice(l+r.length):s]})}),{...t,id:i,data:n,children:t.children.map(r=>qj(r,e))}}function lit(t){let e={};return function(i,n){return Hu(i,n,null)??i}(qj(t,e),e)}function hit(t){let e=Array.isArray(t)?t[0]:t,i=e.layers?.map(cit)??[],n=e.layers?.find(r=>r.type==="light");return{layers:i,alpha:n?.node.alphaOverride?.value??1}}function cit(t){return t.type==="texture"||t.type==="video"||t.type==="matcap"?{...t.data,updateTexture:e=>t.color.texture.image.updateSrc(e)}:{...t.data}}Eh(),Ui(),WC(),xs();var cm=new vn(0,0,0,1),dit={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]};te(),te();var uit=new at;function zU(t){let e=new vn(0,0,0,1);try{e.setStyle(t)}catch(i){console.error(i)}return e}var Xj=class{constructor(t,{renderOnDemand:e,renderMode:i="auto",wasmPath:n,renderer:r,htmlContentMode:a="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=s=>{if(this.time=s,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<yF?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),qc(o)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&o.warnClassicFallbackOnce(),o.isSimulating&&(o.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let o=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=o,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=s=>{if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=uit.set(this._viewportWidth,this._viewportHeight)),s){let o=this._viewportWidth,l=this._viewportHeight;this._renderer.setSize(o-1,l-1,!1),this._renderer.setSize(o,l,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);if(this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera){let o=Object.values(this._data?.frames??{})[0].preset??"fullscreen";this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(o!=="fullscreen"),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()}this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=Tg(this._resize,10),this._onScroll=s=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=t,this._htmlContentMode=a,this.renderMode=e?"auto":i,n!==void 0&&(this._wasmPath=function(s){let o=s.length;for(;o>0&&"/".includes(s[o-1]);)o--;return s.slice(0,o)}(n)),this._rendererBackend=r??"webgl",r===void 0){let s=null;try{s=new URLSearchParams(window.location.search).get("renderer")}catch{}s==="webgpu"||s==="webgl"||s==="webgl2"?this._rendererBackend=s==="webgl2"?"webgl":s:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(kY(),O6)).then(({Perfs:s})=>{this._perfs=new s({x:10,y:10})}),function(s){s.addEventListener("pointerdown",HR,!0),s.addEventListener("pointerdown",J0,!0),s.addEventListener("pointermove",J0,!0),s.addEventListener("pointerup",Od,!0),s.addEventListener("pointercancel",Od,!0),s.addEventListener("pointerleave",Od,!0),window.addEventListener("keydown",WR,!0),window.addEventListener("keyup",qR,!0)}(t)}async _createRenderer(){this._rendererBackend,this._rendererBackend;{let{SplineRenderer:t,rendererGlobals:e}=await Promise.resolve().then(()=>(a5(),dT));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(e.taaEnabled.value=!1)}catch{}return new t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=i*t;let n=this.canvas.getContext("2d");n&&(n.scale(t,t),n.fillStyle="rgba(127, 127, 127, 0.85)",n.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",n.textAlign="center",n.textBaseline="middle",n.fillText("This scene requires a WebGPU-capable browser.",e/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,i){(function(r){let a="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";r.endsWith(".spline")?console.warn(a+" The .spline files are only meant to be used by the Editor."):r.endsWith(".splinecode")||console.warn(a)})(t),this.disposed=!1;let n=await(await fetch(t,i)).arrayBuffer();await this.start(n,{variables:e})}async start(t,{interactive:e=!0,variables:i}={}){if(this.disposed)return;fh.init();let n=await async function(u){let[p,f]=Em(Cg.deserialize(new Uint8Array(u)));if((p.schema??0)!==130){let{updateDocumentSchema:g}=await Promise.resolve().then(()=>(Hb(),hF));g(p)}return f.result().data}(t);this._data=n;let r=function(u){let p=[];return u.scene.objects.traverse((f,g)=>{g.type==="Mesh"&&g.geometry.type==="NonParametricGeometry"&&g.geometry.data.draco!==void 0&&p.push(g)}),p}(n);n.version&&(0,Zet.default)(n.version,"2.0.13")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),function(u){QA=u}(this._wasmPath));let a=async function(){}();await Promise.all([a,r.length&&DU(this._wasmPath),q4(n)&&n$(this._wasmPath),j$(n)&&L$(this._wasmPath),up.physicsEnabled(n.scene.objects)&&gJ(this._wasmPath),JI(n)&&hB(),eL(n)&&lY(),p$(n)&&u$(),eB(n)&&a.then(()=>oA()?.loadHanaUIRUNTIME()),hJ(n)&&OJ(this._wasmPath)].filter(Boolean)),r.length&&await RU(r),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let s=n.scene.publish.renderer;if(this._rendererAuto&&s==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&s==="webgpu")return void this._failWebGPURequired();let o=function(u){let p=new Set;return u.scene.objects.traverse((f,g)=>{if(g.type!=="Page")return;let m=g.postprocessing;if(m&&typeof m=="object"&&m.enabled===!0)for(let[y,v]of Object.entries(m))y!=="enabled"&&v&&typeof v=="object"&&v.enabled===!0&&p.add(y)}),[...p]}(n);this._rendererBackend,this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(a5(),dT)),Yet(o)]),function(u){ex=u}((this._rendererBackend,"webgl"));let l=new Het(n);if(l.resetPersonalCameraFromDocumentData(),this._scene=l.scene,this._sharedAssetsManager=l.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:u}=await Promise.resolve().then(()=>(xK(),fV)),p=performance.now();u(n,l.scene);let f=performance.now();console.log("Merged geometries in ",f-p," ms")}q4(n)&&this._scene.traverse(u=>{io(u)&&u.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(u=>{Bu(u)&&u.pendingMediaLoad&&u.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(u=>{u.type==="ParticleSystem"&&(u.wakeUp(),u.data.autoPlay?u.start():u.stop()),qc(u)&&u.setPlayMode(!0)});let c=Object.keys(n.shared.fonts).map(u=>this._sharedAssetsManager.getFont(u).loadingPromise);if(Promise.all(c).then(()=>{this.disposed||(l.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),JI(n)&&function(u){if(up.physicsEnabled(u.scene.objects))return!0;let p=!1;return u.scene.objects.traverse((f,g)=>{if(g.events){if(Array.isArray(g.events)){for(let m of g.events)if(m.data.disabled!==!0&&m.data.type==="GameControl"&&m.data.collisionEnabled){p=!0;break}}else for(let m of Object.values(g.events))if(m.disabled!==!0&&m.type==="GameControl"&&m.collisionEnabled){p=!0;break}}}),p}(n)&&await Promise.all(c),eB(n)){let u=[];this._scene.traverseEntity(p=>{(Cr(p)||p instanceof pn)&&p.uiCanvas&&u.push(p.uiCanvas)}),await Promise.all(u.map(p=>p.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),G3(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=n.scene.publish.hdTransmission===!0;let u=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),p=this._getPixelRatio(u()?n.scene.publish.settings.web.pixelRatioMobile:n.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(p),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),n.shared.images.SplineWatermark){let f=this._sharedAssetsManager.getImage("SplineWatermark");await f.loadPromise;let g=f.getTexture(1001);this._renderer.pipeline.setWatermark(g)}}eL(n)&&this._scene.initializeSplatViewer(),n.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(n.scene.blueNoiseTextureData);let h=Object.values(n.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(h.preset==="fullscreen"?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=h.size[0],this._viewportHeight=h.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new iQ(this._renderer,this._camera,new at(this._viewportWidth,this._viewportHeight),new at(window.innerWidth,window.innerHeight)),this._frameView.enableResponsive=(h.allowResponsive??!1)&&h.preset==="fullscreen"),e){let u=new BK(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,h);this._scene.updateMatrixWorld(!0),this._controls=new bJ(u),this._animationControls=new Xet(this._scene,this._requestRenderAutoMode),this._eventManager=new ZK(n.scene.publish,this._controls,this._animationControls,u,n.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),i!==void 0&&this.setVariables(i),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0;let d=n.scene.publish.htmlContent?.html;if(e&&d&&this._htmlContentMode!=="none"){let u={shared:this._sharedAssetsManager,findEntity:p=>this._scene?.getObjectByProperty("uuid",p)??this._scene?.getObjectByName(p)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?jj.mount(this,this.canvas,d,u):Vj.mount(this,this.canvas,d,u))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[i,n]of e)this.setVariable(i,n)}}setVariable(t,e){let i=this._getVariableByName(t);if(i&&!("dynamicVariableType"in i.data)){let n=e;typeof i.data.value=="number"?n=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e):typeof i.data.value=="boolean"?n=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()!=="false"&&!!e:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(n=e.toString());let r=typeof n=="string"?{textValue:n}:n;this._sharedAssetsManager?.updateVariable(i.id,r),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let i=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(i)}}_getVariableValue(t){return typeof t!="string"&&br.isTextValue(t)?br.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(i=>i.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(!(e.uuid===Qc||this._scene.isInvisibleObjects(e)||e instanceof pn)){let i=this._createProxyObject(e);i&&t.push(i)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof DV&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=zU(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,lg&&lg.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{D2.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,function(t){t.removeEventListener("pointerdown",HR,!0),t.removeEventListener("pointerdown",J0,!0),t.removeEventListener("pointermove",J0,!0),t.removeEventListener("pointerup",Od,!0),t.removeEventListener("pointercancel",Od,!0),t.removeEventListener("pointerleave",Od,!0),window.removeEventListener("keydown",WR,!0),window.removeEventListener("keyup",qR,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),fh.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e,i=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);t.traverseAncestors(h=>{h instanceof pn&&(e=h.name)});let n=this._sharedAssetsManager,r={shared:n,scene:this._scene},a=h=>{if(h===null||h==="Base State")return null;if(h&&t.data.states){let d=t.data.states.find(u=>u.data.name===h);return d?d.id:void 0}},s="material"in t?t.material:void 0,o=t.materialOverride,l={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:e,material:o??(s?hit(s):void 0),parentUuid:t.parent instanceof pn||t instanceof lx?void 0:t.parent?.uuid,emitEvent(h){t.dispatchEvent({type:"userEvent",eventName:h})},emitEventReverse(h){t.dispatchEvent({type:"userEvent",eventName:h,reverse:!0})},hide(){t.visible&&(t.visible=!1,r.shared.requestRender())},show(){t.visible||(t.visible=!0,r.shared.requestRender())},get state(){let h=t.stateSelection;if(h!==null)return t.data.states.find(({id:d})=>d===h)?.data.name},set state(h){let d;if(h!==void 0){let u=typeof h=="string"?t.data.states.find(({id:p})=>p===h):t.data.states[h];if(u)d=u.id;else{let p=typeof h=="string"?a(h):void 0;p&&(d=p)}}t.changeSelectedState(d??null,r),t.currentState=d??null,t.dispatchEvent({type:"completeState",state:d??null}),r.shared.requestRender()},transition(h){let d=Fj;if(d===null)return Gn("transitions","obj.transition()"),{transition(m){return this},play(){return this},pause(){return this},reset(){return this},seek(m){return this}};let u,p=this,f=fh.timeline({autoplay:h.autoPlay??!0}),g={transition({from:m,to:y,duration:v,delay:_,...b}){let x=a(m);x===void 0&&(x=u);let w=a(y);u=w;let S=new d(t,x,w,{state:w,repeat:0,delay:_??0,delayDirection:"start-once",direction:"normal",duration:v??1e3,...b,...b.easing===6?b_.defaultData:b.easing===5?x_.defaultData:{}},n,!1,i.activePage);return f.add({...S.params,begin:()=>{(m&&x||m==="Base State"&&!x)&&(p.state=x??void 0)},complete:()=>{p.state=w??void 0}},f.duration),this},play(){return f.play(),this},pause(){return f.pause(),this},reset(){return f.reset(),this},seek(m){return f.seek(m),this}};return g.transition(h),g},set color(h){let d=zU(h);if(tb.is(t))return void(t.color=d);if(!(t.type==="Mesh"&&"material"in t&&t instanceof Hr))return;let u={r:d.r,g:d.g,b:d.b,a:d.a},p=t.materialOverride;if(p!==void 0){let m=p.color;return void(m?.isColor===!0&&typeof m.setStyle=="function"&&(m.setStyle(h),r.shared.requestRender()))}let f=Array.isArray(t.material)?t.material[0]:t.material,g=f.data.layers.find(m=>m.data.type==="color")?.id;if(g)f.updateByOp({type:0,path:["layers",g],props:{color:{...u}}},f.data,r);else{let m=f.data,y=m.layers.find(S=>S.data.type==="light");if(!y)return;let v=m.layers.indexOf(y)===0?y:null,_=m.layers.at(v?m.layers.indexOf(v)+1:0),b={type:4,fi:v?v.fi+(_?(_.fi-v.fi)/2:1):_?_.fi/2:1,id:It.generateUUID(),data:{...Qi.defaultData("color"),color:u},localIndex:0},x=m.layers.insertAfterHelper(v?.id??null,1),w=m.layers.runOp({...b,fi:x[0]}).data;Object.assign(f.data,{layers:w}),f.updateByOp({...b,path:["layers"]},f.data,r)}}},c=D2(l,(h,d)=>{let u=t[h],p=function(f){return f.split(".")}(h);p[0]==="material"&&s&&o===void 0&&function(f,g,m){let y=Array.isArray(m)?m[0]:m;if(f[0]==="layers"){let v=parseInt(f[1]),_=y.layers[v],b=f[2];_&&b&&function(x,w,S){let T=x[0];try{if(function(E,P){return!!dit[P]?.includes(E)}(T,S.type,x.slice(1)))if(T==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let E=parseInt(x[1]),P=S.getValue(T)?.[E];if(!P)throw new Error("Color index out of range");cm.setStyle(w),P.set(cm.r,cm.g,cm.b,cm.a)}else S.getValue(T)?.setStyle(w);else if(T==="texture"||T==="video"){let E=S.color;(function(P,A,R,O){let D=P[0];if(D==="repeat"||D==="offset"||D==="rotation"){let I=O.getNode("mat"),U=I&&typeof I.updateMatrix=="function"?I:O.getValue("mat");if(!U)return;if(D==="rotation")U.rotation=parseFloat(A);else{let N=P[1];if(N===void 0)A instanceof Array&&A.length===2&&Object.assign(U,{[D]:A});else{let G=U[D],H=parseInt(N)===0?[parseFloat(A),G[1]]:[G[0],parseFloat(A)];Object.assign(U,{[D]:H})}}U.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?R.texture.wrap=A:R.texture[D]=A:D==="image"&&P[1]==="data"&&R.texture.image.updateSrc(A)})(x.slice(1),w,E,S)}else{let E=x[1],P=S.getValue(T);P?.isVector3&&E!==void 0||P?.isVector2&&E!==void 0?P.setComponent(parseInt(E),w):S.setValue(T,w)}}catch(E){console.error("Error setting material value",E)}}(f.slice(2),g,_)}else f[0]==="alpha"&&y.layers.forEach(v=>{v.type==="light"&&v.node.alphaOverride!==void 0&&(v.node.alphaOverride.value=g,g<1&&(y.transparent=!0))})}(p.slice(1),d,s),typeof u!="object"&&Object.getOwnPropertyDescriptor(t,h)?.writable&&(t[h]=d),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,c),c}setUIWasmUrl(t){(function(e){G_=e,qb?.setHanaUIWasmUrl(e)})(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let i;if(typeof e=="string"){if(!e.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(e)).arrayBuffer();i=new Uint8Array(l)}}else i=e;let n=Cg.deserialize(i),r="data"in n&&n.data.draco!==void 0;r&&await DU(this._wasmPath);let a=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!a)return void console.warn(`Object ${t} not found`);if(a.data.type!=="Mesh"||!(a instanceof Hr))return void console.warn(`Object ${t} is not a mesh`);let s=a,o={...s.data,geometry:n};r&&await RU([o]),s.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let l of s.data.states){let c={...l.data};s.states||(s.states={}),s.states[l.id]=th.patch(o,c)}return i}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let i=e.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,i=this._findEntity(e);if(!i)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=Ok();if(e===void 0&&e===void 0)throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let i=t(e);if(typeof i!="object"||i===null||i.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return i}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let i=this._scene;if(!i)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let n=typeof t=="string"?t:t.uuid,r=this._findEntity(n);if(!r)throw new Error(`setMaterial: '${n}' \u2014 no object with that name or uuid in the scene.`);if(!(r instanceof Hr))throw new Error(`setMaterial: '${n}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let a=typeof e=="function"?await this.createCustomMaterial(e):e;if(Q_()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let s=IU({material:a});if(s.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return r.setMaterialOverride(s.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(r.uuid),this._requestRenderAutoMode(),s.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let r=function(m){if(typeof m!="string"||m.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${LU}.`);let y=m.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),v=eit[y];if(v)return{objectType:v};let _=tit[y];if(_)return{objectType:"Mesh",geometryType:_};let b=iit[y];throw b?new Error(`createObject: '${m}' is not supported \u2014 ${b}`):new Error(`createObject: '${m}' is not a creatable Spline type \u2014 use one of ${LU}, e.g. createObject('Cube', { width: 200 }).`)}(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let a,s,{options:o,material:l}=IU(e);if(l!==void 0){if(r.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(Q_()!=="webgpu")throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}if(r.geometryType==="TextGeometry"){if(!BC.has("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature \u2014 re-export the scene with a Text object present, or load the full runtime build.");if(await hB(),s=e.font??Su,n.shared.fonts[s]===void 0){if(s!==Su){let m=Object.keys(n.shared.fonts).join(", ");throw new Error(`createObject: font '${s}' is not in this document \u2014 available fonts: ${m||"(none)"}.`)}a={name:Su,url:XN}}}let c=this._resolveParentId(e.parent),h=oit(r,o,n),d=It.generateUUID(),[u,p]=Em(n);a&&(u.shared.fonts[Su]=a),u.scene.objects.insertAfter(c,null,[{id:d,data:h,children:[]}]);let f=p.result();if(a&&this._sharedAssetsManager.addFont(Su,a),s!==void 0){let m=this._sharedAssetsManager.getFont(s);m&&await m.loadingPromise}this._applyDocumentTransaction(f);let g=i.find(d);return l!==void 0&&g.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(g)}cloneObject(t,e={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t?.uuid,a=r?this._findEntity(r):void 0;if(!a)throw new Error(`cloneObject: '${r}' \u2014 no object with that name or uuid in the scene.`);if(a instanceof pn)throw new Error("cloneObject: pages cannot be cloned.");let s=n.scene.objects.get(a.uuid);if(!s)throw new Error(`cloneObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let o=function(p,f,g){let m={...p.data};return f.position!==void 0&&(m.position=Vg(f.position,[0,0,0])),f.rotation!==void 0&&(m.rotation=Vg(f.rotation,[0,0,0])),f.scale!==void 0&&(m.scale=Hj(f.scale)),f.visible!==void 0&&(m.visible=f.visible),m.name=f.name??Wj(`${p.data.name??"Object"} Copy`,g),{...p,data:m}}(lit(s),e,n.scene.objects),l=e.parent!==void 0?this._resolveParentId(e.parent):n.scene.objects.parent(a.uuid)??null,c=e.parent!==void 0?null:a.uuid,[h,d]=Em(n);h.scene.objects.insertAfter(l,c,[o]),this._applyDocumentTransaction(d.result());let u=i.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(u)}removeObject(t){let e=this._scene,i=this._data;if(this.disposed||!e||!i)return!1;let n=typeof t=="string"?t:t?.uuid,r=n?this._findEntity(n):void 0;if(!r)return!1;if(r instanceof pn)throw new Error("removeObject: pages cannot be removed.");if(r.data.type==="PerspectiveCamera"||r.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(r.uuid)===void 0)throw new Error(`removeObject: '${n}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let a=[];r.traverseEntity(l=>{a.push(l.uuid)});let[s,o]=Em(i);s.scene.objects.delete(r.uuid),this._applyDocumentTransaction(o.result());for(let l of a){let c=this._proxyObjectCache.get(l);c&&(D2.unsubscribe(c),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var _x=window,bx=_x.ShadowRoot&&(_x.ShadyCSS===void 0||_x.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Q3=Symbol(),$j=new WeakMap,e0=class{constructor(e,i,n){if(this._$cssResult$=!0,n!==Q3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=i}get styleSheet(){let e=this.o,i=this.t;if(bx&&e===void 0){let n=i!==void 0&&i.length===1;n&&(e=$j.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&$j.set(i,e))}return e}toString(){return this.cssText}},Yj=t=>new e0(typeof t=="string"?t:t+"",void 0,Q3),J3=(t,...e)=>{let i=t.length===1?t[0]:e.reduce((n,r,a)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[a+1],t[0]);return new e0(i,t,Q3)},tP=(t,e)=>{bx?t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):e.forEach(i=>{let n=document.createElement("style"),r=_x.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=i.cssText,t.appendChild(n)})},xx=bx?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(let n of e.cssRules)i+=n.cssText;return Yj(i)})(t):t;var eP,wx=window,Zj=wx.trustedTypes,pit=Zj?Zj.emptyScript:"",Kj=wx.reactiveElementPolyfillSupport,nP={toAttribute(t,e){switch(e){case Boolean:t=t?pit:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},Qj=(t,e)=>e!==t&&(e==e||t==t),iP={attribute:!0,type:String,converter:nP,reflect:!1,hasChanged:Qj},rP="finalized",pl=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((i,n)=>{let r=this._$Ep(n,i);r!==void 0&&(this._$Ev.set(r,n),e.push(r))}),e}static createProperty(e,i=iP){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(e,i),!i.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,r=this.getPropertyDescriptor(e,n,i);r!==void 0&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,i,n){return{get(){return this[i]},set(r){let a=this[e];this[i]=r,this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||iP}static finalize(){if(this.hasOwnProperty(rP))return!1;this[rP]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,n=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let r of n)this.createProperty(r,i[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let i=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)i.unshift(xx(r))}else e!==void 0&&i.push(xx(e));return i}static _$Ep(e,i){let n=i.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(i=>i(this))}addController(e){var i,n;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var e;let i=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return tP(i,this.constructor.elementStyles),i}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostConnected)===null||n===void 0?void 0:n.call(i)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostDisconnected)===null||n===void 0?void 0:n.call(i)})}attributeChangedCallback(e,i,n){this._$AK(e,n)}_$EO(e,i,n=iP){var r;let a=this.constructor._$Ep(e,n);if(a!==void 0&&n.reflect===!0){let s=(((r=n.converter)===null||r===void 0?void 0:r.toAttribute)!==void 0?n.converter:nP).toAttribute(i,n.type);this._$El=e,s==null?this.removeAttribute(a):this.setAttribute(a,s),this._$El=null}}_$AK(e,i){var n;let r=this.constructor,a=r._$Ev.get(e);if(a!==void 0&&this._$El!==a){let s=r.getPropertyOptions(a),o=typeof s.converter=="function"?{fromAttribute:s.converter}:((n=s.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?s.converter:nP;this._$El=a,this[a]=o.fromAttribute(i,s.type),this._$El=null}}requestUpdate(e,i,n){let r=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Qj)(this[e],i)?(this._$AL.has(e)||this._$AL.set(e,i),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):r=!1),!this.isUpdatePending&&r&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((r,a)=>this[a]=r),this._$Ei=void 0);let i=!1,n=this._$AL;try{i=this.shouldUpdate(n),i?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var a;return(a=r.hostUpdate)===null||a===void 0?void 0:a.call(r)}),this.update(n)):this._$Ek()}catch(r){throw i=!1,this._$Ek(),r}i&&this._$AE(n)}willUpdate(e){}_$AE(e){var i;(i=this._$ES)===null||i===void 0||i.forEach(n=>{var r;return(r=n.hostUpdated)===null||r===void 0?void 0:r.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((i,n)=>this._$EO(n,this[n],i)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};pl[rP]=!0,pl.elementProperties=new Map,pl.elementStyles=[],pl.shadowRootOptions={mode:"open"},Kj?.({ReactiveElement:pl}),((eP=wx.reactiveElementVersions)!==null&&eP!==void 0?eP:wx.reactiveElementVersions=[]).push("1.6.3");var aP,Sx=window,Ip=Sx.trustedTypes,Jj=Ip?Ip.createPolicy("lit-html",{createHTML:t=>t}):void 0,oP="$lit$",Ph=`lit$${(Math.random()+"").slice(9)}$`,s9="?"+Ph,fit=`<${s9}>`,ad=document,n0=()=>ad.createComment(""),r0=t=>t===null||typeof t!="object"&&typeof t!="function",o9=Array.isArray,mit=t=>o9(t)||typeof t?.[Symbol.iterator]=="function",sP=`[
|
|
9937
9937
|
\f\r]`,i0=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,t9=/-->/g,e9=/>/g,nd=RegExp(`>|${sP}(?:([^\\s"'>=/]+)(${sP}*=${sP}*(?:[^
|
|
9938
9938
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),i9=/'/g,n9=/"/g,l9=/^(?:script|style|textarea|title)$/i,h9=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),c9=h9(1),zut=h9(2),sd=Symbol.for("lit-noChange"),cr=Symbol.for("lit-nothing"),r9=new WeakMap,rd=ad.createTreeWalker(ad,129,null,!1);function d9(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Jj!==void 0?Jj.createHTML(e):e}var git=(t,e)=>{let i=t.length-1,n=[],r,a=e===2?"<svg>":"",s=i0;for(let o=0;o<i;o++){let l=t[o],c,h,d=-1,u=0;for(;u<l.length&&(s.lastIndex=u,h=s.exec(l),h!==null);)u=s.lastIndex,s===i0?h[1]==="!--"?s=t9:h[1]!==void 0?s=e9:h[2]!==void 0?(l9.test(h[2])&&(r=RegExp("</"+h[2],"g")),s=nd):h[3]!==void 0&&(s=nd):s===nd?h[0]===">"?(s=r??i0,d=-1):h[1]===void 0?d=-2:(d=s.lastIndex-h[2].length,c=h[1],s=h[3]===void 0?nd:h[3]==='"'?n9:i9):s===n9||s===i9?s=nd:s===t9||s===e9?s=i0:(s=nd,r=void 0);let p=s===nd&&t[o+1].startsWith("/>")?" ":"";a+=s===i0?l+fit:d>=0?(n.push(c),l.slice(0,d)+oP+l.slice(d)+Ph+p):l+Ph+(d===-2?(n.push(void 0),o):p)}return[d9(t,a+(t[i]||"<?>")+(e===2?"</svg>":"")),n]},od=class{constructor({strings:e,_$litType$:i},n){let r;this.parts=[];let a=0,s=0,o=e.length-1,l=this.parts,[c,h]=git(e,i);if(this.el=od.createElement(c,n),rd.currentNode=this.el.content,i===2){let d=this.el.content,u=d.firstChild;u.remove(),d.append(...u.childNodes)}for(;(r=rd.nextNode())!==null&&l.length<o;){if(r.nodeType===1){if(r.hasAttributes()){let d=[];for(let u of r.getAttributeNames())if(u.endsWith(oP)||u.startsWith(Ph)){let p=h[s++];if(d.push(u),p!==void 0){let f=r.getAttribute(p.toLowerCase()+oP).split(Ph),g=/([.?@])?(.*)/.exec(p);l.push({type:1,index:a,name:g[2],strings:f,ctor:g[1]==="."?hP:g[1]==="?"?cP:g[1]==="@"?dP:Bp})}else l.push({type:6,index:a})}for(let u of d)r.removeAttribute(u)}if(l9.test(r.tagName)){let d=r.textContent.split(Ph),u=d.length-1;if(u>0){r.textContent=Ip?Ip.emptyScript:"";for(let p=0;p<u;p++)r.append(d[p],n0()),rd.nextNode(),l.push({type:2,index:++a});r.append(d[u],n0())}}}else if(r.nodeType===8)if(r.data===s9)l.push({type:2,index:a});else{let d=-1;for(;(d=r.data.indexOf(Ph,d+1))!==-1;)l.push({type:7,index:a}),d+=Ph.length-1}a++}}static createElement(e,i){let n=ad.createElement("template");return n.innerHTML=e,n}};function Lp(t,e,i=t,n){var r,a,s,o;if(e===sd)return e;let l=n!==void 0?(r=i._$Co)===null||r===void 0?void 0:r[n]:i._$Cl,c=r0(e)?void 0:e._$litDirective$;return l?.constructor!==c&&((a=l?._$AO)===null||a===void 0||a.call(l,!1),c===void 0?l=void 0:(l=new c(t),l._$AT(t,i,n)),n!==void 0?((s=(o=i)._$Co)!==null&&s!==void 0?s:o._$Co=[])[n]=l:i._$Cl=l),l!==void 0&&(e=Lp(t,l._$AS(t,e.values),l,n)),e}var lP=class{constructor(e,i){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var i;let{el:{content:n},parts:r}=this._$AD,a=((i=e?.creationScope)!==null&&i!==void 0?i:ad).importNode(n,!0);rd.currentNode=a;let s=rd.nextNode(),o=0,l=0,c=r[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new ld(s,s.nextSibling,this,e):c.type===1?h=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(h=new uP(s,this,e)),this._$AV.push(h),c=r[++l]}o!==c?.index&&(s=rd.nextNode(),o++)}return rd.currentNode=ad,a}v(e){let i=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,i),i+=n.strings.length-2):n._$AI(e[i])),i++}},ld=class{constructor(e,i,n,r){var a;this.type=2,this._$AH=cr,this._$AN=void 0,this._$AA=e,this._$AB=i,this._$AM=n,this.options=r,this._$Cp=(a=r?.isConnected)===null||a===void 0||a}get _$AU(){var e,i;return(i=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&i!==void 0?i:this._$Cp}get parentNode(){let e=this._$AA.parentNode,i=this._$AM;return i!==void 0&&e?.nodeType===11&&(e=i.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,i=this){e=Lp(this,e,i),r0(e)?e===cr||e==null||e===""?(this._$AH!==cr&&this._$AR(),this._$AH=cr):e!==this._$AH&&e!==sd&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):mit(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==cr&&r0(this._$AH)?this._$AA.nextSibling.data=e:this.$(ad.createTextNode(e)),this._$AH=e}g(e){var i;let{values:n,_$litType$:r}=e,a=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=od.createElement(d9(r.h,r.h[0]),this.options)),r);if(((i=this._$AH)===null||i===void 0?void 0:i._$AD)===a)this._$AH.v(n);else{let s=new lP(a,this),o=s.u(this.options);s.v(n),this.$(o),this._$AH=s}}_$AC(e){let i=r9.get(e.strings);return i===void 0&&r9.set(e.strings,i=new od(e)),i}T(e){o9(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,n,r=0;for(let a of e)r===i.length?i.push(n=new ld(this.k(n0()),this.k(n0()),this,this.options)):n=i[r],n._$AI(a),r++;r<i.length&&(this._$AR(n&&n._$AB.nextSibling,r),i.length=r)}_$AR(e=this._$AA.nextSibling,i){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,i);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){var i;this._$AM===void 0&&(this._$Cp=e,(i=this._$AP)===null||i===void 0||i.call(this,e))}},Bp=class{constructor(e,i,n,r,a){this.type=1,this._$AH=cr,this._$AN=void 0,this.element=e,this.name=i,this._$AM=r,this.options=a,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=cr}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,i=this,n,r){let a=this.strings,s=!1;if(a===void 0)e=Lp(this,e,i,0),s=!r0(e)||e!==this._$AH&&e!==sd,s&&(this._$AH=e);else{let o=e,l,c;for(e=a[0],l=0;l<a.length-1;l++)c=Lp(this,o[n+l],i,l),c===sd&&(c=this._$AH[l]),s||(s=!r0(c)||c!==this._$AH[l]),c===cr?e=cr:e!==cr&&(e+=(c??"")+a[l+1]),this._$AH[l]=c}s&&!r&&this.j(e)}j(e){e===cr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},hP=class extends Bp{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===cr?void 0:e}},vit=Ip?Ip.emptyScript:"",cP=class extends Bp{constructor(){super(...arguments),this.type=4}j(e){e&&e!==cr?this.element.setAttribute(this.name,vit):this.element.removeAttribute(this.name)}},dP=class extends Bp{constructor(e,i,n,r,a){super(e,i,n,r,a),this.type=5}_$AI(e,i=this){var n;if((e=(n=Lp(this,e,i,0))!==null&&n!==void 0?n:cr)===sd)return;let r=this._$AH,a=e===cr&&r!==cr||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==cr&&(r===cr||a);a&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var i,n;typeof this._$AH=="function"?this._$AH.call((n=(i=this.options)===null||i===void 0?void 0:i.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}},uP=class{constructor(e,i,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=i,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Lp(this,e)}};var a9=Sx.litHtmlPolyfillSupport;a9?.(od,ld),((aP=Sx.litHtmlVersions)!==null&&aP!==void 0?aP:Sx.litHtmlVersions=[]).push("2.8.0");var a0=(t,e,i)=>{var n,r;let a=(n=i?.renderBefore)!==null&&n!==void 0?n:e,s=a._$litPart$;if(s===void 0){let o=(r=i?.renderBefore)!==null&&r!==void 0?r:null;a._$litPart$=s=new ld(e.insertBefore(n0(),o),o,void 0,i??{})}return s._$AI(t),s};var pP,fP;var Dh=class extends pl{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,i;let n=super.createRenderRoot();return(e=(i=this.renderOptions).renderBefore)!==null&&e!==void 0||(i.renderBefore=n.firstChild),n}update(e){let i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=a0(i,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return sd}};Dh.finalized=!0,Dh._$litElement$=!0,(pP=globalThis.litElementHydrateSupport)===null||pP===void 0||pP.call(globalThis,{LitElement:Dh});var u9=globalThis.litElementPolyfillSupport;u9?.({LitElement:Dh});((fP=globalThis.litElementVersions)!==null&&fP!==void 0?fP:globalThis.litElementVersions=[]).push("3.3.3");var p9=t=>e=>typeof e=="function"?((i,n)=>(customElements.define(i,n),n))(t,e):((i,n)=>{let{kind:r,elements:a}=n;return{kind:r,elements:a,finisher(s){customElements.define(i,s)}}})(t,e);var yit=(t,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}},_it=(t,e,i)=>{e.constructor.createProperty(i,t)};function Ma(t){return(e,i)=>i!==void 0?_it(t,e,i):yit(t,e)}var mP,cpt=((mP=window.HTMLSlotElement)===null||mP===void 0?void 0:mP.prototype.assignedElements)!=null?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter(i=>i.nodeType===Node.ELEMENT_NODE);var Mx=window.IntersectionObserver!=null;var f9=(t=32,e=2)=>{let i=t/2;return c9` <style>
|
|
9939
9939
|
:host {
|