@tomorrowevening/hermes 0.0.47 → 0.0.48

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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("three"),hn=require("tweakpane"),pn=require("@tweakpane/plugin-essentials"),x=require("react"),qt=require("framer-motion");function mn(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 vn=mn(pn),jt=()=>{},gn=()=>{};function Xe(t){return t.substring(0,1).toUpperCase()+t.substring(1)}function Ye(t,n,a){return Math.min(n,Math.max(t,a))}function Rt(t,n,a){return(a-t)/(n-t)}function _t(t,n,a){return t*(1-a)+n*a}function bn(t,n){const a=t-n;return Math.sqrt(a*a)}function Kt(){return Math.round(Math.random()*1e6).toString()}function Xt(t){return t.r!==void 0&&t.g!==void 0&&t.b!==void 0}function Zt(t){const n=Math.round(t.r*255),a=Math.round(t.g*255),e=Math.round(t.b*255),i=f=>{const d=f.toString(16);return d.length===1?"0"+d:d},s=i(n),h=i(a),c=i(e);return"#"+s+h+c}function Ke(t,n=1){return Number(t.toFixed(n))}exports.totalThreeObjects=0;const Jt=()=>{exports.totalThreeObjects=0},kt=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=>{kt(a)})},yn=t=>{t?.dispose()},Qt=t=>{t&&(Array.isArray(t)?t.forEach(n=>n.dispose()):t.dispose())},Dt=t=>{if(t){for(;t.children.length>0;){const n=t.children[0];n.type==="Audio"?(n.pause(),n.parent&&n.parent.remove(n)):Dt(n)}if(t.parent&&t.parent.remove(t),t.isMesh){const n=t;n.geometry?.dispose(),Qt(n.material)}t.dispose!==void 0&&t.dispose()}};class En{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)))}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 N=new u.EventDispatcher,L={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,a,e){}handleEditor(n,a,e){}}class xn 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,a,e){switch(e.event){case"selectComponent":N.dispatchEvent({type:L.SELECT_DROPDOWN,value:e.data});break;case"draggableListUpdate":N.dispatchEvent({type:L.DRAG_UPDATE,value:e.data});break}}}class bt extends ot{project;sheets=new Map;sheetObjects=new Map;sheetObjectCBs=new Map;sheetObjectUnsubscribe=new Map;activeSheet;studio=void 0;static rafDriver=void 0;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,i){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const s=this.sheet(n);if(s===void 0)return;const h=`${n}_${a}`;let c=this.sheetObjects.get(h);c!==void 0?c=s.object(a,{...e,...c.value},{reconfigure:!0}):c=s.object(a,e),this.sheetObjects.set(h,c),this.sheetObjectCBs.set(h,i!==void 0?i:jt);const f=c.onValuesChange(d=>{if(this.app.editor){for(const y in d){const S=d[y];typeof S=="object"&&Xt(S)&&(d[y]={r:S.r,g:S.g,b:S.b,a:S.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:n,sheetObject:h,values:d}})}const v=this.sheetObjectCBs.get(h);v!==void 0&&v(d)});return this.sheetObjectUnsubscribe.set(h,f),c}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 s=`${a}_${e}`,h=this.sheetObjectUnsubscribe.get(s);h!==void 0&&(this.sheetObjects.delete(s),this.sheetObjectCBs.delete(s),this.sheetObjectUnsubscribe.delete(s),h())}handleApp(n,a,e){const i=a;let s;switch(e.event){case"setSheet":s=i.sheets.get(e.data.sheet),s!==void 0&&(i.activeSheet=s,this.studio?.setSelection([s]));break;case"setSheetObject":s=i.sheetObjects.get(`${e.data.sheet}_${e.data.key}`),s!==void 0&&this.studio?.setSelection([s]);break;case"updateSheetObject":s=i.sheets.get(e.data.sheet),s!==void 0&&s.sequence.pause(),s=i.sheetObjectCBs.get(e.data.sheetObject),s!==void 0&&s(e.data.values);break;case"updateTimeline":s=i.sheets.get(e.data.sheet),i.activeSheet!==void 0&&(i.activeSheet.sequence.position=e.data.position);break}}handleEditor(n,a,e){if(n.editor){const i=a;switch(e.event){case"playSheet":i.sheet(e.data.sheet)?.sequence.play(e.data.value);break;case"pauseSheet":i.sheet(e.data.sheet)?.sequence.pause();break}}}handleEditorApp(n,a){if(n.editor){this.studio?.ui.restore(),this.studio?.onSelectionChange(h=>{h.length<1||h.forEach(c=>{let f=c.address.sheetId,d="setSheet",v={};switch(c.type){case"Theatre_Sheet_PublicAPI":d="setSheet",v={sheet:c.address.sheetId},a.activeSheet=a.sheets.get(c.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":d="setSheetObject",f+=`_${c.address.objectKey}`,v={id:f,sheet:c.address.sheetId,key:c.address.objectKey},a.activeSheet=a.sheets.get(c.address.sheetId);break}n.send({event:d,target:"app",data:v})})});let e=-1;const i=()=>{if(bt.rafDriver?.tick(performance.now()),a.activeSheet!==void 0&&e!==a.activeSheet.sequence.position){e=a.activeSheet.sequence.position;const h=a.activeSheet;n.send({event:"updateTimeline",target:"app",data:{position:e,sheet:h.address.sheetId}})}},s=()=>{i(),requestAnimationFrame(s)};i(),s()}else this.studio?.ui.hide()}}function Sn(t,n,a){if(t.editor){a.ui.restore(),a.onSelectionChange(h=>{h.length<1||h.forEach(c=>{let f=c.address.sheetId,d="setSheet",v={};switch(c.type){case"Theatre_Sheet_PublicAPI":d="setSheet",v={sheet:c.address.sheetId},n.activeSheet=n.sheets.get(c.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":d="setSheetObject",f+=`_${c.address.objectKey}`,v={id:f,sheet:c.address.sheetId,key:c.address.objectKey},n.activeSheet=n.sheets.get(c.address.sheetId);break}t.send({event:d,target:"app",data:v})})});let e=-1;const i=()=>{if(bt.rafDriver?.tick(performance.now()),n.activeSheet!==void 0&&e!==n.activeSheet.sequence.position){e=n.activeSheet.sequence.position;const h=n.activeSheet;t.send({event:"updateTimeline",target:"app",data:{position:e,sheet:h.address.sheetId}})}},s=()=>{i(),requestAnimationFrame(s)};i(),s()}else a.ui.hide()}function Cn(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 en(t){const n={name:t.name,type:t.type,uuid:t.uuid,children:[]};return t.children.forEach(a=>{n.children.push(en(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 On(t){switch(t){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function $e(t){const n={};for(const a in t){if(a.substring(0,1)==="_"||a.substring(0,2)==="is"||On(a))continue;const e=typeof t[a],i=t[a];switch(e){case"boolean":case"number":case"string":n[a]=i;break;case"object":if(i!==null)if(n[a]=i,i.isTexture)if(i instanceof u.Texture){const s=i.source.toJSON();n[a]={src:s.url}}else i instanceof u.CubeTexture&&(console.log("env map"),console.log(i.source.data),console.log(i.source.toJSON()),n[a]={src:""});else a==="uniforms"&&(n[a]=wn(n[a]));else n[a]={src:""};break}}return n}function Ot(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 i=[];e.material.forEach(s=>{i.push($e(s))}),n.material=i}else n.material=$e(e.material)}else if(a.search("points")>-1){const e=t;if(Array.isArray(e.material)){const i=[];e.material.forEach(s=>{i.push($e(s))}),n.material=i}else n.material=$e(e.material)}else if(a.search("line")>-1){const e=t;if(Array.isArray(e.material)){const i=[];e.material.forEach(s=>{i.push($e(s))}),n.material=i}else n.material=$e(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 Mn(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 At(t){return new Promise((n,a)=>{const e=new Image;e.onload=()=>{const i=new u.Texture(e);i.wrapS=u.RepeatWrapping,i.wrapT=u.RepeatWrapping,i.needsUpdate=!0,n(i)},e.onerror=a,e.src=t})}class Tn extends ot{scene=void 0;renderer=void 0;getObject(n){this.app.debugEnabled&&this.app.send({event:"getObject",target:"app",data:n})}setObject(n){const a=Ot(n);this.app.send({event:"setObject",target:"editor",data:a})}requestMethod(n,a,e,i){this.app.send({event:"requestMethod",target:"app",data:{uuid:n,key:a,value:e,subitem:i}})}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;Jt(),kt(this.scene);const a=en(this.scene);this.app.send({event:"setScene",target:"editor",data:a})}addCamera(n){if(!this.app.debugEnabled)return;const a=Ot(n);this.app.send({event:"addCamera",target:"editor",data:a})}removeCamera(n){if(!this.app.debugEnabled)return;const a=Ot(n);this.app.send({event:"removeCamera",target:"editor",data:a})}handleApp(n,a,e){switch(e.event){case"getObject":N.dispatchEvent({type:L.GET_OBJECT,value:e.data});break;case"updateObject":N.dispatchEvent({type:L.UPDATE_OBJECT,value:e.data});break;case"createTexture":N.dispatchEvent({type:L.CREATE_TEXTURE,value:e.data});break;case"requestMethod":N.dispatchEvent({type:L.REQUEST_METHOD,value:e.data});break}}handleEditor(n,a,e){switch(e.event){case"setObject":N.dispatchEvent({type:L.SET_OBJECT,value:e.data});break;case"setScene":N.dispatchEvent({type:L.SET_SCENE,value:e.data});break;case"addCamera":N.dispatchEvent({type:L.ADD_CAMERA,value:e.data});break;case"removeCamera":N.dispatchEvent({type:L.REMOVE_CAMERA,value:e.data});break}}}class Rn 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 hn.Pane({title:"GUI"}),this.pane.registerPlugin(vn)}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,i=void 0){const s=this.bindID,h=e.onChange!==void 0?e.onChange:jt;this.bindCBs.set(s,h),this.app.editor?(this.pane===void 0&&this.createGUI(),(i!==void 0?i:this.pane).addBinding(n,a,e).on("change",f=>{this.app.send({event:"updateBind",target:"app",data:{id:s,value:f.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",target:"app",data:{id:s,name:a,params:e,parent:i}}),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 i=this.bindID;this.buttonCBs.set(i,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:i}})}),this.editorCallbacks++):(this.app.send({event:"addButton",target:"app",data:{id:i,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,a,e){const i=a;switch(e.event){case"addFolder":i.addFolder(e.data.name,e.data.params,e.data.parent);break;case"bindObject":i.bind(e.data.name,e.data.params,e.data.parent);break;case"updateBind":i.triggerBind(e.data.id,e.data.value);break;case"addButton":i.button(e.data.name,e.data.callback,e.data.parent);break;case"clickButton":i.triggerButton(e.data.id);break}}}var Pt={exports:{}},nt={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("three"),fn=require("tweakpane"),pn=require("@tweakpane/plugin-essentials"),S=require("react"),qt=require("framer-motion");function mn(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 vn=mn(pn),jt=()=>{},gn=()=>{};function st(t){return t.substring(0,1).toUpperCase()+t.substring(1)}function Fe(t,n,a){return Math.min(n,Math.max(t,a))}function _t(t,n,a){return(a-t)/(n-t)}function Rt(t,n,a){return t*(1-a)+n*a}function bn(t,n){const a=t-n;return Math.sqrt(a*a)}function Kt(){return Math.round(Math.random()*1e6).toString()}function Xt(t){return t.r!==void 0&&t.g!==void 0&&t.b!==void 0}function Zt(t){const n=Math.round(t.r*255),a=Math.round(t.g*255),e=Math.round(t.b*255),i=u=>{const h=u.toString(16);return h.length===1?"0"+h:h},c=i(n),f=i(a),s=i(e);return"#"+c+f+s}function Je(t,n=1){return Number(t.toFixed(n))}exports.totalThreeObjects=0;const Jt=()=>{exports.totalThreeObjects=0},kt=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=>{kt(a)})},yn=t=>{t?.dispose()},Qt=t=>{t&&(Array.isArray(t)?t.forEach(n=>n.dispose()):t.dispose())},Dt=t=>{if(t){for(;t.children.length>0;){const n=t.children[0];n.type==="Audio"?(n.pause(),n.parent&&n.parent.remove(n)):Dt(n)}if(t.parent&&t.parent.remove(t),t.isMesh){const n=t;n.geometry?.dispose(),Qt(n.material)}t.dispose!==void 0&&t.dispose()}};class En{components=new Map;listen;_appID="";_debugEnabled;_broadcastChannel=void 0;_webSocket=void 0;_mode="app";_connected=!1;_useBC=!1;constructor(n,a,e=!0){this._appID=n,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){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 appID(){return this._appID}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 I=new d.EventDispatcher,N={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{app;constructor(n){this.app=n}dispose(){}handleApp(n,a,e){}handleEditor(n,a,e){}}class Sn 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}})}handleApp(n,a,e){switch(e.event){case"selectComponent":I.dispatchEvent({type:N.SELECT_DROPDOWN,value:e.data});break;case"draggableListUpdate":I.dispatchEvent({type:N.DRAG_UPDATE,value:e.data});break}}}class bt extends ct{project;sheets=new Map;sheetObjects=new Map;sheetObjectCBs=new Map;sheetObjectUnsubscribe=new Map;activeSheet;studio=void 0;static rafDriver=void 0;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,i){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 f=`${n}_${a}`;let s=this.sheetObjects.get(f);s!==void 0?s=c.object(a,{...e,...s.value},{reconfigure:!0}):s=c.object(a,e),this.sheetObjects.set(f,s),this.sheetObjectCBs.set(f,i!==void 0?i:jt);const u=s.onValuesChange(h=>{if(this.app.editor){for(const y in h){const C=h[y];typeof C=="object"&&Xt(C)&&(h[y]={r:C.r,g:C.g,b:C.b,a:C.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:n,sheetObject:f,values:h}})}const p=this.sheetObjectCBs.get(f);p!==void 0&&p(h)});return this.sheetObjectUnsubscribe.set(f,u),s}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}`,f=this.sheetObjectUnsubscribe.get(c);f!==void 0&&(this.sheetObjects.delete(c),this.sheetObjectCBs.delete(c),this.sheetObjectUnsubscribe.delete(c),f())}handleApp(n,a,e){const i=a;let c;switch(e.event){case"setSheet":c=i.sheets.get(e.data.sheet),c!==void 0&&(i.activeSheet=c,this.studio?.setSelection([c]));break;case"setSheetObject":c=i.sheetObjects.get(`${e.data.sheet}_${e.data.key}`),c!==void 0&&this.studio?.setSelection([c]);break;case"updateSheetObject":c=i.sheets.get(e.data.sheet),c!==void 0&&c.sequence.pause(),c=i.sheetObjectCBs.get(e.data.sheetObject),c!==void 0&&c(e.data.values);break;case"updateTimeline":c=i.sheets.get(e.data.sheet),i.activeSheet!==void 0&&(i.activeSheet.sequence.position=e.data.position);break}}handleEditor(n,a,e){if(n.editor){const i=a;switch(e.event){case"playSheet":i.sheet(e.data.sheet)?.sequence.play(e.data.value);break;case"pauseSheet":i.sheet(e.data.sheet)?.sequence.pause();break}}}handleEditorApp(n,a){if(n.editor){this.studio?.ui.restore(),this.studio?.onSelectionChange(f=>{f.length<1||f.forEach(s=>{let u=s.address.sheetId,h="setSheet",p={};switch(s.type){case"Theatre_Sheet_PublicAPI":h="setSheet",p={sheet:s.address.sheetId},a.activeSheet=a.sheets.get(s.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":h="setSheetObject",u+=`_${s.address.objectKey}`,p={id:u,sheet:s.address.sheetId,key:s.address.objectKey},a.activeSheet=a.sheets.get(s.address.sheetId);break}n.send({event:h,target:"app",data:p})})});let e=-1;const i=()=>{if(bt.rafDriver?.tick(performance.now()),a.activeSheet!==void 0&&e!==a.activeSheet.sequence.position){e=a.activeSheet.sequence.position;const f=a.activeSheet;n.send({event:"updateTimeline",target:"app",data:{position:e,sheet:f.address.sheetId}})}},c=()=>{i(),requestAnimationFrame(c)};i(),c()}else this.studio?.ui.hide()}}function Cn(t,n,a){if(t.editor){a.ui.restore(),a.onSelectionChange(f=>{f.length<1||f.forEach(s=>{let u=s.address.sheetId,h="setSheet",p={};switch(s.type){case"Theatre_Sheet_PublicAPI":h="setSheet",p={sheet:s.address.sheetId},n.activeSheet=n.sheets.get(s.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":h="setSheetObject",u+=`_${s.address.objectKey}`,p={id:u,sheet:s.address.sheetId,key:s.address.objectKey},n.activeSheet=n.sheets.get(s.address.sheetId);break}t.send({event:h,target:"app",data:p})})});let e=-1;const i=()=>{if(bt.rafDriver?.tick(performance.now()),n.activeSheet!==void 0&&e!==n.activeSheet.sequence.position){e=n.activeSheet.sequence.position;const f=n.activeSheet;t.send({event:"updateTimeline",target:"app",data:{position:e,sheet:f.address.sheetId}})}},c=()=>{i(),requestAnimationFrame(c)};i(),c()}else a.ui.hide()}function xn(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 en(t){const n={name:t.name,type:t.type,uuid:t.uuid,children:[]};return t.children.forEach(a=>{n.children.push(en(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 On(t){switch(t){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function Xe(t){const n={};for(const a in t){if(a.substring(0,1)==="_"||a.substring(0,2)==="is"||On(a))continue;const e=typeof t[a],i=t[a];switch(e){case"boolean":case"number":case"string":n[a]=i;break;case"object":if(i!==null)if(n[a]=i,i.isTexture)if(i instanceof d.Texture){const c=i.source.toJSON();n[a]={src:c.url}}else i instanceof d.CubeTexture&&(console.log("env map"),console.log(i.source.data),console.log(i.source.toJSON()),n[a]={src:""});else a==="uniforms"&&(n[a]=wn(n[a]));else n[a]={src:""};break}}return n}function Ot(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 i=[];e.material.forEach(c=>{i.push(Xe(c))}),n.material=i}else n.material=Xe(e.material)}else if(a.search("points")>-1){const e=t;if(Array.isArray(e.material)){const i=[];e.material.forEach(c=>{i.push(Xe(c))}),n.material=i}else n.material=Xe(e.material)}else if(a.search("line")>-1){const e=t;if(Array.isArray(e.material)){const i=[];e.material.forEach(c=>{i.push(Xe(c))}),n.material=i}else n.material=Xe(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 Mn(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 X(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 Pt(t){return new Promise((n,a)=>{const e=new Image;e.onload=()=>{const i=new d.Texture(e);i.wrapS=d.RepeatWrapping,i.wrapT=d.RepeatWrapping,i.needsUpdate=!0,n(i)},e.onerror=a,e.src=t})}class Tn extends ct{scene=void 0;renderer=void 0;getObject(n){this.app.debugEnabled&&this.app.send({event:"getObject",target:"app",data:n})}setObject(n){const a=Ot(n);this.app.send({event:"setObject",target:"editor",data:a})}requestMethod(n,a,e,i){this.app.send({event:"requestMethod",target:"app",data:{uuid:n,key:a,value:e,subitem:i}})}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;Jt(),kt(this.scene);const a=en(this.scene);this.app.send({event:"setScene",target:"editor",data:a})}addCamera(n){if(!this.app.debugEnabled)return;const a=Ot(n);this.app.send({event:"addCamera",target:"editor",data:a})}removeCamera(n){if(!this.app.debugEnabled)return;const a=Ot(n);this.app.send({event:"removeCamera",target:"editor",data:a})}handleApp(n,a,e){switch(e.event){case"getObject":I.dispatchEvent({type:N.GET_OBJECT,value:e.data});break;case"updateObject":I.dispatchEvent({type:N.UPDATE_OBJECT,value:e.data});break;case"createTexture":I.dispatchEvent({type:N.CREATE_TEXTURE,value:e.data});break;case"requestMethod":I.dispatchEvent({type:N.REQUEST_METHOD,value:e.data});break}}handleEditor(n,a,e){switch(e.event){case"setObject":I.dispatchEvent({type:N.SET_OBJECT,value:e.data});break;case"setScene":I.dispatchEvent({type:N.SET_SCENE,value:e.data});break;case"addCamera":I.dispatchEvent({type:N.ADD_CAMERA,value:e.data});break;case"removeCamera":I.dispatchEvent({type:N.REMOVE_CAMERA,value:e.data});break}}resize(n,a){this.renderer?.setSize(n,a)}set dpr(n){this.renderer?.setPixelRatio(Fe(1,2,n))}get dpr(){return this.renderer!==void 0?this.renderer?.getPixelRatio():1}get width(){return this.renderer!==void 0?this.renderer?.domElement.width/this.dpr:0}get height(){return this.renderer!==void 0?this.renderer?.domElement.height/this.dpr:0}get canvas(){return this.renderer!==void 0?this.renderer?.domElement:null}}class _n extends ct{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 fn.Pane({title:"GUI"}),this.pane.registerPlugin(vn)}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,i=void 0){const c=this.bindID,f=e.onChange!==void 0?e.onChange:jt;this.bindCBs.set(c,f),this.app.editor?(this.pane===void 0&&this.createGUI(),(i!==void 0?i:this.pane).addBinding(n,a,e).on("change",u=>{this.app.send({event:"updateBind",target:"app",data:{id:c,value:u.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",target:"app",data:{id:c,name:a,params:e,parent:i}}),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 i=this.bindID;this.buttonCBs.set(i,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:i}})}),this.editorCallbacks++):(this.app.send({event:"addButton",target:"app",data:{id:i,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,a,e){const i=a;switch(e.event){case"addFolder":i.addFolder(e.data.name,e.data.params,e.data.parent);break;case"bindObject":i.bind(e.data.name,e.data.params,e.data.parent);break;case"updateBind":i.triggerBind(e.data.id,e.data.value);break;case"addButton":i.button(e.data.name,e.data.callback,e.data.parent);break;case"clickButton":i.triggerButton(e.data.id);break}}}var At={exports:{}},at={};/**
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 Ut;function _n(){if(Ut)return nt;Ut=1;var t=x,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function h(c,f,d){var v,y={},S=null,C=null;d!==void 0&&(S=""+d),f.key!==void 0&&(S=""+f.key),f.ref!==void 0&&(C=f.ref);for(v in f)e.call(f,v)&&!s.hasOwnProperty(v)&&(y[v]=f[v]);if(c&&c.defaultProps)for(v in f=c.defaultProps,f)y[v]===void 0&&(y[v]=f[v]);return{$$typeof:n,type:c,key:S,ref:C,props:y,_owner:i.current}}return nt.Fragment=a,nt.jsx=h,nt.jsxs=h,nt}var at={};/**
9
+ */var Ut;function Rn(){if(Ut)return at;Ut=1;var t=S,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function f(s,u,h){var p,y={},C=null,x=null;h!==void 0&&(C=""+h),u.key!==void 0&&(C=""+u.key),u.ref!==void 0&&(x=u.ref);for(p in u)e.call(u,p)&&!c.hasOwnProperty(p)&&(y[p]=u[p]);if(s&&s.defaultProps)for(p in u=s.defaultProps,u)y[p]===void 0&&(y[p]=u[p]);return{$$typeof:n,type:s,key:C,ref:x,props:y,_owner:i.current}}return at.Fragment=a,at.jsx=f,at.jsxs=f,at}var it={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,20 +14,20 @@
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 Bt;function An(){return Bt||(Bt=1,process.env.NODE_ENV!=="production"&&function(){var t=x,n=Symbol.for("react.element"),a=Symbol.for("react.portal"),e=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),C=Symbol.for("react.offscreen"),A=Symbol.iterator,j="@@iterator";function H(r){if(r===null||typeof r!="object")return null;var p=A&&r[A]||r[j];return typeof p=="function"?p:null}var B=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(r){{for(var p=arguments.length,b=new Array(p>1?p-1:0),O=1;O<p;O++)b[O-1]=arguments[O];M("error",r,b)}}function M(r,p,b){{var O=B.ReactDebugCurrentFrame,F=O.getStackAddendum();F!==""&&(p+="%s",b=b.concat([F]));var V=b.map(function(I){return String(I)});V.unshift("Warning: "+p),Function.prototype.apply.call(console[r],console,V)}}var ae=!1,Z=!1,Y=!1,K=!1,w=!1,Me;Me=Symbol.for("react.module.reference");function Ie(r){return!!(typeof r=="string"||typeof r=="function"||r===e||r===s||w||r===i||r===d||r===v||K||r===C||ae||Z||Y||typeof r=="object"&&r!==null&&(r.$$typeof===S||r.$$typeof===y||r.$$typeof===h||r.$$typeof===c||r.$$typeof===f||r.$$typeof===Me||r.getModuleId!==void 0))}function Ce(r,p,b){var O=r.displayName;if(O)return O;var F=p.displayName||p.name||"";return F!==""?b+"("+F+")":b}function me(r){return r.displayName||"Context"}function ie(r){if(r==null)return null;if(typeof r.tag=="number"&&R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case e:return"Fragment";case a:return"Portal";case s:return"Profiler";case i:return"StrictMode";case d:return"Suspense";case v:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case c:var p=r;return me(p)+".Consumer";case h:var b=r;return me(b._context)+".Provider";case f:return Ce(r,r.render,"ForwardRef");case y:var O=r.displayName||null;return O!==null?O:ie(r.type)||"Memo";case S:{var F=r,V=F._payload,I=F._init;try{return ie(I(V))}catch{return null}}}return null}var fe=Object.assign,ve=0,ge,J,pe,Te,Re,he,m;function g(){}g.__reactDisabledLog=!0;function T(){{if(ve===0){ge=console.log,J=console.info,pe=console.warn,Te=console.error,Re=console.group,he=console.groupCollapsed,m=console.groupEnd;var r={configurable:!0,enumerable:!0,value:g,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}ve++}}function k(){{if(ve--,ve===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:fe({},r,{value:ge}),info:fe({},r,{value:J}),warn:fe({},r,{value:pe}),error:fe({},r,{value:Te}),group:fe({},r,{value:Re}),groupCollapsed:fe({},r,{value:he}),groupEnd:fe({},r,{value:m})})}ve<0&&R("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var $=B.ReactCurrentDispatcher,q;function oe(r,p,b){{if(q===void 0)try{throw Error()}catch(F){var O=F.stack.trim().match(/\n( *(at )?)/);q=O&&O[1]||""}return`
18
- `+q+r}}var G=!1,Q;{var se=typeof WeakMap=="function"?WeakMap:Map;Q=new se}function D(r,p){if(!r||G)return"";{var b=Q.get(r);if(b!==void 0)return b}var O;G=!0;var F=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var V;V=$.current,$.current=null,T();try{if(p){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(Oe){O=Oe}Reflect.construct(r,[],I)}else{try{I.call()}catch(Oe){O=Oe}r.call(I.prototype)}}else{try{throw Error()}catch(Oe){O=Oe}r()}}catch(Oe){if(Oe&&O&&typeof Oe.stack=="string"){for(var P=Oe.stack.split(`
19
- `),de=O.stack.split(`
20
- `),ee=P.length-1,ne=de.length-1;ee>=1&&ne>=0&&P[ee]!==de[ne];)ne--;for(;ee>=1&&ne>=0;ee--,ne--)if(P[ee]!==de[ne]){if(ee!==1||ne!==1)do if(ee--,ne--,ne<0||P[ee]!==de[ne]){var Ee=`
21
- `+P[ee].replace(" at new "," at ");return r.displayName&&Ee.includes("<anonymous>")&&(Ee=Ee.replace("<anonymous>",r.displayName)),typeof r=="function"&&Q.set(r,Ee),Ee}while(ee>=1&&ne>=0);break}}}finally{G=!1,$.current=V,k(),Error.prepareStackTrace=F}var We=r?r.displayName||r.name:"",Ft=We?oe(We):"";return typeof r=="function"&&Q.set(r,Ft),Ft}function z(r,p,b){return D(r,!1)}function re(r){var p=r.prototype;return!!(p&&p.isReactComponent)}function xe(r,p,b){if(r==null)return"";if(typeof r=="function")return D(r,re(r));if(typeof r=="string")return oe(r);switch(r){case d:return oe("Suspense");case v:return oe("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case f:return z(r.render);case y:return xe(r.type,p,b);case S:{var O=r,F=O._payload,V=O._init;try{return xe(V(F),p,b)}catch{}}}return""}var we=Object.prototype.hasOwnProperty,st={},ct=B.ReactDebugCurrentFrame;function Ne(r){if(r){var p=r._owner,b=xe(r.type,r._source,p?p.type:null);ct.setExtraStackFrame(b)}else ct.setExtraStackFrame(null)}function Ze(r,p,b,O,F){{var V=Function.call.bind(we);for(var I in r)if(V(r,I)){var P=void 0;try{if(typeof r[I]!="function"){var de=Error((O||"React class")+": "+b+" type `"+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[I]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw de.name="Invariant Violation",de}P=r[I](p,I,O,b,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ee){P=ee}P&&!(P instanceof Error)&&(Ne(F),R("%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).",O||"React class",b,I,typeof P),Ne(null)),P instanceof Error&&!(P.message in st)&&(st[P.message]=!0,Ne(F),R("Failed %s type: %s",b,P.message),Ne(null))}}}var Le=Array.isArray;function Je(r){return Le(r)}function Et(r){{var p=typeof Symbol=="function"&&Symbol.toStringTag,b=p&&r[Symbol.toStringTag]||r.constructor.name||"Object";return b}}function lt(r){try{return ut(r),!1}catch{return!0}}function ut(r){return""+r}function dt(r){if(lt(r))return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Et(r)),ut(r)}var _e=B.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},et,ft,He;He={};function xt(r){if(we.call(r,"ref")){var p=Object.getOwnPropertyDescriptor(r,"ref").get;if(p&&p.isReactWarning)return!1}return r.ref!==void 0}function St(r){if(we.call(r,"key")){var p=Object.getOwnPropertyDescriptor(r,"key").get;if(p&&p.isReactWarning)return!1}return r.key!==void 0}function ht(r,p){if(typeof r.ref=="string"&&_e.current&&p&&_e.current.stateNode!==p){var b=ie(_e.current.type);He[b]||(R('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',ie(_e.current.type),r.ref),He[b]=!0)}}function Ae(r,p){{var b=function(){et||(et=!0,R("%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)",p))};b.isReactWarning=!0,Object.defineProperty(r,"key",{get:b,configurable:!0})}}function Lt(r,p){{var b=function(){ft||(ft=!0,R("%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)",p))};b.isReactWarning=!0,Object.defineProperty(r,"ref",{get:b,configurable:!0})}}var o=function(r,p,b,O,F,V,I){var P={$$typeof:n,type:r,key:p,ref:b,props:I,_owner:V};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:O}),Object.defineProperty(P,"_source",{configurable:!1,enumerable:!1,writable:!1,value:F}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P};function E(r,p,b,O,F){{var V,I={},P=null,de=null;b!==void 0&&(dt(b),P=""+b),St(p)&&(dt(p.key),P=""+p.key),xt(p)&&(de=p.ref,ht(p,F));for(V in p)we.call(p,V)&&!Qe.hasOwnProperty(V)&&(I[V]=p[V]);if(r&&r.defaultProps){var ee=r.defaultProps;for(V in ee)I[V]===void 0&&(I[V]=ee[V])}if(P||de){var ne=typeof r=="function"?r.displayName||r.name||"Unknown":r;P&&Ae(I,ne),de&&Lt(I,ne)}return o(r,P,de,F,O,_e.current,I)}}var _=B.ReactCurrentOwner,U=B.ReactDebugCurrentFrame;function X(r){if(r){var p=r._owner,b=xe(r.type,r._source,p?p.type:null);U.setExtraStackFrame(b)}else U.setExtraStackFrame(null)}var be;be=!1;function ue(r){return typeof r=="object"&&r!==null&&r.$$typeof===n}function Ct(){{if(_.current){var r=ie(_.current.type);if(r)return`
17
+ */var Bt;function Pn(){return Bt||(Bt=1,process.env.NODE_ENV!=="production"&&function(){var t=S,n=Symbol.for("react.element"),a=Symbol.for("react.portal"),e=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),s=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),_=Symbol.iterator,j="@@iterator";function H(r){if(r===null||typeof r!="object")return null;var v=_&&r[_]||r[j];return typeof v=="function"?v:null}var $=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function L(r){{for(var v=arguments.length,b=new Array(v>1?v-1:0),M=1;M<v;M++)b[M-1]=arguments[M];T("error",r,b)}}function T(r,v,b){{var M=$.ReactDebugCurrentFrame,F=M.getStackAddendum();F!==""&&(v+="%s",b=b.concat([F]));var V=b.map(function(D){return String(D)});V.unshift("Warning: "+v),Function.prototype.apply.call(console[r],console,V)}}var re=!1,ee=!1,ye=!1,W=!1,te=!1,pe;pe=Symbol.for("react.module.reference");function Ue(r){return!!(typeof r=="string"||typeof r=="function"||r===e||r===c||te||r===i||r===h||r===p||W||r===x||re||ee||ye||typeof r=="object"&&r!==null&&(r.$$typeof===C||r.$$typeof===y||r.$$typeof===f||r.$$typeof===s||r.$$typeof===u||r.$$typeof===pe||r.getModuleId!==void 0))}function xe(r,v,b){var M=r.displayName;if(M)return M;var F=v.displayName||v.name||"";return F!==""?b+"("+F+")":b}function z(r){return r.displayName||"Context"}function le(r){if(r==null)return null;if(typeof r.tag=="number"&&L("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case e:return"Fragment";case a:return"Portal";case c:return"Profiler";case i:return"StrictMode";case h:return"Suspense";case p:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case s:var v=r;return z(v)+".Consumer";case f:var b=r;return z(b._context)+".Provider";case u:return xe(r,r.render,"ForwardRef");case y:var M=r.displayName||null;return M!==null?M:le(r.type)||"Memo";case C:{var F=r,V=F._payload,D=F._init;try{return le(D(V))}catch{return null}}}return null}var O=Object.assign,we=0,me,Oe,Re,Me,Te,Pe,Be;function ne(){}ne.__reactDisabledLog=!0;function Ee(){{if(we===0){me=console.log,Oe=console.info,Re=console.warn,Me=console.error,Te=console.group,Pe=console.groupCollapsed,Be=console.groupEnd;var r={configurable:!0,enumerable:!0,value:ne,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}we++}}function Qe(){{if(we--,we===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:O({},r,{value:me}),info:O({},r,{value:Oe}),warn:O({},r,{value:Re}),error:O({},r,{value:Me}),group:O({},r,{value:Te}),groupCollapsed:O({},r,{value:Pe}),groupEnd:O({},r,{value:Be})})}we<0&&L("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ve=$.ReactCurrentDispatcher,fe;function m(r,v,b){{if(fe===void 0)try{throw Error()}catch(F){var M=F.stack.trim().match(/\n( *(at )?)/);fe=M&&M[1]||""}return`
18
+ `+fe+r}}var g=!1,w;{var P=typeof WeakMap=="function"?WeakMap:Map;w=new P}function q(r,v){if(!r||g)return"";{var b=w.get(r);if(b!==void 0)return b}var M;g=!0;var F=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var V;V=Ve.current,Ve.current=null,Ee();try{if(v){var D=function(){throw Error()};if(Object.defineProperty(D.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(D,[])}catch(Ae){M=Ae}Reflect.construct(r,[],D)}else{try{D.call()}catch(Ae){M=Ae}r.call(D.prototype)}}else{try{throw Error()}catch(Ae){M=Ae}r()}}catch(Ae){if(Ae&&M&&typeof Ae.stack=="string"){for(var A=Ae.stack.split(`
19
+ `),he=M.stack.split(`
20
+ `),Q=A.length-1,ae=he.length-1;Q>=1&&ae>=0&&A[Q]!==he[ae];)ae--;for(;Q>=1&&ae>=0;Q--,ae--)if(A[Q]!==he[ae]){if(Q!==1||ae!==1)do if(Q--,ae--,ae<0||A[Q]!==he[ae]){var be=`
21
+ `+A[Q].replace(" at new "," at ");return r.displayName&&be.includes("<anonymous>")&&(be=be.replace("<anonymous>",r.displayName)),typeof r=="function"&&w.set(r,be),be}while(Q>=1&&ae>=0);break}}}finally{g=!1,Ve.current=V,Qe(),Error.prepareStackTrace=F}var Ke=r?r.displayName||r.name:"",Ft=Ke?m(Ke):"";return typeof r=="function"&&w.set(r,Ft),Ft}function Z(r,v,b){return q(r,!1)}function de(r){var v=r.prototype;return!!(v&&v.isReactComponent)}function Y(r,v,b){if(r==null)return"";if(typeof r=="function")return q(r,de(r));if(typeof r=="string")return m(r);switch(r){case h:return m("Suspense");case p:return m("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case u:return Z(r.render);case y:return Y(r.type,v,b);case C:{var M=r,F=M._payload,V=M._init;try{return Y(V(F),v,b)}catch{}}}return""}var J=Object.prototype.hasOwnProperty,oe={},k=$.ReactDebugCurrentFrame;function U(r){if(r){var v=r._owner,b=Y(r.type,r._source,v?v.type:null);k.setExtraStackFrame(b)}else k.setExtraStackFrame(null)}function ie(r,v,b,M,F){{var V=Function.call.bind(J);for(var D in r)if(V(r,D)){var A=void 0;try{if(typeof r[D]!="function"){var he=Error((M||"React class")+": "+b+" type `"+D+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[D]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw he.name="Invariant Violation",he}A=r[D](v,D,M,b,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Q){A=Q}A&&!(A instanceof Error)&&(U(F),L("%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,D,typeof A),U(null)),A instanceof Error&&!(A.message in oe)&&(oe[A.message]=!0,U(F),L("Failed %s type: %s",b,A.message),U(null))}}}var Se=Array.isArray;function je(r){return Se(r)}function Et(r){{var v=typeof Symbol=="function"&&Symbol.toStringTag,b=v&&r[Symbol.toStringTag]||r.constructor.name||"Object";return b}}function lt(r){try{return ut(r),!1}catch{return!0}}function ut(r){return""+r}function dt(r){if(lt(r))return L("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Et(r)),ut(r)}var ke=$.ReactCurrentOwner,et={key:!0,ref:!0,__self:!0,__source:!0},tt,ht,qe;qe={};function St(r){if(J.call(r,"ref")){var v=Object.getOwnPropertyDescriptor(r,"ref").get;if(v&&v.isReactWarning)return!1}return r.ref!==void 0}function Ct(r){if(J.call(r,"key")){var v=Object.getOwnPropertyDescriptor(r,"key").get;if(v&&v.isReactWarning)return!1}return r.key!==void 0}function ft(r,v){if(typeof r.ref=="string"&&ke.current&&v&&ke.current.stateNode!==v){var b=le(ke.current.type);qe[b]||(L('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',le(ke.current.type),r.ref),qe[b]=!0)}}function De(r,v){{var b=function(){tt||(tt=!0,L("%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)",v))};b.isReactWarning=!0,Object.defineProperty(r,"key",{get:b,configurable:!0})}}function Lt(r,v){{var b=function(){ht||(ht=!0,L("%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)",v))};b.isReactWarning=!0,Object.defineProperty(r,"ref",{get:b,configurable:!0})}}var o=function(r,v,b,M,F,V,D){var A={$$typeof:n,type:r,key:v,ref:b,props:D,_owner:V};return A._store={},Object.defineProperty(A._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(A,"_self",{configurable:!1,enumerable:!1,writable:!1,value:M}),Object.defineProperty(A,"_source",{configurable:!1,enumerable:!1,writable:!1,value:F}),Object.freeze&&(Object.freeze(A.props),Object.freeze(A)),A};function E(r,v,b,M,F){{var V,D={},A=null,he=null;b!==void 0&&(dt(b),A=""+b),Ct(v)&&(dt(v.key),A=""+v.key),St(v)&&(he=v.ref,ft(v,F));for(V in v)J.call(v,V)&&!et.hasOwnProperty(V)&&(D[V]=v[V]);if(r&&r.defaultProps){var Q=r.defaultProps;for(V in Q)D[V]===void 0&&(D[V]=Q[V])}if(A||he){var ae=typeof r=="function"?r.displayName||r.name||"Unknown":r;A&&De(D,ae),he&&Lt(D,ae)}return o(r,A,he,F,M,ke.current,D)}}var R=$.ReactCurrentOwner,B=$.ReactDebugCurrentFrame;function K(r){if(r){var v=r._owner,b=Y(r.type,r._source,v?v.type:null);B.setExtraStackFrame(b)}else B.setExtraStackFrame(null)}var ve;ve=!1;function ue(r){return typeof r=="object"&&r!==null&&r.$$typeof===n}function xt(){{if(R.current){var r=le(R.current.type);if(r)return`
22
22
 
23
- Check the render method of \``+r+"`."}return""}}function wt(r){{if(r!==void 0){var p=r.fileName.replace(/^.*[\\\/]/,""),b=r.lineNumber;return`
23
+ Check the render method of \``+r+"`."}return""}}function wt(r){{if(r!==void 0){var v=r.fileName.replace(/^.*[\\\/]/,""),b=r.lineNumber;return`
24
24
 
25
- Check your code at `+p+":"+b+"."}return""}}var tt={};function Se(r){{var p=Ct();if(!p){var b=typeof r=="string"?r:r.displayName||r.name;b&&(p=`
25
+ Check your code at `+v+":"+b+"."}return""}}var nt={};function Ce(r){{var v=xt();if(!v){var b=typeof r=="string"?r:r.displayName||r.name;b&&(v=`
26
26
 
27
- Check the top-level render call using <`+b+">.")}return p}}function ye(r,p){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var b=Se(p);if(tt[b])return;tt[b]=!0;var O="";r&&r._owner&&r._owner!==_.current&&(O=" It was passed a child from "+ie(r._owner.type)+"."),X(r),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',b,O),X(null)}}function Fe(r,p){{if(typeof r!="object")return;if(Je(r))for(var b=0;b<r.length;b++){var O=r[b];ue(O)&&ye(O,p)}else if(ue(r))r._store&&(r._store.validated=!0);else if(r){var F=H(r);if(typeof F=="function"&&F!==r.entries)for(var V=F.call(r),I;!(I=V.next()).done;)ue(I.value)&&ye(I.value,p)}}}function Ue(r){{var p=r.type;if(p==null||typeof p=="string")return;var b;if(typeof p=="function")b=p.propTypes;else if(typeof p=="object"&&(p.$$typeof===f||p.$$typeof===y))b=p.propTypes;else return;if(b){var O=ie(p);Ze(b,r.props,"prop",O,r)}else if(p.PropTypes!==void 0&&!be){be=!0;var F=ie(p);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",F||"Unknown")}typeof p.getDefaultProps=="function"&&!p.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Be(r){{for(var p=Object.keys(r.props),b=0;b<p.length;b++){var O=p[b];if(O!=="children"&&O!=="key"){X(r),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",O),X(null);break}}r.ref!==null&&(X(r),R("Invalid attribute `ref` supplied to `React.Fragment`."),X(null))}}function Ve(r,p,b,O,F,V){{var I=Ie(r);if(!I){var P="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).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 de=wt(F);de?P+=de:P+=Ct();var ee;r===null?ee="null":Je(r)?ee="array":r!==void 0&&r.$$typeof===n?(ee="<"+(ie(r.type)||"Unknown")+" />",P=" Did you accidentally export a JSX literal instead of a component?"):ee=typeof r,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ee,P)}var ne=E(r,p,b,F,V);if(ne==null)return ne;if(I){var Ee=p.children;if(Ee!==void 0)if(O)if(Je(Ee)){for(var We=0;We<Ee.length;We++)Fe(Ee[We],r);Object.freeze&&Object.freeze(Ee)}else R("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 Fe(Ee,r)}return r===e?Be(ne):Ue(ne),ne}}function ln(r,p,b){return Ve(r,p,b,!0)}function un(r,p,b){return Ve(r,p,b,!1)}var dn=un,fn=ln;at.Fragment=e,at.jsx=dn,at.jsxs=fn}()),at}process.env.NODE_ENV==="production"?Pt.exports=_n():Pt.exports=An();var l=Pt.exports;function It(t){return t.title.search("<")>-1?l.jsx("button",{className:"svg",dangerouslySetInnerHTML:{__html:t.title}}):l.jsx("button",{children:t.title})}const Pn=l.jsxs("svg",{className:"closeIcon",width:"14",height:"14",fill:"none",stroke:"#666666",strokeMiterlimit:"10",children:[l.jsx("circle",{cx:"7",cy:"7",r:"6"}),l.jsx("line",{x1:"4",y1:"4",x2:"10",y2:"10"}),l.jsx("line",{x1:"4",y1:"10",x2:"10",y2:"4"})]}),jn=l.jsx("svg",{className:"dragIcon",width:"14",height:"14",fill:"#666666",stroke:"none",children:l.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 v}}function ge(r,v){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var b=Ce(v);if(nt[b])return;nt[b]=!0;var M="";r&&r._owner&&r._owner!==R.current&&(M=" It was passed a child from "+le(r._owner.type)+"."),K(r),L('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),K(null)}}function $e(r,v){{if(typeof r!="object")return;if(je(r))for(var b=0;b<r.length;b++){var M=r[b];ue(M)&&ge(M,v)}else if(ue(r))r._store&&(r._store.validated=!0);else if(r){var F=H(r);if(typeof F=="function"&&F!==r.entries)for(var V=F.call(r),D;!(D=V.next()).done;)ue(D.value)&&ge(D.value,v)}}}function ze(r){{var v=r.type;if(v==null||typeof v=="string")return;var b;if(typeof v=="function")b=v.propTypes;else if(typeof v=="object"&&(v.$$typeof===u||v.$$typeof===y))b=v.propTypes;else return;if(b){var M=le(v);ie(b,r.props,"prop",M,r)}else if(v.PropTypes!==void 0&&!ve){ve=!0;var F=le(v);L("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",F||"Unknown")}typeof v.getDefaultProps=="function"&&!v.getDefaultProps.isReactClassApproved&&L("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ye(r){{for(var v=Object.keys(r.props),b=0;b<v.length;b++){var M=v[b];if(M!=="children"&&M!=="key"){K(r),L("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",M),K(null);break}}r.ref!==null&&(K(r),L("Invalid attribute `ref` supplied to `React.Fragment`."),K(null))}}function Ge(r,v,b,M,F,V){{var D=Ue(r);if(!D){var A="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(A+=" 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 he=wt(F);he?A+=he:A+=xt();var Q;r===null?Q="null":je(r)?Q="array":r!==void 0&&r.$$typeof===n?(Q="<"+(le(r.type)||"Unknown")+" />",A=" Did you accidentally export a JSX literal instead of a component?"):Q=typeof r,L("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Q,A)}var ae=E(r,v,b,F,V);if(ae==null)return ae;if(D){var be=v.children;if(be!==void 0)if(M)if(je(be)){for(var Ke=0;Ke<be.length;Ke++)$e(be[Ke],r);Object.freeze&&Object.freeze(be)}else L("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 $e(be,r)}return r===e?Ye(ae):ze(ae),ae}}function ln(r,v,b){return Ge(r,v,b,!0)}function un(r,v,b){return Ge(r,v,b,!1)}var dn=un,hn=ln;it.Fragment=e,it.jsx=dn,it.jsxs=hn}()),it}process.env.NODE_ENV==="production"?At.exports=Rn():At.exports=Pn();var l=At.exports;function It(t){return t.title.search("<")>-1?l.jsx("button",{className:"svg",dangerouslySetInnerHTML:{__html:t.title}}):l.jsx("button",{children:t.title})}const An=l.jsxs("svg",{className:"closeIcon",width:"14",height:"14",fill:"none",stroke:"#666666",strokeMiterlimit:"10",children:[l.jsx("circle",{cx:"7",cy:"7",r:"6"}),l.jsx("line",{x1:"4",y1:"4",x2:"10",y2:"10"}),l.jsx("line",{x1:"4",y1:"10",x2:"10",y2:"4"})]}),jn=l.jsx("svg",{className:"dragIcon",width:"14",height:"14",fill:"#666666",stroke:"none",children:l.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 tn(t){return l.jsx(qt.Reorder.Item,{value:t.title,children:l.jsxs("div",{children:[jn,l.jsx("span",{children:t.title}),l.jsx("button",{className:"closeIcon",onClick:()=>{t.onDelete(t.index)},children:Pn})]})},t.title)}function nn(t){const[n,a]=x.useState(!1),[e,i]=x.useState(t.options),s=d=>{t.onDragComplete(d),i(d)},h=d=>{const v=[...e];v.splice(d,1),s(v)},c=[];e.forEach((d,v)=>{c.push(l.jsx(tn,{index:v,title:d,onDelete:h},d))});let f="dropdown draggable";return t.subdropdown&&(f+=" subdropdown"),l.jsxs("div",{className:f,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(It,{title:t.title}),l.jsx(qt.Reorder.Group,{axis:"y",values:e,onReorder:s,style:{visibility:n?"visible":"hidden"},children:c})]})}function an(t){const[n,a]=x.useState(!1),e=[];t.options.map((s,h)=>{t.onSelect!==void 0&&(s.onSelect=t.onSelect),e.push(l.jsx(rn,{option:s},h))});let i="dropdown";return t.subdropdown&&(i+=" subdropdown"),l.jsxs("div",{className:i,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(It,{title:t.title}),l.jsx("ul",{style:{visibility:n?"visible":"hidden"},children:e})]})}function rn(t){const{option:n}=t,[a,e]=x.useState("");let i;switch(n.type){case"draggable":i=l.jsx(nn,{title:n.title,options:n.value,onDragComplete:s=>{n.onDragComplete!==void 0&&n.onDragComplete(s)},subdropdown:!0});break;case"dropdown":i=l.jsx(an,{title:n.title,options:n.value,onSelect:n.onSelect,subdropdown:!0});break;case"option":i=l.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 l.jsx("li",{className:a===n.title?"selected":"",children:i},Kt())}function kn(t,n,a){function e(s){switch(n.forEach(h=>{h.callback(t,h.remote,s)}),s.event){case"custom":N.dispatchEvent({type:L.CUSTOM,value:s.data});break}}function i(s){switch(a.forEach(h=>{h.callback(t,h.remote,s)}),s.event){case"custom":N.dispatchEvent({type:L.CUSTOM,value:s.data});break}}t.listen=s=>{s.target==="editor"?i(s):e(s)}}function yt(t){const[n,a]=x.useState(t.open!==void 0?t.open:!0),e=!n||t.children===void 0;return l.jsxs("div",{className:`accordion ${e?"hide":""}`,children:[l.jsxs("button",{className:"toggle",onClick:()=>{const i=!n;t.onToggle!==void 0&&t.onToggle(i),a(i)},children:[l.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),l.jsx("p",{className:"label",children:Xe(t.label)})]}),t.button,l.jsx("div",{className:n?"open":"",children:l.jsx("div",{children:t.children})})]})}function Nt(t){const[n,a]=x.useState(!1),e=t.child!==void 0&&t.child.children.length>0,i=[];return t.child!==void 0&&t.child.children.length>0&&t.child.children.map(s=>{i.push(l.jsx(Nt,{child:s,three:t.three},Math.random()))}),l.jsx(l.Fragment,{children:t.child!==void 0&&l.jsxs("div",{className:"childObject",children:[l.jsxs("div",{className:"child",children:[e?l.jsx("button",{className:"status",style:{backgroundPositionX:n?"-14px":"2px"},onClick:()=>{a(!n)}}):null,l.jsx("button",{className:"name",style:{left:e?"20px":"5px"},onClick:()=>{t.child!==void 0&&(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}`}),l.jsx("div",{className:`icon ${Cn(t.child)}`})]}),l.jsx("div",{className:n?"open":"",children:l.jsx("div",{className:"container",children:i})})]},Math.random())})}function on(t){const n=[];return t.child?.children.map(a=>{n.push(l.jsx(Nt,{child:a,three:t.three},Math.random()))}),l.jsx("div",{className:`scene ${t.class!==void 0?t.class:""}`,children:n})}const Dn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";function In(t){return"items"in t}function Ge(t){const n=[];return t.items.forEach(a=>{In(a)?n.push(l.jsx(Ge,{title:Xe(a.title),items:a.items},Math.random())):n.push(l.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,i)=>{a.onChange!==void 0&&a.onChange(e,i)}},Math.random()))}),l.jsx(yt,{label:t.title,open:t.expanded===!0,children:n})}function Nn(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 Pe(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 Ln(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 Fn(){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],i=new FileReader;i.onload=function(s){n(s.target.result)},i.readAsDataURL(e)}}),t.click()})}const Un=[{title:"Front",value:u.FrontSide},{title:"Back",value:u.BackSide},{title:"Double",value:u.DoubleSide}],Bn=[{title:"No Blending",value:u.NoBlending},{title:"Normal",value:u.NormalBlending},{title:"Additive",value:u.AdditiveBlending},{title:"Subtractive",value:u.SubtractiveBlending},{title:"Multiply",value:u.MultiplyBlending},{title:"Custom",value:u.CustomBlending}],Vn=[{title:"Add",value:u.AddEquation},{title:"Subtract",value:u.SubtractEquation},{title:"Reverse Subtract",value:u.ReverseSubtractEquation},{title:"Min",value:u.MinEquation},{title:"Max",value:u.MaxEquation}],zn=[{title:"Zero",valye:u.ZeroFactor},{title:"One",valye:u.OneFactor},{title:"Src Color",valye:u.SrcColorFactor},{title:"One Minus Src Color",valye:u.OneMinusSrcColorFactor},{title:"Src Alpha",valye:u.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:u.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:u.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:u.OneMinusDstAlphaFactor},{title:"Dst Color",valye:u.DstColorFactor},{title:"One Minus Dst Color",valye:u.OneMinusDstColorFactor},{title:"Src Alpha Saturate",valye:u.SrcAlphaSaturateFactor},{title:"Constant Color",valye:u.ConstantColorFactor},{title:"One Minus Constant Color",valye:u.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:u.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:u.OneMinusConstantAlphaFactor}],Yn=[{title:"Zero",valye:u.ZeroFactor},{title:"One",valye:u.OneFactor},{title:"Src Color",valye:u.SrcColorFactor},{title:"One Minus Src Color",valye:u.OneMinusSrcColorFactor},{title:"Src Alpha",valye:u.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:u.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:u.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:u.OneMinusDstAlphaFactor},{title:"Dst Color",valye:u.DstColorFactor},{title:"One Minus Dst Color",valye:u.OneMinusDstColorFactor},{title:"Constant Color",valye:u.ConstantColorFactor},{title:"One Minus Constant Color",valye:u.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:u.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:u.OneMinusConstantAlphaFactor}];function it(t,n){t.needsUpdate=!0,t.type="option",t.options=n}function Vt(t,n,a){const e=[];for(const i in t){if(!Nn(i))continue;const s=typeof t[i],h=t[i];if(s==="boolean"||s==="number"||s==="string"){const c={title:Pe(i),prop:i,type:s,value:h,min:void 0,max:void 0,needsUpdate:s==="boolean",onChange:(d,v)=>{a.updateObject(n.uuid,`material.${d}`,v),c.needsUpdate&&a.updateObject(n.uuid,"material.needsUpdate",!0);const y=a.scene?.getObjectByProperty("uuid",n.uuid);y!==void 0&&te(y,`material.${d}`,v)}};switch(i){case"blending":it(c,Bn);break;case"blendDst":it(c,Yn);break;case"blendEquation":it(c,Vn);break;case"blendSrc":it(c,zn);break;case"side":it(c,Un);break}Ln(i)&&(c.value=Number(h),c.type="range",c.min=0,c.max=1,c.step=.01);const f=s==="string"&&(i==="vertexShader"||i==="fragmentShader");f&&(c.disabled=!1,c.latest=c.value,c.onChange=(d,v)=>{c.latest=v}),e.push(c),f&&e.push({title:`${Xe(i)} - Update`,type:"button",onChange:()=>{a.updateObject(n.uuid,`material.${i}`,c.latest),a.updateObject(n.uuid,"material.needsUpdate",!0);const d=a.scene?.getObjectByProperty("uuid",n.uuid);d!==void 0&&(te(d,`material.${i}`,c.latest),d.material.needsUpdate=!0)}})}else if(s==="object")if(h.isColor)e.push({title:Pe(i),prop:i,type:"color",value:h,onChange:(c,f)=>{const d=new u.Color(f);a.updateObject(n.uuid,`material.${c}`,d);const v=a.scene?.getObjectByProperty("uuid",n.uuid);v!==void 0&&te(v,`material.${c}`,d)}});else if(Array.isArray(h)){const c=[];for(const f in h)c.push({title:`${f}`,type:`${typeof h[f]}`,value:h[f],onChange:(d,v)=>{a.updateObject(n.uuid,`material.${i}`,v);const y=a.scene?.getObjectByProperty("uuid",n.uuid);y!==void 0&&te(y,`material.${i}`,v)}});e.push({title:Pe(i),items:c})}else if(h.x!==void 0&&h.y!==void 0&&h.z===void 0)e.push({title:Pe(i),prop:i,type:"vector",value:h,onChange:(c,f)=>{a.updateObject(n.uuid,`material.${c}`,f);const d=a.scene?.getObjectByProperty("uuid",n.uuid);d!==void 0&&te(d,`material.${c}`,f)}});else{const c=[];for(const f in h){const d=h[f];switch(typeof d){case"boolean":case"number":case"string":f==="src"?e.push({title:Pe(i),type:"image",value:d,onChange:(y,S)=>{a.createTexture(n.uuid,`material.${i}`,S);const C=a.scene?.getObjectByProperty("uuid",n.uuid);C!==void 0&&At(S).then(A=>{te(C,`material.${i}`,A),te(C,"material.needsUpdate",!0)})}}):c.push({title:`${Pe(f)}`,prop:`material.${i}.${f}`,type:`${typeof t[i][f]}`,value:h[f],onChange:(y,S)=>{a.updateObject(n.uuid,`material.${i}.${f}`,S);const C=a.scene?.getObjectByProperty("uuid",n.uuid);C!==void 0&&te(C,`material.${i}.${f}`,S)}});break;case"object":if(d.value!==void 0&&d.value.src!==void 0)c.push({title:Pe(f),type:"image",value:d.value.src,onChange:(y,S)=>{a.createTexture(n.uuid,`material.${i}.${f}.value`,h);const C=a.scene?.getObjectByProperty("uuid",n.uuid);C!==void 0&&At(S).then(A=>{te(C,`material.${i}.${f}.value`,A)})}});else if(i==="uniforms"){const y=d.value,S=(C,A,j)=>({title:C,type:"number",value:j,step:.01,onChange:(H,B)=>{const R=`material.uniforms.${f}.value.${A}`;a.updateObject(n.uuid,R,B);const M=a.scene?.getObjectByProperty("uuid",n.uuid);M!==void 0&&te(M,R,B)}});if(typeof d.value=="number")c.push({title:f,type:"number",value:d.value,step:.01,onChange:(C,A)=>{const j=`material.${i}.${C}.value`;a.updateObject(n.uuid,j,A);const H=a.scene?.getObjectByProperty("uuid",n.uuid);H!==void 0&&te(H,j,A)}});else if(y.r!==void 0&&y.g!==void 0&&y.b!==void 0)c.push({title:f,type:"color",value:d.value,onChange:(C,A)=>{const j=new u.Color(A),H=`material.${i}.${C}.value`;a.updateObject(n.uuid,H,j);const B=a.scene?.getObjectByProperty("uuid",n.uuid);B!==void 0&&te(B,H,j)}});else if(y.x!==void 0&&y.y!==void 0&&y.z===void 0&&y.w===void 0)c.push({title:f,type:"vector",value:d.value,prop:`material.${i}.${f}.value`,onChange:(C,A)=>{a.updateObject(n.uuid,C,A);const j=a.scene?.getObjectByProperty("uuid",n.uuid);j!==void 0&&te(j,C,A)}});else if(y.x!==void 0&&y.y!==void 0&&y.z!==void 0&&y.w===void 0)c.push({title:f,items:[S("X","x",d.value.x),S("Y","y",d.value.y),S("Z","z",d.value.z)]});else if(y.x!==void 0&&y.y!==void 0&&y.z!==void 0&&y.w!==void 0)c.push({title:f,items:[S("X","x",d.value.x),S("Y","y",d.value.y),S("Z","z",d.value.z),S("W","w",d.value.w)]});else if(y.elements!==void 0){const C=y.elements,A=[];for(let j=0;j<C.length;j++)A.push(S(j.toString(),j.toString(),C[j]));c.push({title:f,items:A})}else console.log(">>> need to add this format:",f,y)}else c.push({title:f,type:`${typeof d.value}`,value:d.value,onChange:(y,S)=>{a.updateObject(n.uuid,`material.${i}.${f}.value`,S);const C=a.scene?.getObjectByProperty("uuid",n.uuid);C!==void 0&&te(C,`material.${i}.${f}.value`,S)}});break}}c.length>0&&e.push({title:Pe(i),items:c})}else h!==void 0&&console.log("other:",i,s,h)}return e.sort((i,s)=>i.title<s.title?-1:i.title>s.title?1:0),e.push({title:"Update Material",type:"button",onChange:()=>{a.updateObject(n.uuid,"material.needsUpdate",!0)}}),e}function Gn(t,n){const a=t.material;if(Array.isArray(a)){const e=[],i=a.length;for(let s=0;s<i;s++)e.push(l.jsx(Ge,{title:`Material ${s}`,items:Vt(a[s],t,n)},`Material ${s}`));return l.jsx(l.Fragment,{children:e})}else return l.jsx(Ge,{title:"Material",items:Vt(a,t,n)})}function Hn(t){const n=x.useRef(null),a=x.useRef(null),e=x.useRef(null),i=x.useRef(null),s=x.useRef(null),h=x.useRef(null),[c,f]=x.useState(t.value),[d,v]=x.useState({min:t.min,max:t.max}),[y,S]=x.useState(!1);function C(){y||(window.addEventListener("mousemove",j),window.addEventListener("mouseup",A),window.addEventListener("mouseup",A),S(!0))}function A(){window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",A),S(!1)}function j(M){const ae=s.current.getBoundingClientRect(),Z=Ye(0,99,M.clientX-ae.left)/99,Y=Ye(0,99,M.clientY-ae.top)/99,K=Ke(_t(d.min,d.max,Z),3),w=Ke(_t(d.min,d.max,Y),3);t.onChange({target:{value:{x:K,y:w}}}),f({x:K,y:w})}function H(M){let ae=c.x,Z=c.y;M.target===n.current?ae=Number(M.target.value):Z=Number(M.target.value),f({x:ae,y:Z})}function B(){const M=Number(e.current.value);v({min:M,max:d.max}),(c.x<M||c.y<M)&&f({x:Ye(M,d.max,c.x),y:Ye(M,d.max,c.y)})}function R(){const M=Number(i.current.value);v({min:d.min,max:M}),(c.x>M||c.y>M)&&f({x:Ye(d.min,M,c.x),y:Ye(d.min,M,c.y)})}return x.useEffect(()=>{console.log(d.min,d.max,c.x,c.y);const M=Rt(d.min,d.max,c.x),ae=Rt(d.min,d.max,c.y);h.current.style.left=`${M*100}%`,h.current.style.top=`${ae*100}%`},[d,c]),l.jsxs("div",{className:"vector",children:[l.jsxs("div",{className:"fields",children:[l.jsxs("div",{children:[l.jsx("label",{children:"X:"}),l.jsx("input",{ref:n,type:"number",value:c.x,min:d.min,max:d.max,step:.01,onChange:H})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Y:"}),l.jsx("input",{ref:a,type:"number",value:c.y,min:d.min,max:d.max,step:.01,onChange:H})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Min:"}),l.jsx("input",{ref:e,type:"number",value:d.min,step:.01,onChange:B})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Max:"}),l.jsx("input",{ref:i,type:"number",value:d.max,step:.01,onChange:R})]})]}),l.jsxs("div",{className:"input",ref:s,onMouseDown:C,onMouseUp:A,children:[l.jsx("div",{className:"x"}),l.jsx("div",{className:"y"}),l.jsx("div",{className:"pt",ref:h})]})]})}function rt(t){let n=t.value;n!==void 0&&n.isColor!==void 0&&(n=Zt(t.value));const[a,e]=x.useState(n),i=x.useRef(null),s=x.useRef(null),h=x.useRef(null);x.useEffect(()=>{let v=!1,y=-1,S=0,C=Number(a);const A=M=>{v=!0,S=C,y=M.clientX},j=M=>{if(!v)return;const ae=t.step!==void 0?t.step:1,Z=(M.clientX-y)*ae;C=Number((S+Z).toFixed(4)),s.current!==null&&(s.current.value=C.toString()),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,C)},H=()=>{v=!1},B=()=>{v=!1},R=t.type==="number";return R&&(i.current?.addEventListener("mousedown",A,!1),document.addEventListener("mouseup",H,!1),document.addEventListener("mousemove",j,!1),document.addEventListener("contextmenu",B,!1)),()=>{R&&(i.current?.removeEventListener("mousedown",A),document.removeEventListener("mouseup",H),document.removeEventListener("mousemove",j),document.removeEventListener("contextmenu",B))}},[a]);const c=t.type==="string"&&(a.length>100||a.search(`
30
- `)>-1),f=c||t.type==="image"||t.type==="vector",d=v=>{let y=v.target.value;t.type==="boolean"?y=v.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 l.jsxs("div",{className:`field ${f?"block":""}`,children:[t.type!=="button"&&l.jsx("label",{ref:i,children:Xe(t.title)},"fieldLabel"),t.type==="string"&&!c&&l.jsx("input",{type:"text",disabled:t.disabled,onChange:d,value:a}),t.type==="string"&&c&&l.jsx("textarea",{cols:50,rows:10,disabled:t.disabled!==void 0?t.disabled:!0,onChange:d,value:a}),t.type==="boolean"&&l.jsx("input",{type:"checkbox",disabled:t.disabled,onChange:d,checked:a}),t.type==="number"&&l.jsx("input",{ref:s,type:"number",value:a,min:t.min,max:t.max,step:t.step,disabled:t.disabled,onChange:d}),t.type==="range"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:a.toString(),onChange:d,disabled:t.disabled,className:"min"}),l.jsx("input",{disabled:t.disabled,type:"range",value:a,min:t.min,max:t.max,step:t.step,onChange:d})]}),t.type==="color"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:a.toString(),onChange:d,disabled:t.disabled,className:"color"}),l.jsx("input",{type:"color",value:a,onChange:d,disabled:t.disabled})]}),t.type==="button"&&l.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"&&l.jsx("img",{ref:h,onClick:()=>{Fn().then(v=>{h.current.src=v,t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,v)})},src:a.length>0?a:Dn}),t.type==="option"&&l.jsx(l.Fragment,{children:l.jsx("select",{onChange:d,disabled:t.disabled,defaultValue:t.value,children:t.options?.map((v,y)=>l.jsx("option",{value:v.value,children:Xe(v.title)},y))})}),t.type==="vector"&&l.jsx(Hn,{value:a,min:-1,max:1,onChange:d})]})}function zt(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 Wn(t,n){const a=[];if(t.perspectiveCameraInfo!==void 0)for(const e in t.perspectiveCameraInfo)a.push({title:zt(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(i,s)=>{n.updateObject(t.uuid,i,s),n.requestMethod(t.uuid,"updateProjectionMatrix");const h=n.scene?.getObjectByProperty("uuid",t.uuid);h!==void 0&&(te(h,i,s),h.updateProjectionMatrix())}});else if(t.orthographicCameraInfo!==void 0)for(const e in t.orthographicCameraInfo)a.push({title:zt(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(i,s)=>{n.updateObject(t.uuid,i,s),n.requestMethod(t.uuid,"updateProjectionMatrix");const h=n.scene?.getObjectByProperty("uuid",t.uuid);h!==void 0&&(te(h,i,s),h.updateProjectionMatrix())}});return l.jsx(Ge,{title:"Camera",items:a})}const $n=Math.PI/180,qn=180/Math.PI;function qe(t,n,a,e,i){return e+(t-n)*(i-e)/(a-n)}function Kn(t){return t*$n}function Mt(t){return t*qn}function Xn(t,n){const a=new u.Matrix4;a.elements=t.matrix;const e=new u.Vector3,i=new u.Euler,s=new u.Vector3;t.uuid.length>0&&(e.setFromMatrixPosition(a),i.setFromRotationMatrix(a),s.setFromMatrixScale(a));const h=(f,d)=>{n.updateObject(t.uuid,f,d);const v=n.scene?.getObjectByProperty("uuid",t.uuid);v!==void 0&&te(v,f,d)},c=(f,d)=>{h(f,Kn(d))};return l.jsx(Ge,{title:"Transform",items:[{title:"Position X",prop:"position.x",type:"number",value:e.x,onChange:h},{title:"Position Y",prop:"position.y",type:"number",value:e.y,onChange:h},{title:"Position Z",prop:"position.z",type:"number",value:e.z,onChange:h},{title:"Rotation X",prop:"rotation.x",type:"number",value:Ke(Mt(i.x)),min:-360,max:360,step:.1,onChange:c},{title:"Rotation Y",prop:"rotation.y",type:"number",value:Ke(Mt(i.y)),min:-360,max:360,step:.1,onChange:c},{title:"Rotation Z",prop:"rotation.z",type:"number",value:Ke(Mt(i.z)),min:-360,max:360,step:.1,onChange:c},{title:"Scale X",prop:"scale.x",type:"number",value:s.x,step:.01,onChange:h},{title:"Scale Y",prop:"scale.y",type:"number",value:s.y,step:.01,onChange:h},{title:"Scale Z",prop:"scale.z",type:"number",value:s.z,step:.01,onChange:h}]})}function Yt(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 Zn(t,n){const a=[];if(t.lightInfo!==void 0)for(const e in t.lightInfo){const i=t.lightInfo[e];i!==void 0&&(i.isColor!==void 0?a.push({title:Yt(e),prop:e,type:"color",value:i,onChange:(s,h)=>{const c=new u.Color(h);n.updateObject(t.uuid,s,c);const f=n.scene?.getObjectByProperty("uuid",t.uuid);f!==void 0&&te(f,s,c)}}):a.push({title:Yt(e),prop:e,type:typeof i,value:i,step:typeof i=="number"?.01:void 0,onChange:(s,h)=>{n.updateObject(t.uuid,s,h);const c=n.scene?.getObjectByProperty("uuid",t.uuid);c!==void 0&&te(c,s,h)}}))}return l.jsx(Ge,{title:"Light",items:a})}function Jn(t,n){const a=[],e=[];let i=0;t.animations.forEach(c=>{i=Math.max(i,c.duration),c.duration>0&&e.push({title:c.name,items:[{title:"Duration",type:"number",value:c.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=n.scene?.getObjectByProperty("uuid",t.uuid);let h=!1;if(s!==void 0){const c=s.mixer;if(h=c!==void 0,h){const f=[{title:"Time Scale",type:"range",value:c.timeScale,step:.01,min:-1,max:2,onChange:(d,v)=>{c.timeScale=v,n.updateObject(t.uuid,"mixer.timeScale",v)}}];f.push({title:"Stop All",type:"button",onChange:()=>{c.stopAllAction(),n.requestMethod(t.uuid,"stopAllAction",void 0,"mixer")}}),a.push({title:"Mixer",items:f})}}return l.jsx(Ge,{title:"Animation",items:a})}const sn={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 ce={...sn};function cn(t){const[n,a]=x.useState(-1);x.useEffect(()=>{function h(f){ce={...f.value},a(Date.now())}function c(){ce={...sn},a(Date.now())}return N.addEventListener(L.SET_SCENE,c),N.addEventListener(L.SET_OBJECT,h),()=>{N.removeEventListener(L.SET_SCENE,c),N.removeEventListener(L.SET_OBJECT,h)}},[]);const e=ce.type.toLowerCase(),i=ce.animations.length>0||ce.mixer!==void 0,s=e.search("mesh")>-1||e.search("line")>-1||e.search("points")>-1;return l.jsx(yt,{label:"Inspector",children:l.jsx("div",{id:"Inspector",className:t.class,children:ce.uuid.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(l.Fragment,{children:[l.jsx(rt,{type:"string",title:"Name",prop:"name",value:ce.name,disabled:!0}),l.jsx(rt,{type:"string",title:"Type",prop:"type",value:ce.type,disabled:!0}),l.jsx(rt,{type:"string",title:"UUID",prop:"uuid",value:ce.uuid,disabled:!0}),l.jsx(rt,{type:"boolean",title:"Visible",prop:"visible",value:ce.visible,onChange:(h,c)=>{t.three.updateObject(ce.uuid,h,c);const f=t.three.scene?.getObjectByProperty("uuid",ce.uuid);f!==void 0&&te(f,h,c)}})]}),l.jsxs(l.Fragment,{children:[Xn(ce,t.three),i?Jn(ce,t.three):null,e.search("camera")>-1?Wn(ce,t.three):null,e.search("light")>-1?Zn(ce,t.three):null,s?Gn(ce,t.three):null]})]})},n)},"Inspector")}function Qn(t){const[n,a]=x.useState(t.scene);x.useEffect(()=>{const s=h=>{a(h.value)};return N.addEventListener(L.SET_SCENE,s),()=>{N.removeEventListener(L.SET_SCENE,s)}},[]);const e=n!==null,i="Hierarchy - "+(e?`${n?.name}`:"No Scene");return l.jsxs("div",{id:"SidePanel",children:[l.jsx(yt,{label:i,open:!0,children:l.jsx(l.Fragment,{children:e&&l.jsx(on,{child:n,three:t.three})})}),l.jsx(cn,{three:t.three})]},"SidePanel")}function ea(t){function n(){return t.three.scene===void 0?(console.log("No scene:",t.three),!1):!0}const a=c=>{if(!n())return;const f=t.three.scene?.getObjectByProperty("uuid",c.value);f!==void 0&&t.three.setObject(f)},e=(c,f,d)=>{if(!n())return;const v=t.three.scene?.getObjectByProperty("uuid",c);v!==void 0&&te(v,f,d)},i=c=>{if(!n())return;const f=c.value,{key:d,value:v,uuid:y}=f;e(y,d,v)},s=c=>{if(!n())return;const f=c.value;At(f.value).then(d=>{e(f.uuid,f.key,d),e(f.uuid,"material.needsUpdate",!0)})},h=c=>{if(!n())return;const{key:f,uuid:d,value:v,subitem:y}=c.value,S=t.three.scene?.getObjectByProperty("uuid",d);if(S!==void 0)try{y!==void 0?Mn(S,y)[f](v):S[f](v)}catch(C){console.log("Error requesting method:"),console.log(C),console.log(f),console.log(v)}};return x.useEffect(()=>(N.addEventListener(L.GET_OBJECT,a),N.addEventListener(L.UPDATE_OBJECT,i),N.addEventListener(L.CREATE_TEXTURE,s),N.addEventListener(L.REQUEST_METHOD,h),()=>{N.removeEventListener(L.GET_OBJECT,a),N.removeEventListener(L.UPDATE_OBJECT,i),N.removeEventListener(L.CREATE_TEXTURE,s),N.removeEventListener(L.REQUEST_METHOD,h)}),[]),null}const Gt={type:"change"},Tt={type:"start"},Ht={type:"end"},pt=new u.Ray,Wt=new u.Plane,ta=Math.cos(70*u.MathUtils.DEG2RAD);class na extends u.EventDispatcher{constructor(n,a){super(),this.object=n,this.domElement=a,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new u.Vector3,this.cursor=new u.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:u.MOUSE.ROTATE,MIDDLE:u.MOUSE.DOLLY,RIGHT:u.MOUSE.PAN},this.touches={ONE:u.TOUCH.ROTATE,TWO:u.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 c.phi},this.getAzimuthalAngle=function(){return c.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(Gt),e.update(),s=i.NONE},this.update=function(){const o=new u.Vector3,E=new u.Quaternion().setFromUnitVectors(n.up,new u.Vector3(0,1,0)),_=E.clone().invert(),U=new u.Vector3,X=new u.Quaternion,be=new u.Vector3,ue=2*Math.PI;return function(wt=null){const tt=e.object.position;o.copy(tt).sub(e.target),o.applyQuaternion(E),c.setFromVector3(o),e.autoRotate&&s===i.NONE&&me(Ie(wt)),e.enableDamping?(c.theta+=f.theta*e.dampingFactor,c.phi+=f.phi*e.dampingFactor):(c.theta+=f.theta,c.phi+=f.phi);let Se=e.minAzimuthAngle,ye=e.maxAzimuthAngle;isFinite(Se)&&isFinite(ye)&&(Se<-Math.PI?Se+=ue:Se>Math.PI&&(Se-=ue),ye<-Math.PI?ye+=ue:ye>Math.PI&&(ye-=ue),Se<=ye?c.theta=Math.max(Se,Math.min(ye,c.theta)):c.theta=c.theta>(Se+ye)/2?Math.max(Se,c.theta):Math.min(ye,c.theta)),c.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,c.phi)),c.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(v,e.dampingFactor):e.target.add(v),e.target.sub(e.cursor),e.target.clampLength(e.minTargetRadius,e.maxTargetRadius),e.target.add(e.cursor),e.zoomToCursor&&Y||e.object.isOrthographicCamera?c.radius=Re(c.radius):c.radius=Re(c.radius*d),o.setFromSpherical(c),o.applyQuaternion(_),tt.copy(e.target).add(o),e.object.lookAt(e.target),e.enableDamping===!0?(f.theta*=1-e.dampingFactor,f.phi*=1-e.dampingFactor,v.multiplyScalar(1-e.dampingFactor)):(f.set(0,0,0),v.set(0,0,0));let Fe=!1;if(e.zoomToCursor&&Y){let Ue=null;if(e.object.isPerspectiveCamera){const Be=o.length();Ue=Re(Be*d);const Ve=Be-Ue;e.object.position.addScaledVector(ae,Ve),e.object.updateMatrixWorld()}else if(e.object.isOrthographicCamera){const Be=new u.Vector3(Z.x,Z.y,0);Be.unproject(e.object),e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/d)),e.object.updateProjectionMatrix(),Fe=!0;const Ve=new u.Vector3(Z.x,Z.y,0);Ve.unproject(e.object),e.object.position.sub(Ve).add(Be),e.object.updateMatrixWorld(),Ue=o.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;Ue!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(Ue).add(e.object.position):(pt.origin.copy(e.object.position),pt.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(pt.direction))<ta?n.lookAt(e.target):(Wt.setFromNormalAndCoplanarPoint(e.object.up,e.target),pt.intersectPlane(Wt,e.target))))}else e.object.isOrthographicCamera&&(Fe=d!==1,Fe&&(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/d)),e.object.updateProjectionMatrix()));return d=1,Y=!1,Fe||U.distanceToSquared(e.object.position)>h||8*(1-X.dot(e.object.quaternion))>h||be.distanceToSquared(e.target)>0?(e.dispatchEvent(Gt),U.copy(e.object.position),X.copy(e.object.quaternion),be.copy(e.target),!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",He),e.domElement.removeEventListener("pointerdown",Ne),e.domElement.removeEventListener("pointercancel",Le),e.domElement.removeEventListener("wheel",lt),e.domElement.removeEventListener("pointermove",Ze),e.domElement.removeEventListener("pointerup",Le),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",Qe),e._domElementKeyEvents=null)};const e=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=i.NONE;const h=1e-6,c=new u.Spherical,f=new u.Spherical;let d=1;const v=new u.Vector3,y=new u.Vector2,S=new u.Vector2,C=new u.Vector2,A=new u.Vector2,j=new u.Vector2,H=new u.Vector2,B=new u.Vector2,R=new u.Vector2,M=new u.Vector2,ae=new u.Vector3,Z=new u.Vector2;let Y=!1;const K=[],w={};let Me=!1;function Ie(o){return o!==null?2*Math.PI/60*e.autoRotateSpeed*o:2*Math.PI/60/60*e.autoRotateSpeed}function Ce(o){const E=Math.abs(o*.01);return Math.pow(.95,e.zoomSpeed*E)}function me(o){f.theta-=o}function ie(o){f.phi-=o}const fe=function(){const o=new u.Vector3;return function(_,U){o.setFromMatrixColumn(U,0),o.multiplyScalar(-_),v.add(o)}}(),ve=function(){const o=new u.Vector3;return function(_,U){e.screenSpacePanning===!0?o.setFromMatrixColumn(U,1):(o.setFromMatrixColumn(U,0),o.crossVectors(e.object.up,o)),o.multiplyScalar(_),v.add(o)}}(),ge=function(){const o=new u.Vector3;return function(_,U){const X=e.domElement;if(e.object.isPerspectiveCamera){const be=e.object.position;o.copy(be).sub(e.target);let ue=o.length();ue*=Math.tan(e.object.fov/2*Math.PI/180),fe(2*_*ue/X.clientHeight,e.object.matrix),ve(2*U*ue/X.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(fe(_*(e.object.right-e.object.left)/e.object.zoom/X.clientWidth,e.object.matrix),ve(U*(e.object.top-e.object.bottom)/e.object.zoom/X.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function J(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?d/=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function pe(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?d*=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function Te(o,E){if(!e.zoomToCursor)return;Y=!0;const _=e.domElement.getBoundingClientRect(),U=o-_.left,X=E-_.top,be=_.width,ue=_.height;Z.x=U/be*2-1,Z.y=-(X/ue)*2+1,ae.set(Z.x,Z.y,1).unproject(e.object).sub(e.object.position).normalize()}function Re(o){return Math.max(e.minDistance,Math.min(e.maxDistance,o))}function he(o){y.set(o.clientX,o.clientY)}function m(o){Te(o.clientX,o.clientX),B.set(o.clientX,o.clientY)}function g(o){A.set(o.clientX,o.clientY)}function T(o){S.set(o.clientX,o.clientY),C.subVectors(S,y).multiplyScalar(e.rotateSpeed);const E=e.domElement;me(2*Math.PI*C.x/E.clientHeight),ie(2*Math.PI*C.y/E.clientHeight),y.copy(S),e.update()}function k(o){R.set(o.clientX,o.clientY),M.subVectors(R,B),M.y>0?J(Ce(M.y)):M.y<0&&pe(Ce(M.y)),B.copy(R),e.update()}function $(o){j.set(o.clientX,o.clientY),H.subVectors(j,A).multiplyScalar(e.panSpeed),ge(H.x,H.y),A.copy(j),e.update()}function q(o){Te(o.clientX,o.clientY),o.deltaY<0?pe(Ce(o.deltaY)):o.deltaY>0&&J(Ce(o.deltaY)),e.update()}function oe(o){let E=!1;switch(o.code){case e.keys.UP:o.ctrlKey||o.metaKey||o.shiftKey?ie(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ge(0,e.keyPanSpeed),E=!0;break;case e.keys.BOTTOM:o.ctrlKey||o.metaKey||o.shiftKey?ie(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ge(0,-e.keyPanSpeed),E=!0;break;case e.keys.LEFT:o.ctrlKey||o.metaKey||o.shiftKey?me(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ge(e.keyPanSpeed,0),E=!0;break;case e.keys.RIGHT:o.ctrlKey||o.metaKey||o.shiftKey?me(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ge(-e.keyPanSpeed,0),E=!0;break}E&&(o.preventDefault(),e.update())}function G(o){if(K.length===1)y.set(o.pageX,o.pageY);else{const E=Ae(o),_=.5*(o.pageX+E.x),U=.5*(o.pageY+E.y);y.set(_,U)}}function Q(o){if(K.length===1)A.set(o.pageX,o.pageY);else{const E=Ae(o),_=.5*(o.pageX+E.x),U=.5*(o.pageY+E.y);A.set(_,U)}}function se(o){const E=Ae(o),_=o.pageX-E.x,U=o.pageY-E.y,X=Math.sqrt(_*_+U*U);B.set(0,X)}function D(o){e.enableZoom&&se(o),e.enablePan&&Q(o)}function z(o){e.enableZoom&&se(o),e.enableRotate&&G(o)}function re(o){if(K.length==1)S.set(o.pageX,o.pageY);else{const _=Ae(o),U=.5*(o.pageX+_.x),X=.5*(o.pageY+_.y);S.set(U,X)}C.subVectors(S,y).multiplyScalar(e.rotateSpeed);const E=e.domElement;me(2*Math.PI*C.x/E.clientHeight),ie(2*Math.PI*C.y/E.clientHeight),y.copy(S)}function xe(o){if(K.length===1)j.set(o.pageX,o.pageY);else{const E=Ae(o),_=.5*(o.pageX+E.x),U=.5*(o.pageY+E.y);j.set(_,U)}H.subVectors(j,A).multiplyScalar(e.panSpeed),ge(H.x,H.y),A.copy(j)}function we(o){const E=Ae(o),_=o.pageX-E.x,U=o.pageY-E.y,X=Math.sqrt(_*_+U*U);R.set(0,X),M.set(0,Math.pow(R.y/B.y,e.zoomSpeed)),J(M.y),B.copy(R);const be=(o.pageX+E.x)*.5,ue=(o.pageY+E.y)*.5;Te(be,ue)}function st(o){e.enableZoom&&we(o),e.enablePan&&xe(o)}function ct(o){e.enableZoom&&we(o),e.enableRotate&&re(o)}function Ne(o){e.enabled!==!1&&(K.length===0&&(e.domElement.setPointerCapture(o.pointerId),e.domElement.addEventListener("pointermove",Ze),e.domElement.addEventListener("pointerup",Le)),xt(o),o.pointerType==="touch"?et(o):Je(o))}function Ze(o){e.enabled!==!1&&(o.pointerType==="touch"?ft(o):Et(o))}function Le(o){switch(St(o),K.length){case 0:e.domElement.releasePointerCapture(o.pointerId),e.domElement.removeEventListener("pointermove",Ze),e.domElement.removeEventListener("pointerup",Le),e.dispatchEvent(Ht),s=i.NONE;break;case 1:const E=K[0],_=w[E];et({pointerId:E,pageX:_.x,pageY:_.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 u.MOUSE.DOLLY:if(e.enableZoom===!1)return;m(o),s=i.DOLLY;break;case u.MOUSE.ROTATE:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enablePan===!1)return;g(o),s=i.PAN}else{if(e.enableRotate===!1)return;he(o),s=i.ROTATE}break;case u.MOUSE.PAN:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enableRotate===!1)return;he(o),s=i.ROTATE}else{if(e.enablePan===!1)return;g(o),s=i.PAN}break;default:s=i.NONE}s!==i.NONE&&e.dispatchEvent(Tt)}function Et(o){switch(s){case i.ROTATE:if(e.enableRotate===!1)return;T(o);break;case i.DOLLY:if(e.enableZoom===!1)return;k(o);break;case i.PAN:if(e.enablePan===!1)return;$(o);break}}function lt(o){e.enabled===!1||e.enableZoom===!1||s!==i.NONE||(o.preventDefault(),e.dispatchEvent(Tt),q(ut(o)),e.dispatchEvent(Ht))}function ut(o){const E=o.deltaMode,_={clientX:o.clientX,clientY:o.clientY,deltaY:o.deltaY};switch(E){case 1:_.deltaY*=16;break;case 2:_.deltaY*=100;break}return o.ctrlKey&&!Me&&(_.deltaY*=10),_}function dt(o){o.key==="Control"&&(Me=!0,e.domElement.getRootNode().addEventListener("keyup",_e,{passive:!0,capture:!0}))}function _e(o){o.key==="Control"&&(Me=!1,e.domElement.getRootNode().removeEventListener("keyup",_e,{passive:!0,capture:!0}))}function Qe(o){e.enabled===!1||e.enablePan===!1||oe(o)}function et(o){switch(ht(o),K.length){case 1:switch(e.touches.ONE){case u.TOUCH.ROTATE:if(e.enableRotate===!1)return;G(o),s=i.TOUCH_ROTATE;break;case u.TOUCH.PAN:if(e.enablePan===!1)return;Q(o),s=i.TOUCH_PAN;break;default:s=i.NONE}break;case 2:switch(e.touches.TWO){case u.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;D(o),s=i.TOUCH_DOLLY_PAN;break;case u.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;z(o),s=i.TOUCH_DOLLY_ROTATE;break;default:s=i.NONE}break;default:s=i.NONE}s!==i.NONE&&e.dispatchEvent(Tt)}function ft(o){switch(ht(o),s){case i.TOUCH_ROTATE:if(e.enableRotate===!1)return;re(o),e.update();break;case i.TOUCH_PAN:if(e.enablePan===!1)return;xe(o),e.update();break;case i.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;st(o),e.update();break;case i.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;ct(o),e.update();break;default:s=i.NONE}}function He(o){e.enabled!==!1&&o.preventDefault()}function xt(o){K.push(o.pointerId)}function St(o){delete w[o.pointerId];for(let E=0;E<K.length;E++)if(K[E]==o.pointerId){K.splice(E,1);return}}function ht(o){let E=w[o.pointerId];E===void 0&&(E=new u.Vector2,w[o.pointerId]=E),E.set(o.pageX,o.pageY)}function Ae(o){const E=o.pointerId===K[0]?K[1]:K[0];return w[E]}e.domElement.addEventListener("contextmenu",He),e.domElement.addEventListener("pointerdown",Ne),e.domElement.addEventListener("pointercancel",Le),e.domElement.addEventListener("wheel",lt,{passive:!1}),e.domElement.getRootNode().addEventListener("keydown",dt,{passive:!0,capture:!0}),this.update()}}const gt=t=>{const[n,a]=x.useState(t.options[t.index]),e=()=>{t.onToggle(!t.open)},i=s=>{s!==n&&(t.onSelect(s),a(s)),t.onToggle(!1)};return l.jsxs("div",{className:`dropdown ${t.up===!0?"up":""}`,children:[l.jsx("div",{className:"dropdown-toggle",onClick:e,children:n}),t.open&&l.jsx("ul",{className:"dropdown-menu",children:t.options.map(s=>l.jsx("li",{onClick:()=>i(s),children:s},s))})]})},ze=x.forwardRef(function(n,a){const[e,i]=x.useState(!1),s=n.options.indexOf(n.camera.name);return l.jsxs("div",{className:"CameraWindow",children:[l.jsx("div",{ref:a,className:"clickable",onClick:()=>{e&&i(!1)}}),l.jsx(gt,{index:s,open:e,options:n.options,onSelect:n.onSelect,onToggle:h=>{i(h)},up:!0})]})});class aa extends u.ShaderMaterial{constructor(n){super({extensions:{derivatives:!0},glslVersion:u.GLSL3,side:u.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 u.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:`out vec3 worldPosition;
29
+ C11,8.22,10.74,8,10.43,8z`})});function tn(t){return l.jsx(qt.Reorder.Item,{value:t.title,children:l.jsxs("div",{children:[jn,l.jsx("span",{children:t.title}),l.jsx("button",{className:"closeIcon",onClick:()=>{t.onDelete(t.index)},children:An})]})},t.title)}function nn(t){const[n,a]=S.useState(!1),[e,i]=S.useState(t.options),c=h=>{t.onDragComplete(h),i(h)},f=h=>{const p=[...e];p.splice(h,1),c(p)},s=[];e.forEach((h,p)=>{s.push(l.jsx(tn,{index:p,title:h,onDelete:f},h))});let u="dropdown draggable";return t.subdropdown&&(u+=" subdropdown"),l.jsxs("div",{className:u,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(It,{title:t.title}),l.jsx(qt.Reorder.Group,{axis:"y",values:e,onReorder:c,style:{visibility:n?"visible":"hidden"},children:s})]})}function an(t){const[n,a]=S.useState(!1),e=[];t.options.map((c,f)=>{t.onSelect!==void 0&&(c.onSelect=t.onSelect),e.push(l.jsx(rn,{option:c},f))});let i="dropdown";return t.subdropdown&&(i+=" subdropdown"),l.jsxs("div",{className:i,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(It,{title:t.title}),l.jsx("ul",{style:{visibility:n?"visible":"hidden"},children:e})]})}function rn(t){const{option:n}=t,[a,e]=S.useState("");let i;switch(n.type){case"draggable":i=l.jsx(nn,{title:n.title,options:n.value,onDragComplete:c=>{n.onDragComplete!==void 0&&n.onDragComplete(c)},subdropdown:!0});break;case"dropdown":i=l.jsx(an,{title:n.title,options:n.value,onSelect:n.onSelect,subdropdown:!0});break;case"option":i=l.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 l.jsx("li",{className:a===n.title?"selected":"",children:i},Kt())}function kn(t,n,a){function e(c){switch(n.forEach(f=>{f.callback(t,f.remote,c)}),c.event){case"custom":I.dispatchEvent({type:N.CUSTOM,value:c.data});break}}function i(c){switch(a.forEach(f=>{f.callback(t,f.remote,c)}),c.event){case"custom":I.dispatchEvent({type:N.CUSTOM,value:c.data});break}}t.listen=c=>{c.target==="editor"?i(c):e(c)}}function yt(t){const[n,a]=S.useState(t.open!==void 0?t.open:!0),e=!n||t.children===void 0;return l.jsxs("div",{className:`accordion ${e?"hide":""}`,children:[l.jsxs("button",{className:"toggle",onClick:()=>{const i=!n;t.onToggle!==void 0&&t.onToggle(i),a(i)},children:[l.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),l.jsx("p",{className:"label",children:st(t.label)})]}),t.button,l.jsx("div",{className:n?"open":"",children:l.jsx("div",{children:t.children})})]})}function Nt(t){const[n,a]=S.useState(!1),e=t.child!==void 0&&t.child.children.length>0,i=[];return t.child!==void 0&&t.child.children.length>0&&t.child.children.map(c=>{i.push(l.jsx(Nt,{child:c,three:t.three},Math.random()))}),l.jsx(l.Fragment,{children:t.child!==void 0&&l.jsxs("div",{className:"childObject",children:[l.jsxs("div",{className:"child",children:[e?l.jsx("button",{className:"status",style:{backgroundPositionX:n?"-14px":"2px"},onClick:()=>{a(!n)}}):null,l.jsx("button",{className:"name",style:{left:e?"20px":"5px"},onClick:()=>{t.child!==void 0&&(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}`}),l.jsx("div",{className:`icon ${xn(t.child)}`})]}),l.jsx("div",{className:n?"open":"",children:l.jsx("div",{className:"container",children:i})})]},Math.random())})}function on(t){const n=[];return t.child?.children.map(a=>{n.push(l.jsx(Nt,{child:a,three:t.three},Math.random()))}),l.jsx("div",{className:`scene ${t.class!==void 0?t.class:""}`,children:n})}const Dn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";function In(t){return"items"in t}function We(t){const n=[];return t.items.forEach(a=>{In(a)?n.push(l.jsx(We,{title:st(a.title),items:a.items},Math.random())):n.push(l.jsx(ot,{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,i)=>{a.onChange!==void 0&&a.onChange(e,i)}},Math.random()))}),l.jsx(yt,{label:t.title,open:t.expanded===!0,children:n})}function Nn(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 _e(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 Ln(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 Fn(){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],i=new FileReader;i.onload=function(c){n(c.target.result)},i.readAsDataURL(e)}}),t.click()})}const Un=[{title:"Front",value:d.FrontSide},{title:"Back",value:d.BackSide},{title:"Double",value:d.DoubleSide}],Bn=[{title:"No Blending",value:d.NoBlending},{title:"Normal",value:d.NormalBlending},{title:"Additive",value:d.AdditiveBlending},{title:"Subtractive",value:d.SubtractiveBlending},{title:"Multiply",value:d.MultiplyBlending},{title:"Custom",value:d.CustomBlending}],Vn=[{title:"Add",value:d.AddEquation},{title:"Subtract",value:d.SubtractEquation},{title:"Reverse Subtract",value:d.ReverseSubtractEquation},{title:"Min",value:d.MinEquation},{title:"Max",value:d.MaxEquation}],$n=[{title:"Zero",valye:d.ZeroFactor},{title:"One",valye:d.OneFactor},{title:"Src Color",valye:d.SrcColorFactor},{title:"One Minus Src Color",valye:d.OneMinusSrcColorFactor},{title:"Src Alpha",valye:d.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:d.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:d.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:d.OneMinusDstAlphaFactor},{title:"Dst Color",valye:d.DstColorFactor},{title:"One Minus Dst Color",valye:d.OneMinusDstColorFactor},{title:"Src Alpha Saturate",valye:d.SrcAlphaSaturateFactor},{title:"Constant Color",valye:d.ConstantColorFactor},{title:"One Minus Constant Color",valye:d.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:d.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:d.OneMinusConstantAlphaFactor}],zn=[{title:"Zero",valye:d.ZeroFactor},{title:"One",valye:d.OneFactor},{title:"Src Color",valye:d.SrcColorFactor},{title:"One Minus Src Color",valye:d.OneMinusSrcColorFactor},{title:"Src Alpha",valye:d.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:d.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:d.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:d.OneMinusDstAlphaFactor},{title:"Dst Color",valye:d.DstColorFactor},{title:"One Minus Dst Color",valye:d.OneMinusDstColorFactor},{title:"Constant Color",valye:d.ConstantColorFactor},{title:"One Minus Constant Color",valye:d.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:d.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:d.OneMinusConstantAlphaFactor}];function rt(t,n){t.needsUpdate=!0,t.type="option",t.options=n}function Yn(t,n,a,e){return{type:"boolean",title:_e(t),prop:t,value:n,needsUpdate:!0,onChange:(i,c)=>{e.updateObject(a.uuid,`material.${t}`,c),e.updateObject(a.uuid,"material.needsUpdate",!0);const f=e.scene?.getObjectByProperty("uuid",a.uuid);f!==void 0&&X(f,`material.${t}`,c)}}}function Gn(t,n,a,e){const i={type:"number",title:_e(t),prop:t,value:n,min:void 0,max:void 0,step:.01,needsUpdate:!0,onChange:(c,f)=>{e.updateObject(a.uuid,`material.${t}`,f),e.updateObject(a.uuid,"material.needsUpdate",!0);const s=e.scene?.getObjectByProperty("uuid",a.uuid);s!==void 0&&X(s,`material.${t}`,f)}};switch(t){case"blending":rt(i,Bn);break;case"blendDst":rt(i,zn);break;case"blendEquation":rt(i,Vn);break;case"blendSrc":rt(i,$n);break;case"side":rt(i,Un);break}return Ln(t)&&(i.value=Number(n),i.type="range",i.min=0,i.max=1,i.step=.01),i}function Hn(t,n,a,e){const i={type:"string",title:_e(t),prop:t,value:n,needsUpdate:!0,onChange:(f,s)=>{e.updateObject(a.uuid,`material.${t}`,s),e.updateObject(a.uuid,"material.needsUpdate",!0);const u=e.scene?.getObjectByProperty("uuid",a.uuid);u!==void 0&&X(u,`material.${t}`,s)}};return(t==="vertexShader"||t==="fragmentShader")&&(i.disabled=!1,i.latest=i.value,i.onChange=(f,s)=>{i.latest=s}),i}function Vt(t,n,a){const e=[];for(const i in t){if(!Nn(i))continue;const c=typeof t[i],f=t[i];if(c==="boolean")e.push(Yn(i,f,n,a));else if(c==="number")e.push(Gn(i,f,n,a));else if(c==="string")e.push(Hn(i,f,n,a));else if(c==="object")if(f.isColor)e.push({title:_e(i),prop:i,type:"color",value:f,onChange:(s,u)=>{const h=new d.Color(u);a.updateObject(n.uuid,`material.${s}`,h);const p=a.scene?.getObjectByProperty("uuid",n.uuid);p!==void 0&&X(p,`material.${s}`,h)}});else if(Array.isArray(f)){const s=[];for(const u in f)s.push({title:`${u}`,type:`${typeof f[u]}`,value:f[u],onChange:(h,p)=>{a.updateObject(n.uuid,`material.${i}`,p);const y=a.scene?.getObjectByProperty("uuid",n.uuid);y!==void 0&&X(y,`material.${i}`,p)}});e.push({title:_e(i),items:s})}else if(f.x!==void 0&&f.y!==void 0&&f.z===void 0)e.push({title:_e(i),prop:i,type:"vector",value:f,onChange:(s,u)=>{a.updateObject(n.uuid,`material.${s}`,u);const h=a.scene?.getObjectByProperty("uuid",n.uuid);h!==void 0&&X(h,`material.${s}`,u)}});else{const s=[];for(const u in f){const h=f[u];switch(typeof h){case"boolean":case"number":case"string":u==="src"?e.push({title:_e(i),type:"image",value:h,onChange:(y,C)=>{a.createTexture(n.uuid,`material.${i}`,C);const x=a.scene?.getObjectByProperty("uuid",n.uuid);x!==void 0&&Pt(C).then(_=>{X(x,`material.${i}`,_),X(x,"material.needsUpdate",!0)})}}):s.push({title:`${_e(u)}`,prop:`material.${i}.${u}`,type:`${typeof t[i][u]}`,value:f[u],onChange:(y,C)=>{a.updateObject(n.uuid,`material.${i}.${u}`,C);const x=a.scene?.getObjectByProperty("uuid",n.uuid);x!==void 0&&X(x,`material.${i}.${u}`,C)}});break;case"object":if(h.value!==void 0&&h.value.src!==void 0)s.push({title:_e(u),type:"image",value:h.value.src,onChange:(y,C)=>{a.createTexture(n.uuid,`material.${i}.${u}.value`,f);const x=a.scene?.getObjectByProperty("uuid",n.uuid);x!==void 0&&Pt(C).then(_=>{X(x,`material.${i}.${u}.value`,_)})}});else if(i==="uniforms"){const y=h.value,C=(x,_,j)=>({title:x,type:"number",value:j,step:.01,onChange:(H,$)=>{const L=`material.uniforms.${u}.value.${_}`;a.updateObject(n.uuid,L,$);const T=a.scene?.getObjectByProperty("uuid",n.uuid);T!==void 0&&X(T,L,$)}});if(typeof h.value=="number")s.push({title:u,type:"number",value:h.value,step:.01,onChange:(x,_)=>{const j=`material.${i}.${x}.value`;a.updateObject(n.uuid,j,_);const H=a.scene?.getObjectByProperty("uuid",n.uuid);H!==void 0&&X(H,j,_)}});else if(y.r!==void 0&&y.g!==void 0&&y.b!==void 0)s.push({title:u,type:"color",value:h.value,onChange:(x,_)=>{const j=new d.Color(_),H=`material.${i}.${x}.value`;a.updateObject(n.uuid,H,j);const $=a.scene?.getObjectByProperty("uuid",n.uuid);$!==void 0&&X($,H,j)}});else if(y.x!==void 0&&y.y!==void 0&&y.z===void 0&&y.w===void 0)s.push({title:u,type:"vector",value:h.value,prop:`material.${i}.${u}.value`,onChange:(x,_)=>{a.updateObject(n.uuid,x,_);const j=a.scene?.getObjectByProperty("uuid",n.uuid);j!==void 0&&X(j,x,_)}});else if(y.x!==void 0&&y.y!==void 0&&y.z!==void 0&&y.w===void 0)s.push({title:u,items:[C("X","x",h.value.x),C("Y","y",h.value.y),C("Z","z",h.value.z)]});else if(y.x!==void 0&&y.y!==void 0&&y.z!==void 0&&y.w!==void 0)s.push({title:u,items:[C("X","x",h.value.x),C("Y","y",h.value.y),C("Z","z",h.value.z),C("W","w",h.value.w)]});else if(y.elements!==void 0){const x=y.elements,_=[];for(let j=0;j<x.length;j++)_.push(C(j.toString(),j.toString(),x[j]));s.push({title:u,items:_})}else console.log(">>> need to add this format:",u,y)}else s.push({title:u,type:`${typeof h.value}`,value:h.value,onChange:(y,C)=>{a.updateObject(n.uuid,`material.${i}.${u}.value`,C);const x=a.scene?.getObjectByProperty("uuid",n.uuid);x!==void 0&&X(x,`material.${i}.${u}.value`,C)}});break}}s.length>0&&e.push({title:_e(i),items:s})}else f!==void 0&&console.log("other:",i,c,f)}return e.sort((i,c)=>i.title<c.title?-1:i.title>c.title?1:0),e.push({title:"Update Material",type:"button",onChange:()=>{a.updateObject(n.uuid,"material.needsUpdate",!0)}}),e}function Wn(t,n){const a=t.material;if(Array.isArray(a)){const e=[],i=a.length;for(let c=0;c<i;c++)e.push(l.jsx(We,{title:`Material ${c}`,items:Vt(a[c],t,n)},`Material ${c}`));return l.jsx(l.Fragment,{children:e})}else return l.jsx(We,{title:"Material",items:Vt(a,t,n)})}function qn(t){const n=S.useRef(null),a=S.useRef(null),e=S.useRef(null),i=S.useRef(null),c=S.useRef(null),f=S.useRef(null),[s,u]=S.useState(t.value),[h,p]=S.useState({min:t.min,max:t.max}),[y,C]=S.useState(!1);function x(){y||(window.addEventListener("mousemove",j),window.addEventListener("mouseup",_),window.addEventListener("mouseup",_),C(!0))}function _(){window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",_),C(!1)}function j(T){const re=c.current.getBoundingClientRect(),ee=Fe(0,99,T.clientX-re.left)/99,ye=Fe(0,99,T.clientY-re.top)/99,W=Je(Rt(h.min,h.max,ee),3),te=Je(Rt(h.min,h.max,ye),3);t.onChange({target:{value:{x:W,y:te}}}),u({x:W,y:te})}function H(T){let re=s.x,ee=s.y;T.target===n.current?re=Number(T.target.value):ee=Number(T.target.value),u({x:re,y:ee})}function $(){const T=Number(e.current.value);p({min:T,max:h.max}),(s.x<T||s.y<T)&&u({x:Fe(T,h.max,s.x),y:Fe(T,h.max,s.y)})}function L(){const T=Number(i.current.value);p({min:h.min,max:T}),(s.x>T||s.y>T)&&u({x:Fe(h.min,T,s.x),y:Fe(h.min,T,s.y)})}return S.useEffect(()=>{const T=_t(h.min,h.max,s.x),re=_t(h.min,h.max,s.y);f.current.style.left=`${T*100}%`,f.current.style.top=`${re*100}%`},[h,s]),l.jsxs("div",{className:"vector",children:[l.jsxs("div",{className:"fields",children:[l.jsxs("div",{children:[l.jsx("label",{children:"X:"}),l.jsx("input",{ref:n,type:"number",value:s.x,min:h.min,max:h.max,step:.01,onChange:H})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Y:"}),l.jsx("input",{ref:a,type:"number",value:s.y,min:h.min,max:h.max,step:.01,onChange:H})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Min:"}),l.jsx("input",{ref:e,type:"number",value:h.min,step:.01,onChange:$})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Max:"}),l.jsx("input",{ref:i,type:"number",value:h.max,step:.01,onChange:L})]})]}),l.jsxs("div",{className:"input",ref:c,onMouseDown:x,onMouseUp:_,children:[l.jsx("div",{className:"x"}),l.jsx("div",{className:"y"}),l.jsx("div",{className:"pt",ref:f})]})]})}function ot(t){let n=t.value;n!==void 0&&n.isColor!==void 0&&(n=Zt(t.value));const[a,e]=S.useState(n),i=S.useRef(null),c=S.useRef(null),f=S.useRef(null);S.useEffect(()=>{let p=!1,y=-1,C=0,x=Number(a);const _=T=>{p=!0,C=x,y=T.clientX},j=T=>{if(!p)return;const re=t.step!==void 0?t.step:1,ee=(T.clientX-y)*re;x=Number((C+ee).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)},H=()=>{p=!1},$=()=>{p=!1},L=t.type==="number";return L&&(i.current?.addEventListener("mousedown",_,!1),document.addEventListener("mouseup",H,!1),document.addEventListener("mousemove",j,!1),document.addEventListener("contextmenu",$,!1)),()=>{L&&(i.current?.removeEventListener("mousedown",_),document.removeEventListener("mouseup",H),document.removeEventListener("mousemove",j),document.removeEventListener("contextmenu",$))}},[a]);const s=t.type==="string"&&(a.length>100||a.search(`
30
+ `)>-1),u=s||t.type==="image"||t.type==="vector",h=p=>{let y=p.target.value;t.type==="boolean"?y=p.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 l.jsxs("div",{className:`field ${u?"block":""}`,children:[t.type!=="button"&&l.jsx("label",{ref:i,children:st(t.title)},"fieldLabel"),t.type==="string"&&!s&&l.jsx("input",{type:"text",disabled:t.disabled,onChange:h,value:a}),t.type==="string"&&s&&l.jsx("textarea",{cols:50,rows:10,disabled:t.disabled!==void 0?t.disabled:!0,onChange:h,value:a}),t.type==="boolean"&&l.jsx("input",{type:"checkbox",disabled:t.disabled,onChange:h,checked:a}),t.type==="number"&&l.jsx("input",{ref:c,type:"number",value:a,min:t.min,max:t.max,step:t.step,disabled:t.disabled,onChange:h}),t.type==="range"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:a.toString(),onChange:h,disabled:t.disabled,className:"min"}),l.jsx("input",{disabled:t.disabled,type:"range",value:a,min:t.min,max:t.max,step:t.step,onChange:h})]}),t.type==="color"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:a.toString(),onChange:h,disabled:t.disabled,className:"color"}),l.jsx("input",{type:"color",value:a,onChange:h,disabled:t.disabled})]}),t.type==="button"&&l.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"&&l.jsx("img",{ref:f,onClick:()=>{Fn().then(p=>{f.current.src=p,t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,p)})},src:a.length>0?a:Dn}),t.type==="option"&&l.jsx(l.Fragment,{children:l.jsx("select",{onChange:h,disabled:t.disabled,defaultValue:t.value,children:t.options?.map((p,y)=>l.jsx("option",{value:p.value,children:st(p.title)},y))})}),t.type==="vector"&&l.jsx(qn,{value:a,min:-1,max:1,onChange:h})]})}function $t(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 Kn(t,n){const a=[];if(t.perspectiveCameraInfo!==void 0)for(const e in t.perspectiveCameraInfo)a.push({title:$t(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(i,c)=>{n.updateObject(t.uuid,i,c),n.requestMethod(t.uuid,"updateProjectionMatrix");const f=n.scene?.getObjectByProperty("uuid",t.uuid);f!==void 0&&(X(f,i,c),f.updateProjectionMatrix())}});else if(t.orthographicCameraInfo!==void 0)for(const e in t.orthographicCameraInfo)a.push({title:$t(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(i,c)=>{n.updateObject(t.uuid,i,c),n.requestMethod(t.uuid,"updateProjectionMatrix");const f=n.scene?.getObjectByProperty("uuid",t.uuid);f!==void 0&&(X(f,i,c),f.updateProjectionMatrix())}});return l.jsx(We,{title:"Camera",items:a})}const Xn=Math.PI/180,Zn=180/Math.PI;function Ze(t,n,a,e,i){return e+(t-n)*(i-e)/(a-n)}function Jn(t){return t*Xn}function Mt(t){return t*Zn}function Qn(t,n){const a=new d.Matrix4;a.elements=t.matrix;const e=new d.Vector3,i=new d.Euler,c=new d.Vector3;t.uuid.length>0&&(e.setFromMatrixPosition(a),i.setFromRotationMatrix(a),c.setFromMatrixScale(a));const f=(u,h)=>{n.updateObject(t.uuid,u,h);const p=n.scene?.getObjectByProperty("uuid",t.uuid);p!==void 0&&X(p,u,h)},s=(u,h)=>{f(u,Jn(h))};return l.jsx(We,{title:"Transform",items:[{title:"Position X",prop:"position.x",type:"number",value:e.x,onChange:f},{title:"Position Y",prop:"position.y",type:"number",value:e.y,onChange:f},{title:"Position Z",prop:"position.z",type:"number",value:e.z,onChange:f},{title:"Rotation X",prop:"rotation.x",type:"number",value:Je(Mt(i.x)),min:-360,max:360,step:.1,onChange:s},{title:"Rotation Y",prop:"rotation.y",type:"number",value:Je(Mt(i.y)),min:-360,max:360,step:.1,onChange:s},{title:"Rotation Z",prop:"rotation.z",type:"number",value:Je(Mt(i.z)),min:-360,max:360,step:.1,onChange:s},{title:"Scale X",prop:"scale.x",type:"number",value:c.x,step:.01,onChange:f},{title:"Scale Y",prop:"scale.y",type:"number",value:c.y,step:.01,onChange:f},{title:"Scale Z",prop:"scale.z",type:"number",value:c.z,step:.01,onChange:f}]})}function zt(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 ea(t,n){const a=[];if(t.lightInfo!==void 0)for(const e in t.lightInfo){const i=t.lightInfo[e];i!==void 0&&(i.isColor!==void 0?a.push({title:zt(e),prop:e,type:"color",value:i,onChange:(c,f)=>{const s=new d.Color(f);n.updateObject(t.uuid,c,s);const u=n.scene?.getObjectByProperty("uuid",t.uuid);u!==void 0&&X(u,c,s)}}):a.push({title:zt(e),prop:e,type:typeof i,value:i,step:typeof i=="number"?.01:void 0,onChange:(c,f)=>{n.updateObject(t.uuid,c,f);const s=n.scene?.getObjectByProperty("uuid",t.uuid);s!==void 0&&X(s,c,f)}}))}return l.jsx(We,{title:"Light",items:a})}function ta(t,n){const a=[],e=[];let i=0;t.animations.forEach(s=>{i=Math.max(i,s.duration),s.duration>0&&e.push({title:s.name,items:[{title:"Duration",type:"number",value:s.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 f=!1;if(c!==void 0){const s=c.mixer;if(f=s!==void 0,f){const u=[{title:"Time Scale",type:"range",value:s.timeScale,step:.01,min:-1,max:2,onChange:(h,p)=>{s.timeScale=p,n.updateObject(t.uuid,"mixer.timeScale",p)}}];u.push({title:"Stop All",type:"button",onChange:()=>{s.stopAllAction(),n.requestMethod(t.uuid,"stopAllAction",void 0,"mixer")}}),a.push({title:"Mixer",items:u})}}return l.jsx(We,{title:"Animation",items:a})}const sn={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 se={...sn};function cn(t){const[n,a]=S.useState(-1);S.useEffect(()=>{function f(u){se={...u.value},a(Date.now())}function s(){se={...sn},a(Date.now())}return I.addEventListener(N.SET_SCENE,s),I.addEventListener(N.SET_OBJECT,f),()=>{I.removeEventListener(N.SET_SCENE,s),I.removeEventListener(N.SET_OBJECT,f)}},[]);const e=se.type.toLowerCase(),i=se.animations.length>0||se.mixer!==void 0,c=e.search("mesh")>-1||e.search("line")>-1||e.search("points")>-1;return l.jsx(yt,{label:"Inspector",children:l.jsx("div",{id:"Inspector",className:t.class,children:se.uuid.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(l.Fragment,{children:[l.jsx(ot,{type:"string",title:"Name",prop:"name",value:se.name,disabled:!0}),l.jsx(ot,{type:"string",title:"Type",prop:"type",value:se.type,disabled:!0}),l.jsx(ot,{type:"string",title:"UUID",prop:"uuid",value:se.uuid,disabled:!0}),l.jsx(ot,{type:"boolean",title:"Visible",prop:"visible",value:se.visible,onChange:(f,s)=>{t.three.updateObject(se.uuid,f,s);const u=t.three.scene?.getObjectByProperty("uuid",se.uuid);u!==void 0&&X(u,f,s)}})]}),l.jsxs(l.Fragment,{children:[Qn(se,t.three),i?ta(se,t.three):null,e.search("camera")>-1?Kn(se,t.three):null,e.search("light")>-1?ea(se,t.three):null,c?Wn(se,t.three):null]})]})},n)},"Inspector")}function na(t){const[n,a]=S.useState(t.scene);S.useEffect(()=>{const c=f=>{a(f.value)};return I.addEventListener(N.SET_SCENE,c),()=>{I.removeEventListener(N.SET_SCENE,c)}},[]);const e=n!==null,i="Hierarchy - "+(e?`${n?.name}`:"No Scene");return l.jsxs("div",{id:"SidePanel",children:[l.jsx(yt,{label:i,open:!0,children:l.jsx(l.Fragment,{children:e&&l.jsx(on,{child:n,three:t.three})})}),l.jsx(cn,{three:t.three})]},"SidePanel")}function aa(t){function n(){return t.three.scene===void 0?(console.log("No scene:",t.three),!1):!0}const a=s=>{if(!n())return;const u=t.three.scene?.getObjectByProperty("uuid",s.value);u!==void 0&&t.three.setObject(u)},e=(s,u,h)=>{if(!n())return;const p=t.three.scene?.getObjectByProperty("uuid",s);p!==void 0&&X(p,u,h)},i=s=>{if(!n())return;const u=s.value,{key:h,value:p,uuid:y}=u;e(y,h,p)},c=s=>{if(!n())return;const u=s.value;Pt(u.value).then(h=>{e(u.uuid,u.key,h),e(u.uuid,"material.needsUpdate",!0)})},f=s=>{if(!n())return;const{key:u,uuid:h,value:p,subitem:y}=s.value,C=t.three.scene?.getObjectByProperty("uuid",h);if(C!==void 0)try{y!==void 0?Mn(C,y)[u](p):C[u](p)}catch(x){console.log("Error requesting method:"),console.log(x),console.log(u),console.log(p)}};return S.useEffect(()=>(I.addEventListener(N.GET_OBJECT,a),I.addEventListener(N.UPDATE_OBJECT,i),I.addEventListener(N.CREATE_TEXTURE,c),I.addEventListener(N.REQUEST_METHOD,f),()=>{I.removeEventListener(N.GET_OBJECT,a),I.removeEventListener(N.UPDATE_OBJECT,i),I.removeEventListener(N.CREATE_TEXTURE,c),I.removeEventListener(N.REQUEST_METHOD,f)}),[]),null}const Yt={type:"change"},Tt={type:"start"},Gt={type:"end"},pt=new d.Ray,Ht=new d.Plane,ia=Math.cos(70*d.MathUtils.DEG2RAD);class ra extends d.EventDispatcher{constructor(n,a){super(),this.object=n,this.domElement=a,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new d.Vector3,this.cursor=new d.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:d.MOUSE.ROTATE,MIDDLE:d.MOUSE.DOLLY,RIGHT:d.MOUSE.PAN},this.touches={ONE:d.TOUCH.ROTATE,TWO:d.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 s.phi},this.getAzimuthalAngle=function(){return s.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(o){o.addEventListener("keydown",et),this._domElementKeyEvents=o},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",et),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(Yt),e.update(),c=i.NONE},this.update=function(){const o=new d.Vector3,E=new d.Quaternion().setFromUnitVectors(n.up,new d.Vector3(0,1,0)),R=E.clone().invert(),B=new d.Vector3,K=new d.Quaternion,ve=new d.Vector3,ue=2*Math.PI;return function(wt=null){const nt=e.object.position;o.copy(nt).sub(e.target),o.applyQuaternion(E),s.setFromVector3(o),e.autoRotate&&c===i.NONE&&z(Ue(wt)),e.enableDamping?(s.theta+=u.theta*e.dampingFactor,s.phi+=u.phi*e.dampingFactor):(s.theta+=u.theta,s.phi+=u.phi);let Ce=e.minAzimuthAngle,ge=e.maxAzimuthAngle;isFinite(Ce)&&isFinite(ge)&&(Ce<-Math.PI?Ce+=ue:Ce>Math.PI&&(Ce-=ue),ge<-Math.PI?ge+=ue:ge>Math.PI&&(ge-=ue),Ce<=ge?s.theta=Math.max(Ce,Math.min(ge,s.theta)):s.theta=s.theta>(Ce+ge)/2?Math.max(Ce,s.theta):Math.min(ge,s.theta)),s.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,s.phi)),s.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(p,e.dampingFactor):e.target.add(p),e.target.sub(e.cursor),e.target.clampLength(e.minTargetRadius,e.maxTargetRadius),e.target.add(e.cursor),e.zoomToCursor&&ye||e.object.isOrthographicCamera?s.radius=Te(s.radius):s.radius=Te(s.radius*h),o.setFromSpherical(s),o.applyQuaternion(R),nt.copy(e.target).add(o),e.object.lookAt(e.target),e.enableDamping===!0?(u.theta*=1-e.dampingFactor,u.phi*=1-e.dampingFactor,p.multiplyScalar(1-e.dampingFactor)):(u.set(0,0,0),p.set(0,0,0));let $e=!1;if(e.zoomToCursor&&ye){let ze=null;if(e.object.isPerspectiveCamera){const Ye=o.length();ze=Te(Ye*h);const Ge=Ye-ze;e.object.position.addScaledVector(re,Ge),e.object.updateMatrixWorld()}else if(e.object.isOrthographicCamera){const Ye=new d.Vector3(ee.x,ee.y,0);Ye.unproject(e.object),e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/h)),e.object.updateProjectionMatrix(),$e=!0;const Ge=new d.Vector3(ee.x,ee.y,0);Ge.unproject(e.object),e.object.position.sub(Ge).add(Ye),e.object.updateMatrixWorld(),ze=o.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;ze!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(ze).add(e.object.position):(pt.origin.copy(e.object.position),pt.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(pt.direction))<ia?n.lookAt(e.target):(Ht.setFromNormalAndCoplanarPoint(e.object.up,e.target),pt.intersectPlane(Ht,e.target))))}else e.object.isOrthographicCamera&&($e=h!==1,$e&&(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/h)),e.object.updateProjectionMatrix()));return h=1,ye=!1,$e||B.distanceToSquared(e.object.position)>f||8*(1-K.dot(e.object.quaternion))>f||ve.distanceToSquared(e.target)>0?(e.dispatchEvent(Yt),B.copy(e.object.position),K.copy(e.object.quaternion),ve.copy(e.target),!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",qe),e.domElement.removeEventListener("pointerdown",U),e.domElement.removeEventListener("pointercancel",Se),e.domElement.removeEventListener("wheel",lt),e.domElement.removeEventListener("pointermove",ie),e.domElement.removeEventListener("pointerup",Se),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",et),e._domElementKeyEvents=null)};const e=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let c=i.NONE;const f=1e-6,s=new d.Spherical,u=new d.Spherical;let h=1;const p=new d.Vector3,y=new d.Vector2,C=new d.Vector2,x=new d.Vector2,_=new d.Vector2,j=new d.Vector2,H=new d.Vector2,$=new d.Vector2,L=new d.Vector2,T=new d.Vector2,re=new d.Vector3,ee=new d.Vector2;let ye=!1;const W=[],te={};let pe=!1;function Ue(o){return o!==null?2*Math.PI/60*e.autoRotateSpeed*o:2*Math.PI/60/60*e.autoRotateSpeed}function xe(o){const E=Math.abs(o*.01);return Math.pow(.95,e.zoomSpeed*E)}function z(o){u.theta-=o}function le(o){u.phi-=o}const O=function(){const o=new d.Vector3;return function(R,B){o.setFromMatrixColumn(B,0),o.multiplyScalar(-R),p.add(o)}}(),we=function(){const o=new d.Vector3;return function(R,B){e.screenSpacePanning===!0?o.setFromMatrixColumn(B,1):(o.setFromMatrixColumn(B,0),o.crossVectors(e.object.up,o)),o.multiplyScalar(R),p.add(o)}}(),me=function(){const o=new d.Vector3;return function(R,B){const K=e.domElement;if(e.object.isPerspectiveCamera){const ve=e.object.position;o.copy(ve).sub(e.target);let ue=o.length();ue*=Math.tan(e.object.fov/2*Math.PI/180),O(2*R*ue/K.clientHeight,e.object.matrix),we(2*B*ue/K.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(O(R*(e.object.right-e.object.left)/e.object.zoom/K.clientWidth,e.object.matrix),we(B*(e.object.top-e.object.bottom)/e.object.zoom/K.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function Oe(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?h/=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function Re(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?h*=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function Me(o,E){if(!e.zoomToCursor)return;ye=!0;const R=e.domElement.getBoundingClientRect(),B=o-R.left,K=E-R.top,ve=R.width,ue=R.height;ee.x=B/ve*2-1,ee.y=-(K/ue)*2+1,re.set(ee.x,ee.y,1).unproject(e.object).sub(e.object.position).normalize()}function Te(o){return Math.max(e.minDistance,Math.min(e.maxDistance,o))}function Pe(o){y.set(o.clientX,o.clientY)}function Be(o){Me(o.clientX,o.clientX),$.set(o.clientX,o.clientY)}function ne(o){_.set(o.clientX,o.clientY)}function Ee(o){C.set(o.clientX,o.clientY),x.subVectors(C,y).multiplyScalar(e.rotateSpeed);const E=e.domElement;z(2*Math.PI*x.x/E.clientHeight),le(2*Math.PI*x.y/E.clientHeight),y.copy(C),e.update()}function Qe(o){L.set(o.clientX,o.clientY),T.subVectors(L,$),T.y>0?Oe(xe(T.y)):T.y<0&&Re(xe(T.y)),$.copy(L),e.update()}function Ve(o){j.set(o.clientX,o.clientY),H.subVectors(j,_).multiplyScalar(e.panSpeed),me(H.x,H.y),_.copy(j),e.update()}function fe(o){Me(o.clientX,o.clientY),o.deltaY<0?Re(xe(o.deltaY)):o.deltaY>0&&Oe(xe(o.deltaY)),e.update()}function m(o){let E=!1;switch(o.code){case e.keys.UP:o.ctrlKey||o.metaKey||o.shiftKey?le(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):me(0,e.keyPanSpeed),E=!0;break;case e.keys.BOTTOM:o.ctrlKey||o.metaKey||o.shiftKey?le(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):me(0,-e.keyPanSpeed),E=!0;break;case e.keys.LEFT:o.ctrlKey||o.metaKey||o.shiftKey?z(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):me(e.keyPanSpeed,0),E=!0;break;case e.keys.RIGHT:o.ctrlKey||o.metaKey||o.shiftKey?z(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):me(-e.keyPanSpeed,0),E=!0;break}E&&(o.preventDefault(),e.update())}function g(o){if(W.length===1)y.set(o.pageX,o.pageY);else{const E=De(o),R=.5*(o.pageX+E.x),B=.5*(o.pageY+E.y);y.set(R,B)}}function w(o){if(W.length===1)_.set(o.pageX,o.pageY);else{const E=De(o),R=.5*(o.pageX+E.x),B=.5*(o.pageY+E.y);_.set(R,B)}}function P(o){const E=De(o),R=o.pageX-E.x,B=o.pageY-E.y,K=Math.sqrt(R*R+B*B);$.set(0,K)}function q(o){e.enableZoom&&P(o),e.enablePan&&w(o)}function Z(o){e.enableZoom&&P(o),e.enableRotate&&g(o)}function de(o){if(W.length==1)C.set(o.pageX,o.pageY);else{const R=De(o),B=.5*(o.pageX+R.x),K=.5*(o.pageY+R.y);C.set(B,K)}x.subVectors(C,y).multiplyScalar(e.rotateSpeed);const E=e.domElement;z(2*Math.PI*x.x/E.clientHeight),le(2*Math.PI*x.y/E.clientHeight),y.copy(C)}function Y(o){if(W.length===1)j.set(o.pageX,o.pageY);else{const E=De(o),R=.5*(o.pageX+E.x),B=.5*(o.pageY+E.y);j.set(R,B)}H.subVectors(j,_).multiplyScalar(e.panSpeed),me(H.x,H.y),_.copy(j)}function J(o){const E=De(o),R=o.pageX-E.x,B=o.pageY-E.y,K=Math.sqrt(R*R+B*B);L.set(0,K),T.set(0,Math.pow(L.y/$.y,e.zoomSpeed)),Oe(T.y),$.copy(L);const ve=(o.pageX+E.x)*.5,ue=(o.pageY+E.y)*.5;Me(ve,ue)}function oe(o){e.enableZoom&&J(o),e.enablePan&&Y(o)}function k(o){e.enableZoom&&J(o),e.enableRotate&&de(o)}function U(o){e.enabled!==!1&&(W.length===0&&(e.domElement.setPointerCapture(o.pointerId),e.domElement.addEventListener("pointermove",ie),e.domElement.addEventListener("pointerup",Se)),St(o),o.pointerType==="touch"?tt(o):je(o))}function ie(o){e.enabled!==!1&&(o.pointerType==="touch"?ht(o):Et(o))}function Se(o){switch(Ct(o),W.length){case 0:e.domElement.releasePointerCapture(o.pointerId),e.domElement.removeEventListener("pointermove",ie),e.domElement.removeEventListener("pointerup",Se),e.dispatchEvent(Gt),c=i.NONE;break;case 1:const E=W[0],R=te[E];tt({pointerId:E,pageX:R.x,pageY:R.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 d.MOUSE.DOLLY:if(e.enableZoom===!1)return;Be(o),c=i.DOLLY;break;case d.MOUSE.ROTATE:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enablePan===!1)return;ne(o),c=i.PAN}else{if(e.enableRotate===!1)return;Pe(o),c=i.ROTATE}break;case d.MOUSE.PAN:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enableRotate===!1)return;Pe(o),c=i.ROTATE}else{if(e.enablePan===!1)return;ne(o),c=i.PAN}break;default:c=i.NONE}c!==i.NONE&&e.dispatchEvent(Tt)}function Et(o){switch(c){case i.ROTATE:if(e.enableRotate===!1)return;Ee(o);break;case i.DOLLY:if(e.enableZoom===!1)return;Qe(o);break;case i.PAN:if(e.enablePan===!1)return;Ve(o);break}}function lt(o){e.enabled===!1||e.enableZoom===!1||c!==i.NONE||(o.preventDefault(),e.dispatchEvent(Tt),fe(ut(o)),e.dispatchEvent(Gt))}function ut(o){const E=o.deltaMode,R={clientX:o.clientX,clientY:o.clientY,deltaY:o.deltaY};switch(E){case 1:R.deltaY*=16;break;case 2:R.deltaY*=100;break}return o.ctrlKey&&!pe&&(R.deltaY*=10),R}function dt(o){o.key==="Control"&&(pe=!0,e.domElement.getRootNode().addEventListener("keyup",ke,{passive:!0,capture:!0}))}function ke(o){o.key==="Control"&&(pe=!1,e.domElement.getRootNode().removeEventListener("keyup",ke,{passive:!0,capture:!0}))}function et(o){e.enabled===!1||e.enablePan===!1||m(o)}function tt(o){switch(ft(o),W.length){case 1:switch(e.touches.ONE){case d.TOUCH.ROTATE:if(e.enableRotate===!1)return;g(o),c=i.TOUCH_ROTATE;break;case d.TOUCH.PAN:if(e.enablePan===!1)return;w(o),c=i.TOUCH_PAN;break;default:c=i.NONE}break;case 2:switch(e.touches.TWO){case d.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;q(o),c=i.TOUCH_DOLLY_PAN;break;case d.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Z(o),c=i.TOUCH_DOLLY_ROTATE;break;default:c=i.NONE}break;default:c=i.NONE}c!==i.NONE&&e.dispatchEvent(Tt)}function ht(o){switch(ft(o),c){case i.TOUCH_ROTATE:if(e.enableRotate===!1)return;de(o),e.update();break;case i.TOUCH_PAN:if(e.enablePan===!1)return;Y(o),e.update();break;case i.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;oe(o),e.update();break;case i.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;k(o),e.update();break;default:c=i.NONE}}function qe(o){e.enabled!==!1&&o.preventDefault()}function St(o){W.push(o.pointerId)}function Ct(o){delete te[o.pointerId];for(let E=0;E<W.length;E++)if(W[E]==o.pointerId){W.splice(E,1);return}}function ft(o){let E=te[o.pointerId];E===void 0&&(E=new d.Vector2,te[o.pointerId]=E),E.set(o.pageX,o.pageY)}function De(o){const E=o.pointerId===W[0]?W[1]:W[0];return te[E]}e.domElement.addEventListener("contextmenu",qe),e.domElement.addEventListener("pointerdown",U),e.domElement.addEventListener("pointercancel",Se),e.domElement.addEventListener("wheel",lt,{passive:!1}),e.domElement.getRootNode().addEventListener("keydown",dt,{passive:!0,capture:!0}),this.update()}}const gt=t=>{const[n,a]=S.useState(t.options[t.index]),e=()=>{t.onToggle(!t.open)},i=c=>{c!==n&&(t.onSelect(c),a(c)),t.onToggle(!1)};return l.jsxs("div",{className:`dropdown ${t.up===!0?"up":""}`,children:[l.jsx("div",{className:"dropdown-toggle",onClick:e,children:n}),t.open&&l.jsx("ul",{className:"dropdown-menu",children:t.options.map(c=>l.jsx("li",{onClick:()=>i(c),children:c},c))})]})},He=S.forwardRef(function(n,a){const[e,i]=S.useState(!1),c=n.options.indexOf(n.camera.name);return l.jsxs("div",{className:"CameraWindow",children:[l.jsx("div",{ref:a,className:"clickable",onClick:()=>{e&&i(!1)}}),l.jsx(gt,{index:c,open:e,options:n.options,onSelect:n.onSelect,onToggle:f=>{i(f)},up:!0})]})});class oa extends d.ShaderMaterial{constructor(n){super({extensions:{derivatives:!0},glslVersion:d.GLSL3,side:d.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 d.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:`out vec3 worldPosition;
31
31
  uniform float uDistance;
32
32
 
33
33
  void main() {
@@ -103,7 +103,7 @@ C11,8.22,10.74,8,10.43,8z`})});function tn(t){return l.jsx(qt.Reorder.Item,{valu
103
103
  fragColor.a = mix(fragColor.a, baseOpacity * uGridOpacity, nextGrid);
104
104
 
105
105
  if (fragColor.a <= 0.0) discard;
106
- }`,name:"InfiniteGrid",depthWrite:!1})}}class ia extends u.Mesh{gridMaterial;constructor(){const n=new aa;super(new u.PlaneGeometry(2,2),n),this.gridMaterial=n,this.frustumCulled=!1,this.name="InfiniteGridHelper",this.position.y=.1}update(){this.gridMaterial.needsUpdate=!0}}const ra=`#include <common>
106
+ }`,name:"InfiniteGrid",depthWrite:!1})}}class sa extends d.Mesh{gridMaterial;constructor(){const n=new oa;super(new d.PlaneGeometry(2,2),n),this.gridMaterial=n,this.frustumCulled=!1,this.name="InfiniteGridHelper",this.position.y=.1}update(){this.gridMaterial.needsUpdate=!0}}const ca=`#include <common>
107
107
  #include <batching_pars_vertex>
108
108
  #include <uv_pars_vertex>
109
109
  #include <color_pars_vertex>
@@ -133,7 +133,7 @@ void main() {
133
133
  #include <logdepthbuf_vertex>
134
134
  #include <clipping_planes_vertex>
135
135
  #include <worldpos_vertex>
136
- }`,oa=`
136
+ }`,la=`
137
137
  #include <common>
138
138
  #include <uv_pars_fragment>
139
139
  #include <clipping_planes_pars_fragment>
@@ -141,4 +141,4 @@ void main() {
141
141
  void main() {
142
142
  #include <clipping_planes_fragment>
143
143
  gl_FragColor = vec4(vec3(vUv, 0.0), 1.0);
144
- }`;class sa extends u.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:ra,fragmentShader:oa})}}let mt="Renderer",je,vt=!1,$t=!1,W,le,ke,De;function ca(t){const n=x.useMemo(()=>new Map,[]),a=x.useMemo(()=>new Map,[]),e=x.useMemo(()=>new Map,[]),i=x.useMemo(()=>new u.Scene,[]),s=x.useMemo(()=>new u.Group,[]),h=x.useMemo(()=>new ia,[]),c=x.useMemo(()=>new u.AxesHelper(500),[]),f=x.useMemo(()=>new u.AxesHelper(100),[]),d=x.useMemo(()=>new u.MeshDepthMaterial,[]),v=x.useMemo(()=>new u.MeshNormalMaterial,[]),y=x.useMemo(()=>new sa,[]),S=x.useMemo(()=>new u.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0}),[]);function C(m,g){const T=new u.OrthographicCamera(-100,100,100,-100,50,3e3);return T.name=m,T.position.copy(g),T.lookAt(0,0,0),n.set(m,T),T}const A=["Renderer","Depth","Normals","UVs","Wireframe"],j=["Single","Side by Side","Stacked","Quad"];x.useEffect(()=>{i.name="Debug Scene",s.name="helpers",i.add(s),s.add(h),c.name="axisHelper",s.add(c),f.name="interactionHelper",s.add(f),f.visible=!1,C("Top",new u.Vector3(0,1e3,0)),C("Bottom",new u.Vector3(0,-1e3,0)),C("Left",new u.Vector3(-1e3,0,0)),C("Right",new u.Vector3(1e3,0,0)),C("Front",new u.Vector3(0,0,1e3)),C("Back",new u.Vector3(0,0,-1e3)),C("Orthographic",new u.Vector3(1e3,1e3,1e3));const m=new u.PerspectiveCamera(60,1,50,3e3);m.name="Debug",m.position.set(500,500,500),m.lookAt(0,0,0),n.set("Debug",m),W=n.get("Debug"),le=n.get("Orthographic"),ke=n.get("Front"),De=n.get("Top")},[]);const H=x.useRef(null),B=x.useRef(null),R=x.useRef(null),M=x.useRef(null),ae=x.useRef(null),Z=x.useRef(null),[Y,K]=x.useState(t.mode!==void 0?t.mode:"Single"),[w,Me]=x.useState(null),[Ie,Ce]=x.useState(!1),[me,ie]=x.useState(!1),[fe,ve]=x.useState(!1),[,ge]=x.useState(Date.now()),J=(m,g)=>{const T=a.get(m.name);T!==void 0&&T.dispose(),a.delete(m.name);const k=e.get(m.name);k!==void 0&&(i.remove(k),k.dispose()),e.delete(m.name);const $=new na(m,g);switch($.enableDamping=!0,$.dampingFactor=.05,m.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":$.enableRotate=!1;break}if(a.set(m.name,$),m instanceof u.PerspectiveCamera){const q=new u.CameraHelper(m);e.set(m.name,q),i.add(q)}},pe=m=>{const g=e.get(m.name);g!==void 0&&(i.remove(g),g.dispose(),e.delete(m.name));const T=a.get(m.name);T!==void 0&&(T.dispose(),a.delete(m.name))},Te=()=>{a.forEach((m,g)=>{m.dispose();const T=e.get(g);T!==void 0&&(i.remove(T),T.dispose()),e.delete(g),a.delete(g)}),a.clear(),e.clear()},Re=()=>{switch(Y){case"Single":J(W,R.current);break;case"Side by Side":case"Stacked":J(W,R.current),J(le,M.current);break;case"Quad":J(W,R.current),J(le,M.current),J(ke,ae.current),J(De,Z.current);break}};x.useEffect(()=>{const m=new u.WebGLRenderer({canvas:H.current,stencil:!1});m.autoClear=!1,m.shadowMap.enabled=!0,m.setPixelRatio(devicePixelRatio),m.setClearColor(0),t.three.renderer=m,Me(m)},[]),x.useEffect(()=>{const m=k=>{Dt(je),i.remove(je);const $=t.scenes.get(k.value.name);if($!==void 0){const q=new $;t.onSceneSet!==void 0&&t.onSceneSet(q),je=q,t.three.scene=je,i.add(je),$t=!0}},g=k=>{const $=k.value,q=t.three.scene?.getObjectByProperty("uuid",$.uuid);q!==void 0&&n.set($.name,q),ge(Date.now())},T=k=>{n.delete(k.value.name),ge(Date.now())};return N.addEventListener(L.SET_SCENE,m),N.addEventListener(L.ADD_CAMERA,g),N.addEventListener(L.REMOVE_CAMERA,T),()=>{N.removeEventListener(L.SET_SCENE,m),N.removeEventListener(L.ADD_CAMERA,g),N.removeEventListener(L.REMOVE_CAMERA,T)}},[]),x.useEffect(()=>{if(w===null)return;let m=window.innerWidth,g=window.innerHeight,T=Math.floor(m/2),k=Math.floor(g/2),$=-1;const q=()=>{m=window.innerWidth-300,g=window.innerHeight,T=Math.floor(m/2),k=Math.floor(g/2),w.setSize(m,g);let D=m,z=g;switch(Y){case"Side by Side":D=T,z=g;break;case"Stacked":D=m,z=k;break;case"Quad":D=T,z=k;break}n.forEach(re=>{re instanceof u.OrthographicCamera?(re.left=D/-2,re.right=D/2,re.top=z/2,re.bottom=z/-2,re.updateProjectionMatrix()):re instanceof u.PerspectiveCamera&&(re.aspect=D/z,re.updateProjectionMatrix(),e.get(re.name)?.update())})},oe=()=>{w.setViewport(0,0,m,g),w.setScissor(0,0,m,g),w.render(i,W)},G=()=>{if(Y==="Side by Side")w.setViewport(0,0,T,g),w.setScissor(0,0,T,g),w.render(i,W),w.setViewport(T,0,T,g),w.setScissor(T,0,T,g),w.render(i,le);else{const D=g-k;w.setViewport(0,D,m,k),w.setScissor(0,D,m,k),w.render(i,W),w.setViewport(0,0,m,k),w.setScissor(0,0,m,k),w.render(i,le)}},Q=()=>{let D=0,z=0;z=g-k,D=0,w.setViewport(D,z,T,k),w.setScissor(D,z,T,k),w.render(i,W),D=T,w.setViewport(D,z,T,k),w.setScissor(D,z,T,k),w.render(i,le),z=0,D=0,w.setViewport(D,z,T,k),w.setScissor(D,z,T,k),w.render(i,ke),D=T,w.setViewport(D,z,T,k),w.setScissor(D,z,T,k),w.render(i,De)},se=()=>{switch(a.forEach(D=>{D.update()}),t.onSceneUpdate!==void 0&&$t&&t.onSceneUpdate(je),w.clear(),Y){case"Single":oe();break;case"Side by Side":case"Stacked":G();break;case"Quad":Q();break}$=requestAnimationFrame(se)};return Re(),window.addEventListener("resize",q),q(),se(),()=>{window.removeEventListener("resize",q),cancelAnimationFrame($),$=-1}},[Y,w]),x.useEffect(()=>{if(w!==null){const m=new u.Raycaster,g=new u.Vector2,T=(oe,G,Q,se)=>{switch(Y){case"Quad":oe<Q?G<se?m.setFromCamera(g,W):m.setFromCamera(g,ke):G<se?m.setFromCamera(g,le):m.setFromCamera(g,De);break;case"Side by Side":oe<Q?m.setFromCamera(g,W):m.setFromCamera(g,le);break;case"Single":m.setFromCamera(g,W);break;case"Stacked":G<se?m.setFromCamera(g,W):m.setFromCamera(g,le);break}},k=oe=>{if(!vt)return;const G=new u.Vector2;w.getSize(G);const Q=Math.min(oe.clientX,G.x),se=Math.min(oe.clientY,G.y);g.x=qe(Q,0,G.x,-1,1),g.y=qe(se,0,G.y,1,-1);const D=G.x/2,z=G.y/2,re=()=>{Q<D?g.x=qe(Q,0,D,-1,1):g.x=qe(Q,D,G.x,-1,1)},xe=()=>{se<z?g.y=qe(se,0,z,1,-1):g.y=qe(se,z,G.y,1,-1)};switch(Y){case"Quad":re(),xe();break;case"Side by Side":re();break;case"Stacked":xe(),xe();break}T(Q,se,D,z);const we=m.intersectObjects(je.children);we.length>0&&f.position.copy(we[0].point)},$=oe=>{if(!vt)return;const G=new u.Vector2;if(w.getSize(G),oe.clientX>=G.x)return;k(oe);const Q=m.intersectObjects(je.children);Q.length>0&&t.three.getObject(Q[0].object.uuid)},q=B.current;return q.addEventListener("mousemove",k,!1),q.addEventListener("click",$,!1),()=>{q.removeEventListener("mousemove",k),q.removeEventListener("click",$)}}},[Y,w]);const he=[];return n.forEach((m,g)=>{he.push(g)}),l.jsxs("div",{className:"multiview",children:[l.jsx("canvas",{ref:H}),w!==null&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`cameras ${Y==="Single"||Y==="Stacked"?"single":""}`,ref:B,children:[Y==="Single"&&l.jsx(l.Fragment,{children:l.jsx(ze,{camera:W,options:he,ref:R,onSelect:m=>{a.get(W.name)?.dispose();const g=n.get(m);g!==void 0&&(pe(W),W=g,J(g,R.current))}})}),(Y==="Side by Side"||Y==="Stacked")&&l.jsxs(l.Fragment,{children:[l.jsx(ze,{camera:W,options:he,ref:R,onSelect:m=>{a.get(W.name)?.dispose();const g=n.get(m);g!==void 0&&(pe(W),W=g,J(g,R.current))}}),l.jsx(ze,{camera:le,options:he,ref:M,onSelect:m=>{a.get(le.name)?.dispose();const g=n.get(m);g!==void 0&&(pe(le),le=g,J(g,M.current))}})]}),Y==="Quad"&&l.jsxs(l.Fragment,{children:[l.jsx(ze,{camera:W,options:he,ref:R,onSelect:m=>{a.get(W.name)?.dispose();const g=n.get(m);g!==void 0&&(pe(W),W=g,J(g,R.current))}}),l.jsx(ze,{camera:le,options:he,ref:M,onSelect:m=>{a.get(le.name)?.dispose();const g=n.get(m);g!==void 0&&(pe(le),le=g,J(g,M.current))}}),l.jsx(ze,{camera:ke,options:he,ref:ae,onSelect:m=>{a.get(ke.name)?.dispose();const g=n.get(m);g!==void 0&&(pe(ke),ke=g,J(g,ae.current))}}),l.jsx(ze,{camera:De,options:he,ref:Z,onSelect:m=>{a.get(De.name)?.dispose();const g=n.get(m);g!==void 0&&(pe(De),De=g,J(g,Z.current))}})]})]}),l.jsxs("div",{className:"settings",children:[l.jsx(gt,{index:j.indexOf(Y),options:j,onSelect:m=>{m!==Y&&(Te(),K(m))},open:Ie,onToggle:m=>{Ce(m),me&&ie(!1),fe&&ve(!1)}}),l.jsx(gt,{index:A.indexOf(mt),options:A,onSelect:m=>{if(m!==mt)switch(mt=m,mt){case"Depth":i.overrideMaterial=d;break;case"Normals":i.overrideMaterial=v;break;default:case"Renderer":i.overrideMaterial=null;break;case"Wireframe":i.overrideMaterial=S;break;case"UVs":i.overrideMaterial=y;break}},open:me,onToggle:m=>{Ie&&Ce(!1),ie(m),fe&&ve(!1)}}),l.jsx(gt,{index:0,options:["Orbit Mode","Selection Mode"],onSelect:m=>{vt=m==="Selection Mode",f.visible=vt},open:fe,onToggle:m=>{Ie&&Ce(!1),me&&ie(!1),ve(m)}})]})]})]})}function la(t){return l.jsxs("div",{className:"editor",ref:t.ref,style:t.style,children:[l.jsx("div",{className:"header",children:t.header}),t.children,l.jsx("div",{className:"footer",children:t.footer})]})}exports.Accordion=yt;exports.Application=En;exports.BaseRemote=ot;exports.ChildObject=Nt;exports.ContainerObject=on;exports.Draggable=nn;exports.DraggableItem=tn;exports.Dropdown=an;exports.DropdownItem=rn;exports.Editor=la;exports.Inspector=cn;exports.MultiView=ca;exports.NavButton=It;exports.RemoteComponents=xn;exports.RemoteController=kn;exports.RemoteTheatre=bt;exports.RemoteThree=Tn;exports.RemoteTweakpane=Rn;exports.SceneInspector=ea;exports.SidePanel=Qn;exports.ToolEvents=L;exports.capitalize=Xe;exports.clamp=Ye;exports.colorToHex=Zt;exports.debugDispatcher=N;exports.defaultTheatreCallback=gn;exports.dispose=Dt;exports.disposeMaterial=Qt;exports.disposeTexture=yn;exports.distance=bn;exports.hierarchyUUID=kt;exports.isColor=Xt;exports.mix=_t;exports.noop=jt;exports.normalize=Rt;exports.randomID=Kt;exports.resetThreeObjects=Jt;exports.round=Ke;exports.theatreEditorApp=Sn;
144
+ }`;class ua extends d.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:ca,fragmentShader:la})}}let mt="Renderer",Ie,vt=!1,Wt=!1,G=null,ce=null,Ne=null,Le=null;function da(t){const n=t.three.app.appID,a=localStorage.getItem(`${n}_mode`),e=localStorage.getItem(`${n}_tlCam`)!==null?localStorage.getItem(`${n}_tlCam`):"Debug",i=localStorage.getItem(`${n}_trCam`)!==null?localStorage.getItem(`${n}_trCam`):"Orthographic",c=localStorage.getItem(`${n}_blCam`)!==null?localStorage.getItem(`${n}_blCam`):"Front",f=localStorage.getItem(`${n}_brCam`)!==null?localStorage.getItem(`${n}_brCam`):"Top",s=S.useMemo(()=>new Map,[]),u=S.useMemo(()=>new Map,[]),h=S.useMemo(()=>new Map,[]),p=S.useMemo(()=>new d.Scene,[]),y=S.useMemo(()=>new d.Group,[]),C=S.useMemo(()=>new sa,[]),x=S.useMemo(()=>new d.AxesHelper(500),[]),_=S.useMemo(()=>new d.AxesHelper(100),[]),j=S.useMemo(()=>new d.MeshDepthMaterial,[]),H=S.useMemo(()=>new d.MeshNormalMaterial,[]),$=S.useMemo(()=>new ua,[]),L=S.useMemo(()=>new d.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0}),[]);function T(m,g){const w=new d.OrthographicCamera(-100,100,100,-100,50,3e3);return w.name=m,w.position.copy(g),w.lookAt(0,0,0),s.set(m,w),w}const re=["Renderer","Depth","Normals","UVs","Wireframe"],ee=["Single","Side by Side","Stacked","Quad"],ye=S.useRef(null),W=S.useRef(null),te=S.useRef(null),pe=S.useRef(null),Ue=S.useRef(null),xe=S.useRef(null),[z,le]=S.useState(a!==null?a:"Single"),[O,we]=S.useState(null),[me,Oe]=S.useState(!1),[Re,Me]=S.useState(!1),[Te,Pe]=S.useState(!1),[,Be]=S.useState(Date.now());localStorage.setItem(`${n}_mode`,z),localStorage.setItem(`${n}_tlCam`,e),localStorage.setItem(`${n}_trCam`,i),localStorage.setItem(`${n}_blCam`,c),localStorage.setItem(`${n}_brCam`,f);const ne=(m,g)=>{const w=u.get(m.name);w!==void 0&&w.dispose(),u.delete(m.name);const P=h.get(m.name);P!==void 0&&(p.remove(P),P.dispose()),h.delete(m.name);const q=new ra(m,g);switch(q.enableDamping=!0,q.dampingFactor=.05,m.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":q.enableRotate=!1;break}if(u.set(m.name,q),m instanceof d.PerspectiveCamera){const Z=new d.CameraHelper(m);h.set(m.name,Z),p.add(Z)}},Ee=m=>{const g=h.get(m.name);g!==void 0&&(p.remove(g),g.dispose(),h.delete(m.name));const w=u.get(m.name);w!==void 0&&(w.dispose(),u.delete(m.name))},Qe=()=>{u.forEach((m,g)=>{m.dispose();const w=h.get(g);w!==void 0&&(p.remove(w),w.dispose()),h.delete(g),u.delete(g)}),u.clear(),h.clear()},Ve=()=>{switch(z){case"Single":ne(G,te.current);break;case"Side by Side":case"Stacked":ne(G,te.current),ne(ce,pe.current);break;case"Quad":ne(G,te.current),ne(ce,pe.current),ne(Ne,Ue.current),ne(Le,xe.current);break}};S.useEffect(()=>{const m=new d.WebGLRenderer({canvas:ye.current,stencil:!1});m.autoClear=!1,m.shadowMap.enabled=!0,m.setPixelRatio(devicePixelRatio),m.setClearColor(0),t.three.renderer=m,we(m)},[]),S.useEffect(()=>{p.name="Debug Scene",y.name="helpers",p.add(y),y.add(C),x.name="axisHelper",y.add(x),_.name="interactionHelper",y.add(_),_.visible=!1,T("Top",new d.Vector3(0,1e3,0)),T("Bottom",new d.Vector3(0,-1e3,0)),T("Left",new d.Vector3(-1e3,0,0)),T("Right",new d.Vector3(1e3,0,0)),T("Front",new d.Vector3(0,0,1e3)),T("Back",new d.Vector3(0,0,-1e3)),T("Orthographic",new d.Vector3(1e3,1e3,1e3));const m=new d.PerspectiveCamera(60,1,50,3e3);m.name="Debug",m.position.set(500,500,500),m.lookAt(0,0,0),s.set("Debug",m),G=s.get(localStorage.getItem(`${n}_tlCam`)),ce=s.get(localStorage.getItem(`${n}_trCam`)),Ne=s.get(localStorage.getItem(`${n}_blCam`)),Le=s.get(localStorage.getItem(`${n}_brCam`))},[]),S.useEffect(()=>{const m=P=>{Dt(Ie),p.remove(Ie);const q=t.scenes.get(P.value.name);if(q!==void 0){const Z=new q;t.onSceneSet!==void 0&&t.onSceneSet(Z),Ie=Z,t.three.scene=Ie,p.add(Ie),Wt=!0}},g=P=>{const q=P.value,Z=t.three.scene?.getObjectByProperty("uuid",q.uuid);Z!==void 0&&s.set(q.name,Z),Be(Date.now())},w=P=>{s.delete(P.value.name),Be(Date.now())};return I.addEventListener(N.SET_SCENE,m),I.addEventListener(N.ADD_CAMERA,g),I.addEventListener(N.REMOVE_CAMERA,w),()=>{I.removeEventListener(N.SET_SCENE,m),I.removeEventListener(N.ADD_CAMERA,g),I.removeEventListener(N.REMOVE_CAMERA,w)}},[]),S.useEffect(()=>{if(O===null)return;let m=window.innerWidth,g=window.innerHeight,w=Math.floor(m/2),P=Math.floor(g/2),q=-1;const Z=()=>{m=window.innerWidth-300,g=window.innerHeight,w=Math.floor(m/2),P=Math.floor(g/2),O.setSize(m,g);let k=m,U=g;switch(z){case"Side by Side":k=w,U=g;break;case"Stacked":k=m,U=P;break;case"Quad":k=w,U=P;break}s.forEach(ie=>{ie instanceof d.OrthographicCamera?(ie.left=k/-2,ie.right=k/2,ie.top=U/2,ie.bottom=U/-2,ie.updateProjectionMatrix()):ie instanceof d.PerspectiveCamera&&(ie.aspect=k/U,ie.updateProjectionMatrix(),h.get(ie.name)?.update())})},de=()=>{O.setViewport(0,0,m,g),O.setScissor(0,0,m,g),O.render(p,G)},Y=()=>{if(z==="Side by Side")O.setViewport(0,0,w,g),O.setScissor(0,0,w,g),O.render(p,G),O.setViewport(w,0,w,g),O.setScissor(w,0,w,g),O.render(p,ce);else{const k=g-P;O.setViewport(0,k,m,P),O.setScissor(0,k,m,P),O.render(p,G),O.setViewport(0,0,m,P),O.setScissor(0,0,m,P),O.render(p,ce)}},J=()=>{let k=0,U=0;U=g-P,k=0,O.setViewport(k,U,w,P),O.setScissor(k,U,w,P),O.render(p,G),k=w,O.setViewport(k,U,w,P),O.setScissor(k,U,w,P),O.render(p,ce),U=0,k=0,O.setViewport(k,U,w,P),O.setScissor(k,U,w,P),O.render(p,Ne),k=w,O.setViewport(k,U,w,P),O.setScissor(k,U,w,P),O.render(p,Le)},oe=()=>{switch(u.forEach(k=>{k.update()}),t.onSceneUpdate!==void 0&&Wt&&t.onSceneUpdate(Ie),O.clear(),z){case"Single":de();break;case"Side by Side":case"Stacked":Y();break;case"Quad":J();break}q=requestAnimationFrame(oe)};return Ve(),window.addEventListener("resize",Z),Z(),oe(),()=>{window.removeEventListener("resize",Z),cancelAnimationFrame(q),q=-1}},[z,O]),S.useEffect(()=>{if(O!==null){const m=new d.Raycaster,g=new d.Vector2,w=(de,Y,J,oe)=>{switch(z){case"Quad":de<J?Y<oe?m.setFromCamera(g,G):m.setFromCamera(g,Ne):Y<oe?m.setFromCamera(g,ce):m.setFromCamera(g,Le);break;case"Side by Side":de<J?m.setFromCamera(g,G):m.setFromCamera(g,ce);break;case"Single":m.setFromCamera(g,G);break;case"Stacked":Y<oe?m.setFromCamera(g,G):m.setFromCamera(g,ce);break}},P=de=>{if(!vt)return;const Y=new d.Vector2;O.getSize(Y);const J=Math.min(de.clientX,Y.x),oe=Math.min(de.clientY,Y.y);g.x=Ze(J,0,Y.x,-1,1),g.y=Ze(oe,0,Y.y,1,-1);const k=Y.x/2,U=Y.y/2,ie=()=>{J<k?g.x=Ze(J,0,k,-1,1):g.x=Ze(J,k,Y.x,-1,1)},Se=()=>{oe<U?g.y=Ze(oe,0,U,1,-1):g.y=Ze(oe,U,Y.y,1,-1)};switch(z){case"Quad":ie(),Se();break;case"Side by Side":ie();break;case"Stacked":Se(),Se();break}w(J,oe,k,U);const je=m.intersectObjects(Ie.children);je.length>0&&_.position.copy(je[0].point)},q=de=>{if(!vt)return;const Y=new d.Vector2;if(O.getSize(Y),de.clientX>=Y.x)return;P(de);const J=m.intersectObjects(Ie.children);J.length>0&&t.three.getObject(J[0].object.uuid)},Z=W.current;return Z.addEventListener("mousemove",P,!1),Z.addEventListener("click",q,!1),()=>{Z.removeEventListener("mousemove",P),Z.removeEventListener("click",q)}}},[z,O]);const fe=[];return s.forEach((m,g)=>{fe.push(g)}),l.jsxs("div",{className:"multiview",children:[l.jsx("canvas",{ref:ye}),O!==null&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`cameras ${z==="Single"||z==="Stacked"?"single":""}`,ref:W,children:[z==="Single"&&l.jsx(l.Fragment,{children:l.jsx(He,{camera:G,options:fe,ref:te,onSelect:m=>{u.get(G.name)?.dispose();const g=s.get(m);g!==void 0&&(Ee(G),G=g,localStorage.setItem(`${n}_tlCam`,g.name),ne(g,te.current))}})}),(z==="Side by Side"||z==="Stacked")&&l.jsxs(l.Fragment,{children:[l.jsx(He,{camera:G,options:fe,ref:te,onSelect:m=>{u.get(G.name)?.dispose();const g=s.get(m);g!==void 0&&(Ee(G),G=g,localStorage.setItem(`${n}_tlCam`,g.name),ne(g,te.current))}}),l.jsx(He,{camera:ce,options:fe,ref:pe,onSelect:m=>{u.get(ce.name)?.dispose();const g=s.get(m);g!==void 0&&(Ee(ce),ce=g,localStorage.setItem(`${n}_trCam`,g.name),ne(g,pe.current))}})]}),z==="Quad"&&l.jsxs(l.Fragment,{children:[l.jsx(He,{camera:G,options:fe,ref:te,onSelect:m=>{u.get(G.name)?.dispose();const g=s.get(m);g!==void 0&&(Ee(G),G=g,localStorage.setItem(`${n}_tlCam`,g.name),ne(g,te.current))}}),l.jsx(He,{camera:ce,options:fe,ref:pe,onSelect:m=>{u.get(ce.name)?.dispose();const g=s.get(m);g!==void 0&&(Ee(ce),ce=g,localStorage.setItem(`${n}_trCam`,g.name),ne(g,pe.current))}}),l.jsx(He,{camera:Ne,options:fe,ref:Ue,onSelect:m=>{u.get(Ne.name)?.dispose();const g=s.get(m);g!==void 0&&(Ee(Ne),Ne=g,localStorage.setItem(`${n}_blCam`,g.name),ne(g,Ue.current))}}),l.jsx(He,{camera:Le,options:fe,ref:xe,onSelect:m=>{u.get(Le.name)?.dispose();const g=s.get(m);g!==void 0&&(Ee(Le),Le=g,localStorage.setItem(`${n}_brCam`,g.name),ne(g,xe.current))}})]})]}),l.jsxs("div",{className:"settings",children:[l.jsx(gt,{index:ee.indexOf(z),options:ee,onSelect:m=>{m!==z&&(Qe(),le(m))},open:me,onToggle:m=>{Oe(m),Re&&Me(!1),Te&&Pe(!1)}}),l.jsx(gt,{index:re.indexOf(mt),options:re,onSelect:m=>{if(m!==mt)switch(mt=m,mt){case"Depth":p.overrideMaterial=j;break;case"Normals":p.overrideMaterial=H;break;default:case"Renderer":p.overrideMaterial=null;break;case"Wireframe":p.overrideMaterial=L;break;case"UVs":p.overrideMaterial=$;break}},open:Re,onToggle:m=>{me&&Oe(!1),Me(m),Te&&Pe(!1)}}),l.jsx(gt,{index:0,options:["Orbit Mode","Selection Mode"],onSelect:m=>{vt=m==="Selection Mode",_.visible=vt},open:Te,onToggle:m=>{me&&Oe(!1),Re&&Me(!1),Pe(m)}})]})]})]})}function ha(t){return l.jsxs("div",{className:"editor",ref:t.ref,style:t.style,children:[l.jsx("div",{className:"header",children:t.header}),t.children,l.jsx("div",{className:"footer",children:t.footer})]})}exports.Accordion=yt;exports.Application=En;exports.BaseRemote=ct;exports.ChildObject=Nt;exports.ContainerObject=on;exports.Draggable=nn;exports.DraggableItem=tn;exports.Dropdown=an;exports.DropdownItem=rn;exports.Editor=ha;exports.Inspector=cn;exports.MultiView=da;exports.NavButton=It;exports.RemoteComponents=Sn;exports.RemoteController=kn;exports.RemoteTheatre=bt;exports.RemoteThree=Tn;exports.RemoteTweakpane=_n;exports.SceneInspector=aa;exports.SidePanel=na;exports.ToolEvents=N;exports.capitalize=st;exports.clamp=Fe;exports.colorToHex=Zt;exports.debugDispatcher=I;exports.defaultTheatreCallback=gn;exports.dispose=Dt;exports.disposeMaterial=Qt;exports.disposeTexture=yn;exports.distance=bn;exports.hierarchyUUID=kt;exports.isColor=Xt;exports.mix=Rt;exports.noop=jt;exports.normalize=_t;exports.randomID=Kt;exports.resetThreeObjects=Jt;exports.round=Je;exports.theatreEditorApp=Cn;