You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.0 MiB

9 months ago
/**
* @license
* Copyright thing.js www.vaps.cc
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("core-js/es/array/includes")):"function"==typeof define&&define.amd?define(["exports","core-js/es/array/includes"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).THING={})}(this,(function(t){"use strict";function e(t){return t instanceof Buffer?Buffer.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}const i=navigator.userAgent.toLowerCase(),r=function(t){return t.test(window.navigator?i:"")},n=r(/msie/),s=r(/applewebkit.*chrome*./),o=r(/msie/)||r(/trident/),a=r(/msie 10/),l=r(/edge/),h=r(/firefox/),c=r(/mac/),d=!!window.navigator&&window.navigator.platform.indexOf("Win")>-1,u="ontouchstart"in document.documentElement||!d&&(!!document&&"ontouchend"in document),p=-1!=i.indexOf("mobile")||-1!=i.indexOf("android"),m=/(Android)\s+([\d.]+)/i.test(i),f=/\(i[^;]+;( U;)? cpu.+mac os x/i.test(i),g=/(iPhone|iPad|iPod|iOS|Mac OS X)/i.test(i),v=/(iPhone\sOS)\s([\d_]+)/i.test(i),y=/(iPad).*OS\s([\d_]+)/i.test(i),w=/QQ\/([\d.]+)/i.test(i),x=/wxwork\/.* MicroMessenger/i.test(i),b=/micromessenger/i.test(i)&&!x,_=/WeiBo/i.test(i),A="miniprogram"===window.__wxjs_environment;/AlipayClient/i.test(i);const S=h?"DOMMouseScroll":"mousewheel",T=u?["touchstart","touchmove","touchend","keydown","keyup","keypress","input","contextmenu","compositionstart","compositionupdate","compositionend"]:["keydown","keyup","keypress","input","mousedown","mousemove","mouseup","mouseout",S,"wheel","contextmenu","mouseenter","mouseleave","mouseover","compositionstart","compositionupdate","compositionend"];let E=!1;try{const t=Object.defineProperty({},"passive",{get:function(){E=!0}});window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(Yr){E=!1}const P=E,M=!!E&&{passive:!1,capture:!1},C=!E||{passive:!1,capture:!0};function L(){try{let t=new Array;if(null!=window.screen.deviceXDPI)t[0]=window.screen.deviceXDPI,t[1]=window.screen.deviceYDPI;else{let e=document.createElement("DIV");e.style.cssText="width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden",document.body.appendChild(e),t[0]=parseInt(e.offsetWidth),t[1]=parseInt(e.offsetHeight),e.parentNode.removeChild(e)}return t[0]||96}catch{}return 96}const R=L();var O=Object.freeze({__proto__:null,navTest:r,browserIsIE:n,browserIsChrome:s,browserIsIEorTrident:o,browserIsIE10:a,browserIsEdge:l,browserIsFirefox:h,browserIsMac:c,isWindowPlatform:d,isTouchable:u,isMobile:p,isAndroid:m,isIOS:f,isApple:g,isIphone:v,isIpad:y,isQQ:w,isWeiXinWork:x,isWeiXin:b,isWeiBo:_,isMiniProgram:A,CS_MSWHEEL_KEY:S,CS_EVENT_LIST:T,passiveSupported:P,eventListenerOptionsFalse:M,eventListenerOptionsTrue:C,getPlatform:function(){let t=navigator.userAgent;const e=["Android","iPhone","SymbianOS","Windows Phone","iPad","iPod"];let i=!0,r="PC",n=!1;for(let s=0;s<e.length;s++)if(t.indexOf(e[s])>0){i=!1,r=e[s],t.indexOf("MicroMessenger")>0&&(n=!0);break}return{isPC:i,isWeixin:n,platform:r}},getScreenScale:function(){var t=0,e=window.screen;return void 0!==window.devicePixelRatio?t=window.devicePixelRatio:~this.ua.indexOf("msie")?e.deviceXDPI&&e.logicalXDPI&&(t=e.deviceXDPI/e.logicalXDPI):void 0!==window.outerWidth&&void 0!==window.innerWidth&&(t=window.outerWidth/window.innerWidth),t&&(t=Math.round(100*t)),99!==t&&101!==t||(t=100),t},getDPI:L,DPI:R,getPixelPerCentimeter:function(){return L()/2.54}});function F(t){return"object"==typeof HTMLElement?t instanceof HTMLElement:!(!t||"object"!=typeof t||1!==t.nodeType&&9!==t.nodeType||"string"!=typeof t.nodeName)}function N(t,e){let i=t.className.split(/\s+/);for(let t=0;t<i.length;t++)if(i[t]==e)return!0;return!1}function D(t,e){if(N(t,e))return;const i=t.className,r=i+(""!=i?" ":"")+e;t.className=r}function I(t,e){if(!N(t,e))return;let i=" "+t.className+" ";i=i.replace(/(\s+)/gi," ");let r=i.replace(" "+e+" "," ");r=r.replace(/(^\s+)|(\s+$)/g,""),t.className=r}const U=function(t,e,i){const r=window.document.createElement(t);return e&&(r.className=e),i&&i.appendChild(r),r},B=window.document?window.document.documentElement.style:null;
/*!
* camera-controls
* https://github.com/yomotsu/camera-controls
* (c) 2017 @yomotsu
* Released under the MIT License.
*/
/*!
* camera-controls
* https://github.com/yomotsu/camera-controls
* (c) 2017 @yomotsu
* Released under the MIT License.
*/var ta;function ea(t){return(ta[t]||"").toLowerCase()}function ia(t){return t.isPerspectiveCamera}function ra(t){return t.isOrthographicCamera}!function(t){t[t.NONE=0]="NONE",t[t.ROTATE=1]="ROTATE",t[t.TRUCK=2]="TRUCK",t[t.OFFSET=3]="OFFSET",t[t.DOLLY=4]="DOLLY",t[t.ZOOM=5]="ZOOM",t[t.TOUCH_ROTATE=6]="TOUCH_ROTATE",t[t.TOUCH_TRUCK=7]="TOUCH_TRUCK",t[t.TOUCH_OFFSET=8]="TOUCH_OFFSET",t[t.TOUCH_DOLLY=9]="TOUCH_DOLLY",t[t.TOUCH_ZOOM=10]="TOUCH_ZOOM",t[t.TOUCH_DOLLY_TRUCK=11]="TOUCH_DOLLY_TRUCK",t[t.TOUCH_DOLLY_OFFSET=12]="TOUCH_DOLLY_OFFSET",t[t.TOUCH_ZOOM_TRUCK=13]="TOUCH_ZOOM_TRUCK",t[t.TOUCH_ZOOM_OFFSET=14]="TOUCH_ZOOM_OFFSET"}(ta||(ta={}));const na=2*Math.PI,sa=Math.PI/2;function oa(t,e=1e-5){return Math.abs(t)<e}function aa(t,e,i=1e-5){return oa(t-e,i)}function la(t,e){return Math.round(t/e)*e}function ha(t){return isFinite(t)?t:t<0?-Number.MAX_VALUE:Number.MAX_VALUE}function ca(t){return Math.abs(t)<Number.MAX_VALUE?t:t*(1/0)}function da(t,e){e.set(0,0),t.forEach((t=>{e.x+=t.clientX,e.y+=t.clientY})),e.x/=t.length,e.y/=t.length}function ua(t,e){return!!ra(t)&&(console.warn(`${e} is not supported in OrthographicCamera`),!0)}function pa(t){return t.invert?t.invert():t.inverse(),t}const ma="undefined"!=typeof window,fa=ma&&/Mac/.test(navigator.platform),ga=!(ma&&"PointerEvent"in window),va=Object.freeze(ta),ya=1/8;let wa,xa,ba,_a,Aa,Sa,Ta,Ea,Pa,Ma,Ca,La,Ra,Oa,Fa,Na,Da,Ia,Ua,Ba,ka;wa=Object.freeze(new be.Vector3(0,0,0)),xa=Object.freeze(new be.Vector3(0,1,0)),ba=Object.freeze(new be.Vector3(0,0,1)),_a=new be.Vector2,Aa=new be.Vector3,Sa=new be.Vector3,Ta=new be.Vector3,Ea=new be.Vector3,Pa=new be.Vector3,Ma=new be.Vector3,Ca=new be.Vector3,La=new be.Vector3,Ra=new be.Spherical,Oa=new be.Spherical,Fa=new be.Box3,Na=new be.Box3,Da=new be.Sphere,Ia=new be.Quaternion,Ua=new be.Quaternion,Ba=new be.Matrix4,ka=new be.Raycaster;class ja extends class{constructor(){this._listeners={}}addEventListener(t,e){const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}removeEventListener(t,e){const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}removeAllEventListeners(t){t?Array.isArray(this._listeners[t])&&(this._listeners[t].length=0):this._listeners={}}dispatchEvent(t){const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,r=i.length;e<r;e++)i[e].call(this,t)}}}{constructor(t,e){if(super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=0,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.dampingFactor=.05,this.draggingDampingFactor=.25,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.verticalDragToForward=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=ta.NONE,this._viewport=null,this._dollyControlAmount=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._activePointers=[],this._truckInternal=(t,e,i)=>{if(ia(this._camera)){const r=Aa.copy(this._camera.position).sub(this._target),n=this._camera.getEffectiveFOV()*be.MathUtils.DEG2RAD,s=r.length()*Math.tan(.5*n),o=this.truckSpeed*t*s/this._elementRect.height,a=this.truckSpeed*e*s/this._elementRect.height;this.verticalDragToForward?(i?this.setFocalOffset(this._focalOffsetEnd.x+o,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(o,0,!0),this.forward(-a,!0)):i?this.setFocalOffset(this._focalOffsetEnd.x+o,this._focalOffsetEnd.y+a,this._focalOffsetEnd.z,!0):this.truck(o,a,!0)}else if(ra(this._camera)){const r=this._camera,n=t*(r.right-r.left)/r.zoom/this._elementRect.width,s=e*(r.top-r.bottom)/r.zoom/this._elementRect.height;i?this.setFocalOffset(this._focalOffsetEnd.x+n,this._focalOffsetEnd.y+s,this._focalOffsetEnd.z,!0):this.truck(n,s,!0)}},this._rotateInternal=(t,e)=>{const i=na*this.azimuthRotateSpeed*t/this._elementRect.height,r=na*this.pola
/*!
* hotkeys-js v3.8.7
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
*
* Copyright (c) 2021 kenny wong <wowohoo@qq.com>
* http://jaywcjlove.github.io/hotkeys
*
* Licensed under the MIT license.
*/var El="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function Pl(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent&&t.attachEvent("on".concat(e),(function(){i(window.event)}))}function Ml(t,e){for(var i=e.slice(0,e.length-1),r=0;r<i.length;r++)i[r]=t[i[r].toLowerCase()];return i}function Cl(t){"string"!=typeof t&&(t="");for(var e=(t=t.replace(/\s/g,"")).split(","),i=e.lastIndexOf("");i>=0;)e[i-1]+=",",e.splice(i,1),i=e.lastIndexOf("");return e}for(var Ll={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":El?173:189,"=":El?61:187,";":El?59:186,"'":222,"[":219,"]":221,"\\":220},Rl={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},Ol={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Fl={16:!1,18:!1,17:!1,91:!1},Nl={},Dl=1;Dl<20;Dl++)Ll["f".concat(Dl)]=111+Dl;var Il=[],Ul="all",Bl=[],kl=function(t){return Ll[t.toLowerCase()]||Rl[t.toLowerCase()]||t.toUpperCase().charCodeAt(0)};function jl(t){Ul=t||"all"}function Vl(){return Ul||"all"}var zl=function(t){var e=t.key,i=t.scope,r=t.method,n=t.splitKey,s=void 0===n?"+":n;Cl(e).forEach((function(t){var e=t.split(s),n=e.length,o=e[n-1],a="*"===o?"*":kl(o);if(Nl[a]){i||(i=Vl());var l=n>1?Ml(Rl,e):[];Nl[a]=Nl[a].map((function(t){return(!r||t.method===r)&&t.scope===i&&function(t,e){for(var i=t.length>=e.length?t:e,r=t.length>=e.length?e:t,n=!0,s=0;s<i.length;s++)-1===r.indexOf(i[s])&&(n=!1);return n}(t.mods,l)?{}:t}))}}))};function Gl(t,e,i){var r;if(e.scope===i||"all"===e.scope){for(var n in r=e.mods.length>0,Fl)Object.prototype.hasOwnProperty.call(Fl,n)&&(!Fl[n]&&e.mods.indexOf(+n)>-1||Fl[n]&&-1===e.mods.indexOf(+n))&&(r=!1);(0!==e.mods.length||Fl[16]||Fl[18]||Fl[17]||Fl[91])&&!r&&"*"!==e.shortcut||!1===e.method(t,e)&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function Hl(t){var e=Nl["*"],i=t.keyCode||t.which||t.charCode;if(Xl.filter.call(this,t)){if(93!==i&&224!==i||(i=91),-1===Il.indexOf(i)&&229!==i&&Il.push(i),["ctrlKey","altKey","shiftKey","metaKey"].forEach((function(e){var i=Ol[e];t[e]&&-1===Il.indexOf(i)?Il.push(i):!t[e]&&Il.indexOf(i)>-1?Il.splice(Il.indexOf(i),1):"metaKey"===e&&t[e]&&3===Il.length&&(t.ctrlKey||t.shiftKey||t.altKey||(Il=Il.slice(Il.indexOf(i))))})),i in Fl){for(var r in Fl[i]=!0,Rl)Rl[r]===i&&(Xl[r]=!0);if(!e)return}for(var n in Fl)Object.prototype.hasOwnProperty.call(Fl,n)&&(Fl[n]=t[Ol[n]]);t.getModifierState&&(!t.altKey||t.ctrlKey)&&t.getModifierState("AltGraph")&&(-1===Il.indexOf(17)&&Il.push(17),-1===Il.indexOf(18)&&Il.push(18),Fl[17]=!0,Fl[18]=!0);var s=Vl();if(e)for(var o=0;o<e.length;o++)e[o].scope===s&&("keydown"===t.type&&e[o].keydown||"keyup"===t.type&&e[o].keyup)&&Gl(t,e[o],s);if(i in Nl)for(var a=0;a<Nl[i].length;a++)if(("keydown"===t.type&&Nl[i][a].keydown||"keyup"===t.type&&Nl[i][a].keyup)&&Nl[i][a].key){for(var l=Nl[i][a],h=l.splitKey,c=l.key.split(h),d=[],u=0;u<c.length;u++)d.push(kl(c[u]));d.sort().join("")===Il.sort().join("")&&Gl(t,l,s)}}}function Xl(t,e,i){Il=[];var r=Cl(t),n=[],s="all",o=document,a=0,l=!1,h=!0,c="+";for(void 0===i&&"function"==typeof e&&(i=e),"[object Object]"===Object.prototype.toString.call(e)&&(e.scope&&(s=e.scope),e.element&&(o=e.element),e.keyup&&(l=e.keyup),void 0!==e.keydown&&(h=e.keydown),"string"==typeof e.splitKey&&(c=e.splitKey)),"string"==typeof e&&(s=e);a<r.length;a++)n=[],(t=r[a].split(c)).length>1&&(n=Ml(Rl,t)),(t="*"===(t=t[t.length-1])?"*":kl(t))in Nl||(Nl[t]=[]),Nl[t].push({keyup:l,keydown:h,scope:s,mods:n,shortcut:r[a],method:i,key:r[a],splitKey:c});void 0!==o&&!function(t){return Bl.indexOf(t)>-
/** @license
* JS Signals <http://millermedeiros.github.com/js-signals/>
* https://www.cnblogs.com/catherinezyr/p/7403485.html
* Released under the MIT license
* Author: Miller Medeiros
* Version: 1.0.0 - Build: 268 (2012/11/29 05:48 PM)
*/
function dp(t,e,i,r,n){this._listener=e,this._isOnce=i,this.context=r,this._signal=t,this._priority=n||0}function up(t,e){if("function"!=typeof t)throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",e))}function pp(){this._bindings=[],this._prevParams=null;var t=this;this.dispatch=function(){pp.prototype.dispatch.apply(t,arguments)}}cp.prototype={execute:function(t,e){if(!this.enable)return;const i=this.undos[this.undos.length-1],r=(new Date).getTime()-this.lastCmdTime.getTime(),n=i&&i.updatable&&t.updatable&&i.object===t.object&&i.type===t.type&&i.script===t.script&&i.attributeName===t.attributeName;n&&"SetScriptValueCommand"===t.type||n&&r<500?(i.update(t),t=i):(this.undos.push(t),t.id=++this.idCounter),t.name=void 0!==e?e:t.name,t.execute(),t.inMemory=!0,this.config.getKey("settings/history")&&(t.json=t.toJSON()),this.lastCmdTime=new Date,this.redos=[],this.editor.signals.historyChanged.dispatch(t)},undo:function(){if(!this.enable)return;if(this.historyDisabled)return void alert("Undo/Redo disabled while scene is playing.");let t;return this.undos.length>0&&(t=this.undos.pop(),!1===t.inMemory&&t.fromJSON(t.json)),void 0!==t&&(t.undo(),this.redos.push(t),this.editor.signals.historyChanged.dispatch(t)),t},redo:function(){if(!this.enable)return;if(this.historyDisabled)return void alert("Undo/Redo disabled while scene is playing.");let t;return this.redos.length>0&&(t=this.redos.pop(),!1===t.inMemory&&t.fromJSON(t.json)),void 0!==t&&(t.execute(),this.undos.push(t),this.editor.signals.historyChanged.dispatch(t)),t},toJSON:function(){const t={undos:[],redos:[]};if(!this.config.getKey("settings/history"))return t;for(let e=0;e<this.undos.length;e++)this.undos[e].hasOwnProperty("json")&&t.undos.push(this.undos[e].json);for(let e=0;e<this.redos.length;e++)this.redos[e].hasOwnProperty("json")&&t.redos.push(this.redos[e].json);return t},fromJSON:function(t){if(void 0!==t){for(let e=0;e<t.undos.length;e++){const i=t.undos[e],r=new hp[i.type](this.editor);r.json=i,r.id=i.id,r.name=i.name,this.undos.push(r),this.idCounter=i.id>this.idCounter?i.id:this.idCounter}for(let e=0;e<t.redos.length;e++){const i=t.redos[e],r=new hp[i.type](this.editor);r.json=i,r.id=i.id,r.name=i.name,this.redos.push(r),this.idCounter=i.id>this.idCounter?i.id:this.idCounter}this.editor.signals.historyChanged.dispatch(this.undos[this.undos.length-1])}},clear:function(){this.undos=[],this.redos=[],this.idCounter=0,this.editor.signals.historyChanged.dispatch()},goToState:function(t){if(!this.enable)return;if(this.historyDisabled)return void alert("Undo/Redo disabled while scene is playing.");this.editor.signals.sceneGraphChanged.active=!1,this.editor.signals.historyChanged.active=!1;let e=this.undos.length>0?this.undos[this.undos.length-1]:void 0;if(void 0===e||t>e.id)for(e=this.redo();void 0!==e&&t>e.id;)e=this.redo();else for(;e=this.undos[this.undos.length-1],void 0!==e&&t!==e.id;)this.undo();this.editor.signals.sceneGraphChanged.active=!0,this.editor.signals.historyChanged.active=!0,this.editor.signals.sceneGraphChanged.dispatch(),this.editor.signals.historyChanged.dispatch(e)},enableSerialization:function(t){this.goToState(-1),this.editor.signals.sceneGraphChanged.active=!1,this.editor.signals.historyChanged.active=!1;let e=this.redo();for(;void 0!==e;)e.hasOwnProperty("json")||(e.json=e.toJSON()),e=this.redo();this.editor.signals.sceneGraphChanged.active=!0,this.editor.signals.historyChanged.active=!0,this.goToState(t)}},dp.prototype={active:!0,params:null,execute:function(t){var e,i;return this.active&&this._listener&&(i=this.params?this.params.concat(t):t,e=this._listener.apply(this.context,i),this._isOnce&&this.detach()),e},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return