@tomorrowevening/hermes 0.0.54 → 0.0.55

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