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