@tomorrowevening/hermes 0.0.36 → 0.0.38

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.
@@ -1,4 +1,4 @@
1
- "use strict";var kn=Object.defineProperty;var _n=(t,n,a)=>n in t?kn(t,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[n]=a;var B=(t,n,a)=>(_n(t,typeof n!="symbol"?n+"":n,a),a);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("three"),qt=require("@theatre/core"),ot=require("@theatre/studio"),jn=require("tweakpane"),Dn=require("@tweakpane/plugin-essentials"),k=require("react"),sn=require("framer-motion");function In(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const e=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,e.get?e:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const Nn=In(Dn);function $e(t){return t.substring(0,1).toUpperCase()+t.substring(1)}function Ln(t,n,a){return Math.min(n,Math.max(t,a))}function Fn(t,n){const a=t-n;return Math.sqrt(a*a)}function cn(){return Math.round(Math.random()*1e6).toString()}function ln(t){return t.r!==void 0&&t.g!==void 0&&t.b!==void 0}function un(t){const n=Math.round(t.r*255),a=Math.round(t.g*255),e=Math.round(t.b*255),r=u=>{const f=u.toString(16);return f.length===1?"0"+f:f},s=r(n),p=r(a),l=r(e);return"#"+s+p+l}function xt(t,n=1){return Number(t.toFixed(n))}exports.totalThreeObjects=0;const dn=()=>{exports.totalThreeObjects=0},Vt=t=>{if(!t)return;let n=t.name.replace(" ","");n.length===0&&(n=`obj_${exports.totalThreeObjects}`,exports.totalThreeObjects++),t.parent!==null&&(n=`${t.parent.uuid}.${n}`),t.uuid=n,t.children.forEach(a=>{Vt(a)})},Un=t=>{t==null||t.dispose()},fn=t=>{t&&(Array.isArray(t)?t.forEach(n=>n.dispose()):t.dispose())},zt=t=>{var n;if(t){for(;t.children.length>0;){const a=t.children[0];a instanceof c.PositionalAudio?(a.pause(),a.parent&&a.parent.remove(a)):zt(a)}if(t.parent&&t.parent.remove(t),t.isMesh){const a=t;(n=a.geometry)==null||n.dispose(),fn(a.material)}t.dispose!==void 0&&t.dispose()}};class Bn{constructor(n,a,e=!0,r="editor"){B(this,"components",new Map);B(this,"listen");B(this,"_debugEnabled");B(this,"broadcastChannel");B(this,"webSocket");B(this,"_mode","app");B(this,"_connected",!1);B(this,"useBC",!1);B(this,"messageHandler",n=>{this.listen!==void 0&&(this.useBC?this.listen(n.data):this.listen(JSON.parse(n.data)))});B(this,"openHandler",()=>{this._connected=!0});B(this,"closeHandler",()=>{this._connected=!1});this.editor=a&&document.location.hash.search(r)>-1,this._debugEnabled=a,a&&(this.useBC=e,e?(this.broadcastChannel=new BroadcastChannel(n),this.broadcastChannel.addEventListener("message",this.messageHandler)):(this.webSocket=new WebSocket(n),this.webSocket.addEventListener("open",this.openHandler),this.webSocket.addEventListener("close",this.closeHandler),this.webSocket.addEventListener("message",this.messageHandler)))}addComponent(n,a){this.components.set(n,a)}dispose(){this.broadcastChannel!==void 0&&this.broadcastChannel.removeEventListener("message",this.messageHandler),this.webSocket!==void 0&&(this.webSocket.removeEventListener("open",this.openHandler),this.webSocket.removeEventListener("close",this.closeHandler),this.webSocket.removeEventListener("message",this.messageHandler)),this.components.forEach(n=>{n.dispose()}),this.components.clear()}send(n){var a,e;this._mode!==n.target&&(this.useBC?(a=this.broadcastChannel)==null||a.postMessage(n):this._connected&&((e=this.webSocket)==null||e.send(JSON.stringify(n))))}get connected(){return this._connected}get debugEnabled(){return this._debugEnabled}get mode(){return this._mode}get isApp(){return this._mode==="app"}get editor(){return this._mode==="editor"}set editor(n){n&&(this._mode="editor",document.title+=" - Editor")}}const D=new c.EventDispatcher,I={CUSTOM:"ToolEvents::custom",SELECT_DROPDOWN:"ToolEvents::selectDropdown",DRAG_UPDATE:"ToolEvents::dragUpdate",SET_SCENE:"ToolEvents::setScene",GET_OBJECT:"ToolEvents::getObject",SET_OBJECT:"ToolEvents::setObject",UPDATE_OBJECT:"ToolEvents::updateObject",CREATE_TEXTURE:"ToolEvents::createTexture",REQUEST_METHOD:"ToolEvents::requestMethod",ADD_CAMERA:"ToolEvents::addCamera",REMOVE_CAMERA:"ToolEvents::removeCamera"};class ct{constructor(n){B(this,"app");this.app=n}dispose(){}}class hn extends ct{selectDropdown(n,a){this.app.send({event:"selectComponent",target:"app",data:{dropdown:n,value:a}})}updateDropdown(n,a){this.app.send({event:"draggableListUpdate",target:"app",data:{dropdown:n,value:a}})}}function Vn(t,n){switch(n.event){case"selectComponent":D.dispatchEvent({type:I.SELECT_DROPDOWN,value:n.data});break;case"draggableListUpdate":D.dispatchEvent({type:I.DRAG_UPDATE,value:n.data});break}}const pn=()=>{},We=class We extends ct{constructor(){super(...arguments);B(this,"project");B(this,"sheets",new Map);B(this,"sheetObjects",new Map);B(this,"sheetObjectCBs",new Map);B(this,"sheetObjectUnsubscribe",new Map)}init(a,e){return this.project=qt.getProject(a,e),this.project.ready}dispose(){this.project=void 0,this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}sheet(a){var r;if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}let e=this.sheets.get(a);return e!==void 0||(e=(r=this.project)==null?void 0:r.sheet(a),this.sheets.set(a,e)),e}playSheet(a,e){var r;(r=this.sheet(a))==null||r.sequence.play(e),this.app.send({event:"playSheet",target:"editor",data:{sheet:a,value:e}})}pauseSheet(a){var e;(e=this.sheet(a))==null||e.sequence.pause(),this.app.send({event:"pauseSheet",target:"editor",data:{sheet:a}})}clearSheetObjects(a){this.sheetObjects.forEach((e,r)=>{r.search(`${a}_`)>-1&&this.unsubscribe(e)})}sheetObject(a,e,r,s){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const p=this.sheet(a);if(p===void 0)return;const l=`${a}_${e}`;let u=this.sheetObjects.get(l);u!==void 0?u=p.object(e,{...r,...u.value},{reconfigure:!0}):u=p.object(e,r),this.sheetObjects.set(l,u),this.sheetObjectCBs.set(l,s!==void 0?s:pn);const f=u.onValuesChange(y=>{if(this.app.editor){for(const C in y){const x=y[C];typeof x=="object"&&ln(x)&&(y[C]={r:x.r,g:x.g,b:x.b,a:x.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:a,sheetObject:l,values:y}})}const v=this.sheetObjectCBs.get(l);v!==void 0&&v(y)});return this.sheetObjectUnsubscribe.set(l,f),u}unsubscribe(a){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const e=a.address.sheetId,r=a.address.objectKey,s=this.sheets.get(e);s==null||s.detachObject(r);const p=`${e}_${r}`,l=this.sheetObjectUnsubscribe.get(p);l!==void 0&&(this.sheetObjects.delete(p),this.sheetObjectCBs.delete(p),this.sheetObjectUnsubscribe.delete(p),l())}static getRafDriver(){return We.rafDriver||(We.rafDriver=qt.createRafDriver()),We.rafDriver}};B(We,"rafDriver",null);let Le=We,we;function zn(t,n){t.components.forEach(a=>{if(a instanceof Le){let e;const r=a;switch(n.event){case"setSheet":e=r.sheets.get(n.data.sheet),e!==void 0&&(we=e,ot.setSelection([e]));break;case"setSheetObject":e=r.sheetObjects.get(`${n.data.sheet}_${n.data.key}`),e!==void 0&&ot.setSelection([e]);break;case"updateSheetObject":e=r.sheets.get(n.data.sheet),e!==void 0&&e.sequence.pause(),e=r.sheetObjectCBs.get(n.data.sheetObject),e!==void 0&&e(n.data.values);break;case"updateTimeline":e=r.sheets.get(n.data.sheet),we!==void 0&&(we.sequence.position=n.data.position);break}}})}function Hn(t){if(t.editor){let n;t.components.forEach(s=>{s instanceof Le&&(n=s)}),ot.ui.restore(),ot.onSelectionChange(s=>{s.length<1||s.forEach(p=>{let l=p.address.sheetId,u="setSheet",f={};switch(p.type){case"Theatre_Sheet_PublicAPI":u="setSheet",f={sheet:p.address.sheetId},we=n.sheets.get(p.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":u="setSheetObject",l+=`_${p.address.objectKey}`,f={id:l,sheet:p.address.sheetId,key:p.address.objectKey};break}t.send({event:u,target:"app",data:f})})});let a=0;const e=()=>{if(we!==void 0&&a!==we.sequence.position){a=we.sequence.position;const s=we;t.send({event:"updateTimeline",target:"app",data:{position:a,sheet:s.address.sheetId}})}},r=()=>{e(),requestAnimationFrame(r)};e(),r()}else ot.ui.hide()}function Yn(t,n){t.editor&&t.components.forEach(a=>{var e,r;if(a instanceof Le){const s=a;switch(n.event){case"playSheet":(e=s.sheet(n.data.sheet))==null||e.sequence.play(n.data.value);break;case"pauseSheet":(r=s.sheet(n.data.sheet))==null||r.sequence.pause();break}return}})}function Gn(t){if(t.name==="cameras")return"camera";if(t.name==="interactive")return"interactive";if(t.name==="lights")return"light";if(t.name==="ui")return"ui";if(t.name==="utils")return"utils";const n=t.type;return n.search("Helper")>-1?"icon_utils":n.search("Camera")>-1?"camera":n.search("Light")>-1?"light":"obj3D"}function mn(t){const n={name:t.name,type:t.type,uuid:t.uuid,children:[]};return t.children.forEach(a=>{n.children.push(mn(a))}),n}function Wn(t){const n={};for(const a in t){const e=t[a].value;n[a]={value:e},e===null?n[a].value={src:""}:e.isTexture&&(n[a].value={src:e.image.src})}return n}function $n(t){switch(t){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function Ye(t){const n={};for(const a in t){if(a.substring(0,1)==="_"||a.substring(0,2)==="is"||$n(a))continue;const e=typeof t[a],r=t[a];switch(e){case"boolean":case"number":case"string":n[a]=r;break;case"object":if(r!==null)if(n[a]=r,r.isTexture)if(r instanceof c.Texture){const s=r.source.toJSON();n[a]={src:s.url}}else r instanceof c.CubeTexture&&(console.log("env map"),console.log(r.source.data),console.log(r.source.toJSON()),n[a]={src:""});else a==="uniforms"&&(n[a]=Wn(n[a]));else n[a]={src:""};break}}return n}function Nt(t){t.updateMatrix();const n={name:t.name,type:t.type,uuid:t.uuid,visible:t.visible,matrix:t.matrix.elements,animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0};t.animations.forEach(e=>{n.animations.push({name:e.name,duration:e.duration,blendMode:e.blendMode})});const a=t.type.toLowerCase();if(a.search("mesh")>-1){const e=t;if(Array.isArray(e.material)){const r=[];e.material.forEach(s=>{r.push(Ye(s))}),n.material=r}else n.material=Ye(e.material)}else if(a.search("points")>-1){const e=t;if(Array.isArray(e.material)){const r=[];e.material.forEach(s=>{r.push(Ye(s))}),n.material=r}else n.material=Ye(e.material)}else if(a.search("line")>-1){const e=t;if(Array.isArray(e.material)){const r=[];e.material.forEach(s=>{r.push(Ye(s))}),n.material=r}else n.material=Ye(e.material)}else a.search("camera")>-1?t.type==="PerspectiveCamera"?n.perspectiveCameraInfo={fov:t.fov,zoom:t.zoom,near:t.near,far:t.far,focus:t.focus,aspect:t.aspect,filmGauge:t.filmGauge,filmOffset:t.filmOffset}:t.type==="OrthographicCamera"&&(n.orthographicCameraInfo={zoom:t.zoom,near:t.near,far:t.far,left:t.left,right:t.right,top:t.top,bottom:t.bottom}):a.search("light")>-1&&(n.lightInfo={color:t.color,intensity:t.intensity,decay:t.decay,distance:t.distance,angle:t.angle,penumbra:t.penumbra,groundColor:t.groundColor});return n}function qn(t,n){const a=n.split(".");switch(a.length){case 1:return t[a[0]];case 2:return t[a[0]][a[1]];case 3:return t[a[0]][a[1]][a[2]];case 4:return t[a[0]][a[1]][a[2]][a[3]];case 5:return t[a[0]][a[1]][a[2]][a[3]][a[4]];case 6:return t[a[0]][a[1]][a[2]][a[3]][a[4]][a[5]]}}function ae(t,n,a){const e=n.split(".");switch(e.length){case 1:t[e[0]]=a;break;case 2:t[e[0]][e[1]]=a;break;case 3:t[e[0]][e[1]][e[2]]=a;break;case 4:t[e[0]][e[1]][e[2]][e[3]]=a;break;case 5:t[e[0]][e[1]][e[2]][e[3]][e[4]]=a;break}}function Ut(t){return new Promise((n,a)=>{const e=new Image;e.onload=()=>{const r=new c.Texture(e);r.wrapS=c.RepeatWrapping,r.wrapT=c.RepeatWrapping,r.needsUpdate=!0,n(r)},e.onerror=a,e.src=t})}class vn extends ct{constructor(){super(...arguments);B(this,"scene")}getObject(a){this.app.debugEnabled&&this.app.send({event:"getObject",target:"app",data:a})}setObject(a){const e=Nt(a);this.app.send({event:"setObject",target:"editor",data:e})}requestMethod(a,e,r,s){this.app.send({event:"requestMethod",target:"app",data:{uuid:a,key:e,value:r,subitem:s}})}updateObject(a,e,r){this.app.send({event:"updateObject",target:"app",data:{uuid:a,key:e,value:r}})}createTexture(a,e,r){this.app.send({event:"createTexture",target:"app",data:{uuid:a,key:e,value:r}})}setScene(a){if(a===void 0||(this.scene=a,!this.app.debugEnabled))return;dn(),Vt(this.scene);const e=mn(this.scene);this.app.send({event:"setScene",target:"editor",data:e})}addCamera(a){if(!this.app.debugEnabled)return;const e=Nt(a);this.app.send({event:"addCamera",target:"editor",data:e})}removeCamera(a){if(!this.app.debugEnabled)return;const e=Nt(a);this.app.send({event:"removeCamera",target:"editor",data:e})}}function Kn(t,n){switch(n.event){case"getObject":D.dispatchEvent({type:I.GET_OBJECT,value:n.data});break;case"updateObject":D.dispatchEvent({type:I.UPDATE_OBJECT,value:n.data});break;case"createTexture":D.dispatchEvent({type:I.CREATE_TEXTURE,value:n.data});break;case"requestMethod":D.dispatchEvent({type:I.REQUEST_METHOD,value:n.data});break}}function Xn(t,n){switch(n.event){case"setObject":D.dispatchEvent({type:I.SET_OBJECT,value:n.data});break;case"setScene":D.dispatchEvent({type:I.SET_SCENE,value:n.data});break;case"addCamera":D.dispatchEvent({type:I.ADD_CAMERA,value:n.data});break;case"removeCamera":D.dispatchEvent({type:I.REMOVE_CAMERA,value:n.data});break}}class Ht extends ct{constructor(a){super(a);B(this,"bindCBs");B(this,"buttonCBs");B(this,"pane");B(this,"appCallbacks",0);B(this,"editorCallbacks",0);B(this,"inspectorFolder");this.bindCBs=new Map,this.buttonCBs=new Map,a.editor&&this.createGUI()}createGUI(){this.pane=new jn.Pane({title:"GUI"}),this.pane.registerPlugin(Nn)}dispose(){var a;this.bindCBs.clear(),this.buttonCBs.clear(),this.appCallbacks=0,this.editorCallbacks=0,this.app.editor&&((a=this.pane)==null||a.dispose(),this.pane=void 0)}addFolder(a,e=void 0,r=void 0){if(this.app.editor)return this.pane===void 0&&this.createGUI(),(r!==void 0?r:this.pane).addFolder({title:a,...e});this.app.send({event:"addFolder",target:"app",data:{name:a,params:e,parent:r}})}get bindID(){return`debug_${Math.max(this.appCallbacks,this.editorCallbacks)}`}bind(a,e,r,s=void 0){const p=this.bindID,l=r.onChange!==void 0?r.onChange:pn;this.bindCBs.set(p,l),this.app.editor?(this.pane===void 0&&this.createGUI(),(s!==void 0?s:this.pane).addBinding(a,e,r).on("change",f=>{this.app.send({event:"updateBind",target:"app",data:{id:p,value:f.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",target:"app",data:{id:p,name:e,params:r,parent:s}}),this.appCallbacks++)}triggerBind(a,e){const r=this.bindCBs.get(a);r!==void 0?r(e):console.warn(`No callback for: ${a}`,e)}button(a,e,r=void 0){const s=this.bindID;this.buttonCBs.set(s,e),this.app.editor?(this.pane===void 0&&this.createGUI(),(r!==void 0?r:this.pane).addButton({title:a}).on("click",()=>{this.app.send({event:"clickButton",target:"app",data:{id:s}})}),this.editorCallbacks++):(this.app.send({event:"addButton",target:"app",data:{id:s,name:a,callback:e,parent:r}}),this.appCallbacks++)}triggerButton(a){const e=this.buttonCBs.get(a);e!==void 0&&e()}createInspector(){this.inspectorFolder=this.addFolder("Inspector",this.pane)}clearInspector(){const a=this.inspectorFolder.children.length-1;for(let e=a;e>-1;--e)this.inspectorFolder.remove(this.inspectorFolder.children[e])}}function Zn(t,n){t.components.forEach(a=>{if(a instanceof Ht){const e=a;switch(n.event){case"addFolder":e.addFolder(n.data.name,n.data.params,n.data.parent);break;case"bindObject":e.bind(n.data.name,n.data.params,n.data.parent);break;case"updateBind":e.triggerBind(n.data.id,n.data.value);break;case"addButton":e.button(n.data.name,n.data.callback,n.data.parent);break;case"clickButton":e.triggerButton(n.data.id);break}return}})}var Bt={exports:{}},nt={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("three"),Ht=require("@theatre/core"),et=require("@theatre/studio"),Mn=require("tweakpane"),Tn=require("@tweakpane/plugin-essentials"),A=require("react"),an=require("framer-motion");function Rn(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const e=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,e.get?e:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const _n=Rn(Tn);function He(t){return t.substring(0,1).toUpperCase()+t.substring(1)}function An(t,n,a){return Math.min(n,Math.max(t,a))}function Pn(t,n){const a=t-n;return Math.sqrt(a*a)}function rn(){return Math.round(Math.random()*1e6).toString()}function on(t){return t.r!==void 0&&t.g!==void 0&&t.b!==void 0}function sn(t){const n=Math.round(t.r*255),a=Math.round(t.g*255),e=Math.round(t.b*255),o=d=>{const p=d.toString(16);return p.length===1?"0"+p:p},c=o(n),m=o(a),l=o(e);return"#"+c+m+l}function St(t,n=1){return Number(t.toFixed(n))}exports.totalThreeObjects=0;const cn=()=>{exports.totalThreeObjects=0},Ut=t=>{if(!t)return;let n=t.name.replace(" ","");n.length===0&&(n=`obj_${exports.totalThreeObjects}`,exports.totalThreeObjects++),t.parent!==null&&(n=`${t.parent.uuid}.${n}`),t.uuid=n,t.children.forEach(a=>{Ut(a)})},kn=t=>{t?.dispose()},ln=t=>{t&&(Array.isArray(t)?t.forEach(n=>n.dispose()):t.dispose())},Bt=t=>{if(t){for(;t.children.length>0;){const n=t.children[0];n instanceof s.PositionalAudio?(n.pause(),n.parent&&n.parent.remove(n)):Bt(n)}if(t.parent&&t.parent.remove(t),t.isMesh){const n=t;n.geometry?.dispose(),ln(n.material)}t.dispose!==void 0&&t.dispose()}};class jn{components=new Map;listen;_debugEnabled;_broadcastChannel=void 0;_webSocket=void 0;_mode="app";_connected=!1;_useBC=!1;constructor(n,a,e=!0){this._debugEnabled=a,a&&(this._useBC=e,e?(this._broadcastChannel=new BroadcastChannel(n),this._broadcastChannel.addEventListener("message",this.messageHandler)):(this._webSocket=new WebSocket(n),this._webSocket.addEventListener("open",this.openHandler),this._webSocket.addEventListener("close",this.closeHandler),this._webSocket.addEventListener("message",this.messageHandler)))}init(){return new Promise(n=>{this.components.forEach(a=>{a.handleEditorApp()}),n()})}addComponent(n,a){this.components.set(n,a)}dispose(){this._broadcastChannel!==void 0&&this._broadcastChannel.removeEventListener("message",this.messageHandler),this._webSocket!==void 0&&(this._webSocket.removeEventListener("open",this.openHandler),this._webSocket.removeEventListener("close",this.closeHandler),this._webSocket.removeEventListener("message",this.messageHandler)),this.components.forEach(n=>{n.dispose()}),this.components.clear()}send(n){this._mode!==n.target&&(this._useBC?this._broadcastChannel?.postMessage(n):this._connected&&this._webSocket?.send(JSON.stringify(n)))}messageHandler=n=>{this.listen!==void 0&&(this._useBC?this.listen(n.data):this.listen(JSON.parse(n.data)))};openHandler=()=>{this._connected=!0};closeHandler=()=>{this._connected=!1};get connected(){return this._connected}get debugEnabled(){return this._debugEnabled}get mode(){return this._mode}get isApp(){return this._mode==="app"}get editor(){return this._mode==="editor"}set editor(n){n&&(this._mode="editor")}}const D=new s.EventDispatcher,I={CUSTOM:"ToolEvents::custom",SELECT_DROPDOWN:"ToolEvents::selectDropdown",DRAG_UPDATE:"ToolEvents::dragUpdate",SET_SCENE:"ToolEvents::setScene",GET_OBJECT:"ToolEvents::getObject",SET_OBJECT:"ToolEvents::setObject",UPDATE_OBJECT:"ToolEvents::updateObject",CREATE_TEXTURE:"ToolEvents::createTexture",REQUEST_METHOD:"ToolEvents::requestMethod",ADD_CAMERA:"ToolEvents::addCamera",REMOVE_CAMERA:"ToolEvents::removeCamera"};class ot{app;constructor(n){this.app=n}dispose(){}handleApp(n){}handleEditor(n){}handleEditorApp(){}}class Dn extends ot{selectDropdown(n,a){this.app.send({event:"selectComponent",target:"app",data:{dropdown:n,value:a}})}updateDropdown(n,a){this.app.send({event:"draggableListUpdate",target:"app",data:{dropdown:n,value:a}})}handleApp(n){switch(n.event){case"selectComponent":D.dispatchEvent({type:I.SELECT_DROPDOWN,value:n.data});break;case"draggableListUpdate":D.dispatchEvent({type:I.DRAG_UPDATE,value:n.data});break}}}const un=()=>{};let ve;class Ge extends ot{project;sheets=new Map;sheetObjects=new Map;sheetObjectCBs=new Map;sheetObjectUnsubscribe=new Map;static rafDriver=null;init(n,a){return this.project=Ht.getProject(n,a),this.project.ready}dispose(){this.project=void 0,this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}sheet(n){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}let a=this.sheets.get(n);return a!==void 0||(a=this.project?.sheet(n),this.sheets.set(n,a)),a}playSheet(n,a){this.sheet(n)?.sequence.play(a),this.app.send({event:"playSheet",target:"editor",data:{sheet:n,value:a}})}pauseSheet(n){this.sheet(n)?.sequence.pause(),this.app.send({event:"pauseSheet",target:"editor",data:{sheet:n}})}clearSheetObjects(n){this.sheetObjects.forEach((a,e)=>{e.search(`${n}_`)>-1&&this.unsubscribe(a)})}sheetObject(n,a,e,o){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const c=this.sheet(n);if(c===void 0)return;const m=`${n}_${a}`;let l=this.sheetObjects.get(m);l!==void 0?l=c.object(a,{...e,...l.value},{reconfigure:!0}):l=c.object(a,e),this.sheetObjects.set(m,l),this.sheetObjectCBs.set(m,o!==void 0?o:un);const d=l.onValuesChange(p=>{if(this.app.editor){for(const y in p){const C=p[y];typeof C=="object"&&on(C)&&(p[y]={r:C.r,g:C.g,b:C.b,a:C.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:n,sheetObject:m,values:p}})}const g=this.sheetObjectCBs.get(m);g!==void 0&&g(p)});return this.sheetObjectUnsubscribe.set(m,d),l}unsubscribe(n){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const a=n.address.sheetId,e=n.address.objectKey;this.sheets.get(a)?.detachObject(e);const c=`${a}_${e}`,m=this.sheetObjectUnsubscribe.get(c);m!==void 0&&(this.sheetObjects.delete(c),this.sheetObjectCBs.delete(c),this.sheetObjectUnsubscribe.delete(c),m())}handleApp(n){let a;switch(n.event){case"setSheet":a=this.sheets.get(n.data.sheet),a!==void 0&&(ve=a,et.setSelection([a]));break;case"setSheetObject":a=this.sheetObjects.get(`${n.data.sheet}_${n.data.key}`),a!==void 0&&et.setSelection([a]);break;case"updateSheetObject":a=this.sheets.get(n.data.sheet),a!==void 0&&a.sequence.pause(),a=this.sheetObjectCBs.get(n.data.sheetObject),a!==void 0&&a(n.data.values);break;case"updateTimeline":a=this.sheets.get(n.data.sheet),ve!==void 0&&(ve.sequence.position=n.data.position);break}}handleEditor(n){if(this.app.editor)switch(n.event){case"playSheet":this.sheet(n.data.sheet)?.sequence.play(n.data.value);break;case"pauseSheet":this.sheet(n.data.sheet)?.sequence.pause();break}}handleEditorApp(){if(this.app.editor){et.ui.restore(),et.onSelectionChange(o=>{o.length<1||o.forEach(c=>{let m=c.address.sheetId,l="setSheet",d={};switch(c.type){case"Theatre_Sheet_PublicAPI":l="setSheet",d={sheet:c.address.sheetId},ve=this.sheets.get(c.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":l="setSheetObject",m+=`_${c.address.objectKey}`,d={id:m,sheet:c.address.sheetId,key:c.address.objectKey},ve=this.sheets.get(c.address.sheetId);break}this.app.send({event:l,target:"app",data:d})})});let n=-1;const a=()=>{if(Ge.getRafDriver().tick(performance.now()),ve!==void 0&&n!==ve.sequence.position){n=ve.sequence.position;const o=ve;this.app.send({event:"updateTimeline",target:"app",data:{position:n,sheet:o.address.sheetId}})}},e=()=>{a(),requestAnimationFrame(e)};a(),e()}else et.ui.hide()}static getRafDriver(){return Ge.rafDriver||(Ge.rafDriver=Ht.createRafDriver()),Ge.rafDriver}}function In(t){if(t.name==="cameras")return"camera";if(t.name==="interactive")return"interactive";if(t.name==="lights")return"light";if(t.name==="ui")return"ui";if(t.name==="utils")return"utils";const n=t.type;return n.search("Helper")>-1?"icon_utils":n.search("Camera")>-1?"camera":n.search("Light")>-1?"light":"obj3D"}function dn(t){const n={name:t.name,type:t.type,uuid:t.uuid,children:[]};return t.children.forEach(a=>{n.children.push(dn(a))}),n}function Nn(t){const n={};for(const a in t){const e=t[a].value;n[a]={value:e},e===null?n[a].value={src:""}:e.isTexture&&(n[a].value={src:e.image.src})}return n}function Ln(t){switch(t){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function ze(t){const n={};for(const a in t){if(a.substring(0,1)==="_"||a.substring(0,2)==="is"||Ln(a))continue;const e=typeof t[a],o=t[a];switch(e){case"boolean":case"number":case"string":n[a]=o;break;case"object":if(o!==null)if(n[a]=o,o.isTexture)if(o instanceof s.Texture){const c=o.source.toJSON();n[a]={src:c.url}}else o instanceof s.CubeTexture&&(console.log("env map"),console.log(o.source.data),console.log(o.source.toJSON()),n[a]={src:""});else a==="uniforms"&&(n[a]=Nn(n[a]));else n[a]={src:""};break}}return n}function Dt(t){t.updateMatrix();const n={name:t.name,type:t.type,uuid:t.uuid,visible:t.visible,matrix:t.matrix.elements,animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0};t.animations.forEach(e=>{n.animations.push({name:e.name,duration:e.duration,blendMode:e.blendMode})});const a=t.type.toLowerCase();if(a.search("mesh")>-1){const e=t;if(Array.isArray(e.material)){const o=[];e.material.forEach(c=>{o.push(ze(c))}),n.material=o}else n.material=ze(e.material)}else if(a.search("points")>-1){const e=t;if(Array.isArray(e.material)){const o=[];e.material.forEach(c=>{o.push(ze(c))}),n.material=o}else n.material=ze(e.material)}else if(a.search("line")>-1){const e=t;if(Array.isArray(e.material)){const o=[];e.material.forEach(c=>{o.push(ze(c))}),n.material=o}else n.material=ze(e.material)}else a.search("camera")>-1?t.type==="PerspectiveCamera"?n.perspectiveCameraInfo={fov:t.fov,zoom:t.zoom,near:t.near,far:t.far,focus:t.focus,aspect:t.aspect,filmGauge:t.filmGauge,filmOffset:t.filmOffset}:t.type==="OrthographicCamera"&&(n.orthographicCameraInfo={zoom:t.zoom,near:t.near,far:t.far,left:t.left,right:t.right,top:t.top,bottom:t.bottom}):a.search("light")>-1&&(n.lightInfo={color:t.color,intensity:t.intensity,decay:t.decay,distance:t.distance,angle:t.angle,penumbra:t.penumbra,groundColor:t.groundColor});return n}function Fn(t,n){const a=n.split(".");switch(a.length){case 1:return t[a[0]];case 2:return t[a[0]][a[1]];case 3:return t[a[0]][a[1]][a[2]];case 4:return t[a[0]][a[1]][a[2]][a[3]];case 5:return t[a[0]][a[1]][a[2]][a[3]][a[4]];case 6:return t[a[0]][a[1]][a[2]][a[3]][a[4]][a[5]]}}function te(t,n,a){const e=n.split(".");switch(e.length){case 1:t[e[0]]=a;break;case 2:t[e[0]][e[1]]=a;break;case 3:t[e[0]][e[1]][e[2]]=a;break;case 4:t[e[0]][e[1]][e[2]][e[3]]=a;break;case 5:t[e[0]][e[1]][e[2]][e[3]][e[4]]=a;break}}function Lt(t){return new Promise((n,a)=>{const e=new Image;e.onload=()=>{const o=new s.Texture(e);o.wrapS=s.RepeatWrapping,o.wrapT=s.RepeatWrapping,o.needsUpdate=!0,n(o)},e.onerror=a,e.src=t})}class Un extends ot{scene=void 0;getObject(n){this.app.debugEnabled&&this.app.send({event:"getObject",target:"app",data:n})}setObject(n){const a=Dt(n);this.app.send({event:"setObject",target:"editor",data:a})}requestMethod(n,a,e,o){this.app.send({event:"requestMethod",target:"app",data:{uuid:n,key:a,value:e,subitem:o}})}updateObject(n,a,e){this.app.send({event:"updateObject",target:"app",data:{uuid:n,key:a,value:e}})}createTexture(n,a,e){this.app.send({event:"createTexture",target:"app",data:{uuid:n,key:a,value:e}})}setScene(n){if(n===void 0||(this.scene=n,!this.app.debugEnabled))return;cn(),Ut(this.scene);const a=dn(this.scene);this.app.send({event:"setScene",target:"editor",data:a})}addCamera(n){if(!this.app.debugEnabled)return;const a=Dt(n);this.app.send({event:"addCamera",target:"editor",data:a})}removeCamera(n){if(!this.app.debugEnabled)return;const a=Dt(n);this.app.send({event:"removeCamera",target:"editor",data:a})}handleApp(n){switch(n.event){case"getObject":D.dispatchEvent({type:I.GET_OBJECT,value:n.data});break;case"updateObject":D.dispatchEvent({type:I.UPDATE_OBJECT,value:n.data});break;case"createTexture":D.dispatchEvent({type:I.CREATE_TEXTURE,value:n.data});break;case"requestMethod":D.dispatchEvent({type:I.REQUEST_METHOD,value:n.data});break}}handleEditor(n){switch(n.event){case"setObject":D.dispatchEvent({type:I.SET_OBJECT,value:n.data});break;case"setScene":D.dispatchEvent({type:I.SET_SCENE,value:n.data});break;case"addCamera":D.dispatchEvent({type:I.ADD_CAMERA,value:n.data});break;case"removeCamera":D.dispatchEvent({type:I.REMOVE_CAMERA,value:n.data});break}}}class Bn extends ot{bindCBs;buttonCBs;pane=void 0;appCallbacks=0;editorCallbacks=0;inspectorFolder=void 0;constructor(n){super(n),this.bindCBs=new Map,this.buttonCBs=new Map,n.editor&&this.createGUI()}createGUI(){this.pane=new Mn.Pane({title:"GUI"}),this.pane.registerPlugin(_n)}dispose(){this.bindCBs.clear(),this.buttonCBs.clear(),this.appCallbacks=0,this.editorCallbacks=0,this.app.editor&&(this.pane?.dispose(),this.pane=void 0)}addFolder(n,a=void 0,e=void 0){if(this.app.editor)return this.pane===void 0&&this.createGUI(),(e!==void 0?e:this.pane).addFolder({title:n,...a});this.app.send({event:"addFolder",target:"app",data:{name:n,params:a,parent:e}})}get bindID(){return`debug_${Math.max(this.appCallbacks,this.editorCallbacks)}`}bind(n,a,e,o=void 0){const c=this.bindID,m=e.onChange!==void 0?e.onChange:un;this.bindCBs.set(c,m),this.app.editor?(this.pane===void 0&&this.createGUI(),(o!==void 0?o:this.pane).addBinding(n,a,e).on("change",d=>{this.app.send({event:"updateBind",target:"app",data:{id:c,value:d.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",target:"app",data:{id:c,name:a,params:e,parent:o}}),this.appCallbacks++)}triggerBind(n,a){const e=this.bindCBs.get(n);e!==void 0?e(a):console.warn(`No callback for: ${n}`,a)}button(n,a,e=void 0){const o=this.bindID;this.buttonCBs.set(o,a),this.app.editor?(this.pane===void 0&&this.createGUI(),(e!==void 0?e:this.pane).addButton({title:n}).on("click",()=>{this.app.send({event:"clickButton",target:"app",data:{id:o}})}),this.editorCallbacks++):(this.app.send({event:"addButton",target:"app",data:{id:o,name:n,callback:a,parent:e}}),this.appCallbacks++)}triggerButton(n){const a=this.buttonCBs.get(n);a!==void 0&&a()}createInspector(){this.inspectorFolder=this.addFolder("Inspector",this.pane)}clearInspector(){const n=this.inspectorFolder.children.length-1;for(let a=n;a>-1;--a)this.inspectorFolder.remove(this.inspectorFolder.children[a])}handleApp(n){switch(n.event){case"addFolder":this.addFolder(n.data.name,n.data.params,n.data.parent);break;case"bindObject":this.bind(n.data.name,n.data.params,n.data.parent);break;case"updateBind":this.triggerBind(n.data.id,n.data.value);break;case"addButton":this.button(n.data.name,n.data.callback,n.data.parent);break;case"clickButton":this.triggerButton(n.data.id);break}}}var Ft={exports:{}},tt={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Kt;function Jn(){if(Kt)return nt;Kt=1;var t=k,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function p(l,u,f){var y,v={},C=null,x=null;f!==void 0&&(C=""+f),u.key!==void 0&&(C=""+u.key),u.ref!==void 0&&(x=u.ref);for(y in u)e.call(u,y)&&!s.hasOwnProperty(y)&&(v[y]=u[y]);if(l&&l.defaultProps)for(y in u=l.defaultProps,u)v[y]===void 0&&(v[y]=u[y]);return{$$typeof:n,type:l,key:C,ref:x,props:v,_owner:r.current}}return nt.Fragment=a,nt.jsx=p,nt.jsxs=p,nt}var at={};/**
9
+ */var Wt;function Vn(){if(Wt)return tt;Wt=1;var t=A,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function m(l,d,p){var g,y={},C=null,x=null;p!==void 0&&(C=""+p),d.key!==void 0&&(C=""+d.key),d.ref!==void 0&&(x=d.ref);for(g in d)e.call(d,g)&&!c.hasOwnProperty(g)&&(y[g]=d[g]);if(l&&l.defaultProps)for(g in d=l.defaultProps,d)y[g]===void 0&&(y[g]=d[g]);return{$$typeof:n,type:l,key:C,ref:x,props:y,_owner:o.current}}return tt.Fragment=a,tt.jsx=m,tt.jsxs=m,tt}var nt={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,19 +14,19 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Xt;function Qn(){return Xt||(Xt=1,process.env.NODE_ENV!=="production"&&function(){var t=k,n=Symbol.for("react.element"),a=Symbol.for("react.portal"),e=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),w=Symbol.iterator,R="@@iterator";function K(i){if(i===null||typeof i!="object")return null;var m=w&&i[w]||i[R];return typeof m=="function"?m:null}var L=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function O(i){{for(var m=arguments.length,b=new Array(m>1?m-1:0),M=1;M<m;M++)b[M-1]=arguments[M];W("error",i,b)}}function W(i,m,b){{var M=L.ReactDebugCurrentFrame,N=M.getStackAddendum();N!==""&&(m+="%s",b=b.concat([N]));var H=b.map(function(j){return String(j)});H.unshift("Warning: "+m),Function.prototype.apply.call(console[i],console,H)}}var fe=!1,ne=!1,ie=!1,h=!1,g=!1,S;S=Symbol.for("react.module.reference");function _(i){return!!(typeof i=="string"||typeof i=="function"||i===e||i===s||g||i===r||i===f||i===y||h||i===x||fe||ne||ie||typeof i=="object"&&i!==null&&(i.$$typeof===C||i.$$typeof===v||i.$$typeof===p||i.$$typeof===l||i.$$typeof===u||i.$$typeof===S||i.getModuleId!==void 0))}function G(i,m,b){var M=i.displayName;if(M)return M;var N=m.displayName||m.name||"";return N!==""?b+"("+N+")":b}function Y(i){return i.displayName||"Context"}function V(i){if(i==null)return null;if(typeof i.tag=="number"&&O("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case e:return"Fragment";case a:return"Portal";case s:return"Profiler";case r:return"StrictMode";case f:return"Suspense";case y:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case l:var m=i;return Y(m)+".Consumer";case p:var b=i;return Y(b._context)+".Provider";case u:return G(i,i.render,"ForwardRef");case v:var M=i.displayName||null;return M!==null?M:V(i.type)||"Memo";case C:{var N=i,H=N._payload,j=N._init;try{return V(j(H))}catch{return null}}}return null}var F=Object.assign,X=0,Z,A,z,ee,de,Ee,ut;function qe(){}qe.__reactDisabledLog=!0;function Rt(){{if(X===0){Z=console.log,A=console.info,z=console.warn,ee=console.error,de=console.group,Ee=console.groupCollapsed,ut=console.groupEnd;var i={configurable:!0,enumerable:!0,value:qe,writable:!0};Object.defineProperties(console,{info:i,log:i,warn:i,error:i,group:i,groupCollapsed:i,groupEnd:i})}X++}}function At(){{if(X--,X===0){var i={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},i,{value:Z}),info:F({},i,{value:A}),warn:F({},i,{value:z}),error:F({},i,{value:ee}),group:F({},i,{value:de}),groupCollapsed:F({},i,{value:Ee}),groupEnd:F({},i,{value:ut})})}X<0&&O("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ke=L.ReactCurrentDispatcher,Xe;function Be(i,m,b){{if(Xe===void 0)try{throw Error()}catch(N){var M=N.stack.trim().match(/\n( *(at )?)/);Xe=M&&M[1]||""}return`
18
- `+Xe+i}}var Ve=!1,xe;{var dt=typeof WeakMap=="function"?WeakMap:Map;xe=new dt}function ft(i,m){if(!i||Ve)return"";{var b=xe.get(i);if(b!==void 0)return b}var M;Ve=!0;var N=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var H;H=Ke.current,Ke.current=null,Rt();try{if(m){var j=function(){throw Error()};if(Object.defineProperty(j.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(j,[])}catch(ge){M=ge}Reflect.construct(i,[],j)}else{try{j.call()}catch(ge){M=ge}i.call(j.prototype)}}else{try{throw Error()}catch(ge){M=ge}i()}}catch(ge){if(ge&&M&&typeof ge.stack=="string"){for(var P=ge.stack.split(`
19
- `),ue=M.stack.split(`
20
- `),Q=P.length-1,te=ue.length-1;Q>=1&&te>=0&&P[Q]!==ue[te];)te--;for(;Q>=1&&te>=0;Q--,te--)if(P[Q]!==ue[te]){if(Q!==1||te!==1)do if(Q--,te--,te<0||P[Q]!==ue[te]){var me=`
21
- `+P[Q].replace(" at new "," at ");return i.displayName&&me.includes("<anonymous>")&&(me=me.replace("<anonymous>",i.displayName)),typeof i=="function"&&xe.set(i,me),me}while(Q>=1&&te>=0);break}}}finally{Ve=!1,Ke.current=H,At(),Error.prepareStackTrace=N}var He=i?i.displayName||i.name:"",$t=He?Be(He):"";return typeof i=="function"&&xe.set(i,$t),$t}function Pt(i,m,b){return ft(i,!1)}function ht(i){var m=i.prototype;return!!(m&&m.isReactComponent)}function Oe(i,m,b){if(i==null)return"";if(typeof i=="function")return ft(i,ht(i));if(typeof i=="string")return Be(i);switch(i){case f:return Be("Suspense");case y:return Be("SuspenseList")}if(typeof i=="object")switch(i.$$typeof){case u:return Pt(i.render);case v:return Oe(i.type,m,b);case C:{var M=i,N=M._payload,H=M._init;try{return Oe(H(N),m,b)}catch{}}}return""}var Me=Object.prototype.hasOwnProperty,pt={},mt=L.ReactDebugCurrentFrame;function Te(i){if(i){var m=i._owner,b=Oe(i.type,i._source,m?m.type:null);mt.setExtraStackFrame(b)}else mt.setExtraStackFrame(null)}function Ze(i,m,b,M,N){{var H=Function.call.bind(Me);for(var j in i)if(H(i,j)){var P=void 0;try{if(typeof i[j]!="function"){var ue=Error((M||"React class")+": "+b+" type `"+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[j]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ue.name="Invariant Violation",ue}P=i[j](m,j,M,b,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Q){P=Q}P&&!(P instanceof Error)&&(Te(N),O("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",M||"React class",b,j,typeof P),Te(null)),P instanceof Error&&!(P.message in pt)&&(pt[P.message]=!0,Te(N),O("Failed %s type: %s",b,P.message),Te(null))}}}var Re=Array.isArray;function Je(i){return Re(i)}function kt(i){{var m=typeof Symbol=="function"&&Symbol.toStringTag,b=m&&i[Symbol.toStringTag]||i.constructor.name||"Object";return b}}function vt(i){try{return gt(i),!1}catch{return!0}}function gt(i){return""+i}function bt(i){if(vt(i))return O("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",kt(i)),gt(i)}var Ce=L.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},et,yt,ze;ze={};function _t(i){if(Me.call(i,"ref")){var m=Object.getOwnPropertyDescriptor(i,"ref").get;if(m&&m.isReactWarning)return!1}return i.ref!==void 0}function jt(i){if(Me.call(i,"key")){var m=Object.getOwnPropertyDescriptor(i,"key").get;if(m&&m.isReactWarning)return!1}return i.key!==void 0}function Et(i,m){if(typeof i.ref=="string"&&Ce.current&&m&&Ce.current.stateNode!==m){var b=V(Ce.current.type);ze[b]||(O('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',V(Ce.current.type),i.ref),ze[b]=!0)}}function Se(i,m){{var b=function(){et||(et=!0,O("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};b.isReactWarning=!0,Object.defineProperty(i,"key",{get:b,configurable:!0})}}function Wt(i,m){{var b=function(){yt||(yt=!0,O("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};b.isReactWarning=!0,Object.defineProperty(i,"ref",{get:b,configurable:!0})}}var o=function(i,m,b,M,N,H,j){var P={$$typeof:n,type:i,key:m,ref:b,props:j,_owner:H};return P._store={},Object.defineProperty(P._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(P,"_self",{configurable:!1,enumerable:!1,writable:!1,value:M}),Object.defineProperty(P,"_source",{configurable:!1,enumerable:!1,writable:!1,value:N}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P};function E(i,m,b,M,N){{var H,j={},P=null,ue=null;b!==void 0&&(bt(b),P=""+b),jt(m)&&(bt(m.key),P=""+m.key),_t(m)&&(ue=m.ref,Et(m,N));for(H in m)Me.call(m,H)&&!Qe.hasOwnProperty(H)&&(j[H]=m[H]);if(i&&i.defaultProps){var Q=i.defaultProps;for(H in Q)j[H]===void 0&&(j[H]=Q[H])}if(P||ue){var te=typeof i=="function"?i.displayName||i.name||"Unknown":i;P&&Se(j,te),ue&&Wt(j,te)}return o(i,P,ue,N,M,Ce.current,j)}}var T=L.ReactCurrentOwner,U=L.ReactDebugCurrentFrame;function J(i){if(i){var m=i._owner,b=Oe(i.type,i._source,m?m.type:null);U.setExtraStackFrame(b)}else U.setExtraStackFrame(null)}var he;he=!1;function se(i){return typeof i=="object"&&i!==null&&i.$$typeof===n}function Dt(){{if(T.current){var i=V(T.current.type);if(i)return`
17
+ */var $t;function zn(){return $t||($t=1,process.env.NODE_ENV!=="production"&&function(){var t=A,n=Symbol.for("react.element"),a=Symbol.for("react.portal"),e=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),l=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),T=Symbol.iterator,j="@@iterator";function q(i){if(i===null||typeof i!="object")return null;var f=T&&i[T]||i[j];return typeof f=="function"?f:null}var V=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(i){{for(var f=arguments.length,b=new Array(f>1?f-1:0),S=1;S<f;S++)b[S-1]=arguments[S];G("error",i,b)}}function G(i,f,b){{var S=V.ReactDebugCurrentFrame,N=S.getStackAddendum();N!==""&&(f+="%s",b=b.concat([N]));var B=b.map(function(k){return String(k)});B.unshift("Warning: "+f),Function.prototype.apply.call(console[i],console,B)}}var ye=!1,le=!1,se=!1,h=!1,v=!1,O;O=Symbol.for("react.module.reference");function P(i){return!!(typeof i=="string"||typeof i=="function"||i===e||i===c||v||i===o||i===p||i===g||h||i===x||ye||le||se||typeof i=="object"&&i!==null&&(i.$$typeof===C||i.$$typeof===y||i.$$typeof===m||i.$$typeof===l||i.$$typeof===d||i.$$typeof===O||i.getModuleId!==void 0))}function H(i,f,b){var S=i.displayName;if(S)return S;var N=f.displayName||f.name||"";return N!==""?b+"("+N+")":b}function z(i){return i.displayName||"Context"}function Y(i){if(i==null)return null;if(typeof i.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case e:return"Fragment";case a:return"Portal";case c:return"Profiler";case o:return"StrictMode";case p:return"Suspense";case g:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case l:var f=i;return z(f)+".Consumer";case m:var b=i;return z(b._context)+".Provider";case d:return H(i,i.render,"ForwardRef");case y:var S=i.displayName||null;return S!==null?S:Y(i.type)||"Memo";case C:{var N=i,B=N._payload,k=N._init;try{return Y(k(B))}catch{return null}}}return null}var L=Object.assign,K=0,X,R,U,Q,pe,Ee,ct;function We(){}We.__reactDisabledLog=!0;function Mt(){{if(K===0){X=console.log,R=console.info,U=console.warn,Q=console.error,pe=console.group,Ee=console.groupCollapsed,ct=console.groupEnd;var i={configurable:!0,enumerable:!0,value:We,writable:!0};Object.defineProperties(console,{info:i,log:i,warn:i,error:i,group:i,groupCollapsed:i,groupEnd:i})}K++}}function Tt(){{if(K--,K===0){var i={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},i,{value:X}),info:L({},i,{value:R}),warn:L({},i,{value:U}),error:L({},i,{value:Q}),group:L({},i,{value:pe}),groupCollapsed:L({},i,{value:Ee}),groupEnd:L({},i,{value:ct})})}K<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var $e=V.ReactCurrentDispatcher,qe;function Fe(i,f,b){{if(qe===void 0)try{throw Error()}catch(N){var S=N.stack.trim().match(/\n( *(at )?)/);qe=S&&S[1]||""}return`
18
+ `+qe+i}}var Ue=!1,xe;{var lt=typeof WeakMap=="function"?WeakMap:Map;xe=new lt}function ut(i,f){if(!i||Ue)return"";{var b=xe.get(i);if(b!==void 0)return b}var S;Ue=!0;var N=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var B;B=$e.current,$e.current=null,Mt();try{if(f){var k=function(){throw Error()};if(Object.defineProperty(k.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(k,[])}catch(me){S=me}Reflect.construct(i,[],k)}else{try{k.call()}catch(me){S=me}i.call(k.prototype)}}else{try{throw Error()}catch(me){S=me}i()}}catch(me){if(me&&S&&typeof me.stack=="string"){for(var _=me.stack.split(`
19
+ `),ce=S.stack.split(`
20
+ `),J=_.length-1,ee=ce.length-1;J>=1&&ee>=0&&_[J]!==ce[ee];)ee--;for(;J>=1&&ee>=0;J--,ee--)if(_[J]!==ce[ee]){if(J!==1||ee!==1)do if(J--,ee--,ee<0||_[J]!==ce[ee]){var he=`
21
+ `+_[J].replace(" at new "," at ");return i.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",i.displayName)),typeof i=="function"&&xe.set(i,he),he}while(J>=1&&ee>=0);break}}}finally{Ue=!1,$e.current=B,Tt(),Error.prepareStackTrace=N}var Ve=i?i.displayName||i.name:"",Gt=Ve?Fe(Ve):"";return typeof i=="function"&&xe.set(i,Gt),Gt}function Rt(i,f,b){return ut(i,!1)}function dt(i){var f=i.prototype;return!!(f&&f.isReactComponent)}function we(i,f,b){if(i==null)return"";if(typeof i=="function")return ut(i,dt(i));if(typeof i=="string")return Fe(i);switch(i){case p:return Fe("Suspense");case g:return Fe("SuspenseList")}if(typeof i=="object")switch(i.$$typeof){case d:return Rt(i.render);case y:return we(i.type,f,b);case C:{var S=i,N=S._payload,B=S._init;try{return we(B(N),f,b)}catch{}}}return""}var Oe=Object.prototype.hasOwnProperty,ht={},ft=V.ReactDebugCurrentFrame;function Me(i){if(i){var f=i._owner,b=we(i.type,i._source,f?f.type:null);ft.setExtraStackFrame(b)}else ft.setExtraStackFrame(null)}function Ke(i,f,b,S,N){{var B=Function.call.bind(Oe);for(var k in i)if(B(i,k)){var _=void 0;try{if(typeof i[k]!="function"){var ce=Error((S||"React class")+": "+b+" type `"+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[k]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ce.name="Invariant Violation",ce}_=i[k](f,k,S,b,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(J){_=J}_&&!(_ instanceof Error)&&(Me(N),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",S||"React class",b,k,typeof _),Me(null)),_ instanceof Error&&!(_.message in ht)&&(ht[_.message]=!0,Me(N),w("Failed %s type: %s",b,_.message),Me(null))}}}var Te=Array.isArray;function Xe(i){return Te(i)}function _t(i){{var f=typeof Symbol=="function"&&Symbol.toStringTag,b=f&&i[Symbol.toStringTag]||i.constructor.name||"Object";return b}}function pt(i){try{return mt(i),!1}catch{return!0}}function mt(i){return""+i}function vt(i){if(pt(i))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",_t(i)),mt(i)}var Ce=V.ReactCurrentOwner,Ze={key:!0,ref:!0,__self:!0,__source:!0},Je,gt,Be;Be={};function At(i){if(Oe.call(i,"ref")){var f=Object.getOwnPropertyDescriptor(i,"ref").get;if(f&&f.isReactWarning)return!1}return i.ref!==void 0}function Pt(i){if(Oe.call(i,"key")){var f=Object.getOwnPropertyDescriptor(i,"key").get;if(f&&f.isReactWarning)return!1}return i.key!==void 0}function bt(i,f){if(typeof i.ref=="string"&&Ce.current&&f&&Ce.current.stateNode!==f){var b=Y(Ce.current.type);Be[b]||(w('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',Y(Ce.current.type),i.ref),Be[b]=!0)}}function Se(i,f){{var b=function(){Je||(Je=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",f))};b.isReactWarning=!0,Object.defineProperty(i,"key",{get:b,configurable:!0})}}function Yt(i,f){{var b=function(){gt||(gt=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",f))};b.isReactWarning=!0,Object.defineProperty(i,"ref",{get:b,configurable:!0})}}var r=function(i,f,b,S,N,B,k){var _={$$typeof:n,type:i,key:f,ref:b,props:k,_owner:B};return _._store={},Object.defineProperty(_._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(_,"_self",{configurable:!1,enumerable:!1,writable:!1,value:S}),Object.defineProperty(_,"_source",{configurable:!1,enumerable:!1,writable:!1,value:N}),Object.freeze&&(Object.freeze(_.props),Object.freeze(_)),_};function E(i,f,b,S,N){{var B,k={},_=null,ce=null;b!==void 0&&(vt(b),_=""+b),Pt(f)&&(vt(f.key),_=""+f.key),At(f)&&(ce=f.ref,bt(f,N));for(B in f)Oe.call(f,B)&&!Ze.hasOwnProperty(B)&&(k[B]=f[B]);if(i&&i.defaultProps){var J=i.defaultProps;for(B in J)k[B]===void 0&&(k[B]=J[B])}if(_||ce){var ee=typeof i=="function"?i.displayName||i.name||"Unknown":i;_&&Se(k,ee),ce&&Yt(k,ee)}return r(i,_,ce,N,S,Ce.current,k)}}var M=V.ReactCurrentOwner,F=V.ReactDebugCurrentFrame;function Z(i){if(i){var f=i._owner,b=we(i.type,i._source,f?f.type:null);F.setExtraStackFrame(b)}else F.setExtraStackFrame(null)}var ue;ue=!1;function ie(i){return typeof i=="object"&&i!==null&&i.$$typeof===n}function kt(){{if(M.current){var i=Y(M.current.type);if(i)return`
22
22
 
23
- Check the render method of \``+i+"`."}return""}}function It(i){{if(i!==void 0){var m=i.fileName.replace(/^.*[\\\/]/,""),b=i.lineNumber;return`
23
+ Check the render method of \``+i+"`."}return""}}function jt(i){{if(i!==void 0){var f=i.fileName.replace(/^.*[\\\/]/,""),b=i.lineNumber;return`
24
24
 
25
- Check your code at `+m+":"+b+"."}return""}}var tt={};function ve(i){{var m=Dt();if(!m){var b=typeof i=="string"?i:i.displayName||i.name;b&&(m=`
25
+ Check your code at `+f+":"+b+"."}return""}}var Qe={};function fe(i){{var f=kt();if(!f){var b=typeof i=="string"?i:i.displayName||i.name;b&&(f=`
26
26
 
27
- Check the top-level render call using <`+b+">.")}return m}}function pe(i,m){{if(!i._store||i._store.validated||i.key!=null)return;i._store.validated=!0;var b=ve(m);if(tt[b])return;tt[b]=!0;var M="";i&&i._owner&&i._owner!==T.current&&(M=" It was passed a child from "+V(i._owner.type)+"."),J(i),O('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',b,M),J(null)}}function Ae(i,m){{if(typeof i!="object")return;if(Je(i))for(var b=0;b<i.length;b++){var M=i[b];se(M)&&pe(M,m)}else if(se(i))i._store&&(i._store.validated=!0);else if(i){var N=K(i);if(typeof N=="function"&&N!==i.entries)for(var H=N.call(i),j;!(j=H.next()).done;)se(j.value)&&pe(j.value,m)}}}function Pe(i){{var m=i.type;if(m==null||typeof m=="string")return;var b;if(typeof m=="function")b=m.propTypes;else if(typeof m=="object"&&(m.$$typeof===u||m.$$typeof===v))b=m.propTypes;else return;if(b){var M=V(m);Ze(b,i.props,"prop",M,i)}else if(m.PropTypes!==void 0&&!he){he=!0;var N=V(m);O("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",N||"Unknown")}typeof m.getDefaultProps=="function"&&!m.getDefaultProps.isReactClassApproved&&O("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ke(i){{for(var m=Object.keys(i.props),b=0;b<m.length;b++){var M=m[b];if(M!=="children"&&M!=="key"){J(i),O("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",M),J(null);break}}i.ref!==null&&(J(i),O("Invalid attribute `ref` supplied to `React.Fragment`."),J(null))}}function _e(i,m,b,M,N,H){{var j=_(i);if(!j){var P="";(i===void 0||typeof i=="object"&&i!==null&&Object.keys(i).length===0)&&(P+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ue=It(N);ue?P+=ue:P+=Dt();var Q;i===null?Q="null":Je(i)?Q="array":i!==void 0&&i.$$typeof===n?(Q="<"+(V(i.type)||"Unknown")+" />",P=" Did you accidentally export a JSX literal instead of a component?"):Q=typeof i,O("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Q,P)}var te=E(i,m,b,N,H);if(te==null)return te;if(j){var me=m.children;if(me!==void 0)if(M)if(Je(me)){for(var He=0;He<me.length;He++)Ae(me[He],i);Object.freeze&&Object.freeze(me)}else O("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ae(me,i)}return i===e?ke(te):Pe(te),te}}function Tn(i,m,b){return _e(i,m,b,!0)}function Rn(i,m,b){return _e(i,m,b,!1)}var An=Rn,Pn=Tn;at.Fragment=e,at.jsx=An,at.jsxs=Pn}()),at}process.env.NODE_ENV==="production"?Bt.exports=Jn():Bt.exports=Qn();var d=Bt.exports;function Yt(t){return t.title.search("<")>-1?d.jsx("button",{className:"svg",dangerouslySetInnerHTML:{__html:t.title}}):d.jsx("button",{children:t.title})}const ea=d.jsxs("svg",{className:"closeIcon",width:"14",height:"14",fill:"none",stroke:"#666666",strokeMiterlimit:"10",children:[d.jsx("circle",{cx:"7",cy:"7",r:"6"}),d.jsx("line",{x1:"4",y1:"4",x2:"10",y2:"10"}),d.jsx("line",{x1:"4",y1:"10",x2:"10",y2:"4"})]}),ta=d.jsx("svg",{className:"dragIcon",width:"14",height:"14",fill:"#666666",stroke:"none",children:d.jsx("path",{d:`M10.43,4H3.57C3.26,4,3,4.22,3,4.5v1C3,5.78,3.26,6,3.57,6h6.86C10.74,6,11,5.78,11,5.5v-1
27
+ Check the top-level render call using <`+b+">.")}return f}}function de(i,f){{if(!i._store||i._store.validated||i.key!=null)return;i._store.validated=!0;var b=fe(f);if(Qe[b])return;Qe[b]=!0;var S="";i&&i._owner&&i._owner!==M.current&&(S=" It was passed a child from "+Y(i._owner.type)+"."),Z(i),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',b,S),Z(null)}}function Re(i,f){{if(typeof i!="object")return;if(Xe(i))for(var b=0;b<i.length;b++){var S=i[b];ie(S)&&de(S,f)}else if(ie(i))i._store&&(i._store.validated=!0);else if(i){var N=q(i);if(typeof N=="function"&&N!==i.entries)for(var B=N.call(i),k;!(k=B.next()).done;)ie(k.value)&&de(k.value,f)}}}function _e(i){{var f=i.type;if(f==null||typeof f=="string")return;var b;if(typeof f=="function")b=f.propTypes;else if(typeof f=="object"&&(f.$$typeof===d||f.$$typeof===y))b=f.propTypes;else return;if(b){var S=Y(f);Ke(b,i.props,"prop",S,i)}else if(f.PropTypes!==void 0&&!ue){ue=!0;var N=Y(f);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",N||"Unknown")}typeof f.getDefaultProps=="function"&&!f.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ae(i){{for(var f=Object.keys(i.props),b=0;b<f.length;b++){var S=f[b];if(S!=="children"&&S!=="key"){Z(i),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",S),Z(null);break}}i.ref!==null&&(Z(i),w("Invalid attribute `ref` supplied to `React.Fragment`."),Z(null))}}function Pe(i,f,b,S,N,B){{var k=P(i);if(!k){var _="";(i===void 0||typeof i=="object"&&i!==null&&Object.keys(i).length===0)&&(_+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ce=jt(N);ce?_+=ce:_+=kt();var J;i===null?J="null":Xe(i)?J="array":i!==void 0&&i.$$typeof===n?(J="<"+(Y(i.type)||"Unknown")+" />",_=" Did you accidentally export a JSX literal instead of a component?"):J=typeof i,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",J,_)}var ee=E(i,f,b,N,B);if(ee==null)return ee;if(k){var he=f.children;if(he!==void 0)if(S)if(Xe(he)){for(var Ve=0;Ve<he.length;Ve++)Re(he[Ve],i);Object.freeze&&Object.freeze(he)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Re(he,i)}return i===e?Ae(ee):_e(ee),ee}}function Sn(i,f,b){return Pe(i,f,b,!0)}function xn(i,f,b){return Pe(i,f,b,!1)}var wn=xn,On=Sn;nt.Fragment=e,nt.jsx=wn,nt.jsxs=On}()),nt}process.env.NODE_ENV==="production"?Ft.exports=Vn():Ft.exports=zn();var u=Ft.exports;function Vt(t){return t.title.search("<")>-1?u.jsx("button",{className:"svg",dangerouslySetInnerHTML:{__html:t.title}}):u.jsx("button",{children:t.title})}const Yn=u.jsxs("svg",{className:"closeIcon",width:"14",height:"14",fill:"none",stroke:"#666666",strokeMiterlimit:"10",children:[u.jsx("circle",{cx:"7",cy:"7",r:"6"}),u.jsx("line",{x1:"4",y1:"4",x2:"10",y2:"10"}),u.jsx("line",{x1:"4",y1:"10",x2:"10",y2:"4"})]}),Gn=u.jsx("svg",{className:"dragIcon",width:"14",height:"14",fill:"#666666",stroke:"none",children:u.jsx("path",{d:`M10.43,4H3.57C3.26,4,3,4.22,3,4.5v1C3,5.78,3.26,6,3.57,6h6.86C10.74,6,11,5.78,11,5.5v-1
28
28
  C11,4.22,10.74,4,10.43,4z M10.43,8H3.57C3.26,8,3,8.22,3,8.5v1C3,9.78,3.26,10,3.57,10h6.86C10.74,10,11,9.78,11,9.5v-1
29
- C11,8.22,10.74,8,10.43,8z`})});function gn(t){return d.jsx(sn.Reorder.Item,{value:t.title,children:d.jsxs("div",{children:[ta,d.jsx("span",{children:t.title}),d.jsx("button",{className:"closeIcon",onClick:()=>{t.onDelete(t.index)},children:ea})]})},t.title)}function bn(t){const[n,a]=k.useState(!1),[e,r]=k.useState(t.options),s=f=>{t.onDragComplete(f),r(f)},p=f=>{const y=[...e];y.splice(f,1),s(y)},l=[];e.forEach((f,y)=>{l.push(d.jsx(gn,{index:y,title:f,onDelete:p},f))});let u="dropdown draggable";return t.subdropdown&&(u+=" subdropdown"),d.jsxs("div",{className:u,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[d.jsx(Yt,{title:t.title}),d.jsx(sn.Reorder.Group,{axis:"y",values:e,onReorder:s,style:{visibility:n?"visible":"hidden"},children:l})]})}function yn(t){const[n,a]=k.useState(!1),e=[];t.options.map((s,p)=>{t.onSelect!==void 0&&(s.onSelect=t.onSelect),e.push(d.jsx(En,{option:s},p))});let r="dropdown";return t.subdropdown&&(r+=" subdropdown"),d.jsxs("div",{className:r,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[d.jsx(Yt,{title:t.title}),d.jsx("ul",{style:{visibility:n?"visible":"hidden"},children:e})]})}function En(t){const{option:n}=t,[a,e]=k.useState("");let r;switch(n.type){case"draggable":r=d.jsx(bn,{title:n.title,options:n.value,onDragComplete:s=>{n.onDragComplete!==void 0&&n.onDragComplete(s)},subdropdown:!0});break;case"dropdown":r=d.jsx(yn,{title:n.title,options:n.value,onSelect:n.onSelect,subdropdown:!0});break;case"option":r=d.jsx("button",{onClick:()=>{n.onSelect!==void 0&&n.onSelect(n.value),n.selectable&&(a!==n.title?e(n.title):e(""))},children:n.title});break}return d.jsx("li",{className:a===n.title?"selected":"",children:r},cn())}function na(t){const n=[],a=[];t.components.forEach(s=>{s instanceof hn?n.push(Vn):s instanceof Le?(n.push(zn),a.push(Yn),Hn(t)):s instanceof vn?(n.push(Kn),a.push(Xn)):s instanceof Ht&&n.push(Zn)});function e(s){switch(n.forEach(p=>p(t,s)),s.event){case"custom":D.dispatchEvent({type:I.CUSTOM,value:s.data});break}}function r(s){switch(a.forEach(p=>p(t,s)),s.event){case"custom":D.dispatchEvent({type:I.CUSTOM,value:s.data});break}}t.listen=s=>{s.target==="editor"?r(s):e(s)}}const aa=`out vec3 worldPosition;
29
+ C11,8.22,10.74,8,10.43,8z`})});function hn(t){return u.jsx(an.Reorder.Item,{value:t.title,children:u.jsxs("div",{children:[Gn,u.jsx("span",{children:t.title}),u.jsx("button",{className:"closeIcon",onClick:()=>{t.onDelete(t.index)},children:Yn})]})},t.title)}function fn(t){const[n,a]=A.useState(!1),[e,o]=A.useState(t.options),c=p=>{t.onDragComplete(p),o(p)},m=p=>{const g=[...e];g.splice(p,1),c(g)},l=[];e.forEach((p,g)=>{l.push(u.jsx(hn,{index:g,title:p,onDelete:m},p))});let d="dropdown draggable";return t.subdropdown&&(d+=" subdropdown"),u.jsxs("div",{className:d,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[u.jsx(Vt,{title:t.title}),u.jsx(an.Reorder.Group,{axis:"y",values:e,onReorder:c,style:{visibility:n?"visible":"hidden"},children:l})]})}function pn(t){const[n,a]=A.useState(!1),e=[];t.options.map((c,m)=>{t.onSelect!==void 0&&(c.onSelect=t.onSelect),e.push(u.jsx(mn,{option:c},m))});let o="dropdown";return t.subdropdown&&(o+=" subdropdown"),u.jsxs("div",{className:o,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[u.jsx(Vt,{title:t.title}),u.jsx("ul",{style:{visibility:n?"visible":"hidden"},children:e})]})}function mn(t){const{option:n}=t,[a,e]=A.useState("");let o;switch(n.type){case"draggable":o=u.jsx(fn,{title:n.title,options:n.value,onDragComplete:c=>{n.onDragComplete!==void 0&&n.onDragComplete(c)},subdropdown:!0});break;case"dropdown":o=u.jsx(pn,{title:n.title,options:n.value,onSelect:n.onSelect,subdropdown:!0});break;case"option":o=u.jsx("button",{onClick:()=>{n.onSelect!==void 0&&n.onSelect(n.value),n.selectable&&(a!==n.title?e(n.title):e(""))},children:n.title});break}return u.jsx("li",{className:a===n.title?"selected":"",children:o},rn())}function Hn(t){function n(e){switch(t.components.forEach(o=>{o.handleApp(e)}),e.event){case"custom":D.dispatchEvent({type:I.CUSTOM,value:e.data});break}}function a(e){switch(t.components.forEach(o=>{o.handleEditor(e)}),e.event){case"custom":D.dispatchEvent({type:I.CUSTOM,value:e.data});break}}t.listen=e=>{e.target==="editor"?a(e):n(e)}}const Wn=`out vec3 worldPosition;
30
30
  uniform float uDistance;
31
31
 
32
32
  void main() {
@@ -35,7 +35,7 @@ void main() {
35
35
  worldPosition.xz += cameraPosition.xz;
36
36
 
37
37
  gl_Position = projectionMatrix * modelViewMatrix * vec4(worldPosition, 1.0);
38
- }`,ia=`out vec4 fragColor;
38
+ }`,$n=`out vec4 fragColor;
39
39
  in vec3 worldPosition;
40
40
 
41
41
  uniform float uDivisions;
@@ -102,7 +102,7 @@ void main() {
102
102
  fragColor.a = mix(fragColor.a, baseOpacity * uGridOpacity, nextGrid);
103
103
 
104
104
  if (fragColor.a <= 0.0) discard;
105
- }`;class ra extends c.ShaderMaterial{constructor(n){super({extensions:{derivatives:!0},glslVersion:c.GLSL3,side:c.DoubleSide,transparent:!0,uniforms:{uScale:{value:(n==null?void 0:n.scale)!==void 0?n==null?void 0:n.scale:.1},uDivisions:{value:(n==null?void 0:n.divisions)!==void 0?n==null?void 0:n.divisions:10},uColor:{value:(n==null?void 0:n.color)!==void 0?n==null?void 0:n.color:new c.Color(16777215)},uDistance:{value:(n==null?void 0:n.distance)!==void 0?n==null?void 0:n.distance:1e4},uSubgridOpacity:{value:(n==null?void 0:n.subgridOpacity)!==void 0?n==null?void 0:n.subgridOpacity:.15},uGridOpacity:{value:(n==null?void 0:n.gridOpacity)!==void 0?n==null?void 0:n.gridOpacity:.25}},vertexShader:aa,fragmentShader:ia,name:"InfiniteGrid",depthWrite:!1})}}class Cn extends c.Mesh{constructor(){const a=new ra;super(new c.PlaneGeometry(2,2),a);B(this,"gridMaterial");this.gridMaterial=a,this.frustumCulled=!1,this.name="InfiniteGridHelper",this.position.y=.1}update(){this.gridMaterial.needsUpdate=!0}}const oa=`#include <common>
105
+ }`;class qn extends s.ShaderMaterial{constructor(n){super({extensions:{derivatives:!0},glslVersion:s.GLSL3,side:s.DoubleSide,transparent:!0,uniforms:{uScale:{value:n?.scale!==void 0?n?.scale:.1},uDivisions:{value:n?.divisions!==void 0?n?.divisions:10},uColor:{value:n?.color!==void 0?n?.color:new s.Color(16777215)},uDistance:{value:n?.distance!==void 0?n?.distance:1e4},uSubgridOpacity:{value:n?.subgridOpacity!==void 0?n?.subgridOpacity:.15},uGridOpacity:{value:n?.gridOpacity!==void 0?n?.gridOpacity:.25}},vertexShader:Wn,fragmentShader:$n,name:"InfiniteGrid",depthWrite:!1})}}class vn extends s.Mesh{gridMaterial;constructor(){const n=new qn;super(new s.PlaneGeometry(2,2),n),this.gridMaterial=n,this.frustumCulled=!1,this.name="InfiniteGridHelper",this.position.y=.1}update(){this.gridMaterial.needsUpdate=!0}}const Kn=`#include <common>
106
106
  #include <batching_pars_vertex>
107
107
  #include <uv_pars_vertex>
108
108
  #include <color_pars_vertex>
@@ -132,7 +132,7 @@ void main() {
132
132
  #include <logdepthbuf_vertex>
133
133
  #include <clipping_planes_vertex>
134
134
  #include <worldpos_vertex>
135
- }`,sa=`
135
+ }`,Xn=`
136
136
  #include <common>
137
137
  #include <uv_pars_fragment>
138
138
  #include <clipping_planes_pars_fragment>
@@ -140,5 +140,5 @@ void main() {
140
140
  void main() {
141
141
  #include <clipping_planes_fragment>
142
142
  gl_FragColor = vec4(vec3(vUv, 0.0), 1.0);
143
- }`;class Sn extends c.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:oa,fragmentShader:sa})}}function Mt(t){const[n,a]=k.useState(t.open!==void 0?t.open:!0),e=!n||t.children===void 0;return d.jsxs("div",{className:`accordion ${e?"hide":""}`,children:[d.jsxs("button",{className:"toggle",onClick:()=>{const r=!n;t.onToggle!==void 0&&t.onToggle(r),a(r)},children:[d.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),d.jsx("p",{className:"label",children:$e(t.label)})]}),t.button,d.jsx("div",{className:n?"open":"",children:d.jsx("div",{children:t.children})})]})}function Gt(t){const[n,a]=k.useState(!1),e=t.child.children.length>0,r=[];return t.child.children.length>0&&t.child.children.map(s=>{r.push(d.jsx(Gt,{child:s,three:t.three},Math.random()))}),d.jsxs("div",{className:"childObject",children:[d.jsxs("div",{className:"child",children:[e?d.jsx("button",{className:"status",style:{backgroundPositionX:n?"-14px":"2px"},onClick:()=>{a(!n)}}):null,d.jsx("button",{className:"name",style:{left:e?"20px":"5px"},onClick:()=>{t.three.getObject(t.child.uuid),n||a(!0)},children:t.child.name.length>0?`${t.child.name} (${t.child.type})`:`${t.child.type}::${t.child.uuid}`}),d.jsx("div",{className:`icon ${Gn(t.child)}`})]}),d.jsx("div",{className:n?"open":"",children:d.jsx("div",{className:"container",children:r})})]},Math.random())}function wn(t){const n=[];return t.child.children.map(a=>{n.push(d.jsx(Gt,{child:a,three:t.three},Math.random()))}),d.jsx("div",{className:`scene ${t.class!==void 0?t.class:""}`,children:n})}const ca="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";function la(t){return"items"in t}function Fe(t){const n=[];return t.items.forEach(a=>{la(a)?n.push(d.jsx(Fe,{title:$e(a.title),items:a.items},Math.random())):n.push(d.jsx(rt,{title:a.title,prop:a.prop,value:a.value,type:a.type,min:a.min,max:a.max,step:a.step,disabled:a.disabled,options:a.options,onChange:(e,r)=>{a.onChange!==void 0&&a.onChange(e,r)}},Math.random()))}),d.jsx(Mt,{label:t.title,open:t.expanded===!0,children:n})}function ua(t){return!(t==="alphaHash"||t==="alphaToCoverage"||t==="attenuationDistance"||t==="blendDstAlpha"||t==="colorWrite"||t==="combine"||t==="defaultAttributeValues"||t==="depthFunc"||t==="forceSinglePass"||t==="glslVersion"||t==="linecap"||t==="linejoin"||t==="linewidth"||t==="normalMapType"||t==="precision"||t==="premultipliedAlpha"||t==="shadowSide"||t==="toneMapped"||t==="uniformsGroups"||t==="uniformsNeedUpdate"||t==="userData"||t==="vertexColors"||t==="version"||t==="wireframeLinecap"||t==="wireframeLinejoin"||t==="wireframeLinewidth"||t.slice(0,4)==="clip"||t.slice(0,7)==="polygon"||t.slice(0,7)==="stencil"||t.slice(0,2)==="is")}function je(t){switch(t){case"alphaMap":return"Alpha Map";case"anisotropyMap":return"Anisotropy Map";case"anisotropyRotation":return"Anisotropy Rotation";case"aoMap":return"AO Map";case"aoMapIntensity":return"AO Map Intensity";case"attenuationColor":return"Attenuation Color";case"blendAlpha":return"Blend Alpha";case"blendColor":return"Blend Color";case"blendDst":return"Blend Dst";case"blendDstAlpha":return"Blend Dst Alha";case"blendEquation":return"Blend Equation";case"blendEquationAlpha":return"Blend Equation Alpha";case"blending":return"Blending";case"blendSrc":return"Blend Src";case"blendSrcAlpha":return"Blend Src Alpha";case"bumpMap":return"Bump Map";case"bumpScale":return"Bump Scale";case"clearcoatMap":return"Clearcoat Map";case"clearcoatNormalMap":return"Clearcoat Normal Map";case"clearcoatNormalScale":return"Clearcoat Normal Scale";case"clearcoatRoughness":return"Clearcoat Roughness";case"clearcoatRoughnessMap":return"Clearcoat Roughness Map";case"color":return"Color";case"defines":return"Defines";case"depthTest":return"Depth Test";case"depthWrite":return"Depth Write";case"displacementBias":return"Displacement Bias";case"displacementMap":return"Displacement Map";case"displacementScale":return"Displacement Scale";case"dithering":return"Dithering";case"emissive":return"Emissive";case"emissiveMap":return"Emissive Map";case"emissiveIntensity":return"Emissive Intensity";case"envMap":return"Environment Map";case"envMapIntensity":return"Environment Map Intensity";case"extensions":return"Extensions";case"flatShading":return"Flat Shading";case"fragmentShader":return"Fragment Shader";case"fog":return"Fog";case"gradientMap":return"Gradient Map";case"ior":return"IOR";case"iridescenceIOR":return"Iridescence IOR";case"iridescenceMap":return"Iridescence Map";case"iridescenceThicknessMap":return"Iridescence Thickness Map";case"iridescenceThicknessRange":return"Iridescence Thickness Range";case"lights":return"Lights";case"lightMap":return"Light Map";case"lightMapIntensity":return"Light Map Intensity";case"map":return"Map";case"matcap":return"Matcap";case"metalness":return"Metalness";case"metalnessMap":return"Metalness Map";case"name":return"Name";case"normalMap":return"Normal Map";case"normalScale":return"Normal Scale";case"opacity":return"Opacity";case"reflectivity":return"Reflectivity";case"refractionRatio":return"Refraction Ratio";case"roughness":return"Roughness";case"roughnessMap":return"Roughness Map";case"sheenColor":return"Sheen Color";case"sheenColorMap":return"Sheen Color Map";case"sheenRoughness":return"Sheen Roughness";case"sheenRoughnessMap":return"Sheen Roughness Map";case"shininess":return"Shininess";case"side":return"Side";case"size":return"Size";case"sizeAttenuation":return"Size Attenuation";case"specular":return"Specular";case"specularColor":return"Specular Color";case"specularColorMap":return"Specular Color Map";case"specularIntensity":return"Specular Intensity";case"specularIntensityMap":return"Specular Map Intensity";case"thickness":return"Thickness";case"thicknessMap":return"Thickness Map";case"transmission":return"Transmission";case"transmissionMap":return"Transmission Map";case"transparent":return"Transparent";case"type":return"Type";case"uuid":return"UUID";case"uniforms":return"Uniforms";case"vertexShader":return"Vertex Shader";case"visible":return"Visible";case"wireframe":return"Wireframe"}return t}function da(t){return t.toLowerCase().search("intensity")>-1||t==="anisotropyRotation"||t==="blendAlpha"||t==="bumpScale"||t==="clearcoatRoughness"||t==="displacementBias"||t==="displacementScale"||t==="metalness"||t==="opacity"||t==="reflectivity"||t==="refractionRatio"||t==="roughness"||t==="sheenRoughness"||t==="thickness"}function fa(){const t=document.createElement("input");return t.type="file",new Promise((n,a)=>{t.addEventListener("change",function(){if(t.files===null)a();else{const e=t.files[0],r=new FileReader;r.onload=function(s){n(s.target.result)},r.readAsDataURL(e)}}),t.click()})}const ha=[{title:"Front",value:c.FrontSide},{title:"Back",value:c.BackSide},{title:"Double",value:c.DoubleSide}],pa=[{title:"No Blending",value:c.NoBlending},{title:"Normal",value:c.NormalBlending},{title:"Additive",value:c.AdditiveBlending},{title:"Subtractive",value:c.SubtractiveBlending},{title:"Multiply",value:c.MultiplyBlending},{title:"Custom",value:c.CustomBlending}],ma=[{title:"Add",value:c.AddEquation},{title:"Subtract",value:c.SubtractEquation},{title:"Reverse Subtract",value:c.ReverseSubtractEquation},{title:"Min",value:c.MinEquation},{title:"Max",value:c.MaxEquation}],va=[{title:"Zero",valye:c.ZeroFactor},{title:"One",valye:c.OneFactor},{title:"Src Color",valye:c.SrcColorFactor},{title:"One Minus Src Color",valye:c.OneMinusSrcColorFactor},{title:"Src Alpha",valye:c.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:c.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:c.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:c.OneMinusDstAlphaFactor},{title:"Dst Color",valye:c.DstColorFactor},{title:"One Minus Dst Color",valye:c.OneMinusDstColorFactor},{title:"Src Alpha Saturate",valye:c.SrcAlphaSaturateFactor},{title:"Constant Color",valye:c.ConstantColorFactor},{title:"One Minus Constant Color",valye:c.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:c.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:c.OneMinusConstantAlphaFactor}],ga=[{title:"Zero",valye:c.ZeroFactor},{title:"One",valye:c.OneFactor},{title:"Src Color",valye:c.SrcColorFactor},{title:"One Minus Src Color",valye:c.OneMinusSrcColorFactor},{title:"Src Alpha",valye:c.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:c.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:c.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:c.OneMinusDstAlphaFactor},{title:"Dst Color",valye:c.DstColorFactor},{title:"One Minus Dst Color",valye:c.OneMinusDstColorFactor},{title:"Constant Color",valye:c.ConstantColorFactor},{title:"One Minus Constant Color",valye:c.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:c.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:c.OneMinusConstantAlphaFactor}];function it(t,n){t.needsUpdate=!0,t.type="option",t.options=n}function Zt(t,n,a){const e=[];for(const r in t){if(!ua(r))continue;const s=typeof t[r],p=t[r];if(s==="boolean"||s==="number"||s==="string"){const l={title:je(r),prop:r,type:s,value:p,min:void 0,max:void 0,needsUpdate:s==="boolean",onChange:(f,y)=>{var C;a.updateObject(n.uuid,`material.${f}`,y),l.needsUpdate&&a.updateObject(n.uuid,"material.needsUpdate",!0);const v=(C=a.scene)==null?void 0:C.getObjectByProperty("uuid",n.uuid);v!==void 0&&ae(v,`material.${f}`,y)}};switch(r){case"blending":it(l,pa);break;case"blendDst":it(l,ga);break;case"blendEquation":it(l,ma);break;case"blendSrc":it(l,va);break;case"side":it(l,ha);break}da(r)&&(l.value=Number(p),l.type="range",l.min=0,l.max=1,l.step=.01);const u=s==="string"&&(r==="vertexShader"||r==="fragmentShader");u&&(l.disabled=!1,l.latest=l.value,l.onChange=(f,y)=>{l.latest=y}),e.push(l),u&&e.push({title:`${$e(r)} - Update`,type:"button",onChange:()=>{var y;a.updateObject(n.uuid,`material.${r}`,l.latest),a.updateObject(n.uuid,"material.needsUpdate",!0);const f=(y=a.scene)==null?void 0:y.getObjectByProperty("uuid",n.uuid);f!==void 0&&(ae(f,`material.${r}`,l.latest),f.material.needsUpdate=!0)}})}else if(s==="object")if(p.isColor)e.push({title:je(r),prop:r,type:"color",value:p,onChange:(l,u)=>{var v;const f=new c.Color(u);a.updateObject(n.uuid,`material.${l}`,f);const y=(v=a.scene)==null?void 0:v.getObjectByProperty("uuid",n.uuid);y!==void 0&&ae(y,`material.${l}`,f)}});else if(Array.isArray(p)){const l=[];for(const u in p)l.push({title:`${u}`,type:`${typeof p[u]}`,value:p[u],onChange:(f,y)=>{var C;a.updateObject(n.uuid,`material.${r}`,y);const v=(C=a.scene)==null?void 0:C.getObjectByProperty("uuid",n.uuid);v!==void 0&&ae(v,`material.${r}`,y)}});e.push({title:je(r),items:l})}else{const l=[];for(const u in p){const f=p[u];switch(typeof f){case"boolean":case"number":case"string":u==="src"?e.push({title:je(r),type:"image",value:f,onChange:(v,C)=>{var w;a.createTexture(n.uuid,`material.${r}`,C);const x=(w=a.scene)==null?void 0:w.getObjectByProperty("uuid",n.uuid);x!==void 0&&Ut(C).then(R=>{ae(x,`material.${r}`,R),ae(x,"material.needsUpdate",!0)})}}):l.push({title:`${je(u)}`,prop:`material.${r}.${u}`,type:`${typeof t[r][u]}`,value:p[u],onChange:(v,C)=>{var w;a.updateObject(n.uuid,`material.${r}.${u}`,C);const x=(w=a.scene)==null?void 0:w.getObjectByProperty("uuid",n.uuid);x!==void 0&&ae(x,`material.${r}.${u}`,C)}});break;case"object":if(f.value!==void 0&&f.value.src!==void 0)l.push({title:je(u),type:"image",value:f.value.src,onChange:(v,C)=>{var w;a.createTexture(n.uuid,`material.${r}.${u}.value`,p);const x=(w=a.scene)==null?void 0:w.getObjectByProperty("uuid",n.uuid);x!==void 0&&Ut(C).then(R=>{ae(x,`material.${r}.${u}.value`,R)})}});else if(r==="uniforms"){const v=f.value,C=(x,w,R)=>({title:x,type:"number",value:R,step:.01,onChange:(K,L)=>{var fe;const O=`material.uniforms.${u}.value.${w}`;a.updateObject(n.uuid,O,L);const W=(fe=a.scene)==null?void 0:fe.getObjectByProperty("uuid",n.uuid);W!==void 0&&ae(W,O,L)}});if(typeof f.value=="number")l.push({title:u,type:"number",value:f.value,onChange:(x,w)=>{var L;const R=`material.${r}.${x}.value`;a.updateObject(n.uuid,R,w);const K=(L=a.scene)==null?void 0:L.getObjectByProperty("uuid",n.uuid);K!==void 0&&ae(K,R,w)}});else if(v.r!==void 0&&v.g!==void 0&&v.b!==void 0)l.push({title:u,type:"color",value:f.value,onChange:(x,w)=>{var O;const R=new c.Color(w),K=`material.${r}.${x}.value`;a.updateObject(n.uuid,K,R);const L=(O=a.scene)==null?void 0:O.getObjectByProperty("uuid",n.uuid);L!==void 0&&ae(L,K,R)}});else if(v.x!==void 0&&v.y!==void 0&&v.z===void 0&&v.w===void 0)l.push({title:u,items:[C("X","x",f.value.x),C("Y","y",f.value.y)]});else if(v.x!==void 0&&v.y!==void 0&&v.z!==void 0&&v.w===void 0)l.push({title:u,items:[C("X","x",f.value.x),C("Y","y",f.value.y),C("Z","z",f.value.z)]});else if(v.x!==void 0&&v.y!==void 0&&v.z!==void 0&&v.w!==void 0)l.push({title:u,items:[C("X","x",f.value.x),C("Y","y",f.value.y),C("Z","z",f.value.z),C("W","w",f.value.w)]});else if(v.elements!==void 0){const x=v.elements,w=[];for(let R=0;R<x.length;R++)w.push(C(R.toString(),R.toString(),x[R]));l.push({title:u,items:w})}else console.log(">>> need to add this format:",u,v)}else l.push({title:u,type:`${typeof f.value}`,value:f.value,onChange:(v,C)=>{var w;a.updateObject(n.uuid,`material.${r}.${u}.value`,C);const x=(w=a.scene)==null?void 0:w.getObjectByProperty("uuid",n.uuid);x!==void 0&&ae(x,`material.${r}.${u}.value`,C)}});break}}l.length>0&&e.push({title:je(r),items:l})}else p!==void 0&&console.log("other:",r,s,p)}return e.sort((r,s)=>r.title<s.title?-1:r.title>s.title?1:0),e.push({title:"Update Material",type:"button",onChange:()=>{a.updateObject(n.uuid,"material.needsUpdate",!0)}}),e}function ba(t,n){const a=t.material;if(Array.isArray(a)){const e=[],r=a.length;for(let s=0;s<r;s++)e.push(d.jsx(Fe,{title:`Material ${s}`,items:Zt(a[s],t,n)},`Material ${s}`));return d.jsx(d.Fragment,{children:e})}else return d.jsx(Fe,{title:"Material",items:Zt(a,t,n)})}function rt(t){var y;let n=t.value;n!==void 0&&n.isColor!==void 0&&(n=un(t.value));const[a,e]=k.useState(n),r=k.useRef(null),s=k.useRef(null),p=k.useRef(null);k.useEffect(()=>{var fe;let v=!1,C=-1,x=0,w=Number(a);const R=ne=>{v=!0,x=w,C=ne.clientX},K=ne=>{if(!v)return;const ie=t.step!==void 0?t.step:1,h=(ne.clientX-C)*ie;w=Number((x+h).toFixed(4)),s.current!==null&&(s.current.value=w.toString()),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,w)},L=()=>{v=!1},O=()=>{v=!1},W=t.type==="number";return W&&((fe=r.current)==null||fe.addEventListener("mousedown",R,!1),document.addEventListener("mouseup",L,!1),document.addEventListener("mousemove",K,!1),document.addEventListener("contextmenu",O,!1)),()=>{var ne;W&&((ne=r.current)==null||ne.removeEventListener("mousedown",R),document.removeEventListener("mouseup",L),document.removeEventListener("mousemove",K),document.removeEventListener("contextmenu",O))}},[a]);const l=t.type==="string"&&(a.length>100||a.search(`
144
- `)>-1),u=l||t.type==="image",f=v=>{let C=v.target.value;t.type==="boolean"?C=v.target.checked:t.type==="option"&&(C=t.options[C].value),e(C),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,C)};return d.jsxs("div",{className:`field ${u?"block":""}`,children:[t.type!=="button"&&d.jsx("label",{ref:r,children:$e(t.title)},"fieldLabel"),t.type==="string"&&!l&&d.jsx("input",{type:"text",disabled:t.disabled,onChange:f,value:a}),t.type==="string"&&l&&d.jsx("textarea",{cols:50,rows:10,disabled:t.disabled!==void 0?t.disabled:!0,onChange:f,value:a}),t.type==="boolean"&&d.jsx("input",{type:"checkbox",disabled:t.disabled,onChange:f,checked:a}),t.type==="number"&&d.jsx("input",{ref:s,type:"number",value:a,min:t.min,max:t.max,step:t.step,disabled:t.disabled,onChange:f}),t.type==="range"&&d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:a.toString(),onChange:f,disabled:t.disabled,className:"min"}),d.jsx("input",{disabled:t.disabled,type:"range",value:a,min:t.min,max:t.max,step:t.step,onChange:f})]}),t.type==="color"&&d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:a.toString(),onChange:f,disabled:t.disabled,className:"color"}),d.jsx("input",{type:"color",value:a,onChange:f,disabled:t.disabled})]}),t.type==="button"&&d.jsx("button",{disabled:t.disabled,onClick:()=>{t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,!0)},children:t.title}),t.type==="image"&&d.jsx("img",{ref:p,onClick:()=>{fa().then(v=>{p.current.src=v,t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,v)})},src:a.length>0?a:ca}),t.type==="option"&&d.jsx(d.Fragment,{children:d.jsx("select",{onChange:f,disabled:t.disabled,defaultValue:t.value,children:(y=t.options)==null?void 0:y.map((v,C)=>d.jsx("option",{value:v.value,children:$e(v.title)},C))})})]})}function Jt(t){switch(t){case"fov":return"FOV";case"zoom":return"Zoom";case"near":return"Near";case"far":return"Far";case"focus":return"Focus";case"aspect":return"Aspect";case"filmGauge":return"Film Gauge";case"filmOffset":return"Film Offset";case"left":return"Left";case"right":return"Right";case"top":return"Top";case"bottom":return"Bottom"}return t}function ya(t,n){const a=[];if(t.perspectiveCameraInfo!==void 0)for(const e in t.perspectiveCameraInfo)a.push({title:Jt(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(r,s)=>{var l;n.updateObject(t.uuid,r,s),n.requestMethod(t.uuid,"updateProjectionMatrix");const p=(l=n.scene)==null?void 0:l.getObjectByProperty("uuid",t.uuid);p!==void 0&&(ae(p,r,s),p.updateProjectionMatrix())}});else if(t.orthographicCameraInfo!==void 0)for(const e in t.orthographicCameraInfo)a.push({title:Jt(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(r,s)=>{var l;n.updateObject(t.uuid,r,s),n.requestMethod(t.uuid,"updateProjectionMatrix");const p=(l=n.scene)==null?void 0:l.getObjectByProperty("uuid",t.uuid);p!==void 0&&(ae(p,r,s),p.updateProjectionMatrix())}});return d.jsx(Fe,{title:"Camera",items:a})}const Ea=Math.PI/180,Ca=180/Math.PI;function Ge(t,n,a,e,r){return e+(t-n)*(r-e)/(a-n)}function Sa(t){return t*Ea}function Lt(t){return t*Ca}function wa(t,n){const a=new c.Matrix4;a.elements=t.matrix;const e=new c.Vector3,r=new c.Euler,s=new c.Vector3;t.uuid.length>0&&(e.setFromMatrixPosition(a),r.setFromRotationMatrix(a),s.setFromMatrixScale(a));const p=(u,f)=>{var v;n.updateObject(t.uuid,u,f);const y=(v=n.scene)==null?void 0:v.getObjectByProperty("uuid",t.uuid);y!==void 0&&ae(y,u,f)},l=(u,f)=>{p(u,Sa(f))};return d.jsx(Fe,{title:"Transform",items:[{title:"Position X",prop:"position.x",type:"number",value:e.x,onChange:p},{title:"Position Y",prop:"position.y",type:"number",value:e.y,onChange:p},{title:"Position Z",prop:"position.z",type:"number",value:e.z,onChange:p},{title:"Rotation X",prop:"rotation.x",type:"number",value:xt(Lt(r.x)),min:-360,max:360,step:.1,onChange:l},{title:"Rotation Y",prop:"rotation.y",type:"number",value:xt(Lt(r.y)),min:-360,max:360,step:.1,onChange:l},{title:"Rotation Z",prop:"rotation.z",type:"number",value:xt(Lt(r.z)),min:-360,max:360,step:.1,onChange:l},{title:"Scale X",prop:"scale.x",type:"number",value:s.x,step:.01,onChange:p},{title:"Scale Y",prop:"scale.y",type:"number",value:s.y,step:.01,onChange:p},{title:"Scale Z",prop:"scale.z",type:"number",value:s.z,step:.01,onChange:p}]})}function Qt(t){switch(t){case"color":return"Color";case"intensity":return"Intensity";case"decay":return"Decay";case"distance":return"Distance";case"angle":return"Angle";case"penumbra":return"Penumbra";case"groundColor":return"Ground Color"}return t}function xa(t,n){const a=[];if(t.lightInfo!==void 0)for(const e in t.lightInfo){const r=t.lightInfo[e];r!==void 0&&(r.isColor!==void 0?a.push({title:Qt(e),prop:e,type:"color",value:r,onChange:(s,p)=>{var f;const l=new c.Color(p);n.updateObject(t.uuid,s,l);const u=(f=n.scene)==null?void 0:f.getObjectByProperty("uuid",t.uuid);u!==void 0&&ae(u,s,l)}}):a.push({title:Qt(e),prop:e,type:typeof r,value:r,step:typeof r=="number"?.01:void 0,onChange:(s,p)=>{var u;n.updateObject(t.uuid,s,p);const l=(u=n.scene)==null?void 0:u.getObjectByProperty("uuid",t.uuid);l!==void 0&&ae(l,s,p)}}))}return d.jsx(Fe,{title:"Light",items:a})}function Oa(t,n){var l;const a=[],e=[];let r=0;t.animations.forEach(u=>{r=Math.max(r,u.duration),u.duration>0&&e.push({title:u.name,items:[{title:"Duration",type:"number",value:u.duration,disabled:!0},{title:"Blend Mode",type:"option",disabled:!0,options:[{title:"Normal",value:2500},{title:"Additive",value:2501}]}]})}),a.push({title:"Animations",items:e});const s=(l=n.scene)==null?void 0:l.getObjectByProperty("uuid",t.uuid);let p=!1;if(s!==void 0){const u=s.mixer;if(p=u!==void 0,p){const f=[{title:"Time Scale",type:"range",value:u.timeScale,step:.01,min:-1,max:2,onChange:(y,v)=>{u.timeScale=v,n.updateObject(t.uuid,"mixer.timeScale",v)}}];f.push({title:"Stop All",type:"button",onChange:()=>{u.stopAllAction(),n.requestMethod(t.uuid,"stopAllAction",void 0,"mixer")}}),a.push({title:"Mixer",items:f})}}return d.jsx(Fe,{title:"Animation",items:a})}const xn={name:"",uuid:"",type:"",visible:!1,matrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0};let re={...xn};function On(t){const[n,a]=k.useState(-1);k.useEffect(()=>{function p(u){re={...u.value},a(Date.now())}function l(){re={...xn},a(Date.now())}return D.addEventListener(I.SET_SCENE,l),D.addEventListener(I.SET_OBJECT,p),()=>{D.removeEventListener(I.SET_SCENE,l),D.removeEventListener(I.SET_OBJECT,p)}},[]);const e=re.type.toLowerCase(),r=re.animations.length>0||re.mixer!==void 0,s=e.search("mesh")>-1||e.search("line")>-1||e.search("points")>-1;return d.jsx(Mt,{label:"Inspector",children:d.jsx("div",{id:"Inspector",className:t.class,children:re.uuid.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs(d.Fragment,{children:[d.jsx(rt,{type:"string",title:"Name",prop:"name",value:re.name,disabled:!0}),d.jsx(rt,{type:"string",title:"Type",prop:"type",value:re.type,disabled:!0}),d.jsx(rt,{type:"string",title:"UUID",prop:"uuid",value:re.uuid,disabled:!0}),d.jsx(rt,{type:"boolean",title:"Visible",prop:"visible",value:re.visible,onChange:(p,l)=>{var f;t.three.updateObject(re.uuid,p,l);const u=(f=t.three.scene)==null?void 0:f.getObjectByProperty("uuid",re.uuid);u!==void 0&&ae(u,p,l)}})]}),d.jsxs(d.Fragment,{children:[wa(re,t.three),r?Oa(re,t.three):null,e.search("camera")>-1?ya(re,t.three):null,e.search("light")>-1?xa(re,t.three):null,s?ba(re,t.three):null]})]})},n)},"Inspector")}class Ma extends k.Component{constructor(a){super(a);B(this,"three");B(this,"setScene",a=>{this.setState(()=>({scene:a.value}))});this.state={scene:a.scene!==void 0?a.scene:null},this.three=a.three,D.addEventListener(I.SET_SCENE,this.setScene)}componentWillUnmount(){D.removeEventListener(I.SET_SCENE,this.setScene)}render(){var r;const a=this.componentState.scene!==null,e="Hierarchy - "+(a?`${(r=this.componentState.scene)==null?void 0:r.name}`:"No Scene");return d.jsx("div",{id:"SidePanel",children:d.jsxs(d.Fragment,{children:[d.jsx(Mt,{label:e,open:!0,children:d.jsx(d.Fragment,{children:a&&d.jsx(wn,{child:this.componentState.scene,three:this.three})})}),d.jsx(On,{three:this.three})]})},"SidePanel")}get componentState(){return this.state}}function Ta(t){function n(){return t.three.scene===void 0?(console.log("No scene:",t.three),!1):!0}const a=l=>{var f;if(!n())return;const u=(f=t.three.scene)==null?void 0:f.getObjectByProperty("uuid",l.value);u!==void 0&&t.three.setObject(u)},e=(l,u,f)=>{var v;if(!n())return;const y=(v=t.three.scene)==null?void 0:v.getObjectByProperty("uuid",l);y!==void 0&&ae(y,u,f)},r=l=>{if(!n())return;const u=l.value,{key:f,value:y,uuid:v}=u;e(v,f,y)},s=l=>{if(!n())return;const u=l.value;Ut(u.value).then(f=>{e(u.uuid,u.key,f),e(u.uuid,"material.needsUpdate",!0)})},p=l=>{var x;if(!n())return;const{key:u,uuid:f,value:y,subitem:v}=l.value,C=(x=t.three.scene)==null?void 0:x.getObjectByProperty("uuid",f);if(C!==void 0)try{v!==void 0?qn(C,v)[u](y):C[u](y)}catch(w){console.log("Error requesting method:"),console.log(w),console.log(u),console.log(y)}};return k.useEffect(()=>(D.addEventListener(I.GET_OBJECT,a),D.addEventListener(I.UPDATE_OBJECT,r),D.addEventListener(I.CREATE_TEXTURE,s),D.addEventListener(I.REQUEST_METHOD,p),()=>{D.removeEventListener(I.GET_OBJECT,a),D.removeEventListener(I.UPDATE_OBJECT,r),D.removeEventListener(I.CREATE_TEXTURE,s),D.removeEventListener(I.REQUEST_METHOD,p)}),[]),null}const en={type:"change"},Ft={type:"start"},tn={type:"end"},Ct=new c.Ray,nn=new c.Plane,Ra=Math.cos(70*c.MathUtils.DEG2RAD);class Aa extends c.EventDispatcher{constructor(n,a){super(),this.object=n,this.domElement=a,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new c.Vector3,this.cursor=new c.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:c.MOUSE.ROTATE,MIDDLE:c.MOUSE.DOLLY,RIGHT:c.MOUSE.PAN},this.touches={ONE:c.TOUCH.ROTATE,TWO:c.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(o){o.addEventListener("keydown",Qe),this._domElementKeyEvents=o},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",Qe),this._domElementKeyEvents=null},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(en),e.update(),s=r.NONE},this.update=function(){const o=new c.Vector3,E=new c.Quaternion().setFromUnitVectors(n.up,new c.Vector3(0,1,0)),T=E.clone().invert(),U=new c.Vector3,J=new c.Quaternion,he=new c.Vector3,se=2*Math.PI;return function(It=null){const tt=e.object.position;o.copy(tt).sub(e.target),o.applyQuaternion(E),l.setFromVector3(o),e.autoRotate&&s===r.NONE&&Y(_(It)),e.enableDamping?(l.theta+=u.theta*e.dampingFactor,l.phi+=u.phi*e.dampingFactor):(l.theta+=u.theta,l.phi+=u.phi);let ve=e.minAzimuthAngle,pe=e.maxAzimuthAngle;isFinite(ve)&&isFinite(pe)&&(ve<-Math.PI?ve+=se:ve>Math.PI&&(ve-=se),pe<-Math.PI?pe+=se:pe>Math.PI&&(pe-=se),ve<=pe?l.theta=Math.max(ve,Math.min(pe,l.theta)):l.theta=l.theta>(ve+pe)/2?Math.max(ve,l.theta):Math.min(pe,l.theta)),l.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,l.phi)),l.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(y,e.dampingFactor):e.target.add(y),e.target.sub(e.cursor),e.target.clampLength(e.minTargetRadius,e.maxTargetRadius),e.target.add(e.cursor),e.zoomToCursor&&ie||e.object.isOrthographicCamera?l.radius=de(l.radius):l.radius=de(l.radius*f),o.setFromSpherical(l),o.applyQuaternion(T),tt.copy(e.target).add(o),e.object.lookAt(e.target),e.enableDamping===!0?(u.theta*=1-e.dampingFactor,u.phi*=1-e.dampingFactor,y.multiplyScalar(1-e.dampingFactor)):(u.set(0,0,0),y.set(0,0,0));let Ae=!1;if(e.zoomToCursor&&ie){let Pe=null;if(e.object.isPerspectiveCamera){const ke=o.length();Pe=de(ke*f);const _e=ke-Pe;e.object.position.addScaledVector(fe,_e),e.object.updateMatrixWorld()}else if(e.object.isOrthographicCamera){const ke=new c.Vector3(ne.x,ne.y,0);ke.unproject(e.object),e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/f)),e.object.updateProjectionMatrix(),Ae=!0;const _e=new c.Vector3(ne.x,ne.y,0);_e.unproject(e.object),e.object.position.sub(_e).add(ke),e.object.updateMatrixWorld(),Pe=o.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;Pe!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(Pe).add(e.object.position):(Ct.origin.copy(e.object.position),Ct.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(Ct.direction))<Ra?n.lookAt(e.target):(nn.setFromNormalAndCoplanarPoint(e.object.up,e.target),Ct.intersectPlane(nn,e.target))))}else e.object.isOrthographicCamera&&(Ae=f!==1,Ae&&(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/f)),e.object.updateProjectionMatrix()));return f=1,ie=!1,Ae||U.distanceToSquared(e.object.position)>p||8*(1-J.dot(e.object.quaternion))>p||he.distanceToSquared(e.target)>0?(e.dispatchEvent(en),U.copy(e.object.position),J.copy(e.object.quaternion),he.copy(e.target),!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",ze),e.domElement.removeEventListener("pointerdown",Te),e.domElement.removeEventListener("pointercancel",Re),e.domElement.removeEventListener("wheel",vt),e.domElement.removeEventListener("pointermove",Ze),e.domElement.removeEventListener("pointerup",Re),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",Qe),e._domElementKeyEvents=null)};const e=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const p=1e-6,l=new c.Spherical,u=new c.Spherical;let f=1;const y=new c.Vector3,v=new c.Vector2,C=new c.Vector2,x=new c.Vector2,w=new c.Vector2,R=new c.Vector2,K=new c.Vector2,L=new c.Vector2,O=new c.Vector2,W=new c.Vector2,fe=new c.Vector3,ne=new c.Vector2;let ie=!1;const h=[],g={};let S=!1;function _(o){return o!==null?2*Math.PI/60*e.autoRotateSpeed*o:2*Math.PI/60/60*e.autoRotateSpeed}function G(o){const E=Math.abs(o*.01);return Math.pow(.95,e.zoomSpeed*E)}function Y(o){u.theta-=o}function V(o){u.phi-=o}const F=function(){const o=new c.Vector3;return function(T,U){o.setFromMatrixColumn(U,0),o.multiplyScalar(-T),y.add(o)}}(),X=function(){const o=new c.Vector3;return function(T,U){e.screenSpacePanning===!0?o.setFromMatrixColumn(U,1):(o.setFromMatrixColumn(U,0),o.crossVectors(e.object.up,o)),o.multiplyScalar(T),y.add(o)}}(),Z=function(){const o=new c.Vector3;return function(T,U){const J=e.domElement;if(e.object.isPerspectiveCamera){const he=e.object.position;o.copy(he).sub(e.target);let se=o.length();se*=Math.tan(e.object.fov/2*Math.PI/180),F(2*T*se/J.clientHeight,e.object.matrix),X(2*U*se/J.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(F(T*(e.object.right-e.object.left)/e.object.zoom/J.clientWidth,e.object.matrix),X(U*(e.object.top-e.object.bottom)/e.object.zoom/J.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function A(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?f/=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function z(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?f*=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function ee(o,E){if(!e.zoomToCursor)return;ie=!0;const T=e.domElement.getBoundingClientRect(),U=o-T.left,J=E-T.top,he=T.width,se=T.height;ne.x=U/he*2-1,ne.y=-(J/se)*2+1,fe.set(ne.x,ne.y,1).unproject(e.object).sub(e.object.position).normalize()}function de(o){return Math.max(e.minDistance,Math.min(e.maxDistance,o))}function Ee(o){v.set(o.clientX,o.clientY)}function ut(o){ee(o.clientX,o.clientX),L.set(o.clientX,o.clientY)}function qe(o){w.set(o.clientX,o.clientY)}function Rt(o){C.set(o.clientX,o.clientY),x.subVectors(C,v).multiplyScalar(e.rotateSpeed);const E=e.domElement;Y(2*Math.PI*x.x/E.clientHeight),V(2*Math.PI*x.y/E.clientHeight),v.copy(C),e.update()}function At(o){O.set(o.clientX,o.clientY),W.subVectors(O,L),W.y>0?A(G(W.y)):W.y<0&&z(G(W.y)),L.copy(O),e.update()}function Ke(o){R.set(o.clientX,o.clientY),K.subVectors(R,w).multiplyScalar(e.panSpeed),Z(K.x,K.y),w.copy(R),e.update()}function Xe(o){ee(o.clientX,o.clientY),o.deltaY<0?z(G(o.deltaY)):o.deltaY>0&&A(G(o.deltaY)),e.update()}function Be(o){let E=!1;switch(o.code){case e.keys.UP:o.ctrlKey||o.metaKey||o.shiftKey?V(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):Z(0,e.keyPanSpeed),E=!0;break;case e.keys.BOTTOM:o.ctrlKey||o.metaKey||o.shiftKey?V(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):Z(0,-e.keyPanSpeed),E=!0;break;case e.keys.LEFT:o.ctrlKey||o.metaKey||o.shiftKey?Y(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):Z(e.keyPanSpeed,0),E=!0;break;case e.keys.RIGHT:o.ctrlKey||o.metaKey||o.shiftKey?Y(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):Z(-e.keyPanSpeed,0),E=!0;break}E&&(o.preventDefault(),e.update())}function Ve(o){if(h.length===1)v.set(o.pageX,o.pageY);else{const E=Se(o),T=.5*(o.pageX+E.x),U=.5*(o.pageY+E.y);v.set(T,U)}}function xe(o){if(h.length===1)w.set(o.pageX,o.pageY);else{const E=Se(o),T=.5*(o.pageX+E.x),U=.5*(o.pageY+E.y);w.set(T,U)}}function dt(o){const E=Se(o),T=o.pageX-E.x,U=o.pageY-E.y,J=Math.sqrt(T*T+U*U);L.set(0,J)}function ft(o){e.enableZoom&&dt(o),e.enablePan&&xe(o)}function Pt(o){e.enableZoom&&dt(o),e.enableRotate&&Ve(o)}function ht(o){if(h.length==1)C.set(o.pageX,o.pageY);else{const T=Se(o),U=.5*(o.pageX+T.x),J=.5*(o.pageY+T.y);C.set(U,J)}x.subVectors(C,v).multiplyScalar(e.rotateSpeed);const E=e.domElement;Y(2*Math.PI*x.x/E.clientHeight),V(2*Math.PI*x.y/E.clientHeight),v.copy(C)}function Oe(o){if(h.length===1)R.set(o.pageX,o.pageY);else{const E=Se(o),T=.5*(o.pageX+E.x),U=.5*(o.pageY+E.y);R.set(T,U)}K.subVectors(R,w).multiplyScalar(e.panSpeed),Z(K.x,K.y),w.copy(R)}function Me(o){const E=Se(o),T=o.pageX-E.x,U=o.pageY-E.y,J=Math.sqrt(T*T+U*U);O.set(0,J),W.set(0,Math.pow(O.y/L.y,e.zoomSpeed)),A(W.y),L.copy(O);const he=(o.pageX+E.x)*.5,se=(o.pageY+E.y)*.5;ee(he,se)}function pt(o){e.enableZoom&&Me(o),e.enablePan&&Oe(o)}function mt(o){e.enableZoom&&Me(o),e.enableRotate&&ht(o)}function Te(o){e.enabled!==!1&&(h.length===0&&(e.domElement.setPointerCapture(o.pointerId),e.domElement.addEventListener("pointermove",Ze),e.domElement.addEventListener("pointerup",Re)),_t(o),o.pointerType==="touch"?et(o):Je(o))}function Ze(o){e.enabled!==!1&&(o.pointerType==="touch"?yt(o):kt(o))}function Re(o){switch(jt(o),h.length){case 0:e.domElement.releasePointerCapture(o.pointerId),e.domElement.removeEventListener("pointermove",Ze),e.domElement.removeEventListener("pointerup",Re),e.dispatchEvent(tn),s=r.NONE;break;case 1:const E=h[0],T=g[E];et({pointerId:E,pageX:T.x,pageY:T.y});break}}function Je(o){let E;switch(o.button){case 0:E=e.mouseButtons.LEFT;break;case 1:E=e.mouseButtons.MIDDLE;break;case 2:E=e.mouseButtons.RIGHT;break;default:E=-1}switch(E){case c.MOUSE.DOLLY:if(e.enableZoom===!1)return;ut(o),s=r.DOLLY;break;case c.MOUSE.ROTATE:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enablePan===!1)return;qe(o),s=r.PAN}else{if(e.enableRotate===!1)return;Ee(o),s=r.ROTATE}break;case c.MOUSE.PAN:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enableRotate===!1)return;Ee(o),s=r.ROTATE}else{if(e.enablePan===!1)return;qe(o),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&e.dispatchEvent(Ft)}function kt(o){switch(s){case r.ROTATE:if(e.enableRotate===!1)return;Rt(o);break;case r.DOLLY:if(e.enableZoom===!1)return;At(o);break;case r.PAN:if(e.enablePan===!1)return;Ke(o);break}}function vt(o){e.enabled===!1||e.enableZoom===!1||s!==r.NONE||(o.preventDefault(),e.dispatchEvent(Ft),Xe(gt(o)),e.dispatchEvent(tn))}function gt(o){const E=o.deltaMode,T={clientX:o.clientX,clientY:o.clientY,deltaY:o.deltaY};switch(E){case 1:T.deltaY*=16;break;case 2:T.deltaY*=100;break}return o.ctrlKey&&!S&&(T.deltaY*=10),T}function bt(o){o.key==="Control"&&(S=!0,e.domElement.getRootNode().addEventListener("keyup",Ce,{passive:!0,capture:!0}))}function Ce(o){o.key==="Control"&&(S=!1,e.domElement.getRootNode().removeEventListener("keyup",Ce,{passive:!0,capture:!0}))}function Qe(o){e.enabled===!1||e.enablePan===!1||Be(o)}function et(o){switch(Et(o),h.length){case 1:switch(e.touches.ONE){case c.TOUCH.ROTATE:if(e.enableRotate===!1)return;Ve(o),s=r.TOUCH_ROTATE;break;case c.TOUCH.PAN:if(e.enablePan===!1)return;xe(o),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(e.touches.TWO){case c.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;ft(o),s=r.TOUCH_DOLLY_PAN;break;case c.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Pt(o),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&e.dispatchEvent(Ft)}function yt(o){switch(Et(o),s){case r.TOUCH_ROTATE:if(e.enableRotate===!1)return;ht(o),e.update();break;case r.TOUCH_PAN:if(e.enablePan===!1)return;Oe(o),e.update();break;case r.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;pt(o),e.update();break;case r.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;mt(o),e.update();break;default:s=r.NONE}}function ze(o){e.enabled!==!1&&o.preventDefault()}function _t(o){h.push(o.pointerId)}function jt(o){delete g[o.pointerId];for(let E=0;E<h.length;E++)if(h[E]==o.pointerId){h.splice(E,1);return}}function Et(o){let E=g[o.pointerId];E===void 0&&(E=new c.Vector2,g[o.pointerId]=E),E.set(o.pageX,o.pageY)}function Se(o){const E=o.pointerId===h[0]?h[1]:h[0];return g[E]}e.domElement.addEventListener("contextmenu",ze),e.domElement.addEventListener("pointerdown",Te),e.domElement.addEventListener("pointercancel",Re),e.domElement.addEventListener("wheel",vt,{passive:!1}),e.domElement.getRootNode().addEventListener("keydown",bt,{passive:!0,capture:!0}),this.update()}}const Ot=t=>{const[n,a]=k.useState(t.options[t.index]),e=()=>{t.onToggle(!t.open)},r=s=>{s!==n&&(t.onSelect(s),a(s)),t.onToggle(!1)};return d.jsxs("div",{className:`dropdown ${t.up===!0?"up":""}`,children:[d.jsx("div",{className:"dropdown-toggle",onClick:e,children:n}),t.open&&d.jsx("ul",{className:"dropdown-menu",children:t.options.map(s=>d.jsx("li",{onClick:()=>r(s),children:s},s))})]})},De=k.forwardRef(function(n,a){const[e,r]=k.useState(!1),s=n.options.indexOf(n.camera.name);return d.jsxs("div",{className:"CameraWindow",children:[d.jsx("div",{ref:a,className:"clickable",onClick:()=>{e&&r(!1)}}),d.jsx(Ot,{index:s,open:e,options:n.options,onSelect:n.onSelect,onToggle:p=>{r(p)},up:!0})]})}),an=["Single","Side by Side","Stacked","Quad"],oe=new Map,ce=new Map,be=new Map;function Ue(t,n){const a=new c.OrthographicCamera(-100,100,100,-100,50,3e3);return a.name=t,a.position.copy(n),a.lookAt(0,0,0),oe.set(t,a),a}Ue("Top",new c.Vector3(0,1e3,0));Ue("Bottom",new c.Vector3(0,-1e3,0));Ue("Left",new c.Vector3(-1e3,0,0));Ue("Right",new c.Vector3(1e3,0,0));Ue("Front",new c.Vector3(0,0,1e3));Ue("Back",new c.Vector3(0,0,-1e3));Ue("Orthographic",new c.Vector3(1e3,1e3,1e3));const Tt=new c.PerspectiveCamera(60,1,50,3e3);Tt.name="Debug";Tt.position.set(500,500,500);Tt.lookAt(0,0,0);oe.set("Debug",Tt);const rn=["Renderer","Depth","Normals","UVs","Wireframe"],Pa=new c.MeshDepthMaterial,ka=new c.MeshNormalMaterial,_a=new Sn,ja=new c.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0});let St="Renderer";const q=new c.Scene;q.name="Debug Scene";let ye=new c.Scene;q.add(ye);const lt=new c.Group;lt.name="helpers";q.add(lt);const Da=new Cn;lt.add(Da);const Mn=new c.AxesHelper(500);Mn.name="axisHelper";lt.add(Mn);const st=new c.AxesHelper(100);st.name="interactionHelper";lt.add(st);st.visible=!1;let wt=!1,$=oe.get("Debug"),le=oe.get("Orthographic"),Ie=oe.get("Front"),Ne=oe.get("Top"),on=!1;function Ia(t){const[n,a]=k.useState(t.mode!==void 0?t.mode:"Single"),[e,r]=k.useState(null),[s,p]=k.useState(!1),[l,u]=k.useState(!1),[f,y]=k.useState(!1),[,v]=k.useState(Date.now()),C=k.useRef(null),x=k.useRef(null),w=k.useRef(null),R=k.useRef(null),K=k.useRef(null),L=k.useRef(null),O=(h,g)=>{const S=ce.get(h.name);S!==void 0&&S.dispose(),ce.delete(h.name);const _=be.get(h.name);_!==void 0&&(q.remove(_),_.dispose()),be.delete(h.name);const G=new Aa(h,g);switch(G.enableDamping=!0,G.dampingFactor=.05,h.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":G.enableRotate=!1;break}if(ce.set(h.name,G),h instanceof c.PerspectiveCamera){const Y=new c.CameraHelper(h);be.set(h.name,Y),q.add(Y)}},W=h=>{const g=be.get(h.name);g!==void 0&&(q.remove(g),g.dispose(),be.delete(h.name));const S=ce.get(h.name);S!==void 0&&(S.dispose(),ce.delete(h.name))},fe=()=>{ce.forEach((h,g)=>{h.dispose();const S=be.get(g);S!==void 0&&(q.remove(S),S.dispose()),be.delete(g),ce.delete(g)}),ce.clear(),be.clear()},ne=()=>{switch(n){case"Single":O($,w.current);break;case"Side by Side":case"Stacked":O($,w.current),O(le,R.current);break;case"Quad":O($,w.current),O(le,R.current),O(Ie,K.current),O(Ne,L.current);break}};k.useEffect(()=>{const h=new c.WebGLRenderer({canvas:C.current,stencil:!1});h.autoClear=!1,h.shadowMap.enabled=!0,h.setPixelRatio(devicePixelRatio),h.setClearColor(0),r(h)},[]),k.useEffect(()=>{const h=_=>{zt(ye),q.remove(ye);const G=t.scenes.get(_.value.name);if(G!==void 0){const Y=new G;t.onSceneSet!==void 0&&t.onSceneSet(Y),ye=Y,t.three.scene=ye,q.add(ye),on=!0}},g=_=>{var V;const G=_.value,Y=(V=t.three.scene)==null?void 0:V.getObjectByProperty("uuid",G.uuid);Y!==void 0&&oe.set(G.name,Y),v(Date.now())},S=_=>{oe.delete(_.value.name),v(Date.now())};return D.addEventListener(I.SET_SCENE,h),D.addEventListener(I.ADD_CAMERA,g),D.addEventListener(I.REMOVE_CAMERA,S),()=>{D.removeEventListener(I.SET_SCENE,h),D.removeEventListener(I.ADD_CAMERA,g),D.removeEventListener(I.REMOVE_CAMERA,S)}},[]),k.useEffect(()=>{if(e===null)return;let h=window.innerWidth,g=window.innerHeight,S=Math.floor(h/2),_=Math.floor(g/2),G=-1;const Y=()=>{h=window.innerWidth-300,g=window.innerHeight,S=Math.floor(h/2),_=Math.floor(g/2),e.setSize(h,g);let A=h,z=g;switch(n){case"Side by Side":A=S,z=g;break;case"Stacked":A=h,z=_;break;case"Quad":A=S,z=_;break}oe.forEach(ee=>{var de;ee instanceof c.OrthographicCamera?(ee.left=A/-2,ee.right=A/2,ee.top=z/2,ee.bottom=z/-2,ee.updateProjectionMatrix()):ee instanceof c.PerspectiveCamera&&(ee.aspect=A/z,ee.updateProjectionMatrix(),(de=be.get(ee.name))==null||de.update())})},V=()=>{e.setViewport(0,0,h,g),e.setScissor(0,0,h,g),e.render(q,$)},F=()=>{if(n==="Side by Side")e.setViewport(0,0,S,g),e.setScissor(0,0,S,g),e.render(q,$),e.setViewport(S,0,S,g),e.setScissor(S,0,S,g),e.render(q,le);else{const A=g-_;e.setViewport(0,A,h,_),e.setScissor(0,A,h,_),e.render(q,$),e.setViewport(0,0,h,_),e.setScissor(0,0,h,_),e.render(q,le)}},X=()=>{let A=0,z=0;z=g-_,A=0,e.setViewport(A,z,S,_),e.setScissor(A,z,S,_),e.render(q,$),A=S,e.setViewport(A,z,S,_),e.setScissor(A,z,S,_),e.render(q,le),z=0,A=0,e.setViewport(A,z,S,_),e.setScissor(A,z,S,_),e.render(q,Ie),A=S,e.setViewport(A,z,S,_),e.setScissor(A,z,S,_),e.render(q,Ne)},Z=()=>{switch(ce.forEach(A=>{A.update()}),t.onSceneUpdate!==void 0&&on&&t.onSceneUpdate(ye),e.clear(),n){case"Single":V();break;case"Side by Side":case"Stacked":F();break;case"Quad":X();break}G=requestAnimationFrame(Z)};return ne(),window.addEventListener("resize",Y),Y(),Z(),()=>{window.removeEventListener("resize",Y),cancelAnimationFrame(G),G=-1}},[n,e]),k.useEffect(()=>{if(e!==null){const h=new c.Raycaster,g=new c.Vector2,S=(V,F,X,Z)=>{switch(n){case"Quad":V<X?F<Z?h.setFromCamera(g,$):h.setFromCamera(g,Ie):F<Z?h.setFromCamera(g,le):h.setFromCamera(g,Ne);break;case"Side by Side":V<X?h.setFromCamera(g,$):h.setFromCamera(g,le);break;case"Single":h.setFromCamera(g,$);break;case"Stacked":F<Z?h.setFromCamera(g,$):h.setFromCamera(g,le);break}},_=V=>{if(!wt)return;const F=new c.Vector2;e.getSize(F);const X=Math.min(V.clientX,F.x),Z=Math.min(V.clientY,F.y);g.x=Ge(X,0,F.x,-1,1),g.y=Ge(Z,0,F.y,1,-1);const A=F.x/2,z=F.y/2,ee=()=>{X<A?g.x=Ge(X,0,A,-1,1):g.x=Ge(X,A,F.x,-1,1)},de=()=>{Z<z?g.y=Ge(Z,0,z,1,-1):g.y=Ge(Z,z,F.y,1,-1)};switch(n){case"Quad":ee(),de();break;case"Side by Side":ee();break;case"Stacked":de(),de();break}S(X,Z,A,z);const Ee=h.intersectObjects(ye.children);Ee.length>0&&st.position.copy(Ee[0].point)},G=V=>{if(!wt)return;const F=new c.Vector2;if(e.getSize(F),V.clientX>=F.x)return;_(V);const X=h.intersectObjects(ye.children);X.length>0&&t.three.getObject(X[0].object.uuid)},Y=x.current;return Y.addEventListener("mousemove",_,!1),Y.addEventListener("click",G,!1),()=>{Y.removeEventListener("mousemove",_),Y.removeEventListener("click",G)}}},[n,e]);const ie=[];return oe.forEach((h,g)=>{ie.push(g)}),d.jsxs("div",{className:"multiview",children:[d.jsx("canvas",{ref:C}),d.jsxs("div",{className:`cameras ${n==="Single"||n==="Stacked"?"single":""}`,ref:x,children:[n==="Single"&&d.jsx(d.Fragment,{children:d.jsx(De,{camera:$,options:ie,ref:w,onSelect:h=>{var S;(S=ce.get($.name))==null||S.dispose();const g=oe.get(h);g!==void 0&&(W($),$=g,O(g,w.current))}})}),(n==="Side by Side"||n==="Stacked")&&d.jsxs(d.Fragment,{children:[d.jsx(De,{camera:$,options:ie,ref:w,onSelect:h=>{var S;(S=ce.get($.name))==null||S.dispose();const g=oe.get(h);g!==void 0&&(W($),$=g,O(g,w.current))}}),d.jsx(De,{camera:le,options:ie,ref:R,onSelect:h=>{var S;(S=ce.get(le.name))==null||S.dispose();const g=oe.get(h);g!==void 0&&(W(le),le=g,O(g,R.current))}})]}),n==="Quad"&&d.jsxs(d.Fragment,{children:[d.jsx(De,{camera:$,options:ie,ref:w,onSelect:h=>{var S;(S=ce.get($.name))==null||S.dispose();const g=oe.get(h);g!==void 0&&(W($),$=g,O(g,w.current))}}),d.jsx(De,{camera:le,options:ie,ref:R,onSelect:h=>{var S;(S=ce.get(le.name))==null||S.dispose();const g=oe.get(h);g!==void 0&&(W(le),le=g,O(g,R.current))}}),d.jsx(De,{camera:Ie,options:ie,ref:K,onSelect:h=>{var S;(S=ce.get(Ie.name))==null||S.dispose();const g=oe.get(h);g!==void 0&&(W(Ie),Ie=g,O(g,K.current))}}),d.jsx(De,{camera:Ne,options:ie,ref:L,onSelect:h=>{var S;(S=ce.get(Ne.name))==null||S.dispose();const g=oe.get(h);g!==void 0&&(W(Ne),Ne=g,O(g,L.current))}})]})]}),d.jsxs("div",{className:"settings",children:[d.jsx(Ot,{index:an.indexOf(n),options:an,onSelect:h=>{h!==n&&(fe(),a(h))},open:s,onToggle:h=>{p(h),l&&u(!1),f&&y(!1)}}),d.jsx(Ot,{index:rn.indexOf(St),options:rn,onSelect:h=>{if(h!==St)switch(St=h,St){case"Depth":q.overrideMaterial=Pa;break;case"Normals":q.overrideMaterial=ka;break;default:case"Renderer":q.overrideMaterial=null;break;case"Wireframe":q.overrideMaterial=ja;break;case"UVs":q.overrideMaterial=_a;break}},open:l,onToggle:h=>{s&&p(!1),u(h),f&&y(!1)}}),d.jsx(Ot,{index:0,options:["Orbit Mode","Selection Mode"],onSelect:h=>{wt=h==="Selection Mode",st.visible=wt},open:f,onToggle:h=>{s&&p(!1),l&&u(!1),y(h)}})]})]})}function Na(t){return d.jsxs("div",{className:"editor",ref:t.ref,style:t.style,children:[d.jsx("header",{children:t.header}),t.children,d.jsx("footer",{children:t.footer})]})}exports.Accordion=Mt;exports.Application=Bn;exports.BaseRemote=ct;exports.ChildObject=Gt;exports.ContainerObject=wn;exports.Draggable=bn;exports.DraggableItem=gn;exports.Dropdown=yn;exports.DropdownItem=En;exports.Editor=Na;exports.InfiniteGridHelper=Cn;exports.Inspector=On;exports.MultiView=Ia;exports.NavButton=Yt;exports.RemoteComponents=hn;exports.RemoteController=na;exports.RemoteTheatre=Le;exports.RemoteThree=vn;exports.RemoteTweakpane=Ht;exports.SceneInspector=Ta;exports.SidePanel=Ma;exports.ToolEvents=I;exports.UVMaterial=Sn;exports.capitalize=$e;exports.clamp=Ln;exports.colorToHex=un;exports.debugDispatcher=D;exports.dispose=zt;exports.disposeMaterial=fn;exports.disposeTexture=Un;exports.distance=Fn;exports.hierarchyUUID=Vt;exports.isColor=ln;exports.randomID=cn;exports.resetThreeObjects=dn;exports.round=xt;
143
+ }`;class gn extends s.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:Kn,fragmentShader:Xn})}}function wt(t){const[n,a]=A.useState(t.open!==void 0?t.open:!0),e=!n||t.children===void 0;return u.jsxs("div",{className:`accordion ${e?"hide":""}`,children:[u.jsxs("button",{className:"toggle",onClick:()=>{const o=!n;t.onToggle!==void 0&&t.onToggle(o),a(o)},children:[u.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),u.jsx("p",{className:"label",children:He(t.label)})]}),t.button,u.jsx("div",{className:n?"open":"",children:u.jsx("div",{children:t.children})})]})}function zt(t){const[n,a]=A.useState(!1),e=t.child.children.length>0,o=[];return t.child.children.length>0&&t.child.children.map(c=>{o.push(u.jsx(zt,{child:c,three:t.three},Math.random()))}),u.jsxs("div",{className:"childObject",children:[u.jsxs("div",{className:"child",children:[e?u.jsx("button",{className:"status",style:{backgroundPositionX:n?"-14px":"2px"},onClick:()=>{a(!n)}}):null,u.jsx("button",{className:"name",style:{left:e?"20px":"5px"},onClick:()=>{t.three.getObject(t.child.uuid),n||a(!0)},children:t.child.name.length>0?`${t.child.name} (${t.child.type})`:`${t.child.type}::${t.child.uuid}`}),u.jsx("div",{className:`icon ${In(t.child)}`})]}),u.jsx("div",{className:n?"open":"",children:u.jsx("div",{className:"container",children:o})})]},Math.random())}function bn(t){const n=[];return t.child.children.map(a=>{n.push(u.jsx(zt,{child:a,three:t.three},Math.random()))}),u.jsx("div",{className:`scene ${t.class!==void 0?t.class:""}`,children:n})}const Zn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";function Jn(t){return"items"in t}function Ne(t){const n=[];return t.items.forEach(a=>{Jn(a)?n.push(u.jsx(Ne,{title:He(a.title),items:a.items},Math.random())):n.push(u.jsx(it,{title:a.title,prop:a.prop,value:a.value,type:a.type,min:a.min,max:a.max,step:a.step,disabled:a.disabled,options:a.options,onChange:(e,o)=>{a.onChange!==void 0&&a.onChange(e,o)}},Math.random()))}),u.jsx(wt,{label:t.title,open:t.expanded===!0,children:n})}function Qn(t){return!(t==="alphaHash"||t==="alphaToCoverage"||t==="attenuationDistance"||t==="blendDstAlpha"||t==="colorWrite"||t==="combine"||t==="defaultAttributeValues"||t==="depthFunc"||t==="forceSinglePass"||t==="glslVersion"||t==="linecap"||t==="linejoin"||t==="linewidth"||t==="normalMapType"||t==="precision"||t==="premultipliedAlpha"||t==="shadowSide"||t==="toneMapped"||t==="uniformsGroups"||t==="uniformsNeedUpdate"||t==="userData"||t==="vertexColors"||t==="version"||t==="wireframeLinecap"||t==="wireframeLinejoin"||t==="wireframeLinewidth"||t.slice(0,4)==="clip"||t.slice(0,7)==="polygon"||t.slice(0,7)==="stencil"||t.slice(0,2)==="is")}function ke(t){switch(t){case"alphaMap":return"Alpha Map";case"anisotropyMap":return"Anisotropy Map";case"anisotropyRotation":return"Anisotropy Rotation";case"aoMap":return"AO Map";case"aoMapIntensity":return"AO Map Intensity";case"attenuationColor":return"Attenuation Color";case"blendAlpha":return"Blend Alpha";case"blendColor":return"Blend Color";case"blendDst":return"Blend Dst";case"blendDstAlpha":return"Blend Dst Alha";case"blendEquation":return"Blend Equation";case"blendEquationAlpha":return"Blend Equation Alpha";case"blending":return"Blending";case"blendSrc":return"Blend Src";case"blendSrcAlpha":return"Blend Src Alpha";case"bumpMap":return"Bump Map";case"bumpScale":return"Bump Scale";case"clearcoatMap":return"Clearcoat Map";case"clearcoatNormalMap":return"Clearcoat Normal Map";case"clearcoatNormalScale":return"Clearcoat Normal Scale";case"clearcoatRoughness":return"Clearcoat Roughness";case"clearcoatRoughnessMap":return"Clearcoat Roughness Map";case"color":return"Color";case"defines":return"Defines";case"depthTest":return"Depth Test";case"depthWrite":return"Depth Write";case"displacementBias":return"Displacement Bias";case"displacementMap":return"Displacement Map";case"displacementScale":return"Displacement Scale";case"dithering":return"Dithering";case"emissive":return"Emissive";case"emissiveMap":return"Emissive Map";case"emissiveIntensity":return"Emissive Intensity";case"envMap":return"Environment Map";case"envMapIntensity":return"Environment Map Intensity";case"extensions":return"Extensions";case"flatShading":return"Flat Shading";case"fragmentShader":return"Fragment Shader";case"fog":return"Fog";case"gradientMap":return"Gradient Map";case"ior":return"IOR";case"iridescenceIOR":return"Iridescence IOR";case"iridescenceMap":return"Iridescence Map";case"iridescenceThicknessMap":return"Iridescence Thickness Map";case"iridescenceThicknessRange":return"Iridescence Thickness Range";case"lights":return"Lights";case"lightMap":return"Light Map";case"lightMapIntensity":return"Light Map Intensity";case"map":return"Map";case"matcap":return"Matcap";case"metalness":return"Metalness";case"metalnessMap":return"Metalness Map";case"name":return"Name";case"normalMap":return"Normal Map";case"normalScale":return"Normal Scale";case"opacity":return"Opacity";case"reflectivity":return"Reflectivity";case"refractionRatio":return"Refraction Ratio";case"roughness":return"Roughness";case"roughnessMap":return"Roughness Map";case"sheenColor":return"Sheen Color";case"sheenColorMap":return"Sheen Color Map";case"sheenRoughness":return"Sheen Roughness";case"sheenRoughnessMap":return"Sheen Roughness Map";case"shininess":return"Shininess";case"side":return"Side";case"size":return"Size";case"sizeAttenuation":return"Size Attenuation";case"specular":return"Specular";case"specularColor":return"Specular Color";case"specularColorMap":return"Specular Color Map";case"specularIntensity":return"Specular Intensity";case"specularIntensityMap":return"Specular Map Intensity";case"thickness":return"Thickness";case"thicknessMap":return"Thickness Map";case"transmission":return"Transmission";case"transmissionMap":return"Transmission Map";case"transparent":return"Transparent";case"type":return"Type";case"uuid":return"UUID";case"uniforms":return"Uniforms";case"vertexShader":return"Vertex Shader";case"visible":return"Visible";case"wireframe":return"Wireframe"}return t}function ea(t){return t.toLowerCase().search("intensity")>-1||t==="anisotropyRotation"||t==="blendAlpha"||t==="bumpScale"||t==="clearcoatRoughness"||t==="displacementBias"||t==="displacementScale"||t==="metalness"||t==="opacity"||t==="reflectivity"||t==="refractionRatio"||t==="roughness"||t==="sheenRoughness"||t==="thickness"}function ta(){const t=document.createElement("input");return t.type="file",new Promise((n,a)=>{t.addEventListener("change",function(){if(t.files===null)a();else{const e=t.files[0],o=new FileReader;o.onload=function(c){n(c.target.result)},o.readAsDataURL(e)}}),t.click()})}const na=[{title:"Front",value:s.FrontSide},{title:"Back",value:s.BackSide},{title:"Double",value:s.DoubleSide}],aa=[{title:"No Blending",value:s.NoBlending},{title:"Normal",value:s.NormalBlending},{title:"Additive",value:s.AdditiveBlending},{title:"Subtractive",value:s.SubtractiveBlending},{title:"Multiply",value:s.MultiplyBlending},{title:"Custom",value:s.CustomBlending}],ia=[{title:"Add",value:s.AddEquation},{title:"Subtract",value:s.SubtractEquation},{title:"Reverse Subtract",value:s.ReverseSubtractEquation},{title:"Min",value:s.MinEquation},{title:"Max",value:s.MaxEquation}],ra=[{title:"Zero",valye:s.ZeroFactor},{title:"One",valye:s.OneFactor},{title:"Src Color",valye:s.SrcColorFactor},{title:"One Minus Src Color",valye:s.OneMinusSrcColorFactor},{title:"Src Alpha",valye:s.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:s.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:s.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:s.OneMinusDstAlphaFactor},{title:"Dst Color",valye:s.DstColorFactor},{title:"One Minus Dst Color",valye:s.OneMinusDstColorFactor},{title:"Src Alpha Saturate",valye:s.SrcAlphaSaturateFactor},{title:"Constant Color",valye:s.ConstantColorFactor},{title:"One Minus Constant Color",valye:s.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:s.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:s.OneMinusConstantAlphaFactor}],oa=[{title:"Zero",valye:s.ZeroFactor},{title:"One",valye:s.OneFactor},{title:"Src Color",valye:s.SrcColorFactor},{title:"One Minus Src Color",valye:s.OneMinusSrcColorFactor},{title:"Src Alpha",valye:s.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:s.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:s.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:s.OneMinusDstAlphaFactor},{title:"Dst Color",valye:s.DstColorFactor},{title:"One Minus Dst Color",valye:s.OneMinusDstColorFactor},{title:"Constant Color",valye:s.ConstantColorFactor},{title:"One Minus Constant Color",valye:s.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:s.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:s.OneMinusConstantAlphaFactor}];function at(t,n){t.needsUpdate=!0,t.type="option",t.options=n}function qt(t,n,a){const e=[];for(const o in t){if(!Qn(o))continue;const c=typeof t[o],m=t[o];if(c==="boolean"||c==="number"||c==="string"){const l={title:ke(o),prop:o,type:c,value:m,min:void 0,max:void 0,needsUpdate:c==="boolean",onChange:(p,g)=>{a.updateObject(n.uuid,`material.${p}`,g),l.needsUpdate&&a.updateObject(n.uuid,"material.needsUpdate",!0);const y=a.scene?.getObjectByProperty("uuid",n.uuid);y!==void 0&&te(y,`material.${p}`,g)}};switch(o){case"blending":at(l,aa);break;case"blendDst":at(l,oa);break;case"blendEquation":at(l,ia);break;case"blendSrc":at(l,ra);break;case"side":at(l,na);break}ea(o)&&(l.value=Number(m),l.type="range",l.min=0,l.max=1,l.step=.01);const d=c==="string"&&(o==="vertexShader"||o==="fragmentShader");d&&(l.disabled=!1,l.latest=l.value,l.onChange=(p,g)=>{l.latest=g}),e.push(l),d&&e.push({title:`${He(o)} - Update`,type:"button",onChange:()=>{a.updateObject(n.uuid,`material.${o}`,l.latest),a.updateObject(n.uuid,"material.needsUpdate",!0);const p=a.scene?.getObjectByProperty("uuid",n.uuid);p!==void 0&&(te(p,`material.${o}`,l.latest),p.material.needsUpdate=!0)}})}else if(c==="object")if(m.isColor)e.push({title:ke(o),prop:o,type:"color",value:m,onChange:(l,d)=>{const p=new s.Color(d);a.updateObject(n.uuid,`material.${l}`,p);const g=a.scene?.getObjectByProperty("uuid",n.uuid);g!==void 0&&te(g,`material.${l}`,p)}});else if(Array.isArray(m)){const l=[];for(const d in m)l.push({title:`${d}`,type:`${typeof m[d]}`,value:m[d],onChange:(p,g)=>{a.updateObject(n.uuid,`material.${o}`,g);const y=a.scene?.getObjectByProperty("uuid",n.uuid);y!==void 0&&te(y,`material.${o}`,g)}});e.push({title:ke(o),items:l})}else{const l=[];for(const d in m){const p=m[d];switch(typeof p){case"boolean":case"number":case"string":d==="src"?e.push({title:ke(o),type:"image",value:p,onChange:(y,C)=>{a.createTexture(n.uuid,`material.${o}`,C);const x=a.scene?.getObjectByProperty("uuid",n.uuid);x!==void 0&&Lt(C).then(T=>{te(x,`material.${o}`,T),te(x,"material.needsUpdate",!0)})}}):l.push({title:`${ke(d)}`,prop:`material.${o}.${d}`,type:`${typeof t[o][d]}`,value:m[d],onChange:(y,C)=>{a.updateObject(n.uuid,`material.${o}.${d}`,C);const x=a.scene?.getObjectByProperty("uuid",n.uuid);x!==void 0&&te(x,`material.${o}.${d}`,C)}});break;case"object":if(p.value!==void 0&&p.value.src!==void 0)l.push({title:ke(d),type:"image",value:p.value.src,onChange:(y,C)=>{a.createTexture(n.uuid,`material.${o}.${d}.value`,m);const x=a.scene?.getObjectByProperty("uuid",n.uuid);x!==void 0&&Lt(C).then(T=>{te(x,`material.${o}.${d}.value`,T)})}});else if(o==="uniforms"){const y=p.value,C=(x,T,j)=>({title:x,type:"number",value:j,step:.01,onChange:(q,V)=>{const w=`material.uniforms.${d}.value.${T}`;a.updateObject(n.uuid,w,V);const G=a.scene?.getObjectByProperty("uuid",n.uuid);G!==void 0&&te(G,w,V)}});if(typeof p.value=="number")l.push({title:d,type:"number",value:p.value,onChange:(x,T)=>{const j=`material.${o}.${x}.value`;a.updateObject(n.uuid,j,T);const q=a.scene?.getObjectByProperty("uuid",n.uuid);q!==void 0&&te(q,j,T)}});else if(y.r!==void 0&&y.g!==void 0&&y.b!==void 0)l.push({title:d,type:"color",value:p.value,onChange:(x,T)=>{const j=new s.Color(T),q=`material.${o}.${x}.value`;a.updateObject(n.uuid,q,j);const V=a.scene?.getObjectByProperty("uuid",n.uuid);V!==void 0&&te(V,q,j)}});else if(y.x!==void 0&&y.y!==void 0&&y.z===void 0&&y.w===void 0)l.push({title:d,items:[C("X","x",p.value.x),C("Y","y",p.value.y)]});else if(y.x!==void 0&&y.y!==void 0&&y.z!==void 0&&y.w===void 0)l.push({title:d,items:[C("X","x",p.value.x),C("Y","y",p.value.y),C("Z","z",p.value.z)]});else if(y.x!==void 0&&y.y!==void 0&&y.z!==void 0&&y.w!==void 0)l.push({title:d,items:[C("X","x",p.value.x),C("Y","y",p.value.y),C("Z","z",p.value.z),C("W","w",p.value.w)]});else if(y.elements!==void 0){const x=y.elements,T=[];for(let j=0;j<x.length;j++)T.push(C(j.toString(),j.toString(),x[j]));l.push({title:d,items:T})}else console.log(">>> need to add this format:",d,y)}else l.push({title:d,type:`${typeof p.value}`,value:p.value,onChange:(y,C)=>{a.updateObject(n.uuid,`material.${o}.${d}.value`,C);const x=a.scene?.getObjectByProperty("uuid",n.uuid);x!==void 0&&te(x,`material.${o}.${d}.value`,C)}});break}}l.length>0&&e.push({title:ke(o),items:l})}else m!==void 0&&console.log("other:",o,c,m)}return e.sort((o,c)=>o.title<c.title?-1:o.title>c.title?1:0),e.push({title:"Update Material",type:"button",onChange:()=>{a.updateObject(n.uuid,"material.needsUpdate",!0)}}),e}function sa(t,n){const a=t.material;if(Array.isArray(a)){const e=[],o=a.length;for(let c=0;c<o;c++)e.push(u.jsx(Ne,{title:`Material ${c}`,items:qt(a[c],t,n)},`Material ${c}`));return u.jsx(u.Fragment,{children:e})}else return u.jsx(Ne,{title:"Material",items:qt(a,t,n)})}function it(t){let n=t.value;n!==void 0&&n.isColor!==void 0&&(n=sn(t.value));const[a,e]=A.useState(n),o=A.useRef(null),c=A.useRef(null),m=A.useRef(null);A.useEffect(()=>{let g=!1,y=-1,C=0,x=Number(a);const T=G=>{g=!0,C=x,y=G.clientX},j=G=>{if(!g)return;const ye=t.step!==void 0?t.step:1,le=(G.clientX-y)*ye;x=Number((C+le).toFixed(4)),c.current!==null&&(c.current.value=x.toString()),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,x)},q=()=>{g=!1},V=()=>{g=!1},w=t.type==="number";return w&&(o.current?.addEventListener("mousedown",T,!1),document.addEventListener("mouseup",q,!1),document.addEventListener("mousemove",j,!1),document.addEventListener("contextmenu",V,!1)),()=>{w&&(o.current?.removeEventListener("mousedown",T),document.removeEventListener("mouseup",q),document.removeEventListener("mousemove",j),document.removeEventListener("contextmenu",V))}},[a]);const l=t.type==="string"&&(a.length>100||a.search(`
144
+ `)>-1),d=l||t.type==="image",p=g=>{let y=g.target.value;t.type==="boolean"?y=g.target.checked:t.type==="option"&&(y=t.options[y].value),e(y),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,y)};return u.jsxs("div",{className:`field ${d?"block":""}`,children:[t.type!=="button"&&u.jsx("label",{ref:o,children:He(t.title)},"fieldLabel"),t.type==="string"&&!l&&u.jsx("input",{type:"text",disabled:t.disabled,onChange:p,value:a}),t.type==="string"&&l&&u.jsx("textarea",{cols:50,rows:10,disabled:t.disabled!==void 0?t.disabled:!0,onChange:p,value:a}),t.type==="boolean"&&u.jsx("input",{type:"checkbox",disabled:t.disabled,onChange:p,checked:a}),t.type==="number"&&u.jsx("input",{ref:c,type:"number",value:a,min:t.min,max:t.max,step:t.step,disabled:t.disabled,onChange:p}),t.type==="range"&&u.jsxs(u.Fragment,{children:[u.jsx("input",{type:"text",value:a.toString(),onChange:p,disabled:t.disabled,className:"min"}),u.jsx("input",{disabled:t.disabled,type:"range",value:a,min:t.min,max:t.max,step:t.step,onChange:p})]}),t.type==="color"&&u.jsxs(u.Fragment,{children:[u.jsx("input",{type:"text",value:a.toString(),onChange:p,disabled:t.disabled,className:"color"}),u.jsx("input",{type:"color",value:a,onChange:p,disabled:t.disabled})]}),t.type==="button"&&u.jsx("button",{disabled:t.disabled,onClick:()=>{t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,!0)},children:t.title}),t.type==="image"&&u.jsx("img",{ref:m,onClick:()=>{ta().then(g=>{m.current.src=g,t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,g)})},src:a.length>0?a:Zn}),t.type==="option"&&u.jsx(u.Fragment,{children:u.jsx("select",{onChange:p,disabled:t.disabled,defaultValue:t.value,children:t.options?.map((g,y)=>u.jsx("option",{value:g.value,children:He(g.title)},y))})})]})}function Kt(t){switch(t){case"fov":return"FOV";case"zoom":return"Zoom";case"near":return"Near";case"far":return"Far";case"focus":return"Focus";case"aspect":return"Aspect";case"filmGauge":return"Film Gauge";case"filmOffset":return"Film Offset";case"left":return"Left";case"right":return"Right";case"top":return"Top";case"bottom":return"Bottom"}return t}function ca(t,n){const a=[];if(t.perspectiveCameraInfo!==void 0)for(const e in t.perspectiveCameraInfo)a.push({title:Kt(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(o,c)=>{n.updateObject(t.uuid,o,c),n.requestMethod(t.uuid,"updateProjectionMatrix");const m=n.scene?.getObjectByProperty("uuid",t.uuid);m!==void 0&&(te(m,o,c),m.updateProjectionMatrix())}});else if(t.orthographicCameraInfo!==void 0)for(const e in t.orthographicCameraInfo)a.push({title:Kt(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(o,c)=>{n.updateObject(t.uuid,o,c),n.requestMethod(t.uuid,"updateProjectionMatrix");const m=n.scene?.getObjectByProperty("uuid",t.uuid);m!==void 0&&(te(m,o,c),m.updateProjectionMatrix())}});return u.jsx(Ne,{title:"Camera",items:a})}const la=Math.PI/180,ua=180/Math.PI;function Ye(t,n,a,e,o){return e+(t-n)*(o-e)/(a-n)}function da(t){return t*la}function It(t){return t*ua}function ha(t,n){const a=new s.Matrix4;a.elements=t.matrix;const e=new s.Vector3,o=new s.Euler,c=new s.Vector3;t.uuid.length>0&&(e.setFromMatrixPosition(a),o.setFromRotationMatrix(a),c.setFromMatrixScale(a));const m=(d,p)=>{n.updateObject(t.uuid,d,p);const g=n.scene?.getObjectByProperty("uuid",t.uuid);g!==void 0&&te(g,d,p)},l=(d,p)=>{m(d,da(p))};return u.jsx(Ne,{title:"Transform",items:[{title:"Position X",prop:"position.x",type:"number",value:e.x,onChange:m},{title:"Position Y",prop:"position.y",type:"number",value:e.y,onChange:m},{title:"Position Z",prop:"position.z",type:"number",value:e.z,onChange:m},{title:"Rotation X",prop:"rotation.x",type:"number",value:St(It(o.x)),min:-360,max:360,step:.1,onChange:l},{title:"Rotation Y",prop:"rotation.y",type:"number",value:St(It(o.y)),min:-360,max:360,step:.1,onChange:l},{title:"Rotation Z",prop:"rotation.z",type:"number",value:St(It(o.z)),min:-360,max:360,step:.1,onChange:l},{title:"Scale X",prop:"scale.x",type:"number",value:c.x,step:.01,onChange:m},{title:"Scale Y",prop:"scale.y",type:"number",value:c.y,step:.01,onChange:m},{title:"Scale Z",prop:"scale.z",type:"number",value:c.z,step:.01,onChange:m}]})}function Xt(t){switch(t){case"color":return"Color";case"intensity":return"Intensity";case"decay":return"Decay";case"distance":return"Distance";case"angle":return"Angle";case"penumbra":return"Penumbra";case"groundColor":return"Ground Color"}return t}function fa(t,n){const a=[];if(t.lightInfo!==void 0)for(const e in t.lightInfo){const o=t.lightInfo[e];o!==void 0&&(o.isColor!==void 0?a.push({title:Xt(e),prop:e,type:"color",value:o,onChange:(c,m)=>{const l=new s.Color(m);n.updateObject(t.uuid,c,l);const d=n.scene?.getObjectByProperty("uuid",t.uuid);d!==void 0&&te(d,c,l)}}):a.push({title:Xt(e),prop:e,type:typeof o,value:o,step:typeof o=="number"?.01:void 0,onChange:(c,m)=>{n.updateObject(t.uuid,c,m);const l=n.scene?.getObjectByProperty("uuid",t.uuid);l!==void 0&&te(l,c,m)}}))}return u.jsx(Ne,{title:"Light",items:a})}function pa(t,n){const a=[],e=[];let o=0;t.animations.forEach(l=>{o=Math.max(o,l.duration),l.duration>0&&e.push({title:l.name,items:[{title:"Duration",type:"number",value:l.duration,disabled:!0},{title:"Blend Mode",type:"option",disabled:!0,options:[{title:"Normal",value:2500},{title:"Additive",value:2501}]}]})}),a.push({title:"Animations",items:e});const c=n.scene?.getObjectByProperty("uuid",t.uuid);let m=!1;if(c!==void 0){const l=c.mixer;if(m=l!==void 0,m){const d=[{title:"Time Scale",type:"range",value:l.timeScale,step:.01,min:-1,max:2,onChange:(p,g)=>{l.timeScale=g,n.updateObject(t.uuid,"mixer.timeScale",g)}}];d.push({title:"Stop All",type:"button",onChange:()=>{l.stopAllAction(),n.requestMethod(t.uuid,"stopAllAction",void 0,"mixer")}}),a.push({title:"Mixer",items:d})}}return u.jsx(Ne,{title:"Animation",items:a})}const yn={name:"",uuid:"",type:"",visible:!1,matrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0};let ne={...yn};function En(t){const[n,a]=A.useState(-1);A.useEffect(()=>{function m(d){ne={...d.value},a(Date.now())}function l(){ne={...yn},a(Date.now())}return D.addEventListener(I.SET_SCENE,l),D.addEventListener(I.SET_OBJECT,m),()=>{D.removeEventListener(I.SET_SCENE,l),D.removeEventListener(I.SET_OBJECT,m)}},[]);const e=ne.type.toLowerCase(),o=ne.animations.length>0||ne.mixer!==void 0,c=e.search("mesh")>-1||e.search("line")>-1||e.search("points")>-1;return u.jsx(wt,{label:"Inspector",children:u.jsx("div",{id:"Inspector",className:t.class,children:ne.uuid.length>0&&u.jsxs(u.Fragment,{children:[u.jsxs(u.Fragment,{children:[u.jsx(it,{type:"string",title:"Name",prop:"name",value:ne.name,disabled:!0}),u.jsx(it,{type:"string",title:"Type",prop:"type",value:ne.type,disabled:!0}),u.jsx(it,{type:"string",title:"UUID",prop:"uuid",value:ne.uuid,disabled:!0}),u.jsx(it,{type:"boolean",title:"Visible",prop:"visible",value:ne.visible,onChange:(m,l)=>{t.three.updateObject(ne.uuid,m,l);const d=t.three.scene?.getObjectByProperty("uuid",ne.uuid);d!==void 0&&te(d,m,l)}})]}),u.jsxs(u.Fragment,{children:[ha(ne,t.three),o?pa(ne,t.three):null,e.search("camera")>-1?ca(ne,t.three):null,e.search("light")>-1?fa(ne,t.three):null,c?sa(ne,t.three):null]})]})},n)},"Inspector")}class ma extends A.Component{three;constructor(n){super(n),this.state={scene:n.scene!==void 0?n.scene:null},this.three=n.three,D.addEventListener(I.SET_SCENE,this.setScene)}componentWillUnmount(){D.removeEventListener(I.SET_SCENE,this.setScene)}render(){const n=this.componentState.scene!==null,a="Hierarchy - "+(n?`${this.componentState.scene?.name}`:"No Scene");return u.jsx("div",{id:"SidePanel",children:u.jsxs(u.Fragment,{children:[u.jsx(wt,{label:a,open:!0,children:u.jsx(u.Fragment,{children:n&&u.jsx(bn,{child:this.componentState.scene,three:this.three})})}),u.jsx(En,{three:this.three})]})},"SidePanel")}setScene=n=>{this.setState(()=>({scene:n.value}))};get componentState(){return this.state}}function va(t){function n(){return t.three.scene===void 0?(console.log("No scene:",t.three),!1):!0}const a=l=>{if(!n())return;const d=t.three.scene?.getObjectByProperty("uuid",l.value);d!==void 0&&t.three.setObject(d)},e=(l,d,p)=>{if(!n())return;const g=t.three.scene?.getObjectByProperty("uuid",l);g!==void 0&&te(g,d,p)},o=l=>{if(!n())return;const d=l.value,{key:p,value:g,uuid:y}=d;e(y,p,g)},c=l=>{if(!n())return;const d=l.value;Lt(d.value).then(p=>{e(d.uuid,d.key,p),e(d.uuid,"material.needsUpdate",!0)})},m=l=>{if(!n())return;const{key:d,uuid:p,value:g,subitem:y}=l.value,C=t.three.scene?.getObjectByProperty("uuid",p);if(C!==void 0)try{y!==void 0?Fn(C,y)[d](g):C[d](g)}catch(x){console.log("Error requesting method:"),console.log(x),console.log(d),console.log(g)}};return A.useEffect(()=>(D.addEventListener(I.GET_OBJECT,a),D.addEventListener(I.UPDATE_OBJECT,o),D.addEventListener(I.CREATE_TEXTURE,c),D.addEventListener(I.REQUEST_METHOD,m),()=>{D.removeEventListener(I.GET_OBJECT,a),D.removeEventListener(I.UPDATE_OBJECT,o),D.removeEventListener(I.CREATE_TEXTURE,c),D.removeEventListener(I.REQUEST_METHOD,m)}),[]),null}const Zt={type:"change"},Nt={type:"start"},Jt={type:"end"},yt=new s.Ray,Qt=new s.Plane,ga=Math.cos(70*s.MathUtils.DEG2RAD);class ba extends s.EventDispatcher{constructor(n,a){super(),this.object=n,this.domElement=a,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new s.Vector3,this.cursor=new s.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:s.MOUSE.ROTATE,MIDDLE:s.MOUSE.DOLLY,RIGHT:s.MOUSE.PAN},this.touches={ONE:s.TOUCH.ROTATE,TWO:s.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(r){r.addEventListener("keydown",Ze),this._domElementKeyEvents=r},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",Ze),this._domElementKeyEvents=null},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(Zt),e.update(),c=o.NONE},this.update=function(){const r=new s.Vector3,E=new s.Quaternion().setFromUnitVectors(n.up,new s.Vector3(0,1,0)),M=E.clone().invert(),F=new s.Vector3,Z=new s.Quaternion,ue=new s.Vector3,ie=2*Math.PI;return function(jt=null){const Qe=e.object.position;r.copy(Qe).sub(e.target),r.applyQuaternion(E),l.setFromVector3(r),e.autoRotate&&c===o.NONE&&z(P(jt)),e.enableDamping?(l.theta+=d.theta*e.dampingFactor,l.phi+=d.phi*e.dampingFactor):(l.theta+=d.theta,l.phi+=d.phi);let fe=e.minAzimuthAngle,de=e.maxAzimuthAngle;isFinite(fe)&&isFinite(de)&&(fe<-Math.PI?fe+=ie:fe>Math.PI&&(fe-=ie),de<-Math.PI?de+=ie:de>Math.PI&&(de-=ie),fe<=de?l.theta=Math.max(fe,Math.min(de,l.theta)):l.theta=l.theta>(fe+de)/2?Math.max(fe,l.theta):Math.min(de,l.theta)),l.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,l.phi)),l.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(g,e.dampingFactor):e.target.add(g),e.target.sub(e.cursor),e.target.clampLength(e.minTargetRadius,e.maxTargetRadius),e.target.add(e.cursor),e.zoomToCursor&&se||e.object.isOrthographicCamera?l.radius=pe(l.radius):l.radius=pe(l.radius*p),r.setFromSpherical(l),r.applyQuaternion(M),Qe.copy(e.target).add(r),e.object.lookAt(e.target),e.enableDamping===!0?(d.theta*=1-e.dampingFactor,d.phi*=1-e.dampingFactor,g.multiplyScalar(1-e.dampingFactor)):(d.set(0,0,0),g.set(0,0,0));let Re=!1;if(e.zoomToCursor&&se){let _e=null;if(e.object.isPerspectiveCamera){const Ae=r.length();_e=pe(Ae*p);const Pe=Ae-_e;e.object.position.addScaledVector(ye,Pe),e.object.updateMatrixWorld()}else if(e.object.isOrthographicCamera){const Ae=new s.Vector3(le.x,le.y,0);Ae.unproject(e.object),e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/p)),e.object.updateProjectionMatrix(),Re=!0;const Pe=new s.Vector3(le.x,le.y,0);Pe.unproject(e.object),e.object.position.sub(Pe).add(Ae),e.object.updateMatrixWorld(),_e=r.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;_e!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(_e).add(e.object.position):(yt.origin.copy(e.object.position),yt.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(yt.direction))<ga?n.lookAt(e.target):(Qt.setFromNormalAndCoplanarPoint(e.object.up,e.target),yt.intersectPlane(Qt,e.target))))}else e.object.isOrthographicCamera&&(Re=p!==1,Re&&(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/p)),e.object.updateProjectionMatrix()));return p=1,se=!1,Re||F.distanceToSquared(e.object.position)>m||8*(1-Z.dot(e.object.quaternion))>m||ue.distanceToSquared(e.target)>0?(e.dispatchEvent(Zt),F.copy(e.object.position),Z.copy(e.object.quaternion),ue.copy(e.target),!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",Be),e.domElement.removeEventListener("pointerdown",Me),e.domElement.removeEventListener("pointercancel",Te),e.domElement.removeEventListener("wheel",pt),e.domElement.removeEventListener("pointermove",Ke),e.domElement.removeEventListener("pointerup",Te),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",Ze),e._domElementKeyEvents=null)};const e=this,o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let c=o.NONE;const m=1e-6,l=new s.Spherical,d=new s.Spherical;let p=1;const g=new s.Vector3,y=new s.Vector2,C=new s.Vector2,x=new s.Vector2,T=new s.Vector2,j=new s.Vector2,q=new s.Vector2,V=new s.Vector2,w=new s.Vector2,G=new s.Vector2,ye=new s.Vector3,le=new s.Vector2;let se=!1;const h=[],v={};let O=!1;function P(r){return r!==null?2*Math.PI/60*e.autoRotateSpeed*r:2*Math.PI/60/60*e.autoRotateSpeed}function H(r){const E=Math.abs(r*.01);return Math.pow(.95,e.zoomSpeed*E)}function z(r){d.theta-=r}function Y(r){d.phi-=r}const L=function(){const r=new s.Vector3;return function(M,F){r.setFromMatrixColumn(F,0),r.multiplyScalar(-M),g.add(r)}}(),K=function(){const r=new s.Vector3;return function(M,F){e.screenSpacePanning===!0?r.setFromMatrixColumn(F,1):(r.setFromMatrixColumn(F,0),r.crossVectors(e.object.up,r)),r.multiplyScalar(M),g.add(r)}}(),X=function(){const r=new s.Vector3;return function(M,F){const Z=e.domElement;if(e.object.isPerspectiveCamera){const ue=e.object.position;r.copy(ue).sub(e.target);let ie=r.length();ie*=Math.tan(e.object.fov/2*Math.PI/180),L(2*M*ie/Z.clientHeight,e.object.matrix),K(2*F*ie/Z.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(L(M*(e.object.right-e.object.left)/e.object.zoom/Z.clientWidth,e.object.matrix),K(F*(e.object.top-e.object.bottom)/e.object.zoom/Z.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function R(r){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?p/=r:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function U(r){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?p*=r:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function Q(r,E){if(!e.zoomToCursor)return;se=!0;const M=e.domElement.getBoundingClientRect(),F=r-M.left,Z=E-M.top,ue=M.width,ie=M.height;le.x=F/ue*2-1,le.y=-(Z/ie)*2+1,ye.set(le.x,le.y,1).unproject(e.object).sub(e.object.position).normalize()}function pe(r){return Math.max(e.minDistance,Math.min(e.maxDistance,r))}function Ee(r){y.set(r.clientX,r.clientY)}function ct(r){Q(r.clientX,r.clientX),V.set(r.clientX,r.clientY)}function We(r){T.set(r.clientX,r.clientY)}function Mt(r){C.set(r.clientX,r.clientY),x.subVectors(C,y).multiplyScalar(e.rotateSpeed);const E=e.domElement;z(2*Math.PI*x.x/E.clientHeight),Y(2*Math.PI*x.y/E.clientHeight),y.copy(C),e.update()}function Tt(r){w.set(r.clientX,r.clientY),G.subVectors(w,V),G.y>0?R(H(G.y)):G.y<0&&U(H(G.y)),V.copy(w),e.update()}function $e(r){j.set(r.clientX,r.clientY),q.subVectors(j,T).multiplyScalar(e.panSpeed),X(q.x,q.y),T.copy(j),e.update()}function qe(r){Q(r.clientX,r.clientY),r.deltaY<0?U(H(r.deltaY)):r.deltaY>0&&R(H(r.deltaY)),e.update()}function Fe(r){let E=!1;switch(r.code){case e.keys.UP:r.ctrlKey||r.metaKey||r.shiftKey?Y(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):X(0,e.keyPanSpeed),E=!0;break;case e.keys.BOTTOM:r.ctrlKey||r.metaKey||r.shiftKey?Y(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):X(0,-e.keyPanSpeed),E=!0;break;case e.keys.LEFT:r.ctrlKey||r.metaKey||r.shiftKey?z(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):X(e.keyPanSpeed,0),E=!0;break;case e.keys.RIGHT:r.ctrlKey||r.metaKey||r.shiftKey?z(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):X(-e.keyPanSpeed,0),E=!0;break}E&&(r.preventDefault(),e.update())}function Ue(r){if(h.length===1)y.set(r.pageX,r.pageY);else{const E=Se(r),M=.5*(r.pageX+E.x),F=.5*(r.pageY+E.y);y.set(M,F)}}function xe(r){if(h.length===1)T.set(r.pageX,r.pageY);else{const E=Se(r),M=.5*(r.pageX+E.x),F=.5*(r.pageY+E.y);T.set(M,F)}}function lt(r){const E=Se(r),M=r.pageX-E.x,F=r.pageY-E.y,Z=Math.sqrt(M*M+F*F);V.set(0,Z)}function ut(r){e.enableZoom&&lt(r),e.enablePan&&xe(r)}function Rt(r){e.enableZoom&&lt(r),e.enableRotate&&Ue(r)}function dt(r){if(h.length==1)C.set(r.pageX,r.pageY);else{const M=Se(r),F=.5*(r.pageX+M.x),Z=.5*(r.pageY+M.y);C.set(F,Z)}x.subVectors(C,y).multiplyScalar(e.rotateSpeed);const E=e.domElement;z(2*Math.PI*x.x/E.clientHeight),Y(2*Math.PI*x.y/E.clientHeight),y.copy(C)}function we(r){if(h.length===1)j.set(r.pageX,r.pageY);else{const E=Se(r),M=.5*(r.pageX+E.x),F=.5*(r.pageY+E.y);j.set(M,F)}q.subVectors(j,T).multiplyScalar(e.panSpeed),X(q.x,q.y),T.copy(j)}function Oe(r){const E=Se(r),M=r.pageX-E.x,F=r.pageY-E.y,Z=Math.sqrt(M*M+F*F);w.set(0,Z),G.set(0,Math.pow(w.y/V.y,e.zoomSpeed)),R(G.y),V.copy(w);const ue=(r.pageX+E.x)*.5,ie=(r.pageY+E.y)*.5;Q(ue,ie)}function ht(r){e.enableZoom&&Oe(r),e.enablePan&&we(r)}function ft(r){e.enableZoom&&Oe(r),e.enableRotate&&dt(r)}function Me(r){e.enabled!==!1&&(h.length===0&&(e.domElement.setPointerCapture(r.pointerId),e.domElement.addEventListener("pointermove",Ke),e.domElement.addEventListener("pointerup",Te)),At(r),r.pointerType==="touch"?Je(r):Xe(r))}function Ke(r){e.enabled!==!1&&(r.pointerType==="touch"?gt(r):_t(r))}function Te(r){switch(Pt(r),h.length){case 0:e.domElement.releasePointerCapture(r.pointerId),e.domElement.removeEventListener("pointermove",Ke),e.domElement.removeEventListener("pointerup",Te),e.dispatchEvent(Jt),c=o.NONE;break;case 1:const E=h[0],M=v[E];Je({pointerId:E,pageX:M.x,pageY:M.y});break}}function Xe(r){let E;switch(r.button){case 0:E=e.mouseButtons.LEFT;break;case 1:E=e.mouseButtons.MIDDLE;break;case 2:E=e.mouseButtons.RIGHT;break;default:E=-1}switch(E){case s.MOUSE.DOLLY:if(e.enableZoom===!1)return;ct(r),c=o.DOLLY;break;case s.MOUSE.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(e.enablePan===!1)return;We(r),c=o.PAN}else{if(e.enableRotate===!1)return;Ee(r),c=o.ROTATE}break;case s.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(e.enableRotate===!1)return;Ee(r),c=o.ROTATE}else{if(e.enablePan===!1)return;We(r),c=o.PAN}break;default:c=o.NONE}c!==o.NONE&&e.dispatchEvent(Nt)}function _t(r){switch(c){case o.ROTATE:if(e.enableRotate===!1)return;Mt(r);break;case o.DOLLY:if(e.enableZoom===!1)return;Tt(r);break;case o.PAN:if(e.enablePan===!1)return;$e(r);break}}function pt(r){e.enabled===!1||e.enableZoom===!1||c!==o.NONE||(r.preventDefault(),e.dispatchEvent(Nt),qe(mt(r)),e.dispatchEvent(Jt))}function mt(r){const E=r.deltaMode,M={clientX:r.clientX,clientY:r.clientY,deltaY:r.deltaY};switch(E){case 1:M.deltaY*=16;break;case 2:M.deltaY*=100;break}return r.ctrlKey&&!O&&(M.deltaY*=10),M}function vt(r){r.key==="Control"&&(O=!0,e.domElement.getRootNode().addEventListener("keyup",Ce,{passive:!0,capture:!0}))}function Ce(r){r.key==="Control"&&(O=!1,e.domElement.getRootNode().removeEventListener("keyup",Ce,{passive:!0,capture:!0}))}function Ze(r){e.enabled===!1||e.enablePan===!1||Fe(r)}function Je(r){switch(bt(r),h.length){case 1:switch(e.touches.ONE){case s.TOUCH.ROTATE:if(e.enableRotate===!1)return;Ue(r),c=o.TOUCH_ROTATE;break;case s.TOUCH.PAN:if(e.enablePan===!1)return;xe(r),c=o.TOUCH_PAN;break;default:c=o.NONE}break;case 2:switch(e.touches.TWO){case s.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;ut(r),c=o.TOUCH_DOLLY_PAN;break;case s.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Rt(r),c=o.TOUCH_DOLLY_ROTATE;break;default:c=o.NONE}break;default:c=o.NONE}c!==o.NONE&&e.dispatchEvent(Nt)}function gt(r){switch(bt(r),c){case o.TOUCH_ROTATE:if(e.enableRotate===!1)return;dt(r),e.update();break;case o.TOUCH_PAN:if(e.enablePan===!1)return;we(r),e.update();break;case o.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;ht(r),e.update();break;case o.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;ft(r),e.update();break;default:c=o.NONE}}function Be(r){e.enabled!==!1&&r.preventDefault()}function At(r){h.push(r.pointerId)}function Pt(r){delete v[r.pointerId];for(let E=0;E<h.length;E++)if(h[E]==r.pointerId){h.splice(E,1);return}}function bt(r){let E=v[r.pointerId];E===void 0&&(E=new s.Vector2,v[r.pointerId]=E),E.set(r.pageX,r.pageY)}function Se(r){const E=r.pointerId===h[0]?h[1]:h[0];return v[E]}e.domElement.addEventListener("contextmenu",Be),e.domElement.addEventListener("pointerdown",Me),e.domElement.addEventListener("pointercancel",Te),e.domElement.addEventListener("wheel",pt,{passive:!1}),e.domElement.getRootNode().addEventListener("keydown",vt,{passive:!0,capture:!0}),this.update()}}const xt=t=>{const[n,a]=A.useState(t.options[t.index]),e=()=>{t.onToggle(!t.open)},o=c=>{c!==n&&(t.onSelect(c),a(c)),t.onToggle(!1)};return u.jsxs("div",{className:`dropdown ${t.up===!0?"up":""}`,children:[u.jsx("div",{className:"dropdown-toggle",onClick:e,children:n}),t.open&&u.jsx("ul",{className:"dropdown-menu",children:t.options.map(c=>u.jsx("li",{onClick:()=>o(c),children:c},c))})]})},je=A.forwardRef(function(n,a){const[e,o]=A.useState(!1),c=n.options.indexOf(n.camera.name);return u.jsxs("div",{className:"CameraWindow",children:[u.jsx("div",{ref:a,className:"clickable",onClick:()=>{e&&o(!1)}}),u.jsx(xt,{index:c,open:e,options:n.options,onSelect:n.onSelect,onToggle:m=>{o(m)},up:!0})]})}),en=["Single","Side by Side","Stacked","Quad"],ae=new Map,re=new Map,ge=new Map;function Le(t,n){const a=new s.OrthographicCamera(-100,100,100,-100,50,3e3);return a.name=t,a.position.copy(n),a.lookAt(0,0,0),ae.set(t,a),a}Le("Top",new s.Vector3(0,1e3,0));Le("Bottom",new s.Vector3(0,-1e3,0));Le("Left",new s.Vector3(-1e3,0,0));Le("Right",new s.Vector3(1e3,0,0));Le("Front",new s.Vector3(0,0,1e3));Le("Back",new s.Vector3(0,0,-1e3));Le("Orthographic",new s.Vector3(1e3,1e3,1e3));const Ot=new s.PerspectiveCamera(60,1,50,3e3);Ot.name="Debug";Ot.position.set(500,500,500);Ot.lookAt(0,0,0);ae.set("Debug",Ot);const tn=["Renderer","Depth","Normals","UVs","Wireframe"],ya=new s.MeshDepthMaterial,Ea=new s.MeshNormalMaterial,Ca=new gn,Sa=new s.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0});let Et="Renderer";const $=new s.Scene;$.name="Debug Scene";let be=new s.Scene;$.add(be);const st=new s.Group;st.name="helpers";$.add(st);const xa=new vn;st.add(xa);const Cn=new s.AxesHelper(500);Cn.name="axisHelper";st.add(Cn);const rt=new s.AxesHelper(100);rt.name="interactionHelper";st.add(rt);rt.visible=!1;let Ct=!1,W=ae.get("Debug"),oe=ae.get("Orthographic"),De=ae.get("Front"),Ie=ae.get("Top"),nn=!1;function wa(t){const[n,a]=A.useState(t.mode!==void 0?t.mode:"Single"),[e,o]=A.useState(null),[c,m]=A.useState(!1),[l,d]=A.useState(!1),[p,g]=A.useState(!1),[,y]=A.useState(Date.now()),C=A.useRef(null),x=A.useRef(null),T=A.useRef(null),j=A.useRef(null),q=A.useRef(null),V=A.useRef(null),w=(h,v)=>{const O=re.get(h.name);O!==void 0&&O.dispose(),re.delete(h.name);const P=ge.get(h.name);P!==void 0&&($.remove(P),P.dispose()),ge.delete(h.name);const H=new ba(h,v);switch(H.enableDamping=!0,H.dampingFactor=.05,h.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":H.enableRotate=!1;break}if(re.set(h.name,H),h instanceof s.PerspectiveCamera){const z=new s.CameraHelper(h);ge.set(h.name,z),$.add(z)}},G=h=>{const v=ge.get(h.name);v!==void 0&&($.remove(v),v.dispose(),ge.delete(h.name));const O=re.get(h.name);O!==void 0&&(O.dispose(),re.delete(h.name))},ye=()=>{re.forEach((h,v)=>{h.dispose();const O=ge.get(v);O!==void 0&&($.remove(O),O.dispose()),ge.delete(v),re.delete(v)}),re.clear(),ge.clear()},le=()=>{switch(n){case"Single":w(W,T.current);break;case"Side by Side":case"Stacked":w(W,T.current),w(oe,j.current);break;case"Quad":w(W,T.current),w(oe,j.current),w(De,q.current),w(Ie,V.current);break}};A.useEffect(()=>{const h=new s.WebGLRenderer({canvas:C.current,stencil:!1});h.autoClear=!1,h.shadowMap.enabled=!0,h.setPixelRatio(devicePixelRatio),h.setClearColor(0),o(h)},[]),A.useEffect(()=>{const h=P=>{Bt(be),$.remove(be);const H=t.scenes.get(P.value.name);if(H!==void 0){const z=new H;t.onSceneSet!==void 0&&t.onSceneSet(z),be=z,t.three.scene=be,$.add(be),nn=!0}},v=P=>{const H=P.value,z=t.three.scene?.getObjectByProperty("uuid",H.uuid);z!==void 0&&ae.set(H.name,z),y(Date.now())},O=P=>{ae.delete(P.value.name),y(Date.now())};return D.addEventListener(I.SET_SCENE,h),D.addEventListener(I.ADD_CAMERA,v),D.addEventListener(I.REMOVE_CAMERA,O),()=>{D.removeEventListener(I.SET_SCENE,h),D.removeEventListener(I.ADD_CAMERA,v),D.removeEventListener(I.REMOVE_CAMERA,O)}},[]),A.useEffect(()=>{if(e===null)return;let h=window.innerWidth,v=window.innerHeight,O=Math.floor(h/2),P=Math.floor(v/2),H=-1;const z=()=>{h=window.innerWidth-300,v=window.innerHeight,O=Math.floor(h/2),P=Math.floor(v/2),e.setSize(h,v);let R=h,U=v;switch(n){case"Side by Side":R=O,U=v;break;case"Stacked":R=h,U=P;break;case"Quad":R=O,U=P;break}ae.forEach(Q=>{Q instanceof s.OrthographicCamera?(Q.left=R/-2,Q.right=R/2,Q.top=U/2,Q.bottom=U/-2,Q.updateProjectionMatrix()):Q instanceof s.PerspectiveCamera&&(Q.aspect=R/U,Q.updateProjectionMatrix(),ge.get(Q.name)?.update())})},Y=()=>{e.setViewport(0,0,h,v),e.setScissor(0,0,h,v),e.render($,W)},L=()=>{if(n==="Side by Side")e.setViewport(0,0,O,v),e.setScissor(0,0,O,v),e.render($,W),e.setViewport(O,0,O,v),e.setScissor(O,0,O,v),e.render($,oe);else{const R=v-P;e.setViewport(0,R,h,P),e.setScissor(0,R,h,P),e.render($,W),e.setViewport(0,0,h,P),e.setScissor(0,0,h,P),e.render($,oe)}},K=()=>{let R=0,U=0;U=v-P,R=0,e.setViewport(R,U,O,P),e.setScissor(R,U,O,P),e.render($,W),R=O,e.setViewport(R,U,O,P),e.setScissor(R,U,O,P),e.render($,oe),U=0,R=0,e.setViewport(R,U,O,P),e.setScissor(R,U,O,P),e.render($,De),R=O,e.setViewport(R,U,O,P),e.setScissor(R,U,O,P),e.render($,Ie)},X=()=>{switch(re.forEach(R=>{R.update()}),t.onSceneUpdate!==void 0&&nn&&t.onSceneUpdate(be),e.clear(),n){case"Single":Y();break;case"Side by Side":case"Stacked":L();break;case"Quad":K();break}H=requestAnimationFrame(X)};return le(),window.addEventListener("resize",z),z(),X(),()=>{window.removeEventListener("resize",z),cancelAnimationFrame(H),H=-1}},[n,e]),A.useEffect(()=>{if(e!==null){const h=new s.Raycaster,v=new s.Vector2,O=(Y,L,K,X)=>{switch(n){case"Quad":Y<K?L<X?h.setFromCamera(v,W):h.setFromCamera(v,De):L<X?h.setFromCamera(v,oe):h.setFromCamera(v,Ie);break;case"Side by Side":Y<K?h.setFromCamera(v,W):h.setFromCamera(v,oe);break;case"Single":h.setFromCamera(v,W);break;case"Stacked":L<X?h.setFromCamera(v,W):h.setFromCamera(v,oe);break}},P=Y=>{if(!Ct)return;const L=new s.Vector2;e.getSize(L);const K=Math.min(Y.clientX,L.x),X=Math.min(Y.clientY,L.y);v.x=Ye(K,0,L.x,-1,1),v.y=Ye(X,0,L.y,1,-1);const R=L.x/2,U=L.y/2,Q=()=>{K<R?v.x=Ye(K,0,R,-1,1):v.x=Ye(K,R,L.x,-1,1)},pe=()=>{X<U?v.y=Ye(X,0,U,1,-1):v.y=Ye(X,U,L.y,1,-1)};switch(n){case"Quad":Q(),pe();break;case"Side by Side":Q();break;case"Stacked":pe(),pe();break}O(K,X,R,U);const Ee=h.intersectObjects(be.children);Ee.length>0&&rt.position.copy(Ee[0].point)},H=Y=>{if(!Ct)return;const L=new s.Vector2;if(e.getSize(L),Y.clientX>=L.x)return;P(Y);const K=h.intersectObjects(be.children);K.length>0&&t.three.getObject(K[0].object.uuid)},z=x.current;return z.addEventListener("mousemove",P,!1),z.addEventListener("click",H,!1),()=>{z.removeEventListener("mousemove",P),z.removeEventListener("click",H)}}},[n,e]);const se=[];return ae.forEach((h,v)=>{se.push(v)}),u.jsxs("div",{className:"multiview",children:[u.jsx("canvas",{ref:C}),u.jsxs("div",{className:`cameras ${n==="Single"||n==="Stacked"?"single":""}`,ref:x,children:[n==="Single"&&u.jsx(u.Fragment,{children:u.jsx(je,{camera:W,options:se,ref:T,onSelect:h=>{re.get(W.name)?.dispose();const v=ae.get(h);v!==void 0&&(G(W),W=v,w(v,T.current))}})}),(n==="Side by Side"||n==="Stacked")&&u.jsxs(u.Fragment,{children:[u.jsx(je,{camera:W,options:se,ref:T,onSelect:h=>{re.get(W.name)?.dispose();const v=ae.get(h);v!==void 0&&(G(W),W=v,w(v,T.current))}}),u.jsx(je,{camera:oe,options:se,ref:j,onSelect:h=>{re.get(oe.name)?.dispose();const v=ae.get(h);v!==void 0&&(G(oe),oe=v,w(v,j.current))}})]}),n==="Quad"&&u.jsxs(u.Fragment,{children:[u.jsx(je,{camera:W,options:se,ref:T,onSelect:h=>{re.get(W.name)?.dispose();const v=ae.get(h);v!==void 0&&(G(W),W=v,w(v,T.current))}}),u.jsx(je,{camera:oe,options:se,ref:j,onSelect:h=>{re.get(oe.name)?.dispose();const v=ae.get(h);v!==void 0&&(G(oe),oe=v,w(v,j.current))}}),u.jsx(je,{camera:De,options:se,ref:q,onSelect:h=>{re.get(De.name)?.dispose();const v=ae.get(h);v!==void 0&&(G(De),De=v,w(v,q.current))}}),u.jsx(je,{camera:Ie,options:se,ref:V,onSelect:h=>{re.get(Ie.name)?.dispose();const v=ae.get(h);v!==void 0&&(G(Ie),Ie=v,w(v,V.current))}})]})]}),u.jsxs("div",{className:"settings",children:[u.jsx(xt,{index:en.indexOf(n),options:en,onSelect:h=>{h!==n&&(ye(),a(h))},open:c,onToggle:h=>{m(h),l&&d(!1),p&&g(!1)}}),u.jsx(xt,{index:tn.indexOf(Et),options:tn,onSelect:h=>{if(h!==Et)switch(Et=h,Et){case"Depth":$.overrideMaterial=ya;break;case"Normals":$.overrideMaterial=Ea;break;default:case"Renderer":$.overrideMaterial=null;break;case"Wireframe":$.overrideMaterial=Sa;break;case"UVs":$.overrideMaterial=Ca;break}},open:l,onToggle:h=>{c&&m(!1),d(h),p&&g(!1)}}),u.jsx(xt,{index:0,options:["Orbit Mode","Selection Mode"],onSelect:h=>{Ct=h==="Selection Mode",rt.visible=Ct},open:p,onToggle:h=>{c&&m(!1),l&&d(!1),g(h)}})]})]})}function Oa(t){return u.jsxs("div",{className:"editor",ref:t.ref,style:t.style,children:[u.jsx("header",{children:t.header}),t.children,u.jsx("footer",{children:t.footer})]})}exports.Accordion=wt;exports.Application=jn;exports.BaseRemote=ot;exports.ChildObject=zt;exports.ContainerObject=bn;exports.Draggable=fn;exports.DraggableItem=hn;exports.Dropdown=pn;exports.DropdownItem=mn;exports.Editor=Oa;exports.InfiniteGridHelper=vn;exports.Inspector=En;exports.MultiView=wa;exports.NavButton=Vt;exports.RemoteComponents=Dn;exports.RemoteController=Hn;exports.RemoteTheatre=Ge;exports.RemoteThree=Un;exports.RemoteTweakpane=Bn;exports.SceneInspector=va;exports.SidePanel=ma;exports.ToolEvents=I;exports.UVMaterial=gn;exports.capitalize=He;exports.clamp=An;exports.colorToHex=sn;exports.debugDispatcher=D;exports.dispose=Bt;exports.disposeMaterial=ln;exports.disposeTexture=kn;exports.distance=Pn;exports.hierarchyUUID=Ut;exports.isColor=on;exports.randomID=rn;exports.resetThreeObjects=cn;exports.round=St;