@tomorrowevening/hermes 0.0.7 → 0.0.9
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.js +1588 -1494
- package/dist/hermes.umd.cjs +52 -14
- package/package.json +3 -1
- package/src/editor/sceneHierarchy/inspector/Inspector.tsx +5 -3
- package/src/editor/sceneHierarchy/inspector/MultiView/MultiView.tsx +13 -69
- package/src/editor/sceneHierarchy/inspector/MultiView/MultiViewData.ts +67 -0
- package/src/editor/sceneHierarchy/inspector/MultiView/UVMaterial.ts +55 -0
- package/src/editor/sceneHierarchy/inspector/utils/InspectCamera.tsx +1 -1
- package/src/editor/sceneHierarchy/inspector/utils/InspectLight.tsx +3 -3
- package/src/editor/sceneHierarchy/inspector/utils/InspectMaterial.tsx +24 -8
- package/src/editor/sceneHierarchy/utils.ts +29 -23
- package/src/index.ts +2 -1
- package/types/editor/sceneHierarchy/inspector/MultiView/MultiView.d.ts +1 -1
- package/types/editor/sceneHierarchy/inspector/MultiView/MultiViewData.d.ts +16 -0
- package/types/editor/sceneHierarchy/inspector/MultiView/UVMaterial.d.ts +4 -0
- package/types/editor/sceneHierarchy/inspector/utils/InspectCamera.d.ts +1 -1
- package/types/editor/sceneHierarchy/inspector/utils/InspectLight.d.ts +1 -1
- package/types/editor/sceneHierarchy/inspector/utils/InspectMaterial.d.ts +1 -1
- package/types/index.d.ts +2 -1
package/dist/hermes.umd.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
(function(
|
1
|
+
(function(C,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("three"),require("@theatre/core"),require("tweakpane"),require("@tweakpane/plugin-essentials"),require("react"),require("framer-motion"),require("@theatre/studio")):typeof define=="function"&&define.amd?define(["exports","three","@theatre/core","tweakpane","@tweakpane/plugin-essentials","react","framer-motion","@theatre/studio"],m):(C=typeof globalThis<"u"?globalThis:C||self,m(C.Hermes={},C.Three,C["Theatre Core"],C.tweakpane,C["tweakpane-plugin-essentials"],C.React,C["framer-motion"],C["Theatre Studio"]))})(this,function(C,m,ge,an,rn,_,Mt,Ve){"use strict";var ea=Object.defineProperty;var ta=(C,m,ge)=>m in C?ea(C,m,{enumerable:!0,configurable:!0,writable:!0,value:ge}):C[m]=ge;var V=(C,m,ge)=>(ta(C,typeof m!="symbol"?m+"":m,ge),ge);function on(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const e=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,e.get?e:{enumerable:!0,get:()=>t[i]})}}return n.default=t,Object.freeze(n)}const sn=on(rn);function cn(t,n,i){return Math.min(n,Math.max(t,i))}function ln(t,n){const i=t-n;return Math.sqrt(i*i)}function Pt(){return Math.round(Math.random()*1e6).toString()}function jt(t){return t.r!==void 0&&t.g!==void 0&&t.b!==void 0}function _t(t){const n=Math.round(t.r*255),i=Math.round(t.g*255),e=Math.round(t.b*255),o=d=>{const g=d.toString(16);return g.length===1?"0"+g:g},u=o(n),c=o(i),s=o(e);return"#"+u+c+s}let kt=0;const mt=t=>{if(!t)return;let n=t.name.replace(" ","");n.length===0&&(n=`obj_${kt}`),t.parent!==null&&(n=`${t.parent.uuid}.${n}`),t.uuid=n,kt++,t.children.forEach(i=>{mt(i)})};class un{constructor(n,i,e){V(this,"channel");V(this,"components",new Map);V(this,"_mode","app");this.editor=i&&document.location.hash.search(e)>-1,i&&(this.channel=new BroadcastChannel(n))}addComponent(n,i){this.components.set(n,i)}dispose(){this.components.forEach(n=>{n.dispose()}),this.components.clear()}send(n){this.channel!==void 0&&this._mode!==n.target&&this.channel.postMessage(n)}listen(n){this.channel!==void 0&&(this.channel.onmessage=i=>{n(i.data)})}get mode(){return this._mode}get editor(){return this._mode==="editor"}set editor(n){n&&(this._mode="editor",document.title+=" - Editor")}}const A=new m.EventDispatcher,N={CUSTOM:"ToolEvents::custom",SELECT_DROPDOWN:"ToolEvents::selectDropdown",DRAG_UPDATE:"ToolEvents::dragUpdate",GET_SCENE:"ToolEvents::getScene",SET_SCENE:"ToolEvents::setScene",GET_OBJECT:"ToolEvents::getObject",SET_OBJECT:"ToolEvents::setObject",UPDATE_OBJECT:"ToolEvents::updateObject",CREATE_TEXTURE:"ToolEvents::createTexture",REQUEST_METHOD:"ToolEvents::requestMethod"};class Be{constructor(n){V(this,"app");this.app=n}dispose(){}}class dn extends Be{selectDropdown(n,i){this.app.send({event:"selectComponent",target:"app",data:{dropdown:n,value:i}})}updateDropdown(n,i){this.app.send({event:"draggableListUpdate",target:"app",data:{dropdown:n,value:i}})}}const Dt=()=>{};class fn extends Be{constructor(i,e,o){super(i);V(this,"project");V(this,"sheets");V(this,"sheetObjects");V(this,"sheetObjectCBs");V(this,"sheetObjectUnsubscribe");this.project=ge.getProject(e,o),this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}dispose(){this.project=void 0,this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}sheet(i){var o;if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}let e=this.sheets.get(i);return e!==void 0||(e=(o=this.project)==null?void 0:o.sheet(i),this.sheets.set(i,e)),e}sheetObject(i,e,o,u){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const c=this.sheets.get(i);if(c===void 0)return;const s=`${i}_${e}`;let d=this.sheetObjects.get(s);if(d!==void 0)return d=c.object(e,{...o,...d.value},{reconfigure:!0}),d;d=c.object(e,o),this.sheetObjects.set(s,d),this.sheetObjectCBs.set(s,u!==void 0?u:Dt);const g=d.onValuesChange(b=>{if(this.app.editor){for(const f in b){const h=b[f];typeof h=="object"&&jt(h)&&(b[f]={r:h.r,g:h.g,b:h.b,a:h.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheetObject:s,values:b}})}else{const f=this.sheetObjectCBs.get(s);f!==void 0&&f(b)}});return this.sheetObjectUnsubscribe.set(s,g),d}unsubscribe(i){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const e=`${i.address.sheetId}_${i.address.objectKey}`,o=this.sheetObjectUnsubscribe.get(e);o!==void 0&&o()}}function hn(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 It(t){const n={name:t.name,type:t.type,uuid:t.uuid,children:[]};return t.children.forEach(i=>{n.children.push(It(i))}),n}function pn(t){const n={};for(const i in t){const e=t[i].value;n[i]={value:e},e===null?n[i].value={src:""}:e.isTexture&&(n[i].value={src:e.image.src})}return n}function mn(t){switch(t){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function At(t){const n={};for(const i in t){if(i.substring(0,1)==="_"||i.substring(0,2)==="is"||mn(i))continue;const e=typeof t[i],o=t[i];switch(e){case"boolean":case"number":case"string":n[i]=o;break;case"object":if(o!==null)if(n[i]=o,o.isTexture)if(o instanceof m.Texture){const u=o.source.toJSON();n[i]={src:u.url}}else o instanceof m.CubeTexture&&(console.log("env map"),console.log(o.source.data),console.log(o.source.toJSON()),n[i]={src:""});else i==="uniforms"&&(n[i]=pn(n[i]));else n[i]={src:""};break}}return n}function gn(t){t.updateMatrix();const n={name:t.name,type:t.type,uuid:t.uuid,visible:t.visible,matrix:t.matrix.elements,material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0},i=t.type.toLowerCase();if(i.search("mesh")>-1){const e=t;if(Array.isArray(e.material)){const o=[];e.material.forEach(u=>{o.push(At(u))}),n.material=o}else n.material=At(e.material)}else i.search("camera")>-1?t.type==="PerspectiveCamera"?n.perspectiveCameraInfo={fov:t.fov,zoom:t.zoom,near:t.near,far:t.far,focus:t.focus,aspect:t.aspect,filmGauge:t.filmGauge,filmOffset:t.filmOffset}:t.type==="OrthographicCamera"&&(n.orthographicCameraInfo={zoom:t.zoom,near:t.near,far:t.far,left:t.left,right:t.right,top:t.top,bottom:t.bottom}):i.search("light")>-1&&(n.lightInfo={color:t.color,intensity:t.intensity,decay:t.decay,distance:t.distance,angle:t.angle,penumbra:t.penumbra,groundColor:t.groundColor});return n}function K(t,n,i){const e=n.split(".");switch(e.length){case 1:t[e[0]]=i;break;case 2:t[e[0]][e[1]]=i;break;case 3:t[e[0]][e[1]][e[2]]=i;break;case 4:t[e[0]][e[1]][e[2]][e[3]]=i;break;case 5:t[e[0]][e[1]][e[2]][e[3]][e[4]]=i;break}}function gt(t){return new Promise((n,i)=>{const e=new Image;e.onload=()=>{const o=new m.Texture(e);o.wrapS=m.RepeatWrapping,o.wrapT=m.RepeatWrapping,o.needsUpdate=!0,n(o)},e.onerror=i,e.src=t})}class vn extends Be{constructor(){super(...arguments);V(this,"scene")}getObject(i){this.app.send({event:"getObject",target:"app",data:i})}setObject(i){const e=gn(i);this.app.send({event:"setObject",target:"editor",data:e})}requestMethod(i,e,o){this.app.send({event:"requestMethod",target:"app",data:{uuid:i,key:e,value:o}})}updateObject(i,e,o){this.app.send({event:"updateObject",target:"app",data:{uuid:i,key:e,value:o}})}createTexture(i,e,o){this.app.send({event:"createTexture",target:"app",data:{uuid:i,key:e,value:o}})}getScene(){this.app.send({event:"getScene",target:"app"})}setScene(i){this.scene=i,mt(i);const e=It(i);this.app.send({event:"setScene",target:"editor",data:e})}}class bn extends Be{constructor(i){super(i);V(this,"bindCBs");V(this,"buttonCBs");V(this,"pane");V(this,"appCallbacks",0);V(this,"editorCallbacks",0);V(this,"inspectorFolder");this.bindCBs=new Map,this.buttonCBs=new Map,i.editor&&this.createGUI()}createGUI(){this.pane=new an.Pane({title:"GUI"}),this.pane.registerPlugin(sn)}dispose(){var i;this.bindCBs.clear(),this.buttonCBs.clear(),this.appCallbacks=0,this.editorCallbacks=0,this.app.editor&&((i=this.pane)==null||i.dispose(),this.pane=void 0)}addFolder(i,e=void 0,o=void 0){if(this.app.editor)return this.pane===void 0&&this.createGUI(),(o!==void 0?o:this.pane).addFolder({title:i,...e});this.app.send({event:"addFolder",target:"app",data:{name:i,params:e,parent:o}})}get bindID(){return`debug_${Math.max(this.appCallbacks,this.editorCallbacks)}`}bind(i,e,o,u=void 0){const c=this.bindID,s=o.onChange!==void 0?o.onChange:Dt;this.bindCBs.set(c,s),this.app.editor?(this.pane===void 0&&this.createGUI(),(u!==void 0?u:this.pane).addBinding(i,e,o).on("change",g=>{this.app.send({event:"updateBind",target:"app",data:{id:c,value:g.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",target:"app",data:{id:c,name:e,params:o,parent:u}}),this.appCallbacks++)}triggerBind(i,e){const o=this.bindCBs.get(i);o!==void 0?o(e):console.warn(`No callback for: ${i}`,e)}button(i,e,o=void 0){const u=this.bindID;this.buttonCBs.set(u,e),this.app.editor?(this.pane===void 0&&this.createGUI(),(o!==void 0?o:this.pane).addButton({title:i}).on("click",()=>{this.app.send({event:"clickButton",target:"app",data:{id:u}})}),this.editorCallbacks++):(this.app.send({event:"addButton",target:"app",data:{id:u,name:i,callback:e,parent:o}}),this.appCallbacks++)}triggerButton(i){const e=this.buttonCBs.get(i);e!==void 0&&e()}createInspector(){this.inspectorFolder=this.addFolder("Inspector",this.pane)}clearInspector(){const i=this.inspectorFolder.children.length-1;for(let e=i;e>-1;--e)this.inspectorFolder.remove(this.inspectorFolder.children[e])}}var vt={exports:{}},Ge={};/**
|
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
|
9
|
+
*/var Nt;function yn(){if(Nt)return Ge;Nt=1;var t=_,n=Symbol.for("react.element"),i=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function c(s,d,g){var b,f={},h=null,v=null;g!==void 0&&(h=""+g),d.key!==void 0&&(h=""+d.key),d.ref!==void 0&&(v=d.ref);for(b in d)e.call(d,b)&&!u.hasOwnProperty(b)&&(f[b]=d[b]);if(s&&s.defaultProps)for(b in d=s.defaultProps,d)f[b]===void 0&&(f[b]=d[b]);return{$$typeof:n,type:s,key:h,ref:v,props:f,_owner:o.current}}return Ge.Fragment=i,Ge.jsx=c,Ge.jsxs=c,Ge}var Ye={};/**
|
10
10
|
* @license React
|
11
11
|
* react-jsx-runtime.development.js
|
12
12
|
*
|
@@ -14,20 +14,19 @@
|
|
14
14
|
*
|
15
15
|
* This source code is licensed under the MIT license found in the
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
17
|
-
*/var
|
18
|
-
`+
|
19
|
-
`)
|
20
|
-
`),
|
21
|
-
`+
|
17
|
+
*/var Lt;function En(){return Lt||(Lt=1,process.env.NODE_ENV!=="production"&&function(){var t=_,n=Symbol.for("react.element"),i=Symbol.for("react.portal"),e=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),s=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),w=Symbol.iterator,S="@@iterator";function U(a){if(a===null||typeof a!="object")return null;var p=w&&a[w]||a[S];return typeof p=="function"?p:null}var B=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function D(a){{for(var p=arguments.length,y=new Array(p>1?p-1:0),x=1;x<p;x++)y[x-1]=arguments[x];Q("error",a,y)}}function Q(a,p,y){{var x=B.ReactDebugCurrentFrame,P=x.getStackAddendum();P!==""&&(p+="%s",y=y.concat([P]));var I=y.map(function(R){return String(R)});I.unshift("Warning: "+p),Function.prototype.apply.call(console[a],console,I)}}var ee=!1,Z=!1,M=!1,T=!1,z=!1,Ee;Ee=Symbol.for("react.module.reference");function _e(a){return!!(typeof a=="string"||typeof a=="function"||a===e||a===u||z||a===o||a===g||a===b||T||a===v||ee||Z||M||typeof a=="object"&&a!==null&&(a.$$typeof===h||a.$$typeof===f||a.$$typeof===c||a.$$typeof===s||a.$$typeof===d||a.$$typeof===Ee||a.getModuleId!==void 0))}function we(a,p,y){var x=a.displayName;if(x)return x;var P=p.displayName||p.name||"";return P!==""?y+"("+P+")":y}function Ce(a){return a.displayName||"Context"}function ae(a){if(a==null)return null;if(typeof a.tag=="number"&&D("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case e:return"Fragment";case i:return"Portal";case u:return"Profiler";case o:return"StrictMode";case g:return"Suspense";case b:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case s:var p=a;return Ce(p)+".Consumer";case c:var y=a;return Ce(y._context)+".Provider";case d:return we(a,a.render,"ForwardRef");case f:var x=a.displayName||null;return x!==null?x:ae(a.type)||"Memo";case h:{var P=a,I=P._payload,R=P._init;try{return ae(R(I))}catch{return null}}}return null}var oe=Object.assign,ie=0,ke,He,De,Ie,We,at,Ke;function it(){}it.__reactDisabledLog=!0;function xt(){{if(ie===0){ke=console.log,He=console.info,De=console.warn,Ie=console.error,We=console.group,at=console.groupCollapsed,Ke=console.groupEnd;var a={configurable:!0,enumerable:!0,value:it,writable:!0};Object.defineProperties(console,{info:a,log:a,warn:a,error:a,group:a,groupCollapsed:a,groupEnd:a})}ie++}}function St(){{if(ie--,ie===0){var a={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:oe({},a,{value:ke}),info:oe({},a,{value:He}),warn:oe({},a,{value:De}),error:oe({},a,{value:Ie}),group:oe({},a,{value:We}),groupCollapsed:oe({},a,{value:at}),groupEnd:oe({},a,{value:Ke})})}ie<0&&D("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Xe=B.ReactCurrentDispatcher,Ze;function xe(a,p,y){{if(Ze===void 0)try{throw Error()}catch(P){var x=P.stack.trim().match(/\n( *(at )?)/);Ze=x&&x[1]||""}return`
|
18
|
+
`+Ze+a}}var Ae=!1,Se;{var Ot=typeof WeakMap=="function"?WeakMap:Map;Se=new Ot}function rt(a,p){if(!a||Ae)return"";{var y=Se.get(a);if(y!==void 0)return y}var x;Ae=!0;var P=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var I;I=Xe.current,Xe.current=null,xt();try{if(p){var R=function(){throw Error()};if(Object.defineProperty(R.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(R,[])}catch(de){x=de}Reflect.construct(a,[],R)}else{try{R.call()}catch(de){x=de}a.call(R.prototype)}}else{try{throw Error()}catch(de){x=de}a()}}catch(de){if(de&&x&&typeof de.stack=="string"){for(var O=de.stack.split(`
|
19
|
+
`),J=x.stack.split(`
|
20
|
+
`),F=O.length-1,G=J.length-1;F>=1&&G>=0&&O[F]!==J[G];)G--;for(;F>=1&&G>=0;F--,G--)if(O[F]!==J[G]){if(F!==1||G!==1)do if(F--,G--,G<0||O[F]!==J[G]){var re=`
|
21
|
+
`+O[F].replace(" at new "," at ");return a.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",a.displayName)),typeof a=="function"&&Se.set(a,re),re}while(F>=1&&G>=0);break}}}finally{Ae=!1,Xe.current=I,St(),Error.prepareStackTrace=P}var Fe=a?a.displayName||a.name:"",nn=Fe?xe(Fe):"";return typeof a=="function"&&Se.set(a,nn),nn}function ot(a,p,y){return rt(a,!1)}function st(a){var p=a.prototype;return!!(p&&p.isReactComponent)}function Oe(a,p,y){if(a==null)return"";if(typeof a=="function")return rt(a,st(a));if(typeof a=="string")return xe(a);switch(a){case g:return xe("Suspense");case b:return xe("SuspenseList")}if(typeof a=="object")switch(a.$$typeof){case d:return ot(a.render);case f:return Oe(a.type,p,y);case h:{var x=a,P=x._payload,I=x._init;try{return Oe(I(P),p,y)}catch{}}}return""}var Ne=Object.prototype.hasOwnProperty,ct={},Je=B.ReactDebugCurrentFrame;function he(a){if(a){var p=a._owner,y=Oe(a.type,a._source,p?p.type:null);Je.setExtraStackFrame(y)}else Je.setExtraStackFrame(null)}function Te(a,p,y,x,P){{var I=Function.call.bind(Ne);for(var R in a)if(I(a,R)){var O=void 0;try{if(typeof a[R]!="function"){var J=Error((x||"React class")+": "+y+" type `"+R+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[R]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw J.name="Invariant Violation",J}O=a[R](p,R,x,y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(F){O=F}O&&!(O instanceof Error)&&(he(P),D("%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).",x||"React class",y,R,typeof O),he(null)),O instanceof Error&&!(O.message in ct)&&(ct[O.message]=!0,he(P),D("Failed %s type: %s",y,O.message),he(null))}}}var Tt=Array.isArray;function Qe(a){return Tt(a)}function lt(a){{var p=typeof Symbol=="function"&&Symbol.toStringTag,y=p&&a[Symbol.toStringTag]||a.constructor.name||"Object";return y}}function qe(a){try{return ut(a),!1}catch{return!0}}function ut(a){return""+a}function dt(a){if(qe(a))return D("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",lt(a)),ut(a)}var pe=B.ReactCurrentOwner,Rt={key:!0,ref:!0,__self:!0,__source:!0},ft,$e,se;se={};function r(a){if(Ne.call(a,"ref")){var p=Object.getOwnPropertyDescriptor(a,"ref").get;if(p&&p.isReactWarning)return!1}return a.ref!==void 0}function E(a){if(Ne.call(a,"key")){var p=Object.getOwnPropertyDescriptor(a,"key").get;if(p&&p.isReactWarning)return!1}return a.key!==void 0}function j(a,p){if(typeof a.ref=="string"&&pe.current&&p&&pe.current.stateNode!==p){var y=ae(pe.current.type);se[y]||(D('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',ae(pe.current.type),a.ref),se[y]=!0)}}function k(a,p){{var y=function(){ft||(ft=!0,D("%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(a,"key",{get:y,configurable:!0})}}function H(a,p){{var y=function(){$e||($e=!0,D("%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(a,"ref",{get:y,configurable:!0})}}var ce=function(a,p,y,x,P,I,R){var O={$$typeof:n,type:a,key:p,ref:y,props:R,_owner:I};return O._store={},Object.defineProperty(O._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(O,"_self",{configurable:!1,enumerable:!1,writable:!1,value:x}),Object.defineProperty(O,"_source",{configurable:!1,enumerable:!1,writable:!1,value:P}),Object.freeze&&(Object.freeze(O.props),Object.freeze(O)),O};function q(a,p,y,x,P){{var I,R={},O=null,J=null;y!==void 0&&(dt(y),O=""+y),E(p)&&(dt(p.key),O=""+p.key),r(p)&&(J=p.ref,j(p,P));for(I in p)Ne.call(p,I)&&!Rt.hasOwnProperty(I)&&(R[I]=p[I]);if(a&&a.defaultProps){var F=a.defaultProps;for(I in F)R[I]===void 0&&(R[I]=F[I])}if(O||J){var G=typeof a=="function"?a.displayName||a.name||"Unknown":a;O&&k(R,G),J&&H(R,G)}return ce(a,O,J,P,x,pe.current,R)}}var ht=B.ReactCurrentOwner,pt=B.ReactDebugCurrentFrame;function ue(a){if(a){var p=a._owner,y=Oe(a.type,a._source,p?p.type:null);pt.setExtraStackFrame(y)}else pt.setExtraStackFrame(null)}var te;te=!1;function ne(a){return typeof a=="object"&&a!==null&&a.$$typeof===n}function Le(){{if(ht.current){var a=ae(ht.current.type);if(a)return`
|
22
22
|
|
23
|
-
Check the render method of \``+a+"`."}return""}}function
|
23
|
+
Check the render method of \``+a+"`."}return""}}function Re(a){{if(a!==void 0){var p=a.fileName.replace(/^.*[\\\/]/,""),y=a.lineNumber;return`
|
24
24
|
|
25
|
-
Check your code at `+
|
25
|
+
Check your code at `+p+":"+y+"."}return""}}var me={};function Ue(a){{var p=Le();if(!p){var y=typeof a=="string"?a:a.displayName||a.name;y&&(p=`
|
26
26
|
|
27
|
-
Check the top-level render call using <`+
|
27
|
+
Check the top-level render call using <`+y+">.")}return p}}function $t(a,p){{if(!a._store||a._store.validated||a.key!=null)return;a._store.validated=!0;var y=Ue(p);if(me[y])return;me[y]=!0;var x="";a&&a._owner&&a._owner!==ht.current&&(x=" It was passed a child from "+ae(a._owner.type)+"."),ue(a),D('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',y,x),ue(null)}}function en(a,p){{if(typeof a!="object")return;if(Qe(a))for(var y=0;y<a.length;y++){var x=a[y];ne(x)&&$t(x,p)}else if(ne(a))a._store&&(a._store.validated=!0);else if(a){var P=U(a);if(typeof P=="function"&&P!==a.entries)for(var I=P.call(a),R;!(R=I.next()).done;)ne(R.value)&&$t(R.value,p)}}}function Xn(a){{var p=a.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===f))y=p.propTypes;else return;if(y){var x=ae(p);Te(y,a.props,"prop",x,a)}else if(p.PropTypes!==void 0&&!te){te=!0;var P=ae(p);D("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",P||"Unknown")}typeof p.getDefaultProps=="function"&&!p.getDefaultProps.isReactClassApproved&&D("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Zn(a){{for(var p=Object.keys(a.props),y=0;y<p.length;y++){var x=p[y];if(x!=="children"&&x!=="key"){ue(a),D("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",x),ue(null);break}}a.ref!==null&&(ue(a),D("Invalid attribute `ref` supplied to `React.Fragment`."),ue(null))}}function tn(a,p,y,x,P,I){{var R=_e(a);if(!R){var O="";(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(O+=" 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 J=Re(P);J?O+=J:O+=Le();var F;a===null?F="null":Qe(a)?F="array":a!==void 0&&a.$$typeof===n?(F="<"+(ae(a.type)||"Unknown")+" />",O=" Did you accidentally export a JSX literal instead of a component?"):F=typeof a,D("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",F,O)}var G=q(a,p,y,P,I);if(G==null)return G;if(R){var re=p.children;if(re!==void 0)if(x)if(Qe(re)){for(var Fe=0;Fe<re.length;Fe++)en(re[Fe],a);Object.freeze&&Object.freeze(re)}else D("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 en(re,a)}return a===e?Zn(G):Xn(G),G}}function Jn(a,p,y){return tn(a,p,y,!0)}function Qn(a,p,y){return tn(a,p,y,!1)}var qn=Qn,$n=Jn;Ye.Fragment=e,Ye.jsx=qn,Ye.jsxs=$n}()),Ye}process.env.NODE_ENV==="production"?vt.exports=yn():vt.exports=En();var l=vt.exports;function bt(t){return t.title.search("<")>-1?l.jsx("button",{className:"svg",dangerouslySetInnerHTML:{__html:t.title}}):l.jsx("button",{children:t.title})}const wn=l.jsxs("svg",{className:"closeIcon",width:"14",height:"14",fill:"none",stroke:"#666666",strokeMiterlimit:"10",children:[l.jsx("circle",{cx:"7",cy:"7",r:"6"}),l.jsx("line",{x1:"4",y1:"4",x2:"10",y2:"10"}),l.jsx("line",{x1:"4",y1:"10",x2:"10",y2:"4"})]}),Cn=l.jsx("svg",{className:"dragIcon",width:"14",height:"14",fill:"#666666",stroke:"none",children:l.jsx("path",{d:`M10.43,4H3.57C3.26,4,3,4.22,3,4.5v1C3,5.78,3.26,6,3.57,6h6.86C10.74,6,11,5.78,11,5.5v-1
|
28
28
|
C11,4.22,10.74,4,10.43,4z M10.43,8H3.57C3.26,8,3,8.22,3,8.5v1C3,9.78,3.26,10,3.57,10h6.86C10.74,10,11,9.78,11,9.5v-1
|
29
|
-
C11,8.22,10.74,8,10.43,8z`})});function Dt(t){return l.jsx(Ct.Reorder.Item,{value:t.title,children:l.jsxs("div",{children:[pn,l.jsx("span",{children:t.title}),l.jsx("button",{className:"closeIcon",onClick:()=>{t.onDelete(t.index)},children:mn})]})},t.title)}function _t(t){const[n,i]=I.useState(!1),[e,r]=I.useState(t.options),d=m=>{t.onDragComplete(m),r(m)},c=m=>{const p=[...e];p.splice(m,1),d(p)},s=[];e.forEach((m,p)=>{s.push(l.jsx(Dt,{index:p,title:m,onDelete:c},m))});let u="dropdown draggable";return t.subdropdown&&(u+=" subdropdown"),l.jsxs("div",{className:u,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[l.jsx(ft,{title:t.title}),l.jsx(Ct.Reorder.Group,{axis:"y",values:e,onReorder:d,style:{visibility:n?"visible":"hidden"},children:s})]})}function It(t){const[n,i]=I.useState(!1),e=[];t.options.map((d,c)=>{t.onSelect!==void 0&&(d.onSelect=t.onSelect),e.push(l.jsx(At,{option:d},c))});let r="dropdown";return t.subdropdown&&(r+=" subdropdown"),l.jsxs("div",{className:r,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[l.jsx(ft,{title:t.title}),l.jsx("ul",{style:{visibility:n?"visible":"hidden"},children:e})]})}function At(t){const{option:n}=t,[i,e]=I.useState("");let r;switch(n.type){case"draggable":r=l.jsx(_t,{title:n.title,options:n.value,onDragComplete:d=>{n.onDragComplete!==void 0&&n.onDragComplete(d)},subdropdown:!0});break;case"dropdown":r=l.jsx(It,{title:n.title,options:n.value,onSelect:n.onSelect,subdropdown:!0});break;case"option":r=l.jsx("button",{onClick:()=>{n.onSelect!==void 0&&n.onSelect(n.value),n.selectable&&(i!==n.title?e(n.title):e(""))},children:n.title});break}return l.jsx("li",{className:i===n.title?"selected":"",children:r},St())}function gn(t){let n;function i(c){var u,m,p,v,w,x,M,A,E;let s;switch(c.event){case"custom":L.dispatchEvent({type:U.CUSTOM,value:c.data});break;case"selectComponent":L.dispatchEvent({type:U.SELECT_DROPDOWN,value:c.data});break;case"draggableListUpdate":L.dispatchEvent({type:U.DRAG_UPDATE,value:c.data});break;case"addFolder":(u=t.components.get("debug"))==null||u.addFolder(c.data.name,c.data.params,c.data.parent);break;case"bindObject":(m=t.components.get("debug"))==null||m.bind(c.data.name,c.data.params,c.data.parent);break;case"updateBind":(p=t.components.get("debug"))==null||p.triggerBind(c.data.id,c.data.value);break;case"addButton":(v=t.components.get("debug"))==null||v.button(c.data.name,c.data.callback,c.data.parent);break;case"clickButton":(w=t.components.get("debug"))==null||w.triggerButton(c.data.id);break;case"setSheet":s=(x=t.components.get("theatre"))==null?void 0:x.sheets.get(c.data.sheet),s!==void 0&&(n=s,_e.setSelection([s]));break;case"setSheetObject":s=(M=t.components.get("theatre"))==null?void 0:M.sheetObjects.get(`${c.data.sheet}_${c.data.key}`),s!==void 0&&_e.setSelection([s]);break;case"updateSheetObject":s=(A=t.components.get("theatre"))==null?void 0:A.sheetObjectCBs.get(c.data.sheetObject),s!==void 0&&s(c.data.values);break;case"updateTimeline":n=(E=t.components.get("theatre"))==null?void 0:E.sheets.get(c.data.sheet),n!==void 0&&(n.sequence.position=c.data.position);break;case"getScene":L.dispatchEvent({type:U.GET_SCENE});break;case"getObject":L.dispatchEvent({type:U.GET_OBJECT,value:c.data});break;case"updateObject":L.dispatchEvent({type:U.UPDATE_OBJECT,value:c.data});break;case"createTexture":L.dispatchEvent({type:U.CREATE_TEXTURE,value:c.data});break;case"requestMethod":L.dispatchEvent({type:U.REQUEST_METHOD,value:c.data});break}}function e(c){switch(c.event){case"custom":L.dispatchEvent({type:U.CUSTOM,value:c.data});break;case"setObject":L.dispatchEvent({type:U.SET_OBJECT,value:c.data});break;case"setScene":L.dispatchEvent({type:U.SET_SCENE,value:c.data});break}}function r(){_e.ui.hide()}function d(){_e.ui.restore(),_e.onSelectionChange(m=>{m.length<1||m.forEach(p=>{var M;let v=p.address.sheetId,w="setSheet",x={};switch(p.type){case"Theatre_Sheet_PublicAPI":w="setSheet",x={sheet:p.address.sheetId},n=(M=t.components.get("theatre"))==null?void 0:M.sheets.get(p.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":w="setSheetObject",v+=`_${p.address.objectKey}`,x={id:v,sheet:p.address.sheetId,key:p.address.objectKey};break}t.send({event:w,target:"app",data:x})})});let c=0;const s=()=>{if(n!==void 0&&c!==n.sequence.position){c=n.sequence.position;const m=n;t.send({event:"updateTimeline",target:"app",data:{position:c,sheet:m.address.sheetId}})}},u=()=>{s(),requestAnimationFrame(u)};s(),u()}t.listen(c=>{t.editor?e(c):i(c)}),t.editor?d():r()}const Kn="";function Ze(t){const[n,i]=I.useState(t.open!==void 0?t.open:!0),e=!n||t.children===void 0;return l.jsxs("div",{className:`accordion ${e?"hide":""}`,children:[l.jsxs("button",{className:"toggle",onClick:()=>{const r=!n;t.onToggle!==void 0&&t.onToggle(r),i(r)},children:[l.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),l.jsx("p",{className:"label",children:t.label})]}),t.button,l.jsx("div",{className:n?"open":"",children:l.jsx("div",{children:t.children})})]})}function ht(t){const[n,i]=I.useState(!1),e=t.child.children.length>0,r=[];return t.child.children.length>0&&t.child.children.map(d=>{r.push(l.jsx(ht,{child:d,three:t.three},Math.random()))}),l.jsxs("div",{className:"childObject",children:[l.jsxs("div",{className:"child",children:[e?l.jsx("button",{className:"status",style:{backgroundPositionX:n?"-14px":"2px"},onClick:()=>{i(!n)}}):null,l.jsx("button",{className:"name",style:{left:e?"20px":"5px"},onClick:()=>{t.three.getObject(t.child.uuid)},children:t.child.name.length>0?`${t.child.name} (${t.child.type})`:`${t.child.type}::${t.child.uuid}`}),l.jsx("div",{className:`icon ${on(t.child)}`})]}),l.jsx("div",{className:n?"open":"",children:l.jsx("div",{className:"container",children:r})})]},Math.random())}function Nt(t){const n=[];return t.child.children.map(i=>{n.push(l.jsx(ht,{child:i,three:t.three},Math.random()))}),l.jsx("div",{className:`scene ${t.class!==void 0?t.class:""}`,children:n})}const Xn="",vn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";function bn(t){return"items"in t}function Te(t){function n(e,r){console.log("onChange:",e,r)}const i=[];return t.items.forEach(e=>{bn(e)?i.push(l.jsx(Te,{title:e.title,items:e.items},Math.random())):i.push(l.jsx(Le,{title:e.title,prop:e.prop,value:e.value,type:e.type,min:e.min,max:e.max,step:e.step,disabled:e.disabled,onChange:(r,d)=>{e.onChange!==void 0?e.onChange(r,d):n(r,d)}},Math.random()))}),l.jsx(Ze,{label:t.title,open:!1,children:i})}function yn(t){return!(t==="alphaHash"||t==="alphaToCoverage"||t==="attenuationDistance"||t==="colorWrite"||t==="combine"||t==="defaultAttributeValues"||t==="depthFunc"||t==="forceSinglePass"||t==="glslVersion"||t==="linewidth"||t==="normalMapType"||t==="precision"||t==="premultipliedAlpha"||t==="shadowSide"||t==="side"||t==="toneMapped"||t==="uniformsGroups"||t==="uniformsNeedUpdate"||t==="userData"||t==="vertexColors"||t==="version"||t==="wireframeLinecap"||t==="wireframeLinejoin"||t==="wireframeLinewidth"||t.slice(0,5)==="blend"||t.slice(0,4)==="clip"||t.slice(0,7)==="polygon"||t.slice(0,7)==="stencil"||t.slice(0,2)==="is")}function ge(t){switch(t){case"alphaMap":return"Alpha Map";case"anisotropyRotation":return"Anisotropy Rotation";case"aoMap":return"AO Map";case"aoMapIntensity":return"AO Map Intensity";case"attenuationColor":return"Attenuation Color";case"bumpMap":return"Bump Map";case"bumpScale":return"Bump Scale";case"clearcoatNormalScale":return"Clearcoat Normal Scale";case"clearcoatRoughness":return"Clearcoat Roughness";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"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"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"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"sheenColor":return"Sheen Color";case"sheenRoughness":return"Sheen Roughness";case"shininess":return"Shininess";case"specular":return"Specular";case"specularColor":return"Specular Color";case"specularIntensity":return"Specular Intensity";case"thickness":return"Thickness";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 En(t){return t.toLowerCase().search("intensity")>-1||t==="anisotropyRotation"||t==="bumpScale"||t==="clearcoatRoughness"||t==="displacementBias"||t==="displacementScale"||t==="metalness"||t==="opacity"||t==="reflectivity"||t==="refractionRatio"||t==="roughness"||t==="sheenRoughness"||t==="thickness"}function wn(){const t=document.createElement("input");return t.type="file",new Promise((n,i)=>{t.addEventListener("change",function(){if(t.files===null)i();else{const e=t.files[0],r=new FileReader;r.onload=function(d){n(d.target.result)},r.readAsDataURL(e)}}),t.click()})}function Lt(t,n,i){const e=[];for(const r in t){if(!yn(r))continue;const d=typeof t[r],c=t[r];if(d==="boolean"||d==="number"||d==="string"){const s={title:ge(r),prop:r,type:d,value:c,min:void 0,max:void 0,onChange:(u,m)=>{var v;i.updateObject(n.uuid,`material.${u}`,m),d==="boolean"&&i.updateObject(n.uuid,"material.needsUpdate",!0);const p=(v=i.scene)==null?void 0:v.getObjectByProperty("uuid",n.uuid);p!==void 0&&J(p,`material.${u}`,m)}};En(r)&&(s.value=Number(c),s.type="range",s.min=0,s.max=1,s.step=.01),e.push(s)}else if(d==="object")if(c.isColor)e.push({title:ge(r),prop:r,type:"color",value:c,onChange:(s,u)=>{var v;const m=new f.Color(u);i.updateObject(n.uuid,`material.${s}`,m);const p=(v=i.scene)==null?void 0:v.getObjectByProperty("uuid",n.uuid);p!==void 0&&J(p,`material.${s}`,m)}});else if(Array.isArray(c)){const s=[];for(const u in c)s.push({title:`${u}`,type:`${typeof c[u]}`,value:c[u],onChange:(m,p)=>{var w;i.updateObject(n.uuid,`material.${r}`,p);const v=(w=i.scene)==null?void 0:w.getObjectByProperty("uuid",n.uuid);v!==void 0&&J(v,`material.${r}`,p)}});e.push({title:ge(r),items:s})}else{const s=[];for(const u in c){const m=c[u];switch(typeof m){case"boolean":case"number":case"string":u==="src"?e.push({title:ge(r),type:"image",value:m,onChange:(v,w)=>{var M;i.createTexture(n.uuid,`material.${r}`,w);const x=(M=i.scene)==null?void 0:M.getObjectByProperty("uuid",n.uuid);x!==void 0&&ut(w).then(A=>{J(x,`material.${r}`,A),J(x,"material.needsUpdate",!0)})}}):s.push({title:`${ge(u)}`,prop:`material.${r}.${u}`,type:`${typeof t[r][u]}`,value:c[u],onChange:(v,w)=>{var M;i.updateObject(n.uuid,`material.${r}.${u}`,w);const x=(M=i.scene)==null?void 0:M.getObjectByProperty("uuid",n.uuid);x!==void 0&&J(x,`material.${r}.${u}`,w)}});break;case"object":m.value!==void 0&&m.value.src!==void 0?s.push({title:ge(u),type:"image",value:m.value.src,onChange:(v,w)=>{var M;i.createTexture(n.uuid,`material.${r}.${u}.value`,w);const x=(M=i.scene)==null?void 0:M.getObjectByProperty("uuid",n.uuid);x!==void 0&&ut(w).then(A=>{J(x,`material.${r}.${u}.value`,A)})}}):s.push({title:u,type:`${typeof m.value}`,value:m.value,onChange:(v,w)=>{var M;i.updateObject(n.uuid,`material.${r}.${u}.value`,w);const x=(M=i.scene)==null?void 0:M.getObjectByProperty("uuid",n.uuid);x!==void 0&&J(x,`material.${r}.${u}.value`,w)}});break}}s.length>0&&e.push({title:ge(r),items:s})}else c!==void 0&&console.log("other:",r,d,c)}return e.sort((r,d)=>r.title<d.title?-1:r.title>d.title?1:0),e.push({title:"Update Material",type:"button",onChange:()=>{i.updateObject(n.uuid,"material.needsUpdate",!0)}}),e}function Cn(t,n){const i=t.material;if(Array.isArray(i)){const e=[],r=i.length;for(let d=0;d<r;d++)e.push(l.jsx(Te,{title:`Material ${d}`,items:Lt(i[d],t,n)}));return l.jsx(l.Fragment,{children:e})}else return l.jsx(Te,{title:"Material",items:Lt(i,t,n)})}function Le(t){let n=t.value;n!==void 0&&n.isColor!==void 0&&(n=xt(t.value));const[i,e]=I.useState(n),r=I.useRef(null),d=I.useRef(null),c=I.useRef(null);I.useEffect(()=>{var R;let p=!1,v=-1,w=0,x=Number(i);const M=k=>{p=!0,w=x,v=k.clientX},A=k=>{if(!p)return;const K=t.step!==void 0?t.step:1,ne=(k.clientX-v)*K;x=Number((w+ne).toFixed(4)),d.current!==null&&(d.current.value=x.toString()),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,x)},E=()=>{p=!1},y=()=>{p=!1},b=t.type==="number";return b&&((R=r.current)==null||R.addEventListener("mousedown",M,!1),document.addEventListener("mouseup",E,!1),document.addEventListener("mousemove",A,!1),document.addEventListener("contextmenu",y,!1)),()=>{var k;b&&((k=r.current)==null||k.removeEventListener("mousedown",M),document.removeEventListener("mouseup",E),document.removeEventListener("mousemove",A),document.removeEventListener("contextmenu",y))}},[i]);const s=t.type==="string"&&(i.length>100||i.search(`
|
30
|
-
`)>-1),u=s||t.type==="image",m=p=>{let v=p.target.value;t.type==="boolean"&&(v=p.target.checked),e(v),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,v)};return l.jsxs("div",{className:`field ${u?"block":""}`,children:[t.type!=="button"&&l.jsx("label",{ref:r,children:t.title},"fieldLabel"),t.type==="string"&&!s&&l.jsx("input",{type:"text",disabled:t.disabled,onChange:m,value:i}),t.type==="string"&&s&&l.jsx("textarea",{cols:50,rows:10,disabled:!0,onChange:m,value:i}),t.type==="boolean"&&l.jsx("input",{type:"checkbox",disabled:t.disabled,onChange:m,checked:i}),t.type==="number"&&l.jsx("input",{ref:d,type:"number",value:i,min:t.min,max:t.max,step:t.step,onChange:m}),t.type==="range"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:i.toString(),onChange:m,className:"min"}),l.jsx("input",{disabled:t.disabled,type:"range",value:i,min:t.min,max:t.max,step:t.step,onChange:m})]}),t.type==="color"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:i.toString(),onChange:m,className:"color"}),l.jsx("input",{type:"color",value:i,onChange:m})]}),t.type==="button"&&l.jsx("button",{onClick:()=>{t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,!0)},children:t.title}),t.type==="image"&&l.jsx("img",{ref:c,onClick:()=>{wn().then(p=>{c.current.src=p,t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,p)})},src:i.length>0?i:vn})]})}function Ut(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 Sn(t,n){const i=[];if(t.perspectiveCameraInfo!==void 0)for(const e in t.perspectiveCameraInfo)i.push({title:Ut(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(r,d)=>{var s;n.updateObject(t.uuid,r,d),n.requestMethod(t.uuid,"updateProjectionMatrix");const c=(s=n.scene)==null?void 0:s.getObjectByProperty("uuid",t.uuid);c!==void 0&&(J(c,r,d),c.updateProjectionMatrix())}});else if(t.orthographicCameraInfo!==void 0)for(const e in t.orthographicCameraInfo)i.push({title:Ut(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(r,d)=>{var s;n.updateObject(t.uuid,r,d),n.requestMethod(t.uuid,"updateProjectionMatrix");const c=(s=n.scene)==null?void 0:s.getObjectByProperty("uuid",t.uuid);c!==void 0&&(J(c,r,d),c.updateProjectionMatrix())}});return l.jsx(Te,{title:"Camera",items:i})}function On(t,n){const i=new f.Matrix4;i.elements=t.matrix;const e=new f.Vector3,r=new f.Euler,d=new f.Vector3;t.uuid.length>0&&(e.setFromMatrixPosition(i),r.setFromRotationMatrix(i),d.setFromMatrixScale(i));const c=(u,m)=>{var v;n.updateObject(t.uuid,u,m);const p=(v=n.scene)==null?void 0:v.getObjectByProperty("uuid",t.uuid);p!==void 0&&J(p,u,m)},s=[{title:"Position",items:[{title:"X",prop:"position.x",type:"number",value:e.x,onChange:c},{title:"Y",prop:"position.y",type:"number",value:e.y,onChange:c},{title:"Z",prop:"position.z",type:"number",value:e.z,onChange:c}]},{title:"Rotation",items:[{title:"X",prop:"rotation.x",type:"number",value:r.x,min:-Math.PI,max:Math.PI,step:.01,onChange:c},{title:"Y",prop:"rotation.y",type:"number",value:r.y,min:-Math.PI,max:Math.PI,step:.01,onChange:c},{title:"Z",prop:"rotation.z",type:"number",value:r.z,min:-Math.PI,max:Math.PI,step:.01,onChange:c}]},{title:"Scale",items:[{title:"X",prop:"scale.x",type:"number",value:d.x,step:.01,onChange:c},{title:"Y",prop:"scale.y",type:"number",value:d.y,step:.01,onChange:c},{title:"Z",prop:"scale.z",type:"number",value:d.z,step:.01,onChange:c}]}];return l.jsx(Te,{title:"Transform",items:s})}function Ft(t){switch(t){case"color":return"Color";case"intensity":return"Intensity";case"decay":return"Decay";case"distance":return"Distance";case"angle":return"Angle";case"penumbra":return"Penumbra";case"groundColor":return"Ground Color"}return t}function xn(t,n){const i=[];if(t.lightInfo!==void 0)for(const e in t.lightInfo){const r=t.lightInfo[e];r!==void 0&&(r.isColor!==void 0?i.push({title:Ft(e),prop:e,type:"color",value:r,onChange:(d,c)=>{var m;const s=new f.Color(c);n.updateObject(t.uuid,d,s);const u=(m=n.scene)==null?void 0:m.getObjectByProperty("uuid",t.uuid);u!==void 0&&J(u,d,s)}}):i.push({title:Ft(e),prop:e,type:typeof r,value:r,step:typeof r=="number"?.01:void 0,onChange:(d,c)=>{var u;n.updateObject(t.uuid,d,c);const s=(u=n.scene)==null?void 0:u.getObjectByProperty("uuid",t.uuid);s!==void 0&&J(s,d,c)}}))}return l.jsx(Te,{title:"Light",items:i})}function Bt(t){const[n,i]=I.useState(-1),[e,r]=I.useState({name:"",uuid:"",type:"",visible:!1,matrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0});return I.useEffect(()=>{function d(c){const s=c.value;r(s),i(Date.now())}return L.addEventListener(U.SET_OBJECT,d),()=>{L.removeEventListener(U.SET_OBJECT,d)}},[]),l.jsx("div",{id:"Inspector",className:t.class,children:e.uuid.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(l.Fragment,{children:[l.jsx(Le,{type:"string",title:"Name",prop:"name",value:e.name,disabled:!0}),l.jsx(Le,{type:"string",title:"Type",prop:"type",value:e.type,disabled:!0}),l.jsx(Le,{type:"string",title:"UUID",prop:"uuid",value:e.uuid,disabled:!0}),l.jsx(Le,{type:"boolean",title:"Visible",prop:"visible",value:e.visible,onChange:(d,c)=>{var u;t.three.updateObject(e.uuid,d,c);const s=(u=t.three.scene)==null?void 0:u.getObjectByProperty("uuid",e.uuid);s!==void 0&&J(s,d,c)}})]}),l.jsxs(l.Fragment,{children:[On(e,t.three),e.orthographicCameraInfo!==void 0||e.perspectiveCameraInfo!==void 0?Sn(e,t.three):null,e.lightInfo!==void 0?xn(e,t.three):null,e.material!==void 0?Cn(e,t.three):null]})]})},n)}class Tn extends I.Component{constructor(i){super(i);z(this,"three");z(this,"onRefresh",()=>{this.three.getScene()});z(this,"setScene",i=>{this.setState(()=>({scene:i.value}))});this.state={scene:i.scene!==void 0?i.scene:null},this.three=i.three,L.addEventListener(U.SET_SCENE,this.setScene)}componentDidMount(){this.onRefresh()}componentWillUnmount(){L.removeEventListener(U.SET_SCENE,this.setScene)}render(){var r;const i=this.componentState.scene!==null,e="Hierarchy"+(i?`: ${(r=this.componentState.scene)==null?void 0:r.name}`:"");return l.jsx("div",{id:"SceneHierarchy",children:l.jsxs(l.Fragment,{children:[i&&l.jsx(Ze,{label:e,button:l.jsx("button",{className:"icon refresh hideText",onClick:this.onRefresh,children:"Refresh"}),open:!0,children:l.jsx(Nt,{child:this.componentState.scene,three:this.three})}),l.jsx(Ze,{label:"Inspector",children:l.jsx(Bt,{three:this.three},"Inspector")})]})},"SceneHierarchy")}get componentState(){return this.state}}function Rn(t){const n=s=>{const u=t.scene.getObjectByProperty("uuid",s.value);u!==void 0&&t.three.setObject(u)},i=(s,u,m)=>{const p=t.scene.getObjectByProperty("uuid",s);p!==void 0&&J(p,u,m)},e=s=>{const u=s.value,{key:m,value:p,uuid:v}=u;i(v,m,p)},r=s=>{const u=s.value;ut(u.value).then(m=>{i(u.uuid,u.key,m),i(u.uuid,"material.needsUpdate",!0)})},d=()=>{t.three.setScene(t.scene)},c=s=>{const{key:u,uuid:m,value:p}=s.value,v=t.scene.getObjectByProperty("uuid",m);if(v!==void 0)try{v[u](p)}catch(w){console.log("Error requesting method:"),console.log(w),console.log(u),console.log(p)}};return I.useEffect(()=>(L.addEventListener(U.GET_OBJECT,n),L.addEventListener(U.GET_SCENE,d),L.addEventListener(U.UPDATE_OBJECT,e),L.addEventListener(U.CREATE_TEXTURE,r),L.addEventListener(U.REQUEST_METHOD,c),()=>{L.removeEventListener(U.GET_OBJECT,n),L.removeEventListener(U.GET_SCENE,d),L.removeEventListener(U.UPDATE_OBJECT,e),L.removeEventListener(U.CREATE_TEXTURE,r),L.removeEventListener(U.REQUEST_METHOD,c)}),[]),null}const Vt={type:"change"},mt={type:"start"},Gt={type:"end"},Je=new f.Ray,Yt=new f.Plane,Pn=Math.cos(70*f.MathUtils.DEG2RAD);class jn extends f.EventDispatcher{constructor(n,i){super(),this.object=n,this.domElement=i,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new f.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=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:f.MOUSE.ROTATE,MIDDLE:f.MOUSE.DOLLY,RIGHT:f.MOUSE.PAN},this.touches={ONE:f.TOUCH.ROTATE,TWO:f.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return s.phi},this.getAzimuthalAngle=function(){return s.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(o){o.addEventListener("keydown",We),this._domElementKeyEvents=o},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",We),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(Vt),e.update(),d=r.NONE},this.update=function(){const o=new f.Vector3,C=new f.Quaternion().setFromUnitVectors(n.up,new f.Vector3(0,1,0)),V=C.clone().invert(),G=new f.Vector3,q=new f.Quaternion,fe=new f.Vector3,re=2*Math.PI;return function(){const Xe=e.object.position;o.copy(Xe).sub(e.target),o.applyQuaternion(C),s.setFromVector3(o),e.autoRotate&&d===r.NONE&&D(Re()),e.enableDamping?(s.theta+=u.theta*e.dampingFactor,s.phi+=u.phi*e.dampingFactor):(s.theta+=u.theta,s.phi+=u.phi);let Z=e.minAzimuthAngle,te=e.maxAzimuthAngle;isFinite(Z)&&isFinite(te)&&(Z<-Math.PI?Z+=re:Z>Math.PI&&(Z-=re),te<-Math.PI?te+=re:te>Math.PI&&(te-=re),Z<=te?s.theta=Math.max(Z,Math.min(te,s.theta)):s.theta=s.theta>(Z+te)/2?Math.max(Z,s.theta):Math.min(te,s.theta)),s.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,s.phi)),s.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(p,e.dampingFactor):e.target.add(p),e.zoomToCursor&&ne||e.object.isOrthographicCamera?s.radius=je(s.radius):s.radius=je(s.radius*m),o.setFromSpherical(s),o.applyQuaternion(V),Xe.copy(e.target).add(o),e.object.lookAt(e.target),e.enableDamping===!0?(u.theta*=1-e.dampingFactor,u.phi*=1-e.dampingFactor,p.multiplyScalar(1-e.dampingFactor)):(u.set(0,0,0),p.set(0,0,0));let he=!1;if(e.zoomToCursor&&ne){let me=null;if(e.object.isPerspectiveCamera){const Oe=o.length();me=je(Oe*m);const xe=Oe-me;e.object.position.addScaledVector(k,xe),e.object.updateMatrixWorld()}else if(e.object.isOrthographicCamera){const Oe=new f.Vector3(K.x,K.y,0);Oe.unproject(e.object),e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/m)),e.object.updateProjectionMatrix(),he=!0;const xe=new f.Vector3(K.x,K.y,0);xe.unproject(e.object),e.object.position.sub(xe).add(Oe),e.object.updateMatrixWorld(),me=o.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;me!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(me).add(e.object.position):(Je.origin.copy(e.object.position),Je.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(Je.direction))<Pn?n.lookAt(e.target):(Yt.setFromNormalAndCoplanarPoint(e.object.up,e.target),Je.intersectPlane(Yt,e.target))))}else e.object.isOrthographicCamera&&(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/m)),e.object.updateProjectionMatrix(),he=!0);return m=1,ne=!1,he||G.distanceToSquared(e.object.position)>c||8*(1-q.dot(e.object.quaternion))>c||fe.distanceToSquared(e.target)>0?(e.dispatchEvent(Vt),G.copy(e.object.position),q.copy(e.object.quaternion),fe.copy(e.target),he=!1,!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",de),e.domElement.removeEventListener("pointerdown",ze),e.domElement.removeEventListener("pointercancel",Ce),e.domElement.removeEventListener("wheel",it),e.domElement.removeEventListener("pointermove",ue),e.domElement.removeEventListener("pointerup",Ce),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",We),e._domElementKeyEvents=null)};const e=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let d=r.NONE;const c=1e-6,s=new f.Spherical,u=new f.Spherical;let m=1;const p=new f.Vector3,v=new f.Vector2,w=new f.Vector2,x=new f.Vector2,M=new f.Vector2,A=new f.Vector2,E=new f.Vector2,y=new f.Vector2,b=new f.Vector2,R=new f.Vector2,k=new f.Vector3,K=new f.Vector2;let ne=!1;const P=[],le={};function Re(){return 2*Math.PI/60/60*e.autoRotateSpeed}function se(){return Math.pow(.95,e.zoomSpeed)}function D(o){u.theta-=o}function F(o){u.phi-=o}const B=function(){const o=new f.Vector3;return function(V,G){o.setFromMatrixColumn(G,0),o.multiplyScalar(-V),p.add(o)}}(),ee=function(){const o=new f.Vector3;return function(V,G){e.screenSpacePanning===!0?o.setFromMatrixColumn(G,1):(o.setFromMatrixColumn(G,0),o.crossVectors(e.object.up,o)),o.multiplyScalar(V),p.add(o)}}(),ae=function(){const o=new f.Vector3;return function(V,G){const q=e.domElement;if(e.object.isPerspectiveCamera){const fe=e.object.position;o.copy(fe).sub(e.target);let re=o.length();re*=Math.tan(e.object.fov/2*Math.PI/180),B(2*V*re/q.clientHeight,e.object.matrix),ee(2*G*re/q.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(B(V*(e.object.right-e.object.left)/e.object.zoom/q.clientWidth,e.object.matrix),ee(G*(e.object.top-e.object.bottom)/e.object.zoom/q.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function Pe(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?m/=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function Ue(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?m*=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function Fe(o){if(!e.zoomToCursor)return;ne=!0;const C=e.domElement.getBoundingClientRect(),V=o.clientX-C.left,G=o.clientY-C.top,q=C.width,fe=C.height;K.x=V/q*2-1,K.y=-(G/fe)*2+1,k.set(K.x,K.y,1).unproject(n).sub(n.position).normalize()}function je(o){return Math.max(e.minDistance,Math.min(e.maxDistance,o))}function Be(o){v.set(o.clientX,o.clientY)}function qe(o){Fe(o),y.set(o.clientX,o.clientY)}function Ve(o){M.set(o.clientX,o.clientY)}function $e(o){w.set(o.clientX,o.clientY),x.subVectors(w,v).multiplyScalar(e.rotateSpeed);const C=e.domElement;D(2*Math.PI*x.x/C.clientHeight),F(2*Math.PI*x.y/C.clientHeight),v.copy(w),e.update()}function vt(o){b.set(o.clientX,o.clientY),R.subVectors(b,y),R.y>0?Pe(se()):R.y<0&&Ue(se()),y.copy(b),e.update()}function bt(o){A.set(o.clientX,o.clientY),E.subVectors(A,M).multiplyScalar(e.panSpeed),ae(E.x,E.y),M.copy(A),e.update()}function Ge(o){Fe(o),o.deltaY<0?Ue(se()):o.deltaY>0&&Pe(se()),e.update()}function Ye(o){let C=!1;switch(o.code){case e.keys.UP:o.ctrlKey||o.metaKey||o.shiftKey?F(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ae(0,e.keyPanSpeed),C=!0;break;case e.keys.BOTTOM:o.ctrlKey||o.metaKey||o.shiftKey?F(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ae(0,-e.keyPanSpeed),C=!0;break;case e.keys.LEFT:o.ctrlKey||o.metaKey||o.shiftKey?D(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ae(e.keyPanSpeed,0),C=!0;break;case e.keys.RIGHT:o.ctrlKey||o.metaKey||o.shiftKey?D(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ae(-e.keyPanSpeed,0),C=!0;break}C&&(o.preventDefault(),e.update())}function ye(){if(P.length===1)v.set(P[0].pageX,P[0].pageY);else{const o=.5*(P[0].pageX+P[1].pageX),C=.5*(P[0].pageY+P[1].pageY);v.set(o,C)}}function Me(){if(P.length===1)M.set(P[0].pageX,P[0].pageY);else{const o=.5*(P[0].pageX+P[1].pageX),C=.5*(P[0].pageY+P[1].pageY);M.set(o,C)}}function Ee(){const o=P[0].pageX-P[1].pageX,C=P[0].pageY-P[1].pageY,V=Math.sqrt(o*o+C*C);y.set(0,V)}function yt(){e.enableZoom&&Ee(),e.enablePan&&Me()}function et(){e.enableZoom&&Ee(),e.enableRotate&&ye()}function tt(o){if(P.length==1)w.set(o.pageX,o.pageY);else{const V=Se(o),G=.5*(o.pageX+V.x),q=.5*(o.pageY+V.y);w.set(G,q)}x.subVectors(w,v).multiplyScalar(e.rotateSpeed);const C=e.domElement;D(2*Math.PI*x.x/C.clientHeight),F(2*Math.PI*x.y/C.clientHeight),v.copy(w)}function nt(o){if(P.length===1)A.set(o.pageX,o.pageY);else{const C=Se(o),V=.5*(o.pageX+C.x),G=.5*(o.pageY+C.y);A.set(V,G)}E.subVectors(A,M).multiplyScalar(e.panSpeed),ae(E.x,E.y),M.copy(A)}function we(o){const C=Se(o),V=o.pageX-C.x,G=o.pageY-C.y,q=Math.sqrt(V*V+G*G);b.set(0,q),R.set(0,Math.pow(b.y/y.y,e.zoomSpeed)),Pe(R.y),y.copy(b)}function ke(o){e.enableZoom&&we(o),e.enablePan&&nt(o)}function at(o){e.enableZoom&&we(o),e.enableRotate&&tt(o)}function ze(o){e.enabled!==!1&&(P.length===0&&(e.domElement.setPointerCapture(o.pointerId),e.domElement.addEventListener("pointermove",ue),e.domElement.addEventListener("pointerup",Ce)),wt(o),o.pointerType==="touch"?rt(o):Et(o))}function ue(o){e.enabled!==!1&&(o.pointerType==="touch"?ot(o):He(o))}function Ce(o){st(o),P.length===0&&(e.domElement.releasePointerCapture(o.pointerId),e.domElement.removeEventListener("pointermove",ue),e.domElement.removeEventListener("pointerup",Ce)),e.dispatchEvent(Gt),d=r.NONE}function Et(o){let C;switch(o.button){case 0:C=e.mouseButtons.LEFT;break;case 1:C=e.mouseButtons.MIDDLE;break;case 2:C=e.mouseButtons.RIGHT;break;default:C=-1}switch(C){case f.MOUSE.DOLLY:if(e.enableZoom===!1)return;qe(o),d=r.DOLLY;break;case f.MOUSE.ROTATE:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enablePan===!1)return;Ve(o),d=r.PAN}else{if(e.enableRotate===!1)return;Be(o),d=r.ROTATE}break;case f.MOUSE.PAN:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enableRotate===!1)return;Be(o),d=r.ROTATE}else{if(e.enablePan===!1)return;Ve(o),d=r.PAN}break;default:d=r.NONE}d!==r.NONE&&e.dispatchEvent(mt)}function He(o){switch(d){case r.ROTATE:if(e.enableRotate===!1)return;$e(o);break;case r.DOLLY:if(e.enableZoom===!1)return;vt(o);break;case r.PAN:if(e.enablePan===!1)return;bt(o);break}}function it(o){e.enabled===!1||e.enableZoom===!1||d!==r.NONE||(o.preventDefault(),e.dispatchEvent(mt),Ge(o),e.dispatchEvent(Gt))}function We(o){e.enabled===!1||e.enablePan===!1||Ye(o)}function rt(o){switch(Ke(o),P.length){case 1:switch(e.touches.ONE){case f.TOUCH.ROTATE:if(e.enableRotate===!1)return;ye(),d=r.TOUCH_ROTATE;break;case f.TOUCH.PAN:if(e.enablePan===!1)return;Me(),d=r.TOUCH_PAN;break;default:d=r.NONE}break;case 2:switch(e.touches.TWO){case f.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;yt(),d=r.TOUCH_DOLLY_PAN;break;case f.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;et(),d=r.TOUCH_DOLLY_ROTATE;break;default:d=r.NONE}break;default:d=r.NONE}d!==r.NONE&&e.dispatchEvent(mt)}function ot(o){switch(Ke(o),d){case r.TOUCH_ROTATE:if(e.enableRotate===!1)return;tt(o),e.update();break;case r.TOUCH_PAN:if(e.enablePan===!1)return;nt(o),e.update();break;case r.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;ke(o),e.update();break;case r.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;at(o),e.update();break;default:d=r.NONE}}function de(o){e.enabled!==!1&&o.preventDefault()}function wt(o){P.push(o)}function st(o){delete le[o.pointerId];for(let C=0;C<P.length;C++)if(P[C].pointerId==o.pointerId){P.splice(C,1);return}}function Ke(o){let C=le[o.pointerId];C===void 0&&(C=new f.Vector2,le[o.pointerId]=C),C.set(o.pageX,o.pageY)}function Se(o){const C=o.pointerId===P[0].pointerId?P[1]:P[0];return le[C.pointerId]}e.domElement.addEventListener("contextmenu",de),e.domElement.addEventListener("pointerdown",ze),e.domElement.addEventListener("pointercancel",Ce),e.domElement.addEventListener("wheel",it,{passive:!1}),this.update()}}const pt=t=>{const[n,i]=I.useState(!1),[e,r]=I.useState(t.options[t.index]),d=()=>{i(!n)},c=s=>{s!==e&&(t.onSelect(s),r(s)),i(!1)};return l.jsxs("div",{className:`dropdown ${t.up===!0?"up":""}`,children:[l.jsx("div",{className:"dropdown-toggle",onClick:d,children:e}),n&&l.jsx("ul",{className:"dropdown-menu",children:t.options.map(s=>l.jsx("li",{onClick:()=>c(s),children:s},s))})]})},ve=I.forwardRef(function(n,i){const e=n.options.indexOf(n.camera.name);return l.jsxs("div",{className:"CameraWindow",children:[l.jsx("div",{ref:i,className:"clickable"}),l.jsx(pt,{index:e,options:n.options,onSelect:n.onSelect,up:!0})]})}),Mn=`out vec3 worldPosition;
|
29
|
+
C11,8.22,10.74,8,10.43,8z`})});function Ut(t){return l.jsx(Mt.Reorder.Item,{value:t.title,children:l.jsxs("div",{children:[Cn,l.jsx("span",{children:t.title}),l.jsx("button",{className:"closeIcon",onClick:()=>{t.onDelete(t.index)},children:wn})]})},t.title)}function Ft(t){const[n,i]=_.useState(!1),[e,o]=_.useState(t.options),u=g=>{t.onDragComplete(g),o(g)},c=g=>{const b=[...e];b.splice(g,1),u(b)},s=[];e.forEach((g,b)=>{s.push(l.jsx(Ut,{index:b,title:g,onDelete:c},g))});let d="dropdown draggable";return t.subdropdown&&(d+=" subdropdown"),l.jsxs("div",{className:d,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[l.jsx(bt,{title:t.title}),l.jsx(Mt.Reorder.Group,{axis:"y",values:e,onReorder:u,style:{visibility:n?"visible":"hidden"},children:s})]})}function Vt(t){const[n,i]=_.useState(!1),e=[];t.options.map((u,c)=>{t.onSelect!==void 0&&(u.onSelect=t.onSelect),e.push(l.jsx(Bt,{option:u},c))});let o="dropdown";return t.subdropdown&&(o+=" subdropdown"),l.jsxs("div",{className:o,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[l.jsx(bt,{title:t.title}),l.jsx("ul",{style:{visibility:n?"visible":"hidden"},children:e})]})}function Bt(t){const{option:n}=t,[i,e]=_.useState("");let o;switch(n.type){case"draggable":o=l.jsx(Ft,{title:n.title,options:n.value,onDragComplete:u=>{n.onDragComplete!==void 0&&n.onDragComplete(u)},subdropdown:!0});break;case"dropdown":o=l.jsx(Vt,{title:n.title,options:n.value,onSelect:n.onSelect,subdropdown:!0});break;case"option":o=l.jsx("button",{onClick:()=>{n.onSelect!==void 0&&n.onSelect(n.value),n.selectable&&(i!==n.title?e(n.title):e(""))},children:n.title});break}return l.jsx("li",{className:i===n.title?"selected":"",children:o},Pt())}function xn(t){let n;function i(c){var d,g,b,f,h,v,w,S,U;let s;switch(c.event){case"custom":A.dispatchEvent({type:N.CUSTOM,value:c.data});break;case"selectComponent":A.dispatchEvent({type:N.SELECT_DROPDOWN,value:c.data});break;case"draggableListUpdate":A.dispatchEvent({type:N.DRAG_UPDATE,value:c.data});break;case"addFolder":(d=t.components.get("debug"))==null||d.addFolder(c.data.name,c.data.params,c.data.parent);break;case"bindObject":(g=t.components.get("debug"))==null||g.bind(c.data.name,c.data.params,c.data.parent);break;case"updateBind":(b=t.components.get("debug"))==null||b.triggerBind(c.data.id,c.data.value);break;case"addButton":(f=t.components.get("debug"))==null||f.button(c.data.name,c.data.callback,c.data.parent);break;case"clickButton":(h=t.components.get("debug"))==null||h.triggerButton(c.data.id);break;case"setSheet":s=(v=t.components.get("theatre"))==null?void 0:v.sheets.get(c.data.sheet),s!==void 0&&(n=s,Ve.setSelection([s]));break;case"setSheetObject":s=(w=t.components.get("theatre"))==null?void 0:w.sheetObjects.get(`${c.data.sheet}_${c.data.key}`),s!==void 0&&Ve.setSelection([s]);break;case"updateSheetObject":s=(S=t.components.get("theatre"))==null?void 0:S.sheetObjectCBs.get(c.data.sheetObject),s!==void 0&&s(c.data.values);break;case"updateTimeline":n=(U=t.components.get("theatre"))==null?void 0:U.sheets.get(c.data.sheet),n!==void 0&&(n.sequence.position=c.data.position);break;case"getScene":A.dispatchEvent({type:N.GET_SCENE});break;case"getObject":A.dispatchEvent({type:N.GET_OBJECT,value:c.data});break;case"updateObject":A.dispatchEvent({type:N.UPDATE_OBJECT,value:c.data});break;case"createTexture":A.dispatchEvent({type:N.CREATE_TEXTURE,value:c.data});break;case"requestMethod":A.dispatchEvent({type:N.REQUEST_METHOD,value:c.data});break}}function e(c){switch(c.event){case"custom":A.dispatchEvent({type:N.CUSTOM,value:c.data});break;case"setObject":A.dispatchEvent({type:N.SET_OBJECT,value:c.data});break;case"setScene":A.dispatchEvent({type:N.SET_SCENE,value:c.data});break}}function o(){Ve.ui.hide()}function u(){Ve.ui.restore(),Ve.onSelectionChange(g=>{g.length<1||g.forEach(b=>{var w;let f=b.address.sheetId,h="setSheet",v={};switch(b.type){case"Theatre_Sheet_PublicAPI":h="setSheet",v={sheet:b.address.sheetId},n=(w=t.components.get("theatre"))==null?void 0:w.sheets.get(b.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":h="setSheetObject",f+=`_${b.address.objectKey}`,v={id:f,sheet:b.address.sheetId,key:b.address.objectKey};break}t.send({event:h,target:"app",data:v})})});let c=0;const s=()=>{if(n!==void 0&&c!==n.sequence.position){c=n.sequence.position;const g=n;t.send({event:"updateTimeline",target:"app",data:{position:c,sheet:g.address.sheetId}})}},d=()=>{s(),requestAnimationFrame(d)};s(),d()}t.listen(c=>{t.editor?e(c):i(c)}),t.editor?u():o()}const Sn=`out vec3 worldPosition;
|
31
30
|
uniform float uDistance;
|
32
31
|
|
33
32
|
void main() {
|
@@ -36,7 +35,7 @@ void main() {
|
|
36
35
|
worldPosition.xz += cameraPosition.xz;
|
37
36
|
|
38
37
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(worldPosition, 1.0);
|
39
|
-
}`,
|
38
|
+
}`,On=`out vec4 fragColor;
|
40
39
|
in vec3 worldPosition;
|
41
40
|
|
42
41
|
uniform float uDivisions;
|
@@ -103,4 +102,43 @@ void main() {
|
|
103
102
|
fragColor.a = mix(fragColor.a, baseOpacity * uGridOpacity, nextGrid);
|
104
103
|
|
105
104
|
if (fragColor.a <= 0.0) discard;
|
106
|
-
}`;class
|
105
|
+
}`;class Tn extends m.ShaderMaterial{constructor(n){super({extensions:{derivatives:!0},glslVersion:m.GLSL3,side:m.DoubleSide,transparent:!0,uniforms:{uScale:{value:(n==null?void 0:n.scale)!==void 0?n==null?void 0:n.scale:.1},uDivisions:{value:(n==null?void 0:n.divisions)!==void 0?n==null?void 0:n.divisions:10},uColor:{value:(n==null?void 0:n.color)!==void 0?n==null?void 0:n.color:new m.Color(16777215)},uDistance:{value:(n==null?void 0:n.distance)!==void 0?n==null?void 0:n.distance:1e4},uSubgridOpacity:{value:(n==null?void 0:n.subgridOpacity)!==void 0?n==null?void 0:n.subgridOpacity:.15},uGridOpacity:{value:(n==null?void 0:n.gridOpacity)!==void 0?n==null?void 0:n.gridOpacity:.25}},vertexShader:Sn,fragmentShader:On,name:"InfiniteGrid",depthWrite:!1})}}class Gt extends m.Mesh{constructor(){const i=new Tn;super(new m.PlaneGeometry(2,2),i);V(this,"gridMaterial");this.gridMaterial=i,this.frustumCulled=!1,this.name="InfiniteGridHelper",this.position.y=.1}update(){this.gridMaterial.needsUpdate=!0}}const Rn=`#include <common>
|
106
|
+
#include <batching_pars_vertex>
|
107
|
+
#include <uv_pars_vertex>
|
108
|
+
#include <color_pars_vertex>
|
109
|
+
#include <morphtarget_pars_vertex>
|
110
|
+
#include <skinning_pars_vertex>
|
111
|
+
#include <logdepthbuf_pars_vertex>
|
112
|
+
#include <clipping_planes_pars_vertex>
|
113
|
+
|
114
|
+
void main() {
|
115
|
+
#include <uv_vertex>
|
116
|
+
#include <color_vertex>
|
117
|
+
#include <morphcolor_vertex>
|
118
|
+
#include <batching_vertex>
|
119
|
+
|
120
|
+
#if defined ( USE_SKINNING )
|
121
|
+
#include <beginnormal_vertex>
|
122
|
+
#include <morphnormal_vertex>
|
123
|
+
#include <skinbase_vertex>
|
124
|
+
#include <skinnormal_vertex>
|
125
|
+
#include <defaultnormal_vertex>
|
126
|
+
#endif
|
127
|
+
|
128
|
+
#include <begin_vertex>
|
129
|
+
#include <morphtarget_vertex>
|
130
|
+
#include <skinning_vertex>
|
131
|
+
#include <project_vertex>
|
132
|
+
#include <logdepthbuf_vertex>
|
133
|
+
#include <clipping_planes_vertex>
|
134
|
+
#include <worldpos_vertex>
|
135
|
+
}`,Mn=`
|
136
|
+
#include <common>
|
137
|
+
#include <uv_pars_fragment>
|
138
|
+
#include <clipping_planes_pars_fragment>
|
139
|
+
|
140
|
+
void main() {
|
141
|
+
#include <clipping_planes_fragment>
|
142
|
+
gl_FragColor = vec4(vec3(vUv, 0.0), 1.0);
|
143
|
+
}`;class Yt extends m.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:Rn,fragmentShader:Mn})}}const na="";function et(t){const[n,i]=_.useState(t.open!==void 0?t.open:!0),e=!n||t.children===void 0;return l.jsxs("div",{className:`accordion ${e?"hide":""}`,children:[l.jsxs("button",{className:"toggle",onClick:()=>{const o=!n;t.onToggle!==void 0&&t.onToggle(o),i(o)},children:[l.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),l.jsx("p",{className:"label",children:t.label})]}),t.button,l.jsx("div",{className:n?"open":"",children:l.jsx("div",{children:t.children})})]})}function yt(t){const[n,i]=_.useState(!1),e=t.child.children.length>0,o=[];return t.child.children.length>0&&t.child.children.map(u=>{o.push(l.jsx(yt,{child:u,three:t.three},Math.random()))}),l.jsxs("div",{className:"childObject",children:[l.jsxs("div",{className:"child",children:[e?l.jsx("button",{className:"status",style:{backgroundPositionX:n?"-14px":"2px"},onClick:()=>{i(!n)}}):null,l.jsx("button",{className:"name",style:{left:e?"20px":"5px"},onClick:()=>{t.three.getObject(t.child.uuid)},children:t.child.name.length>0?`${t.child.name} (${t.child.type})`:`${t.child.type}::${t.child.uuid}`}),l.jsx("div",{className:`icon ${hn(t.child)}`})]}),l.jsx("div",{className:n?"open":"",children:l.jsx("div",{className:"container",children:o})})]},Math.random())}function zt(t){const n=[];return t.child.children.map(i=>{n.push(l.jsx(yt,{child:i,three:t.three},Math.random()))}),l.jsx("div",{className:`scene ${t.class!==void 0?t.class:""}`,children:n})}const aa="",Pn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";function jn(t){return"items"in t}function Me(t){function n(e,o){console.log("onChange:",e,o)}const i=[];return t.items.forEach(e=>{jn(e)?i.push(l.jsx(Me,{title:e.title,items:e.items},Math.random())):i.push(l.jsx(ze,{title:e.title,prop:e.prop,value:e.value,type:e.type,min:e.min,max:e.max,step:e.step,disabled:e.disabled,onChange:(o,u)=>{e.onChange!==void 0?e.onChange(o,u):n(o,u)}},Math.random()))}),l.jsx(et,{label:t.title,open:!1,children:i})}function _n(t){return!(t==="alphaHash"||t==="alphaToCoverage"||t==="attenuationDistance"||t==="colorWrite"||t==="combine"||t==="defaultAttributeValues"||t==="depthFunc"||t==="forceSinglePass"||t==="glslVersion"||t==="linewidth"||t==="normalMapType"||t==="precision"||t==="premultipliedAlpha"||t==="shadowSide"||t==="side"||t==="toneMapped"||t==="uniformsGroups"||t==="uniformsNeedUpdate"||t==="userData"||t==="vertexColors"||t==="version"||t==="wireframeLinecap"||t==="wireframeLinejoin"||t==="wireframeLinewidth"||t.slice(0,5)==="blend"||t.slice(0,4)==="clip"||t.slice(0,7)==="polygon"||t.slice(0,7)==="stencil"||t.slice(0,2)==="is")}function ve(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"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"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 kn(t){return t.toLowerCase().search("intensity")>-1||t==="anisotropyRotation"||t==="bumpScale"||t==="clearcoatRoughness"||t==="displacementBias"||t==="displacementScale"||t==="metalness"||t==="opacity"||t==="reflectivity"||t==="refractionRatio"||t==="roughness"||t==="sheenRoughness"||t==="thickness"}function Dn(){const t=document.createElement("input");return t.type="file",new Promise((n,i)=>{t.addEventListener("change",function(){if(t.files===null)i();else{const e=t.files[0],o=new FileReader;o.onload=function(u){n(u.target.result)},o.readAsDataURL(e)}}),t.click()})}function Ht(t,n,i){const e=[];for(const o in t){if(!_n(o))continue;const u=typeof t[o],c=t[o];if(u==="boolean"||u==="number"||u==="string"){const s={title:ve(o),prop:o,type:u,value:c,min:void 0,max:void 0,onChange:(d,g)=>{var f;i.updateObject(n.uuid,`material.${d}`,g),u==="boolean"&&i.updateObject(n.uuid,"material.needsUpdate",!0);const b=(f=i.scene)==null?void 0:f.getObjectByProperty("uuid",n.uuid);b!==void 0&&K(b,`material.${d}`,g)}};kn(o)&&(s.value=Number(c),s.type="range",s.min=0,s.max=1,s.step=.01),e.push(s)}else if(u==="object")if(c.isColor)e.push({title:ve(o),prop:o,type:"color",value:c,onChange:(s,d)=>{var f;const g=new m.Color(d);i.updateObject(n.uuid,`material.${s}`,g);const b=(f=i.scene)==null?void 0:f.getObjectByProperty("uuid",n.uuid);b!==void 0&&K(b,`material.${s}`,g)}});else if(Array.isArray(c)){const s=[];for(const d in c)s.push({title:`${d}`,type:`${typeof c[d]}`,value:c[d],onChange:(g,b)=>{var h;i.updateObject(n.uuid,`material.${o}`,b);const f=(h=i.scene)==null?void 0:h.getObjectByProperty("uuid",n.uuid);f!==void 0&&K(f,`material.${o}`,b)}});e.push({title:ve(o),items:s})}else{const s=[];for(const d in c){const g=c[d];switch(typeof g){case"boolean":case"number":case"string":d==="src"?e.push({title:ve(o),type:"image",value:g,onChange:(f,h)=>{var w;i.createTexture(n.uuid,`material.${o}`,h);const v=(w=i.scene)==null?void 0:w.getObjectByProperty("uuid",n.uuid);v!==void 0&>(h).then(S=>{K(v,`material.${o}`,S),K(v,"material.needsUpdate",!0)})}}):s.push({title:`${ve(d)}`,prop:`material.${o}.${d}`,type:`${typeof t[o][d]}`,value:c[d],onChange:(f,h)=>{var w;i.updateObject(n.uuid,`material.${o}.${d}`,h);const v=(w=i.scene)==null?void 0:w.getObjectByProperty("uuid",n.uuid);v!==void 0&&K(v,`material.${o}.${d}`,h)}});break;case"object":g.value!==void 0&&g.value.src!==void 0?s.push({title:ve(d),type:"image",value:g.value.src,onChange:(f,h)=>{var w;i.createTexture(n.uuid,`material.${o}.${d}.value`,h);const v=(w=i.scene)==null?void 0:w.getObjectByProperty("uuid",n.uuid);v!==void 0&>(h).then(S=>{K(v,`material.${o}.${d}.value`,S)})}}):s.push({title:d,type:`${typeof g.value}`,value:g.value,onChange:(f,h)=>{var w;i.updateObject(n.uuid,`material.${o}.${d}.value`,h);const v=(w=i.scene)==null?void 0:w.getObjectByProperty("uuid",n.uuid);v!==void 0&&K(v,`material.${o}.${d}.value`,h)}});break}}s.length>0&&e.push({title:ve(o),items:s})}else c!==void 0&&console.log("other:",o,u,c)}return e.sort((o,u)=>o.title<u.title?-1:o.title>u.title?1:0),e.push({title:"Update Material",type:"button",onChange:()=>{i.updateObject(n.uuid,"material.needsUpdate",!0)}}),e}function In(t,n){const i=t.material;if(Array.isArray(i)){const e=[],o=i.length;for(let u=0;u<o;u++)e.push(l.jsx(Me,{title:`Material ${u}`,items:Ht(i[u],t,n)}));return l.jsx(l.Fragment,{children:e})}else return l.jsx(Me,{title:"Material",items:Ht(i,t,n)})}function ze(t){let n=t.value;n!==void 0&&n.isColor!==void 0&&(n=_t(t.value));const[i,e]=_.useState(n),o=_.useRef(null),u=_.useRef(null),c=_.useRef(null);_.useEffect(()=>{var Q;let b=!1,f=-1,h=0,v=Number(i);const w=ee=>{b=!0,h=v,f=ee.clientX},S=ee=>{if(!b)return;const Z=t.step!==void 0?t.step:1,M=(ee.clientX-f)*Z;v=Number((h+M).toFixed(4)),u.current!==null&&(u.current.value=v.toString()),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,v)},U=()=>{b=!1},B=()=>{b=!1},D=t.type==="number";return D&&((Q=o.current)==null||Q.addEventListener("mousedown",w,!1),document.addEventListener("mouseup",U,!1),document.addEventListener("mousemove",S,!1),document.addEventListener("contextmenu",B,!1)),()=>{var ee;D&&((ee=o.current)==null||ee.removeEventListener("mousedown",w),document.removeEventListener("mouseup",U),document.removeEventListener("mousemove",S),document.removeEventListener("contextmenu",B))}},[i]);const s=t.type==="string"&&(i.length>100||i.search(`
|
144
|
+
`)>-1),d=s||t.type==="image",g=b=>{let f=b.target.value;t.type==="boolean"&&(f=b.target.checked),e(f),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,f)};return l.jsxs("div",{className:`field ${d?"block":""}`,children:[t.type!=="button"&&l.jsx("label",{ref:o,children:t.title},"fieldLabel"),t.type==="string"&&!s&&l.jsx("input",{type:"text",disabled:t.disabled,onChange:g,value:i}),t.type==="string"&&s&&l.jsx("textarea",{cols:50,rows:10,disabled:!0,onChange:g,value:i}),t.type==="boolean"&&l.jsx("input",{type:"checkbox",disabled:t.disabled,onChange:g,checked:i}),t.type==="number"&&l.jsx("input",{ref:u,type:"number",value:i,min:t.min,max:t.max,step:t.step,onChange:g}),t.type==="range"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:i.toString(),onChange:g,className:"min"}),l.jsx("input",{disabled:t.disabled,type:"range",value:i,min:t.min,max:t.max,step:t.step,onChange:g})]}),t.type==="color"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:i.toString(),onChange:g,className:"color"}),l.jsx("input",{type:"color",value:i,onChange:g})]}),t.type==="button"&&l.jsx("button",{onClick:()=>{t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,!0)},children:t.title}),t.type==="image"&&l.jsx("img",{ref:c,onClick:()=>{Dn().then(b=>{c.current.src=b,t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,b)})},src:i.length>0?i:Pn})]})}function Wt(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 An(t,n){const i=[];if(t.perspectiveCameraInfo!==void 0)for(const e in t.perspectiveCameraInfo)i.push({title:Wt(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(o,u)=>{var s;n.updateObject(t.uuid,o,u),n.requestMethod(t.uuid,"updateProjectionMatrix");const c=(s=n.scene)==null?void 0:s.getObjectByProperty("uuid",t.uuid);c!==void 0&&(K(c,o,u),c.updateProjectionMatrix())}});else if(t.orthographicCameraInfo!==void 0)for(const e in t.orthographicCameraInfo)i.push({title:Wt(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(o,u)=>{var s;n.updateObject(t.uuid,o,u),n.requestMethod(t.uuid,"updateProjectionMatrix");const c=(s=n.scene)==null?void 0:s.getObjectByProperty("uuid",t.uuid);c!==void 0&&(K(c,o,u),c.updateProjectionMatrix())}});return l.jsx(Me,{title:"Camera",items:i})}function Nn(t,n){const i=new m.Matrix4;i.elements=t.matrix;const e=new m.Vector3,o=new m.Euler,u=new m.Vector3;t.uuid.length>0&&(e.setFromMatrixPosition(i),o.setFromRotationMatrix(i),u.setFromMatrixScale(i));const c=(d,g)=>{var f;n.updateObject(t.uuid,d,g);const b=(f=n.scene)==null?void 0:f.getObjectByProperty("uuid",t.uuid);b!==void 0&&K(b,d,g)},s=[{title:"Position",items:[{title:"X",prop:"position.x",type:"number",value:e.x,onChange:c},{title:"Y",prop:"position.y",type:"number",value:e.y,onChange:c},{title:"Z",prop:"position.z",type:"number",value:e.z,onChange:c}]},{title:"Rotation",items:[{title:"X",prop:"rotation.x",type:"number",value:o.x,min:-Math.PI,max:Math.PI,step:.01,onChange:c},{title:"Y",prop:"rotation.y",type:"number",value:o.y,min:-Math.PI,max:Math.PI,step:.01,onChange:c},{title:"Z",prop:"rotation.z",type:"number",value:o.z,min:-Math.PI,max:Math.PI,step:.01,onChange:c}]},{title:"Scale",items:[{title:"X",prop:"scale.x",type:"number",value:u.x,step:.01,onChange:c},{title:"Y",prop:"scale.y",type:"number",value:u.y,step:.01,onChange:c},{title:"Z",prop:"scale.z",type:"number",value:u.z,step:.01,onChange:c}]}];return l.jsx(Me,{title:"Transform",items:s})}function Kt(t){switch(t){case"color":return"Color";case"intensity":return"Intensity";case"decay":return"Decay";case"distance":return"Distance";case"angle":return"Angle";case"penumbra":return"Penumbra";case"groundColor":return"Ground Color"}return t}function Ln(t,n){const i=[];if(t.lightInfo!==void 0)for(const e in t.lightInfo){const o=t.lightInfo[e];o!==void 0&&(o.isColor!==void 0?i.push({title:Kt(e),prop:e,type:"color",value:o,onChange:(u,c)=>{var g;const s=new m.Color(c);n.updateObject(t.uuid,u,s);const d=(g=n.scene)==null?void 0:g.getObjectByProperty("uuid",t.uuid);d!==void 0&&K(d,u,s)}}):i.push({title:Kt(e),prop:e,type:typeof o,value:o,step:typeof o=="number"?.01:void 0,onChange:(u,c)=>{var d;n.updateObject(t.uuid,u,c);const s=(d=n.scene)==null?void 0:d.getObjectByProperty("uuid",t.uuid);s!==void 0&&K(s,u,c)}}))}return l.jsx(Me,{title:"Light",items:i})}function Xt(t){const[n,i]=_.useState(-1),[e,o]=_.useState({name:"",uuid:"",type:"",visible:!1,matrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0});_.useEffect(()=>{function c(s){const d=s.value;o(d),i(Date.now())}return A.addEventListener(N.SET_OBJECT,c),()=>{A.removeEventListener(N.SET_OBJECT,c)}},[]);const u=e.type.toLowerCase();return l.jsx("div",{id:"Inspector",className:t.class,children:e.uuid.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(l.Fragment,{children:[l.jsx(ze,{type:"string",title:"Name",prop:"name",value:e.name,disabled:!0}),l.jsx(ze,{type:"string",title:"Type",prop:"type",value:e.type,disabled:!0}),l.jsx(ze,{type:"string",title:"UUID",prop:"uuid",value:e.uuid,disabled:!0}),l.jsx(ze,{type:"boolean",title:"Visible",prop:"visible",value:e.visible,onChange:(c,s)=>{var g;t.three.updateObject(e.uuid,c,s);const d=(g=t.three.scene)==null?void 0:g.getObjectByProperty("uuid",e.uuid);d!==void 0&&K(d,c,s)}})]}),l.jsxs(l.Fragment,{children:[Nn(e,t.three),u.search("camera")>-1?An(e,t.three):null,u.search("light")>-1?Ln(e,t.three):null,u.search("mesh")>-1?In(e,t.three):null]})]})},n)}class Un extends _.Component{constructor(i){super(i);V(this,"three");V(this,"onRefresh",()=>{this.three.getScene()});V(this,"setScene",i=>{this.setState(()=>({scene:i.value}))});this.state={scene:i.scene!==void 0?i.scene:null},this.three=i.three,A.addEventListener(N.SET_SCENE,this.setScene)}componentDidMount(){this.onRefresh()}componentWillUnmount(){A.removeEventListener(N.SET_SCENE,this.setScene)}render(){var o;const i=this.componentState.scene!==null,e="Hierarchy"+(i?`: ${(o=this.componentState.scene)==null?void 0:o.name}`:"");return l.jsx("div",{id:"SceneHierarchy",children:l.jsxs(l.Fragment,{children:[i&&l.jsx(et,{label:e,button:l.jsx("button",{className:"icon refresh hideText",onClick:this.onRefresh,children:"Refresh"}),open:!0,children:l.jsx(zt,{child:this.componentState.scene,three:this.three})}),l.jsx(et,{label:"Inspector",children:l.jsx(Xt,{three:this.three},"Inspector")})]})},"SceneHierarchy")}get componentState(){return this.state}}function Fn(t){const n=s=>{const d=t.scene.getObjectByProperty("uuid",s.value);d!==void 0&&t.three.setObject(d)},i=(s,d,g)=>{const b=t.scene.getObjectByProperty("uuid",s);b!==void 0&&K(b,d,g)},e=s=>{const d=s.value,{key:g,value:b,uuid:f}=d;i(f,g,b)},o=s=>{const d=s.value;gt(d.value).then(g=>{i(d.uuid,d.key,g),i(d.uuid,"material.needsUpdate",!0)})},u=()=>{t.three.setScene(t.scene)},c=s=>{const{key:d,uuid:g,value:b}=s.value,f=t.scene.getObjectByProperty("uuid",g);if(f!==void 0)try{f[d](b)}catch(h){console.log("Error requesting method:"),console.log(h),console.log(d),console.log(b)}};return _.useEffect(()=>(A.addEventListener(N.GET_OBJECT,n),A.addEventListener(N.GET_SCENE,u),A.addEventListener(N.UPDATE_OBJECT,e),A.addEventListener(N.CREATE_TEXTURE,o),A.addEventListener(N.REQUEST_METHOD,c),()=>{A.removeEventListener(N.GET_OBJECT,n),A.removeEventListener(N.GET_SCENE,u),A.removeEventListener(N.UPDATE_OBJECT,e),A.removeEventListener(N.CREATE_TEXTURE,o),A.removeEventListener(N.REQUEST_METHOD,c)}),[]),null}const Zt={type:"change"},Et={type:"start"},Jt={type:"end"},tt=new m.Ray,Qt=new m.Plane,Vn=Math.cos(70*m.MathUtils.DEG2RAD);class Bn extends m.EventDispatcher{constructor(n,i){super(),this.object=n,this.domElement=i,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new m.Vector3,this.cursor=new m.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:m.MOUSE.ROTATE,MIDDLE:m.MOUSE.DOLLY,RIGHT:m.MOUSE.PAN},this.touches={ONE:m.TOUCH.ROTATE,TWO:m.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return s.phi},this.getAzimuthalAngle=function(){return s.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(r){r.addEventListener("keydown",qe),this._domElementKeyEvents=r},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",qe),this._domElementKeyEvents=null},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(Zt),e.update(),u=o.NONE},this.update=function(){const r=new m.Vector3,E=new m.Quaternion().setFromUnitVectors(n.up,new m.Vector3(0,1,0)),j=E.clone().invert(),k=new m.Vector3,H=new m.Quaternion,ce=new m.Vector3,q=2*Math.PI;return function(pt=null){const ue=e.object.position;r.copy(ue).sub(e.target),r.applyQuaternion(E),s.setFromVector3(r),e.autoRotate&&u===o.NONE&&we(Ee(pt)),e.enableDamping?(s.theta+=d.theta*e.dampingFactor,s.phi+=d.phi*e.dampingFactor):(s.theta+=d.theta,s.phi+=d.phi);let te=e.minAzimuthAngle,ne=e.maxAzimuthAngle;isFinite(te)&&isFinite(ne)&&(te<-Math.PI?te+=q:te>Math.PI&&(te-=q),ne<-Math.PI?ne+=q:ne>Math.PI&&(ne-=q),te<=ne?s.theta=Math.max(te,Math.min(ne,s.theta)):s.theta=s.theta>(te+ne)/2?Math.max(te,s.theta):Math.min(ne,s.theta)),s.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,s.phi)),s.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&&M||e.object.isOrthographicCamera?s.radius=Ie(s.radius):s.radius=Ie(s.radius*g),r.setFromSpherical(s),r.applyQuaternion(j),ue.copy(e.target).add(r),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 Le=!1;if(e.zoomToCursor&&M){let Re=null;if(e.object.isPerspectiveCamera){const me=r.length();Re=Ie(me*g);const Ue=me-Re;e.object.position.addScaledVector(ee,Ue),e.object.updateMatrixWorld()}else if(e.object.isOrthographicCamera){const me=new m.Vector3(Z.x,Z.y,0);me.unproject(e.object),e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/g)),e.object.updateProjectionMatrix(),Le=!0;const Ue=new m.Vector3(Z.x,Z.y,0);Ue.unproject(e.object),e.object.position.sub(Ue).add(me),e.object.updateMatrixWorld(),Re=r.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;Re!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(Re).add(e.object.position):(tt.origin.copy(e.object.position),tt.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(tt.direction))<Vn?n.lookAt(e.target):(Qt.setFromNormalAndCoplanarPoint(e.object.up,e.target),tt.intersectPlane(Qt,e.target))))}else e.object.isOrthographicCamera&&(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/g)),e.object.updateProjectionMatrix(),Le=!0);return g=1,M=!1,Le||k.distanceToSquared(e.object.position)>c||8*(1-H.dot(e.object.quaternion))>c||ce.distanceToSquared(e.target)>0?(e.dispatchEvent(Zt),k.copy(e.object.position),H.copy(e.object.quaternion),ce.copy(e.target),!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",pe),e.domElement.removeEventListener("pointerdown",Je),e.domElement.removeEventListener("pointercancel",Te),e.domElement.removeEventListener("wheel",lt),e.domElement.removeEventListener("pointermove",he),e.domElement.removeEventListener("pointerup",Te),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",qe),e._domElementKeyEvents=null)};const e=this,o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=o.NONE;const c=1e-6,s=new m.Spherical,d=new m.Spherical;let g=1;const b=new m.Vector3,f=new m.Vector2,h=new m.Vector2,v=new m.Vector2,w=new m.Vector2,S=new m.Vector2,U=new m.Vector2,B=new m.Vector2,D=new m.Vector2,Q=new m.Vector2,ee=new m.Vector3,Z=new m.Vector2;let M=!1;const T=[],z={};function Ee(r){return r!==null?2*Math.PI/60*e.autoRotateSpeed*r:2*Math.PI/60/60*e.autoRotateSpeed}function _e(r){const E=Math.abs(r)/(100*(window.devicePixelRatio|0));return Math.pow(.95,e.zoomSpeed*E)}function we(r){d.theta-=r}function Ce(r){d.phi-=r}const ae=function(){const r=new m.Vector3;return function(j,k){r.setFromMatrixColumn(k,0),r.multiplyScalar(-j),b.add(r)}}(),oe=function(){const r=new m.Vector3;return function(j,k){e.screenSpacePanning===!0?r.setFromMatrixColumn(k,1):(r.setFromMatrixColumn(k,0),r.crossVectors(e.object.up,r)),r.multiplyScalar(j),b.add(r)}}(),ie=function(){const r=new m.Vector3;return function(j,k){const H=e.domElement;if(e.object.isPerspectiveCamera){const ce=e.object.position;r.copy(ce).sub(e.target);let q=r.length();q*=Math.tan(e.object.fov/2*Math.PI/180),ae(2*j*q/H.clientHeight,e.object.matrix),oe(2*k*q/H.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(ae(j*(e.object.right-e.object.left)/e.object.zoom/H.clientWidth,e.object.matrix),oe(k*(e.object.top-e.object.bottom)/e.object.zoom/H.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function ke(r){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?g/=r:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function He(r){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?g*=r:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function De(r,E){if(!e.zoomToCursor)return;M=!0;const j=e.domElement.getBoundingClientRect(),k=r-j.left,H=E-j.top,ce=j.width,q=j.height;Z.x=k/ce*2-1,Z.y=-(H/q)*2+1,ee.set(Z.x,Z.y,1).unproject(e.object).sub(e.object.position).normalize()}function Ie(r){return Math.max(e.minDistance,Math.min(e.maxDistance,r))}function We(r){f.set(r.clientX,r.clientY)}function at(r){De(r.clientX,r.clientX),B.set(r.clientX,r.clientY)}function Ke(r){w.set(r.clientX,r.clientY)}function it(r){h.set(r.clientX,r.clientY),v.subVectors(h,f).multiplyScalar(e.rotateSpeed);const E=e.domElement;we(2*Math.PI*v.x/E.clientHeight),Ce(2*Math.PI*v.y/E.clientHeight),f.copy(h),e.update()}function xt(r){D.set(r.clientX,r.clientY),Q.subVectors(D,B),Q.y>0?ke(_e(Q.y)):Q.y<0&&He(_e(Q.y)),B.copy(D),e.update()}function St(r){S.set(r.clientX,r.clientY),U.subVectors(S,w).multiplyScalar(e.panSpeed),ie(U.x,U.y),w.copy(S),e.update()}function Xe(r){De(r.clientX,r.clientY),r.deltaY<0?He(_e(r.deltaY)):r.deltaY>0&&ke(_e(r.deltaY)),e.update()}function Ze(r){let E=!1;switch(r.code){case e.keys.UP:r.ctrlKey||r.metaKey||r.shiftKey?Ce(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ie(0,e.keyPanSpeed),E=!0;break;case e.keys.BOTTOM:r.ctrlKey||r.metaKey||r.shiftKey?Ce(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ie(0,-e.keyPanSpeed),E=!0;break;case e.keys.LEFT:r.ctrlKey||r.metaKey||r.shiftKey?we(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ie(e.keyPanSpeed,0),E=!0;break;case e.keys.RIGHT:r.ctrlKey||r.metaKey||r.shiftKey?we(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ie(-e.keyPanSpeed,0),E=!0;break}E&&(r.preventDefault(),e.update())}function xe(r){if(T.length===1)f.set(r.pageX,r.pageY);else{const E=se(r),j=.5*(r.pageX+E.x),k=.5*(r.pageY+E.y);f.set(j,k)}}function Ae(r){if(T.length===1)w.set(r.pageX,r.pageY);else{const E=se(r),j=.5*(r.pageX+E.x),k=.5*(r.pageY+E.y);w.set(j,k)}}function Se(r){const E=se(r),j=r.pageX-E.x,k=r.pageY-E.y,H=Math.sqrt(j*j+k*k);B.set(0,H)}function Ot(r){e.enableZoom&&Se(r),e.enablePan&&Ae(r)}function rt(r){e.enableZoom&&Se(r),e.enableRotate&&xe(r)}function ot(r){if(T.length==1)h.set(r.pageX,r.pageY);else{const j=se(r),k=.5*(r.pageX+j.x),H=.5*(r.pageY+j.y);h.set(k,H)}v.subVectors(h,f).multiplyScalar(e.rotateSpeed);const E=e.domElement;we(2*Math.PI*v.x/E.clientHeight),Ce(2*Math.PI*v.y/E.clientHeight),f.copy(h)}function st(r){if(T.length===1)S.set(r.pageX,r.pageY);else{const E=se(r),j=.5*(r.pageX+E.x),k=.5*(r.pageY+E.y);S.set(j,k)}U.subVectors(S,w).multiplyScalar(e.panSpeed),ie(U.x,U.y),w.copy(S)}function Oe(r){const E=se(r),j=r.pageX-E.x,k=r.pageY-E.y,H=Math.sqrt(j*j+k*k);D.set(0,H),Q.set(0,Math.pow(D.y/B.y,e.zoomSpeed)),ke(Q.y),B.copy(D);const ce=(r.pageX+E.x)*.5,q=(r.pageY+E.y)*.5;De(ce,q)}function Ne(r){e.enableZoom&&Oe(r),e.enablePan&&st(r)}function ct(r){e.enableZoom&&Oe(r),e.enableRotate&&ot(r)}function Je(r){e.enabled!==!1&&(T.length===0&&(e.domElement.setPointerCapture(r.pointerId),e.domElement.addEventListener("pointermove",he),e.domElement.addEventListener("pointerup",Te)),Rt(r),r.pointerType==="touch"?ut(r):Tt(r))}function he(r){e.enabled!==!1&&(r.pointerType==="touch"?dt(r):Qe(r))}function Te(r){ft(r),T.length===0&&(e.domElement.releasePointerCapture(r.pointerId),e.domElement.removeEventListener("pointermove",he),e.domElement.removeEventListener("pointerup",Te)),e.dispatchEvent(Jt),u=o.NONE}function Tt(r){let E;switch(r.button){case 0:E=e.mouseButtons.LEFT;break;case 1:E=e.mouseButtons.MIDDLE;break;case 2:E=e.mouseButtons.RIGHT;break;default:E=-1}switch(E){case m.MOUSE.DOLLY:if(e.enableZoom===!1)return;at(r),u=o.DOLLY;break;case m.MOUSE.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(e.enablePan===!1)return;Ke(r),u=o.PAN}else{if(e.enableRotate===!1)return;We(r),u=o.ROTATE}break;case m.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(e.enableRotate===!1)return;We(r),u=o.ROTATE}else{if(e.enablePan===!1)return;Ke(r),u=o.PAN}break;default:u=o.NONE}u!==o.NONE&&e.dispatchEvent(Et)}function Qe(r){switch(u){case o.ROTATE:if(e.enableRotate===!1)return;it(r);break;case o.DOLLY:if(e.enableZoom===!1)return;xt(r);break;case o.PAN:if(e.enablePan===!1)return;St(r);break}}function lt(r){e.enabled===!1||e.enableZoom===!1||u!==o.NONE||(r.preventDefault(),e.dispatchEvent(Et),Xe(r),e.dispatchEvent(Jt))}function qe(r){e.enabled===!1||e.enablePan===!1||Ze(r)}function ut(r){switch($e(r),T.length){case 1:switch(e.touches.ONE){case m.TOUCH.ROTATE:if(e.enableRotate===!1)return;xe(r),u=o.TOUCH_ROTATE;break;case m.TOUCH.PAN:if(e.enablePan===!1)return;Ae(r),u=o.TOUCH_PAN;break;default:u=o.NONE}break;case 2:switch(e.touches.TWO){case m.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Ot(r),u=o.TOUCH_DOLLY_PAN;break;case m.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;rt(r),u=o.TOUCH_DOLLY_ROTATE;break;default:u=o.NONE}break;default:u=o.NONE}u!==o.NONE&&e.dispatchEvent(Et)}function dt(r){switch($e(r),u){case o.TOUCH_ROTATE:if(e.enableRotate===!1)return;ot(r),e.update();break;case o.TOUCH_PAN:if(e.enablePan===!1)return;st(r),e.update();break;case o.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Ne(r),e.update();break;case o.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;ct(r),e.update();break;default:u=o.NONE}}function pe(r){e.enabled!==!1&&r.preventDefault()}function Rt(r){T.push(r.pointerId)}function ft(r){delete z[r.pointerId];for(let E=0;E<T.length;E++)if(T[E]==r.pointerId){T.splice(E,1);return}}function $e(r){let E=z[r.pointerId];E===void 0&&(E=new m.Vector2,z[r.pointerId]=E),E.set(r.pageX,r.pageY)}function se(r){const E=r.pointerId===T[0]?T[1]:T[0];return z[E]}e.domElement.addEventListener("contextmenu",pe),e.domElement.addEventListener("pointerdown",Je),e.domElement.addEventListener("pointercancel",Te),e.domElement.addEventListener("wheel",lt,{passive:!1}),this.update()}}const wt=t=>{const[n,i]=_.useState(!1),[e,o]=_.useState(t.options[t.index]),u=()=>{i(!n)},c=s=>{s!==e&&(t.onSelect(s),o(s)),i(!1)};return l.jsxs("div",{className:`dropdown ${t.up===!0?"up":""}`,children:[l.jsx("div",{className:"dropdown-toggle",onClick:u,children:e}),n&&l.jsx("ul",{className:"dropdown-menu",children:t.options.map(s=>l.jsx("li",{onClick:()=>c(s),children:s},s))})]})},be=_.forwardRef(function(n,i){const e=n.options.indexOf(n.camera.name);return l.jsxs("div",{className:"CameraWindow",children:[l.jsx("div",{ref:i,className:"clickable"}),l.jsx(wt,{index:e,options:n.options,onSelect:n.onSelect,up:!0})]})}),qt=["Single","Side by Side","Stacked","Quad"],X=new Map,W=new Map,le=new Map,fe=["Top","Bottom","Left","Right","Front","Back","Orthographic","Debug"];function ye(t,n){const i=new m.OrthographicCamera(-100,100,100,-100,50,3e3);return i.name=t,i.position.copy(n),i.lookAt(0,0,0),X.set(t,i),i}ye("Top",new m.Vector3(0,1e3,0)),ye("Bottom",new m.Vector3(0,-1e3,0)),ye("Left",new m.Vector3(-1e3,0,0)),ye("Right",new m.Vector3(1e3,0,0)),ye("Front",new m.Vector3(0,0,1e3)),ye("Back",new m.Vector3(0,0,-1e3)),ye("Orthographic",new m.Vector3(1e3,1e3,1e3));const nt=new m.PerspectiveCamera(60,1,50,3e3);nt.name="Debug",nt.position.set(500,500,500),nt.lookAt(0,0,0),X.set("Debug",nt);const Gn=["Default","Normals","Wireframe","UVs"],Yn=new m.MeshNormalMaterial,zn=new m.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0}),Hn=new Yt,ia="";let Ct="Default";const L=new m.Scene;let Y=X.get("Debug"),$=X.get("Orthographic"),Pe=X.get("Front"),je=X.get("Top");function Wn(t){const[n,i]=_.useState(t.mode!==void 0?t.mode:"Quad"),e=_.useRef(null),o=_.useRef(null),u=_.useRef(null),c=_.useRef(null),s=(f,h)=>{const v=W.get(f.name);v!==void 0&&v.dispose(),W.delete(f.name);const w=le.get(f.name);w!==void 0&&(L.remove(w),w.dispose()),le.delete(f.name);const S=new Bn(f,h);switch(f.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":S.enableRotate=!1;break}if(W.set(f.name,S),f instanceof m.PerspectiveCamera){const U=new m.CameraHelper(f);le.set(f.name,U),L.add(U)}},d=f=>{const h=le.get(f.name);h!==void 0&&(L.remove(h),h.dispose(),le.delete(f.name));const v=W.get(f.name);v!==void 0&&(v.dispose(),W.delete(f.name))},g=()=>{W.forEach((f,h)=>{f.dispose();const v=le.get(h);v!==void 0&&(L.remove(v),v.dispose()),le.delete(h),W.delete(h)}),W.clear(),le.clear()},b=()=>{switch(n){case"Single":s(Y,e.current);break;case"Side by Side":case"Stacked":s(Y,e.current),s($,o.current);break;case"Quad":s(Y,e.current),s($,o.current),s(Pe,u.current),s(je,c.current);break}};return _.useEffect(()=>{L.name="Debug Scene",L.add(t.scene);const f=new Gt;L.add(f);const h=new m.AxesHelper(500);h.name="axisHelper",L.add(h)},[]),_.useEffect(()=>{const f=t.renderer.getSize(new m.Vector2);let h=f.x,v=f.y,w=Math.floor(h/2),S=Math.floor(v/2),U=-1;const B=()=>{h=window.innerWidth-300,v=window.innerHeight,w=Math.floor(h/2),S=Math.floor(v/2);let M=h,T=v;switch(n){case"Side by Side":M=w,T=v;break;case"Stacked":M=h,T=S;break;case"Quad":M=w,T=S;break}X.forEach(z=>{var Ee;z instanceof m.OrthographicCamera?(z.left=M/-2,z.right=M/2,z.top=T/2,z.bottom=T/-2,z.updateProjectionMatrix()):z instanceof m.PerspectiveCamera&&(z.aspect=M/T,z.updateProjectionMatrix(),(Ee=le.get(z.name))==null||Ee.update())})},D=()=>{t.renderer.setViewport(0,0,h,v),t.renderer.setScissor(0,0,h,v),t.renderer.render(L,Y)},Q=()=>{if(n==="Side by Side")t.renderer.setViewport(0,0,w,v),t.renderer.setScissor(0,0,w,v),t.renderer.render(L,Y),t.renderer.setViewport(w,0,w,v),t.renderer.setScissor(w,0,w,v),t.renderer.render(L,$);else{const M=v-S;t.renderer.setViewport(0,M,h,S),t.renderer.setScissor(0,M,h,S),t.renderer.render(L,Y),t.renderer.setViewport(0,0,h,S),t.renderer.setScissor(0,0,h,S),t.renderer.render(L,$)}},ee=()=>{let M=0,T=0;T=v-S,M=0,t.renderer.setViewport(M,T,w,S),t.renderer.setScissor(M,T,w,S),t.renderer.render(L,Y),M=w,t.renderer.setViewport(M,T,w,S),t.renderer.setScissor(M,T,w,S),t.renderer.render(L,$),T=0,M=0,t.renderer.setViewport(M,T,w,S),t.renderer.setScissor(M,T,w,S),t.renderer.render(L,Pe),M=w,t.renderer.setViewport(M,T,w,S),t.renderer.setScissor(M,T,w,S),t.renderer.render(L,je)},Z=()=>{switch(W.forEach(M=>{M.update()}),t.scene.update(),t.renderer.clear(),n){case"Single":D();break;case"Side by Side":case"Stacked":Q();break;case"Quad":ee();break}U=requestAnimationFrame(Z)};return b(),window.addEventListener("resize",B),B(),Z(),()=>{window.removeEventListener("resize",B),cancelAnimationFrame(U),U=-1}},[n]),t.cameras.forEach(f=>{X.set(f.name,f),fe.push(f.name)}),l.jsxs("div",{className:"multiview",children:[l.jsxs("div",{className:`cameras ${n==="Single"||n==="Stacked"?"single":""}`,children:[n==="Single"&&l.jsx(l.Fragment,{children:l.jsx(be,{camera:Y,options:fe,ref:e,onSelect:f=>{var v;(v=W.get(Y.name))==null||v.dispose();const h=X.get(f);h!==void 0&&(d(Y),Y=h,s(h,e.current))}})}),(n==="Side by Side"||n==="Stacked")&&l.jsxs(l.Fragment,{children:[l.jsx(be,{camera:Y,options:fe,ref:e,onSelect:f=>{var v;(v=W.get(Y.name))==null||v.dispose();const h=X.get(f);h!==void 0&&(d(Y),Y=h,s(h,e.current))}}),l.jsx(be,{camera:$,options:fe,ref:o,onSelect:f=>{var v;(v=W.get($.name))==null||v.dispose();const h=X.get(f);h!==void 0&&(d($),$=h,s(h,o.current))}})]}),n==="Quad"&&l.jsxs(l.Fragment,{children:[l.jsx(be,{camera:Y,options:fe,ref:e,onSelect:f=>{var v;(v=W.get(Y.name))==null||v.dispose();const h=X.get(f);h!==void 0&&(d(Y),Y=h,s(h,e.current))}}),l.jsx(be,{camera:$,options:fe,ref:o,onSelect:f=>{var v;(v=W.get($.name))==null||v.dispose();const h=X.get(f);h!==void 0&&(d($),$=h,s(h,o.current))}}),l.jsx(be,{camera:Pe,options:fe,ref:u,onSelect:f=>{var v;(v=W.get(Pe.name))==null||v.dispose();const h=X.get(f);h!==void 0&&(d(Pe),Pe=h,s(h,u.current))}}),l.jsx(be,{camera:je,options:fe,ref:c,onSelect:f=>{var v;(v=W.get(je.name))==null||v.dispose();const h=X.get(f);h!==void 0&&(d(je),je=h,s(h,c.current))}})]})]}),l.jsxs("div",{className:"settings",children:[l.jsx(wt,{index:qt.indexOf(n),options:qt,onSelect:f=>{f!==n&&(g(),i(f))}}),l.jsx(wt,{index:0,options:Gn,onSelect:f=>{if(f!==Ct)switch(Ct=f,Ct){case"Default":L.overrideMaterial=null;break;case"Normals":L.overrideMaterial=Yn;break;case"Wireframe":L.overrideMaterial=zn;break;case"UVs":L.overrideMaterial=Hn;break}}})]})]})}const ra="";function Kn(t){return l.jsxs("div",{className:"editor",ref:t.ref,style:t.style,children:[l.jsx("header",{children:t.header}),t.children,l.jsx("footer",{children:t.footer})]})}C.Accordion=et,C.Application=un,C.BaseRemote=Be,C.ChildObject=yt,C.ContainerObject=zt,C.Draggable=Ft,C.DraggableItem=Ut,C.Dropdown=Vt,C.DropdownItem=Bt,C.Editor=Kn,C.InfiniteGridHelper=Gt,C.Inspector=Xt,C.MultiView=Wn,C.NavButton=bt,C.RemoteComponents=dn,C.RemoteController=xn,C.RemoteTheatre=fn,C.RemoteThree=vn,C.RemoteTweakpane=bn,C.SceneHierarchy=Un,C.SceneInspector=Fn,C.ToolEvents=N,C.UVMaterial=Yt,C.clamp=cn,C.colorToHex=_t,C.debugDispatcher=A,C.distance=ln,C.hierarchyUUID=mt,C.isColor=jt,C.randomID=Pt,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
"module": "./dist/hermes.js",
|
8
8
|
"types": "./types/index.d.ts",
|
9
9
|
"type": "module",
|
10
|
-
"version": "0.0.
|
10
|
+
"version": "0.0.9",
|
11
11
|
"homepage": "https://github.com/tomorrowevening/hermes#readme",
|
12
12
|
"bugs": {
|
13
13
|
"url": "https://github.com/tomorrowevening/hermes/issues"
|
@@ -52,8 +52,10 @@
|
|
52
52
|
"@theatre/core": "0.7.0",
|
53
53
|
"@tweakpane/plugin-essentials": "^0.2.0",
|
54
54
|
"framer-motion": "^10.16.0",
|
55
|
+
"postprocessing": "6.34.1",
|
55
56
|
"react": "^18.2.0",
|
56
57
|
"react-dom": "^18.2.0",
|
58
|
+
"stats-gl": "2.0.1",
|
57
59
|
"three": "^0.160.0",
|
58
60
|
"tweakpane": "^4.0.0"
|
59
61
|
},
|
@@ -37,6 +37,8 @@ export default function Inspector(props: CoreComponentProps) {
|
|
37
37
|
};
|
38
38
|
}, []);
|
39
39
|
|
40
|
+
const objType = currentObject.type.toLowerCase();
|
41
|
+
|
40
42
|
return (
|
41
43
|
<div id="Inspector" className={props.class} key={lastRefresh}>
|
42
44
|
{currentObject.uuid.length > 0 && (
|
@@ -82,11 +84,11 @@ export default function Inspector(props: CoreComponentProps) {
|
|
82
84
|
{/* Transform */}
|
83
85
|
{InspectTransform(currentObject, props.three)}
|
84
86
|
{/* Cameras */}
|
85
|
-
{
|
87
|
+
{objType.search('camera') > -1 ? InspectCamera(currentObject, props.three) : null}
|
86
88
|
{/* Lights */}
|
87
|
-
{
|
89
|
+
{objType.search('light') > -1 ? InspectLight(currentObject, props.three) : null}
|
88
90
|
{/* Material */}
|
89
|
-
{
|
91
|
+
{objType.search('mesh') > -1 ? InspectMaterial(currentObject, props.three) : null}
|
90
92
|
</>
|
91
93
|
</>
|
92
94
|
)}
|