run-scene-v2 0.0.6 → 0.0.8-2.1

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.
Files changed (2) hide show
  1. package/index.js +1 -1
  2. package/package.json +19 -10
package/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios"),require("three"),require("@allex/md5"),require("js-funcs-three"),require("uuid1"),require("js-funcs")):"function"==typeof define&&define.amd?define(["axios","three","@allex/md5","js-funcs-three","uuid1","js-funcs"],t):"object"==typeof exports?exports.RunScene=t(require("axios"),require("three"),require("@allex/md5"),require("js-funcs-three"),require("uuid1"),require("js-funcs")):e.RunScene=t(e.axios,e.three,e["@allex/md5"],e["js-funcs-three"],e.uuid1,e["js-funcs"])}(self,((e,t,r,n,i,o)=>{return s={685:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=(Object.defineProperty(t,"__esModule",{value:!0}),t.downloadFile=t.getFileName=t.urlToBase64=t.toResult=t.getPrefixWord=t.getBackWord=t.bToMB=t.arrayBufferToStr=t.strToArrayBuffer=t.toUrl=t.blobToDataUrl=t.bufferToArrayBuffer=t.base64ToFile=void 0,n(r(300)));t.base64ToFile=function(e,t){for(var r=(e=e.split(","))[0].match(/:(.*?);/)[1],n=atob(e[1]),i=n.length,o=new Uint8Array(i);i--;)o[i]=n.charCodeAt(i);return new File([o],t,{type:r})},t.bufferToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},t.blobToDataUrl=function(e){return i.default.get(e,{baseURL:"",responseType:"blob",timeout:5e3}).then((function(e){return(0,t.toResult)(e.data)})).catch((function(e){return!1}))},t.toUrl=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"any.json";return e=e instanceof File?e:(e=JSON.stringify(e),new File([e],t)),window.URL.createObjectURL(e)},t.strToArrayBuffer=function(e){for(var t="",r=0;r<e.length;r++)""===t?t=e.charCodeAt(r).toString(16):t+=","+e.charCodeAt(r).toString(16);return new Uint8Array(t.match(/[\da-f]{2}/gi).map((function(e){return parseInt(e,16)}))).buffer},t.arrayBufferToStr=function(e){return new Promise((function(t){var r=new Blob([e]),n=new FileReader;n.readAsText(r,"utf-8"),n.onload=function(){t(n.result)}}))},t.bToMB=function(e){return e=e/1024/1024,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?e:e.toFixed(2)+"MB"},t.getBackWord=function(e){return e.substr(e.lastIndexOf(".")+1).toLowerCase()},t.getPrefixWord=function(e){return e.substr(0,e.lastIndexOf("."))},t.toResult=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"text",r=new FileReader;return"text"===t?r.readAsText(e):"arrayBuffer"===t?r.readAsArrayBuffer(e):"base64"===t&&r.readAsDataURL(e),new Promise((function(e){r.onload=function(t){return e(t.target.result)}}))},t.urlToBase64=function(e){return i.default.get(e,{responseType:"arraybuffer"}).then((function(e){var t=e.headers["content-type"];return e=new Buffer(e.data,"binary").toString("base64"),"data:".concat(t,";base64,")+e}))},t.getFileName=function(e){return e.substring(e.lastIndexOf("-")+1)},t.downloadFile=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"any.text",r=document.createElement("a");e instanceof File||e instanceof Blob?r.setAttribute("href",window.URL.createObjectURL(e)):r.setAttribute("href",e),r.setAttribute("download",t),document.body.insertAdjacentElement("beforeend",r),r.click(),r.remove()}},298:function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(){i=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,o=(m="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=m.asyncIterator||"@@asyncIterator",s=m.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(t){l=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i,o,a,s;return t=t&&t.prototype instanceof p?t:p,t=Object.create(t.prototype),n=new S(n||[]),t._invoke=(i=e,o=r,a=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return h;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}return"throw"===(n=c(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,h):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,h):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}(r,a),r)){if(r===h)continue;return r}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);if(s="executing","normal"===(r=c(i,o,a)).type){if(s=a.done?"completed":"suspendedYield",r.arg===h)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s="completed",a.method="throw",a.arg=r.arg)}}),t}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h={};function p(){}function f(){}function d(){}var m,v,g=(l(m={},o,(function(){return this})),(v=(v=Object.getPrototypeOf)&&v(v(T([]))))&&v!==t&&r.call(v,o)&&(m=v),d.prototype=p.prototype=Object.create(m));function y(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var i;this._invoke=function(o,a){function s(){return new t((function(i,s){!function i(o,a,s,l){var u;if("throw"!==(o=c(e[o],e,a)).type)return(a=(u=o.arg).value)&&"object"==n(a)&&r.call(a,"__await")?t.resolve(a.__await).then((function(e){i("next",e,s,l)}),(function(e){i("throw",e,s,l)})):t.resolve(a).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,l)}));l(o.arg)}(o,a,i,s)}))}return i=i?i.then(s,s):s()}}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function T(e){if(e){var t,n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(n=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=n}return{next:_}}function _(){return{value:void 0,done:!0}}return l(g,"constructor",f.prototype=d),l(d,"constructor",f),f.displayName=l(d,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,l(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},y(b.prototype),l(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},y(g),l(g,s,"Generator"),l(g,o,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}var a=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,w(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function o(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var s=this&&this.__awaiter||function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},l=(Object.defineProperty(t,"__esModule",{value:!0}),t.deepArrByMaps=t.map=t.multiArrToArr=t.eachTriggerArray=t.eachTriggerArrGetControls=t.emptyArray=t.delArrEle=t.lastArrayEle=void 0,r(185));function u(e,t,r,n){return s(void 0,void 0,void 0,i().mark((function o(){var a,s,l;return i().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(a=e[t++]){i.next=3;break}return i.abrupt("return",r());case 3:if((s=a())instanceof Promise)return i.next=7,s;i.next=11;break;case 7:l=i.sent,null!=n&&n.eachCb(l,t),i.next=18;break;case 11:if(s.promise&&s.promise instanceof Promise)return null!=n&&n.eachCb(s,t),i.next=15,s.promise;i.next=17;break;case 15:i.next=18;break;case 17:null!=n&&n.eachCb(s,t);case 18:u(e,t,r,n);case 19:case"end":return i.stop()}}),o)})))}function c(e,t){e.map((function(e){if("array"===(0,l.getType)(e))return c(e,t);t.push(e)}))}t.lastArrayEle=function(e){return e.slice(-1)[0]},t.delArrEle=function(e,t){var r=e.slice(0,t);return e=e.slice(t+1),[].concat(o(r),o(e))},t.emptyArray=function(e){return 0===e.length},t.eachTriggerArrGetControls=function(e){var r=new Proxy({run:!0,clean:!1,target:e,index:0,runningAnima:null,eachCb:function(e,t){e.anima&&(r.runningAnima=e.anima),r.index=t}},{set:function(e,t,n){return"clean"===t&&!0===n&&!1===e[t]&&(r.run=!1,r.target.splice(0)),"run"===t&&!1===n&&!0===e[t]&&(console.log(r,"controls"),r.runningAnima&&r.runningAnima.pause()),"run"===t&&!0===n&&!1===e[t]&&r.runningAnima&&r.runningAnima.resume(),e[t]=n,!0}});return e=(0,t.eachTriggerArray)(e,r),{controls:r,promise:e}},t.eachTriggerArray=function(e,t){return new Promise((function(r){return u(e,0,r,t)}))},t.multiArrToArr=function(e){var t=[];return c(e,t),t},t.map=function(e,t){return e.map((function(r,n){return t(r,n,e)})).filter((function(e){return e}))},t.deepArrByMaps=function(e){var r=e.arr,n=e.typeList,i=e.findType;if(e=e.mapType,!r||!n||!i)return r;var a=o(n),s=r.find((function(e){return e[i]===n[0]}));return s?1!==n.length&&s[e]instanceof Array?(a.shift(),(0,t.deepArrByMaps)({arr:s[e],typeList:a,findType:i,mapType:e})):s:r}},594:(e,t,r)=>{"use strict";t.qR=t.js=t.CV=void 0,r(185),t.CV=function(e){return 0===Object.values(e).length},t.js=function(e,t){return Object.keys(e).map((function(r,n){var i=e[r];return t(r,i,n)}))},t.qR=function(e,t){var r=-1;return function e(n){return r++,t.length===r+1?n:e(n[t[r]])}(e)}},251:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=(Object.defineProperty(t,"__esModule",{value:!0}),t.getId=t.getMacro=t.getUuid=void 0,n(r(937))),o=n(r(181));t.getUuid=function(){return i.default.UUID1()},t.getMacro=function(e){var t=setTimeout((function(){return clearTimeout(t),t=null,e()}),1<arguments.length&&void 0!==arguments[1]?arguments[1]:0)},t.getId=function(){return(0,o.default)()}},185:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isTrue=t.getType=void 0,t.getType=function(e){if(void 0!==e){if(null===e)return null;var t;switch(e.constructor){case Array:t="Array";break;case Object:t="Object";break;case String:t="String";break;case Number:t="Number";break;case Boolean:t="Boolean";break;case Function:t="Function"}return t&&t.toLowerCase()||"Object"}},t.isTrue=function(e){return!(null==e||!1===e)}},326:e=>{e.exports=function(e,t,r){for(var n=(2<<Math.log(t.length-1)/Math.LN2)-1,i=-~(1.6*n*r/t.length),o="";;)for(var a=e(i),s=i;s--;)if((o+=t[a[s]&n]||"").length===+r)return o}},181:(e,t,r)=>{"use strict";e.exports=r(882)},488:(e,t,r)=>{"use strict";var n,i,o,a=r(87),s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function l(){o=!1}function u(e){if(e){if(e!==n){if(e.length!==s.length)throw new Error("Custom alphabet for shortid must be "+s.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter((function(e,t,r){return t!==r.lastIndexOf(e)}));if(t.length)throw new Error("Custom alphabet for shortid must be "+s.length+" unique characters. These characters were not unique: "+t.join(", "));n=e,l()}}else n!==s&&(n=s,l())}function c(){return o=o||function(){n||u(s);var e,t=n.split(""),r=[];for(a.nextValue();0<t.length;)e=a.nextValue(),e=Math.floor(e*t.length),r.push(t.splice(e,1)[0]);return r.join("")}()}e.exports={get:function(){return n||s},characters:function(e){return u(e),n},seed:function(e){a.seed(e),i!==e&&(l(),i=e)},lookup:function(e){return c()[e]},shuffled:c}},239:(e,t,r)=>{"use strict";var n,i,o=r(253);r(488),e.exports=function(e){var t="",r=Math.floor(.001*(Date.now()-1567752802062));return r===i?n++:(n=0,i=r),t=(t+=o(7))+o(e),0<n&&(t+=o(n)),t+o(r)}},253:(e,t,r)=>{"use strict";var n=r(488),i=r(19),o=r(326);e.exports=function(e){for(var t,r=0,a="";!t;)a+=o(i,n.get(),1),t=e<Math.pow(16,r+1),r++;return a}},882:(e,t,r)=>{"use strict";var n=r(488),i=r(239),o=r(40),a=r(595)||0;function s(){return i(a)}e.exports=s,e.exports.generate=s,e.exports.seed=function(t){return n.seed(t),e.exports},e.exports.worker=function(t){return a=t,e.exports},e.exports.characters=function(e){return void 0!==e&&n.characters(e),n.shuffled()},e.exports.isValid=o},40:(e,t,r)=>{"use strict";var n=r(488);e.exports=function(e){return!(!e||"string"!=typeof e||e.length<6||new RegExp("[^"+n.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(e))}},19:e=>{"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r="object"===("undefined"==typeof window?"undefined":t(window))&&(window.crypto||window.msCrypto),n=r&&r.getRandomValues?function(e){return r.getRandomValues(new Uint8Array(e))}:function(e){for(var t=[],r=0;r<e;r++)t.push(Math.floor(256*Math.random()));return t};e.exports=n},87:e=>{"use strict";var t=1;e.exports={nextValue:function(){return(t=(9301*t+49297)%233280)/233280},seed:function(e){t=e}}},595:e=>{"use strict";e.exports=0},129:e=>{"use strict";e.exports=r},300:t=>{"use strict";t.exports=e},1:e=>{"use strict";e.exports=o},356:e=>{"use strict";e.exports=n},881:e=>{"use strict";e.exports=t},937:e=>{"use strict";e.exports=i}},l={},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u={},(()=>{"use strict";a.d(u,{default:()=>Qc});var e={},t=(a.r(e),a.d(e,{AsyncCompress:()=>ja,AsyncDecompress:()=>Ka,AsyncDeflate:()=>ka,AsyncGunzip:()=>Fa,AsyncGzip:()=>ja,AsyncInflate:()=>La,AsyncUnzipInflate:()=>xs,AsyncUnzlib:()=>qa,AsyncZipDeflate:()=>vs,AsyncZlib:()=>Ga,Compress:()=>Ia,DecodeUTF8:()=>ns,Decompress:()=>Qa,Deflate:()=>Pa,EncodeUTF8:()=>is,Gunzip:()=>Na,Gzip:()=>Ia,Inflate:()=>Ca,Unzip:()=>ws,UnzipInflate:()=>bs,UnzipPassThrough:()=>ys,Unzlib:()=>Xa,Zip:()=>gs,ZipDeflate:()=>ms,ZipPassThrough:()=>ds,Zlib:()=>Ha,compress:()=>Ua,compressSync:()=>Ba,decompress:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return(31==e[0]&&139==e[1]&&8==e[2]?za:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?Aa:Ya)(e,t,r)},decompressSync:()=>function(e,t){return(31==e[0]&&139==e[1]&&8==e[2]?Va:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?Da:Za)(e,t)},deflate:()=>Ra,deflateSync:()=>Oa,gunzip:()=>za,gunzipSync:()=>Va,gzip:()=>Ua,gzipSync:()=>Ba,inflate:()=>Aa,inflateSync:()=>Da,strFromU8:()=>as,strToU8:()=>os,unzip:()=>function(e,t){if("function"!=typeof t)throw"no callback";for(var r=[],n=function(){for(var e=0;e<r.length;++e)r[e]()},i={},o=e.length-22;101010256!=ya(e,o);--o)if(!o||65558<e.length-o)return void t("invalid zip file",null);var a=ga(e,o+8);a||t(null,{});var s=a,l=ya(e,o+16),u=4294967295==l;if(u){if(o=ya(e,o-12),101075792!=ya(e,o))return void t("invalid zip file",null);s=a=ya(e,o+32),l=ya(e,o+48)}for(var c=function(o){function s(e,r){e?(n(),t(e,null)):(i[f]=r,--a||t(null,i))}var c=(m=us(e,l,u))[0],h=m[1],p=m[2],f=m[3],d=m[4],m=m[5];if(m=ls(e,m),l=d,c)if(8==c)if(d=e.subarray(m,m+h),h<32e4)try{s(null,Da(d,new fo(p)))}catch(o){s(o,null)}else r.push(Aa(d,{size:p},s));else s("unknown compression type "+c,null);else s(null,zo(e,m,m+h))},h=0;h<s;++h)c();return n},unzipSync:()=>function(e){for(var t={},r=e.length-22;101010256!=ya(e,r);--r)if(!r||65558<e.length-r)throw"invalid zip file";var n=ga(e,r+8);if(!n)return{};var i=ya(e,r+16),o=4294967295==i;if(o){if(r=ya(e,r-12),101075792!=ya(e,r))throw"invalid zip file";n=ya(e,r+32),i=ya(e,r+48)}for(var a=0;a<n;++a){var s=(p=us(e,i,o))[0],l=p[1],u=p[2],c=p[3],h=p[4],p=p[5];if(p=ls(e,p),i=h,s){if(8!=s)throw"unknown compression type "+s;t[c]=Da(e.subarray(p,p+l),new fo(u))}else t[c]=zo(e,p,p+l)}return t},unzlib:()=>Ya,unzlibSync:()=>Za,zip:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";function n(){for(var e=0;e<p.length;++e)p[e]()}function i(){for(var e=new fo(u+22),t=l,n=u-l,i=u=0;i<c;++i){var o=h[i];try{var a=o.c.length,s=(ps(e,u,o,o.f,o.u,a),30+o.f.length+hs(o.extra)),p=u+s;e.set(o.c,p),ps(e,l,o,o.f,o.u,a,u,o.m),l+=16+s+(o.m?o.m.length:0),u=p+a}catch(e){return r(e,null)}}fs(e,l,h.length,n,t),r(null,e)}var o={},a=(Ja(e,"",o,t),Object.keys(o)),s=a.length,l=0,u=0,c=s,h=new Array(s),p=[];s||i();for(var f=function(e){function t(t,o){t?(n(),r(t,null)):(t=o.length,h[e]=ia(m,{size:g,crc:v.d(),c:o,f:y,m:w,u:b!=c.length||w&&x.length!=S,compression:_}),l+=30+b+T+t,u+=76+2*(b+T)+(S||0)+t,--s||i())}var c=a[e],f=o[c],d=f[0],m=f[1],v=ta(),g=d.length,y=(v.p(d),os(c)),b=y.length,x=m.comment,w=x&&os(x),S=w&&w.length,T=hs(m.extra),_=0==m.level?0:8;if(65535<b&&t("filename too long",null),_)if(g<16e4)try{t(null,Oa(d,m))}catch(f){t(f,null)}else p.push(Ra(d,m,t));else t(null,d)},d=0;d<c;++d)f(d);return n},zipSync:()=>function(e,t){var r,n={},i=[],o=(Ja(e,"",n,t=t||{}),0),a=0;for(r in n){var s,l=(s=n[r])[0],u=0==(s=s[1]).level?0:8,c=(x=os(r)).length,h=s.comment,p=h&&os(h),f=p&&p.length,d=hs(s.extra);if(65535<c)throw"filename too long";var m=u?Oa(l,s):l,v=m.length,g=ta();g.p(l),i.push(ia(s,{size:l.length,crc:g.d(),c:m,f:x,m:p,u:c!=r.length||p&&h.length!=f,o,compression:u})),o+=30+c+d+v,a+=76+2*(c+d)+(f||0)+v}for(var y=new fo(a+22),b=(e=o,t=a-o,0);b<i.length;++b){var x=i[b],w=(ps(y,x.o,x,x.f,x.u,x.c.length),30+x.f.length+hs(x.extra));y.set(x.c,x.o+w),ps(y,o,x,x.f,x.u,x.c.length,x.o,x.m),o+=16+w+(x.m?x.m.length:0)}return fs(y,o,i.length,t,e),y},zlib:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return va(e,t,[ua,pa,function(){return[Wa]}],(function(e){return da(Wa(e.data[0],e.data[1]))}),4,r)},zlibSync:()=>Wa}),a(300)),r=a.n(t);class n{constructor(e){this.scene=null,this.camera=null,this.controls=null,this.renderer=null,this.engineDom=null,this.runScene=e}reset(){this.renderer=this.runScene.renderEx.create(this.engineDom),this.runScene.renderEx.setSize(),this.renderer.setAnimationLoop(this.runScene.render.bind(this.runScene));var e=this.camera;this.controls=this.runScene.controlsEx.create(e,this.renderer.domElement)}init(e){var t=this.runScene.sceneEx.create(),r=this.runScene.cameraEx.create();const n=this.runScene.renderEx.create(e);var i=this.runScene.controlsEx.create(r,n.domElement);return this.camera=r,this.scene=t,this.renderer=n,this.controls=i,this.engineDom=e,this.runScene.renderEx.setSize(),n.setAnimationLoop(this.runScene.render.bind(this.runScene)),{scene:t,camera:r,render:n,controls:i,engineDom:e}}get(){var{scene:e,camera:t,renderer:r,controls:n,engineDom:i}=this;return{scene:e,camera:t,renderer:r,controls:n,engineDom:i}}}var i=a(881),o={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor.a *= opacity;\n\n\n\t\t}"};function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,r){t&&l(e.prototype,t),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var h=function(){function e(){s(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return c(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}]),e}(),p=new i.OrthographicCamera(-1,1,1,-1,0,1),f=new i.BufferGeometry,d=(f.setAttribute("position",new i.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),f.setAttribute("uv",new i.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){s(this,e),this._mesh=new i.Mesh(f,t)}return c(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,p)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}());function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var y=function(){var e=n,t=h;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g(e);if(r=t?(r=g(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===m(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t){var o;if(this instanceof n)return(o=r.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof i.ShaderMaterial?(o.uniforms=e.uniforms,o.material=e):e&&(o.uniforms=i.UniformsUtils.clone(e.uniforms),o.material=new i.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:o.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),o.fsQuad=new d(o.material),o;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"render",value:function(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),b={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new i.Color(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"};function x(e){return(x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var T=function(){var e=n,t=h;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=S(e);if(r=t?(r=S(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===x(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,s){var l;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(l=r.call(this)).strength=void 0!==t?t:1,l.radius=a,l.threshold=s,l.resolution=void 0!==e?new i.Vector2(e.x,e.y):new i.Vector2(256,256),l.clearColor=new i.Color(0,0,0),l.renderTargetsHorizontal=[],l.renderTargetsVertical=[],l.nMips=5;var u=Math.round(l.resolution.x/2),c=Math.round(l.resolution.y/2);l.renderTargetBright=new i.WebGLRenderTarget(u,c),l.renderTargetBright.texture.name="UnrealBloomPass.bright",l.renderTargetBright.texture.generateMipmaps=!1;for(var h=0;h<l.nMips;h++){var p;((p=new i.WebGLRenderTarget(u,c)).texture.name="UnrealBloomPass.h"+h,p.texture.generateMipmaps=!1,l.renderTargetsHorizontal.push(p),p=new i.WebGLRenderTarget(u,c)).texture.name="UnrealBloomPass.v"+h,p.texture.generateMipmaps=!1,l.renderTargetsVertical.push(p),u=Math.round(u/2),c=Math.round(c/2)}a=b;for(var f=(l.highPassUniforms=i.UniformsUtils.clone(a.uniforms),l.highPassUniforms.luminosityThreshold.value=s,l.highPassUniforms.smoothWidth.value=.01,l.materialHighPassFilter=new i.ShaderMaterial({uniforms:l.highPassUniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,defines:{}}),l.separableBlurMaterials=[],[3,5,7,9,11]),m=(u=Math.round(l.resolution.x/2),c=Math.round(l.resolution.y/2),0);m<l.nMips;m++)l.separableBlurMaterials.push(l.getSeperableBlurMaterial(f[m])),l.separableBlurMaterials[m].uniforms.texSize.value=new i.Vector2(u,c),u=Math.round(u/2),c=Math.round(c/2);return l.compositeMaterial=l.getCompositeMaterial(l.nMips),l.compositeMaterial.uniforms.blurTexture1.value=l.renderTargetsVertical[0].texture,l.compositeMaterial.uniforms.blurTexture2.value=l.renderTargetsVertical[1].texture,l.compositeMaterial.uniforms.blurTexture3.value=l.renderTargetsVertical[2].texture,l.compositeMaterial.uniforms.blurTexture4.value=l.renderTargetsVertical[3].texture,l.compositeMaterial.uniforms.blurTexture5.value=l.renderTargetsVertical[4].texture,l.compositeMaterial.uniforms.bloomStrength.value=t,l.compositeMaterial.uniforms.bloomRadius.value=.1,l.compositeMaterial.needsUpdate=!0,l.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],l.bloomTintColors=[new i.Vector3(1,1,1),new i.Vector3(1,1,1),new i.Vector3(1,1,1),new i.Vector3(1,1,1),new i.Vector3(1,1,1)],l.compositeMaterial.uniforms.bloomTintColors.value=l.bloomTintColors,e=o,l.copyUniforms=i.UniformsUtils.clone(e.uniforms),l.copyUniforms.opacity.value=1,l.materialCopy=new i.ShaderMaterial({uniforms:l.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:i.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),l.enabled=!0,l.needsSwap=!1,l._oldClearColor=new i.Color,l.oldClearAlpha=1,l.basic=new i.MeshBasicMaterial,l.fsQuad=new d(null),l}return e=n,(t=[{key:"dispose",value:function(){for(var e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(var t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose()}},{key:"setSize",value:function(e,t){var r=Math.round(e/2),n=Math.round(t/2);this.renderTargetBright.setSize(r,n);for(var o=0;o<this.nMips;o++)this.renderTargetsHorizontal[o].setSize(r,n),this.renderTargetsVertical[o].setSize(r,n),this.separableBlurMaterials[o].uniforms.texSize.value=new i.Vector2(r,n),r=Math.round(r/2),n=Math.round(n/2)}},{key:"render",value:function(e,t,r,i,o){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var a=e.autoClear,s=(e.autoClear=!1,e.setClearColor(this.clearColor,0),o&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=r.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e),this.renderTargetBright),l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=s.texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),s=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,o&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?e.setRenderTarget(null):e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}},{key:"getSeperableBlurMaterial",value:function(e){return new i.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new i.Vector2(.5,.5)},direction:{value:new i.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}},{key:"getCompositeMaterial",value:function(e){return new i.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function _(e){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function P(e,t,r){t&&E(e.prototype,t),r&&E(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function k(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&R(e,t)}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=C(e);if(r=t?(r=C(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===_(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}T.BlurDirectionX=new i.Vector2(1,0),T.BlurDirectionY=new i.Vector2(0,1);var L=function(){k(t,h);var e=O(t);function t(r,n){var i;return M(this,t),(i=e.call(this)).scene=r,i.camera=n,i.clear=!0,i.needsSwap=!1,i.inverse=!1,i}return P(t,[{key:"render",value:function(e,t,r){var n,i,o=e.getContext(),a=e.state;a.buffers.color.setMask(!1),a.buffers.depth.setMask(!1),a.buffers.color.setLocked(!0),a.buffers.depth.setLocked(!0),i=this.inverse?(n=0,1):(n=1,0),a.buffers.stencil.setTest(!0),a.buffers.stencil.setOp(o.REPLACE,o.REPLACE,o.REPLACE),a.buffers.stencil.setFunc(o.ALWAYS,n,4294967295),a.buffers.stencil.setClear(i),a.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),a.buffers.color.setLocked(!1),a.buffers.depth.setLocked(!1),a.buffers.stencil.setLocked(!1),a.buffers.stencil.setFunc(o.EQUAL,1,4294967295),a.buffers.stencil.setOp(o.KEEP,o.KEEP,o.KEEP),a.buffers.stencil.setLocked(!0)}}]),t}(),A=function(){k(t,h);var e=O(t);function t(){var r;return M(this,t),(r=e.call(this)).needsSwap=!1,r}return P(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();function D(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var I=function(){function e(t,r){var n;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.renderer=t,void 0===r?(n=t.getSize(new i.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=n.width,this._height=n.height,(r=new i.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"):(this._pixelRatio=1,this._width=r.width,this._height=r.height),this.renderTarget1=r,this.renderTarget2=r.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===y&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new y(o),this.clock=new i.Clock}return function(e,t,r){t&&D(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"swapBuffers",value:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}},{key:"addPass",value:function(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"insertPass",value:function(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"removePass",value:function(e){-1!==(e=this.passes.indexOf(e))&&this.passes.splice(e,1)}},{key:"isLastEnabledPass",value:function(e){for(var t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}},{key:"render",value:function(e){void 0===e&&(e=this.clock.getDelta());for(var t=this.renderer.getRenderTarget(),r=!1,n=0,i=this.passes.length;n<i;n++){var o,a,s=this.passes[n];!1!==s.enabled&&(s.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(n),s.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),s.needsSwap&&(r&&(o=this.renderer.getContext(),(a=this.renderer.state.buffers.stencil).setFunc(o.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),a.setFunc(o.EQUAL,1,4294967295)),this.swapBuffers()),void 0!==L&&(s instanceof L?r=!0:s instanceof A&&(r=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new i.Vector2),this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}},{key:"setSize",value:function(e,t){this._width=e,this._height=t;var r=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(r,n),this.renderTarget2.setSize(r,n);for(var i=0;i<this.passes.length;i++)this.passes[i].setSize(r,n)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}]),e}();function j(e){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}new i.OrthographicCamera(-1,1,1,-1,0,1),(t=new i.BufferGeometry).setAttribute("position",new i.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),t.setAttribute("uv",new i.Float32BufferAttribute([0,2,0,0,2,0],2));var N=function(){var e=n,t=h;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&U(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=B(e);if(r=t?(r=B(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===j(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,s){var l;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(l=r.call(this)).scene=e,l.camera=t,l.sampleLevel=4,l.unbiased=!0,l.clearColor=void 0!==a?a:0,l.clearAlpha=void 0!==s?s:0,l._oldClearColor=new i.Color,e=o,l.copyUniforms=i.UniformsUtils.clone(e.uniforms),l.copyMaterial=new i.ShaderMaterial({uniforms:l.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,transparent:!0,blending:i.AdditiveBlending,depthTest:!1,depthWrite:!1}),l.fsQuad=new d(l.copyMaterial),l}return e=n,(t=[{key:"dispose",value:function(){this.sampleRenderTarget&&(this.sampleRenderTarget.dispose(),this.sampleRenderTarget=null)}},{key:"setSize",value:function(e,t){this.sampleRenderTarget&&this.sampleRenderTarget.setSize(e,t)}},{key:"render",value:function(e,t,r){this.sampleRenderTarget||(this.sampleRenderTarget=new i.WebGLRenderTarget(r.width,r.height),this.sampleRenderTarget.texture.name="SSAARenderPass.sample");var n=F[Math.max(0,Math.min(this.sampleLevel,5))],o=e.autoClear,a=(e.autoClear=!1,e.getClearColor(this._oldClearColor),e.getClearAlpha()),s=1/n.length,l=(this.copyUniforms.tDiffuse.value=this.sampleRenderTarget.texture,{fullWidth:r.width,fullHeight:r.height,offsetX:0,offsetY:0,width:r.width,height:r.height});(r=Object.assign({},this.camera.view)).enabled&&Object.assign(l,r);for(var u=0;u<n.length;u++){var c=n[u];this.camera.setViewOffset&&this.camera.setViewOffset(l.fullWidth,l.fullHeight,l.offsetX+.0625*c[0],l.offsetY+.0625*c[1],l.width,l.height),c=s,this.unbiased&&(c+=1/32*((u+.5)/n.length-.5)),this.copyUniforms.opacity.value=c,e.setClearColor(this.clearColor,this.clearAlpha),e.setRenderTarget(this.sampleRenderTarget),e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(this.renderToScreen?null:t),0===u&&(e.setClearColor(0,0),e.clear()),this.fsQuad.render(e)}this.camera.setViewOffset&&r.enabled?this.camera.setViewOffset(r.fullWidth,r.fullHeight,r.offsetX,r.offsetY,r.width,r.height):this.camera.clearViewOffset&&this.camera.clearViewOffset(),e.autoClear=o,e.setClearColor(this._oldClearColor,a)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),F=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];function z(e){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function V(){return(V="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=G(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function H(e,t){return(H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(e){return(G=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var W=function(){var e=n,t=N;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&H(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=G(e);if(r=t?(r=G(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===z(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o){if(this instanceof n)return(e=r.call(this,e,t,i,o)).sampleLevel=0,e.accumulate=!1,e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"render",value:function(e,t,r,o){if(!1===this.accumulate)return V(G(n.prototype),"render",this).call(this,e,t,r,o),void(this.accumulateIndex=-1);var a=X[5],s=(void 0===this.sampleRenderTarget&&(this.sampleRenderTarget=new i.WebGLRenderTarget(r.width,r.height,this.params),this.sampleRenderTarget.texture.name="TAARenderPass.sample"),void 0===this.holdRenderTarget&&(this.holdRenderTarget=new i.WebGLRenderTarget(r.width,r.height,this.params),this.holdRenderTarget.texture.name="TAARenderPass.hold"),-1===this.accumulateIndex&&(V(G(n.prototype),"render",this).call(this,e,this.holdRenderTarget,r,o),this.accumulateIndex=0),o=e.autoClear,e.autoClear=!1,1/a.length);if(0<=this.accumulateIndex&&this.accumulateIndex<a.length){this.copyUniforms.opacity.value=s,this.copyUniforms.tDiffuse.value=t.texture;for(var l=Math.pow(2,this.sampleLevel),u=0;u<l;u++){var c=a[this.accumulateIndex];if(this.camera.setViewOffset&&this.camera.setViewOffset(r.width,r.height,.0625*c[0],.0625*c[1],r.width,r.height),e.setRenderTarget(t),e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(this.sampleRenderTarget),0===this.accumulateIndex&&e.clear(),this.fsQuad.render(e),this.accumulateIndex++,this.accumulateIndex>=a.length)break}this.camera.clearViewOffset&&this.camera.clearViewOffset()}0<(s=this.accumulateIndex*s)&&(this.copyUniforms.opacity.value=1,this.copyUniforms.tDiffuse.value=this.sampleRenderTarget.texture,e.setRenderTarget(t),e.clear(),this.fsQuad.render(e)),s<1&&(this.copyUniforms.opacity.value=1-s,this.copyUniforms.tDiffuse.value=this.holdRenderTarget.texture,e.setRenderTarget(t),0==s&&e.clear(),this.fsQuad.render(e)),e.autoClear=o}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),X=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];class q extends h{constructor(e,t,r){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==r?r:"tDiffuse",e instanceof i.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=i.UniformsUtils.clone(e.uniforms),this.material=new i.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new d(this.material)}render(e,t,r){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}class Y extends h{constructor(e,t,r,n,o){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=r,this.clearColor=n,this.clearAlpha=void 0!==o?o:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new i.Color,this.oldCameraLayer=t.layers.mask}render(e,t,r){var n=e.autoClear;let i,o;e.autoClear=!1,void 0!==this.overrideMaterial&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this.oldClearColor),i=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.sceneBg&&(this.scene.background=null),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,this.clearDepth,e.autoClearStencil),this.camera.layers.set(this.layerIndex),e.render(this.scene,this.camera),this.camera.layers.mask=this.oldCameraLayer,this.clearColor&&e.setClearColor(this.oldClearColor,i),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=o),this.scene.background=this.sceneBg,e.autoClear=n}}const Z={uniforms:{baseTexture:{value:null},bloomTexture:{value:null}},vertexShader:"\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n \n varying vec2 vUv;\n \n void main() {\n vec4 lastColor = texture2D(baseTexture, vUv);\n \n // gl_FragColor = lastColor;\n // gl_FragColor = texture2D(bloomTexture, vUv);\n gl_FragColor = lastColor + texture2D(bloomTexture, vUv);\n }\n "};class Q{constructor(e){this.bloomParams={isBloom:!1,bloomStrength:2,bloomThreshold:0,bloomRadius:0},this.runScene=e,this.BLOOM_SCENE=1,this.bloomParams.isBloom=!1,this.isUpdate=!0,this.sceneBackground=null,this.runScene.exporter.gltf.options.addOption({type:"bloom-glow",process:e=>this.toJSON(),parse:e=>{e=JSON.parse(e),this.setData(e)}})}static getInstance(e){return Q.instance||(Q.instance=new Q(e)),Q.instance}set rendererTone(e){this.renderer&&(this.renderer.toneMapping=e?i.ACESFilmicToneMapping:i.NoToneMapping)}init(e){var{camera:e,scene:t,renderer:r}=e;this.mainScene=t,this.mainCamera=e,this.renderer=r,this.renderer&&(t=this.renderer.getDrawingBufferSize(new i.Vector2),this.rtSize={width:t.width,height:t.height},this.postProcessing())}setData(e){e=e.bloomParams;var{bloomRadius:e,bloomStrength:t,bloomThreshold:r,isBloom:n}=e;this.bloomParams.isBloom=n,this.bloomParams.bloomRadius=e,this.bloomParams.bloomStrength=t,this.bloomParams.bloomThreshold=r,this.bloomPass&&(this.bloomPass.strength=t,this.bloomPass.radius=e,this.bloomPass.threshold=r),this.runScene.optionsEx.cb.bloom.glow.setData.cb(this.bloomParams)}setSize(e,t){this.renderer&&(this.rtSize={width:e,height:t},this.effectComposer&&this.effectComposer.setSize(this.rtSize.width,this.rtSize.height))}setBackground(e){this.sceneBackground&&this.sceneBackground instanceof i.Texture&&this.sceneBackground.dispose(),this.sceneBackground=e,this.bloomRenderPass&&(this.bloomRenderPass.sceneBg=this.sceneBackground)}setUpdate(e){this.isUpdate=e}postProcessing(){this.renderer&&(this.renderer.autoClear=!1),this.effectRT?(this.effectRT.setSize(this.rtSize.width,this.rtSize.height),this.effectRT.depthTexture.dispose()):(this.effectRT=new i.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.effectRT.texture.name="EffectComposer.pass",this.effectRT.texture.type=i.FloatType,this.effectRT.texture.format=i.RGBAFormat,this.effectRT.texture.encoding=i.sRGBEncoding,this.effectRT.texture.minFilter=i.LinearFilter,this.effectRT.texture.magFilter=i.LinearFilter),this.effectRT.depthTexture=new i.DepthTexture(this.rtSize.width,this.rtSize.height),this.effectRT.depthTexture.format=i.DepthFormat,this.effectRT.depthTexture.type=i.UnsignedIntType,this.taaRenderPass?(this.taaRenderPass.scene=this.mainScene,this.taaRenderPass.camera=this.mainCamera):(this.taaRenderPass=new W(this.mainScene,this.mainCamera,0,0),this.taaRenderPass.unbiased=!1,this.taaRenderPass.sampleLevel=1,this.taaRenderPass.accumulate=!1),this.sampleRT?this.sampleRT.setSize(this.rtSize.width,this.rtSize.height):(this.sampleRT=new i.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.sampleRT.texture.name="TAARenderPass.sample",this.sampleRT.texture.type=i.FloatType,this.sampleRT.texture.format=i.RGBAFormat,this.sampleRT.texture.encoding=i.sRGBEncoding,this.sampleRT.texture.minFilter=i.LinearFilter,this.sampleRT.texture.magFilter=i.LinearFilter,this.sampleRT.depthTexture=this.effectRT.depthTexture,this.taaRenderPass.sampleRenderTarget=this.sampleRT),this.holdRT?this.holdRT.setSize(this.rtSize.width,this.rtSize.height):(this.holdRT=new i.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.holdRT.texture.name="TAARenderPass.hold",this.holdRT.texture.type=i.FloatType,this.holdRT.texture.format=i.RGBAFormat,this.holdRT.texture.encoding=i.sRGBEncoding,this.holdRT.texture.minFilter=i.LinearFilter,this.holdRT.texture.magFilter=i.LinearFilter,this.holdRT.depthTexture=this.effectRT.depthTexture,this.taaRenderPass.holdRenderTarget=this.holdRT),this.bloomRenderPass?(this.bloomRenderPass.scene=this.mainScene,this.bloomRenderPass.camera=this.mainCamera):(this.bloomRenderPass=new Y(this.mainScene,this.mainCamera),this.bloomRenderPass.layerIndex=this.BLOOM_SCENE,this.bloomRenderPass.clearDepth=!1,this.bloomRenderPass.sceneBg=this.sceneBackground),this.bloomPass?this.bloomPass.setSize(this.rtSize.width,this.rtSize.height):this.bloomPass=new T(new i.Vector2(this.rtSize.width,this.rtSize.height),1.5,.4,.85),this.bloomPass.strength=this.bloomParams.bloomStrength,this.bloomPass.radius=this.bloomParams.bloomRadius,this.bloomPass.threshold=this.bloomParams.bloomThreshold,this.mixingPass||(this.mixingPass=new q(Z,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new y(o),this.effectCopy.clear=!1,this.effectCopy.renderToScreen=!1,this.effectCopy.needsSwap=!1,this.effectCopy.material.depthWrite=!1),this.effectComposer?this.effectComposer.renderer=this.renderer:(this.effectComposer=new I(this.renderer,this.effectRT),this.effectComposer.addPass(this.taaRenderPass),this.effectComposer.addPass(this.effectCopy),this.effectComposer.addPass(this.bloomRenderPass),this.effectComposer.addPass(this.bloomPass),this.effectComposer.addPass(this.mixingPass))}dispose(){this.mainScene=null,this.mainCamera=null,this.setBackground(null),this.effectRT&&(this.effectRT.depthTexture.dispose(),this.effectRT.depthTexture=null,this.effectRT.dispose(),this.effectRT=null),this.sampleRT&&(this.sampleRT.depthTexture.dispose(),this.sampleRT.depthTexture=null,this.sampleRT.dispose(),this.sampleRT=null),this.holdRT&&(this.holdRT.depthTexture.dispose(),this.holdRT.depthTexture=null,this.holdRT.dispose(),this.holdRT=null),this.taaRenderPass&&(this.taaRenderPass.dispose(),this.taaRenderPass=null),this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.mixingPass=null,this.effectCopy=null,this.effectComposer&&(this.effectComposer.renderTarget1&&(this.effectComposer.renderTarget1.dispose(),this.effectComposer.renderTarget1=null),this.effectComposer.renderTarget2&&(this.effectComposer.renderTarget2.dispose(),this.effectComposer.renderTarget2=null),this.effectComposer=null)}update(){this.isUpdate&&this.mainCamera&&this.mainScene&&this.renderer&&(this.renderer.clear(),this.bloomParams.isBloom?this.effectComposer.render():this.renderer.render(this.mainScene,this.mainCamera))}toJSON(){const e={};var t=this.bloomParams;return e.bloomParams=Object.assign({},t),JSON.stringify(e)}reset(){this.bloomParams.isBloom=!1,this.rendererTone=!1,this.setBackground(null)}}class K{constructor(e){this.runScene=e}create(){return new i.PerspectiveCamera}reset(e){e.position.set(0,20,20);const t=this.runScene.assetsEx.get().controls;t.target.set(0,0,0),t.update()}get(){return this.runScene.assetsEx.get().camera}}function J(e){return(J="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function $(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ee(e,t)}function ee(e,t){return(ee=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function te(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function re(e){return(re=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ne={type:"change"},ie={type:"start"},oe={type:"end"},ae=function(){$(t,i.EventDispatcher);var e=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=re(e);if(r=t?(r=re(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===J(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return te(n)}}(t);function t(r,n){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),o=e.call(this),void 0===n&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),n===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),o.object=r,o.domElement=n,o.domElement.style.touchAction="none",o.enabled=!0,o.target=new i.Vector3,o.minDistance=0,o.maxDistance=1/0,o.minZoom=0,o.maxZoom=1/0,o.minPolarAngle=0,o.maxPolarAngle=Math.PI,o.minAzimuthAngle=-1/0,o.maxAzimuthAngle=1/0,o.enableDamping=!1,o.dampingFactor=.05,o.enableZoom=!0,o.zoomSpeed=1,o.enableRotate=!0,o.rotateSpeed=1,o.enablePan=!0,o.panSpeed=1,o.screenSpacePanning=!0,o.keyPanSpeed=7,o.autoRotate=!1,o.autoRotateSpeed=2,o.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},o.mouseButtons={LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.DOLLY,RIGHT:i.MOUSE.PAN},o.touches={ONE:i.TOUCH.ROTATE,TWO:i.TOUCH.DOLLY_PAN},o.target0=o.target.clone(),o.position0=o.object.position.clone(),o.zoom0=o.object.zoom,o._domElementKeyEvents=null,o.getPolarAngle=function(){return v.phi},o.getAzimuthalAngle=function(){return v.theta},o.getDistance=function(){return this.object.position.distanceTo(this.target)},o.listenToKeyEvents=function(e){e.addEventListener("keydown",ae),this._domElementKeyEvents=e},o.saveState=function(){p.target0.copy(p.target),p.position0.copy(p.object.position),p.zoom0=p.object.zoom},o.reset=function(){p.target.copy(p.target0),p.object.position.copy(p.position0),p.object.zoom=p.zoom0,p.object.updateProjectionMatrix(),p.dispatchEvent(ne),p.update(),d=f.NONE},o.update=(a=new i.Vector3,s=(new i.Quaternion).setFromUnitVectors(r.up,new i.Vector3(0,1,0)),l=s.clone().invert(),u=new i.Vector3,c=new i.Quaternion,h=2*Math.PI,function(){var e=p.object.position,t=(a.copy(e).sub(p.target),a.applyQuaternion(s),v.setFromVector3(a),p.autoRotate&&d===f.NONE&&A(2*Math.PI/60/60*p.autoRotateSpeed),p.enableDamping?(v.theta+=g.theta*p.dampingFactor,v.phi+=g.phi*p.dampingFactor):(v.theta+=g.theta,v.phi+=g.phi),p.minAzimuthAngle),r=p.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=h:t>Math.PI&&(t-=h),r<-Math.PI?r+=h:r>Math.PI&&(r-=h),v.theta=t<=r?Math.max(t,Math.min(r,v.theta)):v.theta>(t+r)/2?Math.max(t,v.theta):Math.min(r,v.theta)),v.phi=Math.max(p.minPolarAngle,Math.min(p.maxPolarAngle,v.phi)),v.makeSafe(),v.radius*=y,v.radius=Math.max(p.minDistance,Math.min(p.maxDistance,v.radius)),!0===p.enableDamping?p.target.addScaledVector(b,p.dampingFactor):p.target.add(b),a.setFromSpherical(v),a.applyQuaternion(l),e.copy(p.target).add(a),p.object.lookAt(p.target),!0===p.enableDamping?(g.theta*=1-p.dampingFactor,g.phi*=1-p.dampingFactor,b.multiplyScalar(1-p.dampingFactor)):(g.set(0,0,0),b.set(0,0,0)),y=1,!(!(x||u.distanceToSquared(p.object.position)>m||8*(1-c.dot(p.object.quaternion))>m)||(p.dispatchEvent(ne),u.copy(p.object.position),c.copy(p.object.quaternion),x=!1))}),o.dispose=function(){p.domElement.removeEventListener("contextmenu",se),p.domElement.removeEventListener("pointerdown",K),p.domElement.removeEventListener("pointercancel",ee),p.domElement.removeEventListener("wheel",re),p.domElement.removeEventListener("pointermove",J),p.domElement.removeEventListener("pointerup",$),null!==p._domElementKeyEvents&&p._domElementKeyEvents.removeEventListener("keydown",ae)};var o,a,s,l,u,c,h,p=te(o),f={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=f.NONE,m=1e-6,v=new i.Spherical,g=new i.Spherical,y=1,b=new i.Vector3,x=!1,w=new i.Vector2,S=new i.Vector2,T=new i.Vector2,_=new i.Vector2,M=new i.Vector2,E=new i.Vector2,P=new i.Vector2,k=new i.Vector2,R=new i.Vector2,O=[],C={};function L(){return Math.pow(.95,p.zoomSpeed)}function A(e){g.theta-=e}function D(e){g.phi-=e}I=new i.Vector3;var I,j,U,B=function(e,t){I.setFromMatrixColumn(t,0),I.multiplyScalar(-e),b.add(I)},N=(j=new i.Vector3,function(e,t){!0===p.screenSpacePanning?j.setFromMatrixColumn(t,1):(j.setFromMatrixColumn(t,0),j.crossVectors(p.object.up,j)),j.multiplyScalar(e),b.add(j)}),F=(U=new i.Vector3,function(e,t){var r,n=p.domElement;p.object.isPerspectiveCamera?(r=p.object.position,U.copy(r).sub(p.target),r=U.length(),r*=Math.tan(p.object.fov/2*Math.PI/180),B(2*e*r/n.clientHeight,p.object.matrix),N(2*t*r/n.clientHeight,p.object.matrix)):p.object.isOrthographicCamera?(B(e*(p.object.right-p.object.left)/p.object.zoom/n.clientWidth,p.object.matrix),N(t*(p.object.top-p.object.bottom)/p.object.zoom/n.clientHeight,p.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),p.enablePan=!1)});function z(e){p.object.isPerspectiveCamera?y/=e:p.object.isOrthographicCamera?(p.object.zoom=Math.max(p.minZoom,Math.min(p.maxZoom,p.object.zoom*e)),p.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),p.enableZoom=!1)}function V(e){p.object.isPerspectiveCamera?y*=e:p.object.isOrthographicCamera?(p.object.zoom=Math.max(p.minZoom,Math.min(p.maxZoom,p.object.zoom/e)),p.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),p.enableZoom=!1)}function H(e){w.set(e.clientX,e.clientY)}function G(e){_.set(e.clientX,e.clientY)}function W(){var e,t;1===O.length?w.set(O[0].pageX,O[0].pageY):(e=.5*(O[0].pageX+O[1].pageX),t=.5*(O[0].pageY+O[1].pageY),w.set(e,t))}function X(){var e,t;1===O.length?_.set(O[0].pageX,O[0].pageY):(e=.5*(O[0].pageX+O[1].pageX),t=.5*(O[0].pageY+O[1].pageY),_.set(e,t))}function q(){var e=O[0].pageX-O[1].pageX,t=O[0].pageY-O[1].pageY;e=Math.sqrt(e*e+t*t),P.set(0,e)}function Y(e){1==O.length?S.set(e.pageX,e.pageY):(r=ce(e),t=.5*(e.pageX+r.x),e=.5*(e.pageY+r.y),S.set(t,e)),T.subVectors(S,w).multiplyScalar(p.rotateSpeed);var t,r=p.domElement;A(2*Math.PI*T.x/r.clientHeight),D(2*Math.PI*T.y/r.clientHeight),w.copy(S)}function Z(e){var t,r;1===O.length?M.set(e.pageX,e.pageY):(t=ce(e),r=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),M.set(r,e)),E.subVectors(M,_).multiplyScalar(p.panSpeed),F(E.x,E.y),_.copy(M)}function Q(e){var t=ce(e),r=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(r*r+e*e),k.set(0,t),R.set(0,Math.pow(k.y/P.y,p.zoomSpeed)),z(R.y),P.copy(k)}function K(e){if(!1!==p.enabled)if(0===O.length&&(p.domElement.setPointerCapture(e.pointerId),p.domElement.addEventListener("pointermove",J),p.domElement.addEventListener("pointerup",$)),O.push(e),"touch"===e.pointerType){switch(ue(e),O.length){case 1:switch(p.touches.ONE){case i.TOUCH.ROTATE:if(!1===p.enableRotate)return;W(),d=f.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(!1===p.enablePan)return;X(),d=f.TOUCH_PAN;break;default:d=f.NONE}break;case 2:switch(p.touches.TWO){case i.TOUCH.DOLLY_PAN:if(!1===p.enableZoom&&!1===p.enablePan)return;p.enableZoom&&q(),p.enablePan&&X(),d=f.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(!1===p.enableZoom&&!1===p.enableRotate)return;p.enableZoom&&q(),p.enableRotate&&W(),d=f.TOUCH_DOLLY_ROTATE;break;default:d=f.NONE}break;default:d=f.NONE}d!==f.NONE&&p.dispatchEvent(ie)}else{var t,r=e;switch(r.button){case 0:t=p.mouseButtons.LEFT;break;case 1:t=p.mouseButtons.MIDDLE;break;case 2:t=p.mouseButtons.RIGHT;break;default:t=-1}switch(t){case i.MOUSE.DOLLY:if(!1===p.enableZoom)return;!function(e){P.set(e.clientX,e.clientY)}(r),d=f.DOLLY;break;case i.MOUSE.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===p.enablePan)return;G(r),d=f.PAN}else{if(!1===p.enableRotate)return;H(r),d=f.ROTATE}break;case i.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===p.enableRotate)return;H(r),d=f.ROTATE}else{if(!1===p.enablePan)return;G(r),d=f.PAN}break;default:d=f.NONE}d!==f.NONE&&p.dispatchEvent(ie)}}function J(e){if(!1!==p.enabled)if("touch"===e.pointerType){var t=e;switch(ue(t),d){case f.TOUCH_ROTATE:if(!1===p.enableRotate)return;Y(t),p.update();break;case f.TOUCH_PAN:if(!1===p.enablePan)return;Z(t),p.update();break;case f.TOUCH_DOLLY_PAN:if(!1===p.enableZoom&&!1===p.enablePan)return;!function(e){p.enableZoom&&Q(e),p.enablePan&&Z(e)}(t),p.update();break;case f.TOUCH_DOLLY_ROTATE:if(!1===p.enableZoom&&!1===p.enableRotate)return;!function(e){p.enableZoom&&Q(e),p.enableRotate&&Y(e)}(t),p.update();break;default:d=f.NONE}}else{var r=e;if(!1!==p.enabled)switch(d){case f.ROTATE:if(!1===p.enableRotate)return;!function(e){S.set(e.clientX,e.clientY),T.subVectors(S,w).multiplyScalar(p.rotateSpeed),e=p.domElement,A(2*Math.PI*T.x/e.clientHeight),D(2*Math.PI*T.y/e.clientHeight),w.copy(S),p.update()}(r);break;case f.DOLLY:if(!1===p.enableZoom)return;!function(e){k.set(e.clientX,e.clientY),R.subVectors(k,P),0<R.y?z(L()):R.y<0&&V(L()),P.copy(k),p.update()}(r);break;case f.PAN:if(!1===p.enablePan)return;!function(e){M.set(e.clientX,e.clientY),E.subVectors(M,_).multiplyScalar(p.panSpeed),F(E.x,E.y),_.copy(M),p.update()}(r)}}}function $(e){le(e),0===O.length&&(p.domElement.releasePointerCapture(e.pointerId),p.domElement.removeEventListener("pointermove",J),p.domElement.removeEventListener("pointerup",$)),p.dispatchEvent(oe),d=f.NONE}function ee(e){le(e)}function re(e){!1!==p.enabled&&!1!==p.enableZoom&&d===f.NONE&&(e.preventDefault(),p.dispatchEvent(ie),e.deltaY<0?V(L()):0<e.deltaY&&z(L()),p.update(),p.dispatchEvent(oe))}function ae(e){if(!1!==p.enabled&&!1!==p.enablePan){var t=!1;switch(e.code){case p.keys.UP:F(0,p.keyPanSpeed),t=!0;break;case p.keys.BOTTOM:F(0,-p.keyPanSpeed),t=!0;break;case p.keys.LEFT:F(p.keyPanSpeed,0),t=!0;break;case p.keys.RIGHT:F(-p.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),p.update())}}function se(e){!1!==p.enabled&&e.preventDefault()}function le(e){delete C[e.pointerId];for(var t=0;t<O.length;t++)if(O[t].pointerId==e.pointerId)return void O.splice(t,1)}function ue(e){var t=C[e.pointerId];void 0===t&&(t=new i.Vector2,C[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ce(e){return e=e.pointerId===O[0].pointerId?O[1]:O[0],C[e.pointerId]}return p.domElement.addEventListener("contextmenu",se),p.domElement.addEventListener("pointerdown",K),p.domElement.addEventListener("pointercancel",ee),p.domElement.addEventListener("wheel",re,{passive:!1}),o.update(),o}return function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}(t)}();class se{create(e,t){return new ae(e,t)}}class le{constructor(e){this._state=!1,this._libsState=!1,this.map={val:"Box",type:"base-model"},this.libsMap={data:"Box",type:"texture"},this.events=e}get state(){return this._state}set state(e){this._state=e}setVal(e){this.state=!0,this.map=e}getVal(){if(this.state)return this.state=!1,this.map}setLibsVal(e){this._libsState=!0,this.libsMap=e}getLibsVal(){if(this._libsState)return this._libsState=!1,this.libsMap}}var ue=a(594),ce=a(129),he=a(685);function pe(){return(pe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=ge(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function fe(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&de(e,t)}function de(e,t){return(de=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function me(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ge(e);if(r=t?(r=ge(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Te(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return ve(n)}}function ve(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ge(e){return(ge=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ye(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function be(e,t,r){return t&&ye(e.prototype,t),r&&ye(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function xe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function we(e){return function(e){if(Array.isArray(e))return Se(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Se(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Se(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Se(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Te(e){return(Te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _e(e){return void 0===e}function Me(){return"undefined"!=typeof window}function Ee(e){return Jt(e)||Kt(e)}function Pe(e){return(pr=je(e,hr))&&Ln}function ke(e,t){return!t&&console.warn(e)}function Re(e,t){return e&&(hr[e]=t)&&pr&&(pr[e]=t)||hr}function Oe(){return 0}function Ce(e,t,r){return(r=e[t])&&Jt(r)?e[t]():_e(r)&&e.getAttribute&&e.getAttribute(t)||r}function Le(e,t){(e=e.split(",")).forEach(t)}function Ae(e,t,r,n){mr.length&&Mr(),e.render(t,r,n),mr.length&&Mr()}function De(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(ur).length<2?t:Kt(e)?e.trim():e}function Ie(e){return e}function je(e,t){for(var r in t)e[r]=t[r];return e}function Ue(e,t){for(var r in t)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=er(t[r])?Ue(e[r]||(e[r]={}),t[r]):t[r]);return e}function Be(e){var t,r=e.parent||gt,n=e.keyframes?(t=nr(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):Er;if(tr(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function Ne(e){return!e||e._ts&&Ne(e.parent)}function Fe(e){return e._repeat?ze(e._tTime,e=e.duration()+e._rDelay)*e:0}function ze(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function Ve(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function He(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=Ve(e.rawTime(),t),(!t._dur||$e(0,t.totalDuration(),r)-t._tTime>Gt)&&t.render(r,!0)),Or(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(r=e;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;e._zTime=-Gt}}function Ge(e,t,r,n){return t.parent&&Rr(t),t._start=_r(($t(r)?r:r||e!==gt?Ke(e,r,t):e._time)+t._delay),t._end=_r(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",o=4<arguments.length?arguments[4]:void 0,a=e[i];if(o)for(r=t[o];a&&a[o]>r;)a=a._prev;a?(t._next=a._next,a._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[i]=t,t._prev=a,t.parent=t._dp=e}(e,t,"_first","_last",e._sort?"_start":0),Ye(t)||(e._recent=t),n||He(e,t),e}function We(e,t){(hr.ScrollTrigger||fr("scrollTrigger",t))&&hr.ScrollTrigger.create(t,e)}function Xe(e,t,r,n){return rn(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&St!==qr.frame?(mr.push(e),e._lazy=[t,n]):void 0:1}function qe(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||qe(e))}function Ye(e){return"isFromStart"===(e=e.data)||"isStart"===e}function Ze(e,t,r,n){var i=e._repeat,o=_r(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=o/e._dur),e._dur=o,e._tDur=i?i<0?1e10:_r(o*(i+1)+e._rDelay*i):o,0<t&&!n?Lr(e,e._tTime=e._tDur*t):e.parent&&Cr(e),r||Or(e.parent,e),e}function Qe(e){return e instanceof mn?Or(e):Ze(e,e._dur)}function Ke(e,t,r){var n,i,o,a=e.labels,s=e._recent||Ar,l=e.duration()>=Ht?s.endTime(!1):e._dur;return Kt(t)&&(isNaN(t)||t in a)?(i=t.charAt(0),o="%"===t.substr(-1),n=t.indexOf("="),"<"===i||">"===i?(0<=n&&(t=t.replace(/=/,"")),("<"===i?s._start:s.endTime(0<=s._repeat))+(parseFloat(t.substr(1))||0)*(o?(n<0?s:r).totalDuration()/100:1)):n<0?(t in a||(a[t]=l),a[t]):(i=parseFloat(t.charAt(n-1)+t.substr(n+1)),o&&r&&(i=i/100*(nr(r)?r[0]:r).totalDuration()),1<n?Ke(e,t.substr(0,n-1),r)+i:l+i)):null==t?l:+t}function Je(e,t,r){var n,i,o=$t(t[1]),a=(o?2:1)+(e<2?0:1),s=t[a];if(o&&(s.duration=t[1]),s.parent=r,e){for(n=s,i=r;i&&!("immediateRender"in n);)n=i.vars.defaults||{},i=tr(i.vars.inherit)&&i.parent;s.immediateRender=tr(n.immediateRender),e<2?s.runBackwards=1:s.startAt=t[a-1]}return new wn(t[0],s,t[1+a])}function $e(e,t,r){return r<e?e:t<r?t:r}function et(e){if(Jt(e))return e;var t=er(e)?e:{each:e},r=$r(t.ease),n=t.from||0,i=parseFloat(t.base)||0,o={},a=(e=0<n&&n<1,isNaN(n)||e),s=t.axis,l=n,u=n;return Kt(n)?l=u={center:.5,edges:.5,end:1}[n]||0:!e&&a&&(l=n[0],u=n[1]),function(e,c,h){var p,f,d,m,v,g,y,b,x=(h||t).length,w=o[x];if(!w){if(!(b="auto"===t.grid?0:(t.grid||[1,Ht])[1])){for(g=-Ht;g<(g=h[b++].getBoundingClientRect().left)&&b<x;);b--}for(w=o[x]=[],p=a?Math.min(b,x)*l-.5:n%b,f=b===Ht?0:a?x*u/b-.5:n/b|0,y=Ht,v=g=0;v<x;v++)m=v%b-p,d=f-(v/b|0),w[v]=m=s?Math.abs("y"===s?d:m):Yt(m*m+d*d),g<m&&(g=m),m<y&&(y=m);"random"===n&&Nr(w),w.max=g-y,w.min=y,w.v=x=(parseFloat(t.amount)||parseFloat(t.each)*(x<b?x-1:s?"y"===s?x/b:b:Math.max(b,x/b))||0)*("edges"===n?-1:1),w.b=x<0?i-x:i,w.u=Ir(t.amount||t.each)||0,r=r&&x<0?Jr(r):r}return x=(w[e]-w.min)/w.max||0,_r(w.b+(r?r(x):x)*w.v)+w.u}}function tt(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var n=Math.round(parseFloat(r)/e)*e*t;return(n-n%1)/t+($t(r)?0:Ir(r))}}function rt(e,t){var r,n,i=nr(e);return!i&&er(e)&&(r=i=e.radius||Ht,e.values?(e=Br(e.values),(n=!$t(e[0]))&&(r*=r)):e=tt(e.increment)),Dr(t,i?Jt(e)?function(t){return n=e(t),Math.abs(n-t)<=r?n:t}:function(t){for(var i,o,a=parseFloat(n?t.x:t),s=parseFloat(n?t.y:0),l=Ht,u=0,c=e.length;c--;)(i=n?(i=e[c].x-a)*i+(o=e[c].y-s)*o:Math.abs(e[c]-a))<l&&(l=i,u=c);return u=!r||l<=r?e[u]:t,n||u===t||$t(t)?u:u+Ir(t)}:tt(e))}function nt(e,t,r,n){return Dr(nr(e)?!t:!0===r?!!(r=0):!n,(function(){return nr(e)?e[~~(Math.random()*e.length)]:(r=r||1e-5)&&(n=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((e-r/2+Math.random()*(t-e+.99*r))/r)*r*n)/n}))}function it(e,t,r){return Dr(r,(function(r){return e[~~t(r)]}))}function ot(e,t,r,n,i){var o=t-e,a=n-r;return Dr(i,(function(t){return r+((t-e)/o*a||0)}))}function at(e,t,r){var n,i,o,a=e.labels,s=Ht;for(n in a)(i=a[n]-t)<0==!!r&&i&&s>(i=Math.abs(i))&&(o=n,s=i);return o}function st(e,t,r){var n=e.vars,i=n[t];i&&(t=n[t+"Params"],n=n.callbackScope||e,r&&mr.length&&Mr(),t?i.apply(n,t):i.call(n))}function lt(e){return Rr(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&st(e,"onInterrupt"),e}function ut(e,t,r){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(r-t)*e*6:e<.5?r:3*e<2?t+(r-t)*(2/3-e)*6:t)*zr+.5|0}function ct(e,t,r){var n,i,o,a,s="",l=(e+s).match(Wr),u=t?"hsla(":"rgba(",c=0;if(!l)return e;if(l=l.map((function(e){return(e=Hr(e,t,1))&&u+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(o=Gr(e),(n=r.c).join(s)!==o.c.join(s)))for(a=(i=e.replace(Wr,"1").split(ar)).length-1;c<a;c++)s+=i[c]+(~n.indexOf(c)?l.shift()||u+"0,0,0,0)":(o.length?o:l.length?l:r).shift());if(!i)for(a=(i=e.split(Wr)).length-1;c<a;c++)s+=i[c]+l[c];return s+i[a]}function ht(e,t){for(var r,n=e._first;n;)n instanceof mn?ht(n,t):!n.vars.yoyoEase||n._yoyo&&n._repeat||n._yoyo===t||(n.timeline?ht(n.timeline,t):(r=n._ease,n._ease=n._yEase,n._yEase=r,n._yoyo=t)),n=n._next}function pt(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},i={easeIn:t,easeOut:n,easeInOut:3<arguments.length&&void 0!==arguments[3]?arguments[3]:function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2}};Le(e,(function(e){for(var t in Zr[e]=hr[e]=i,Zr[r=e.toLowerCase()]=n,i)Zr[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=Zr[e+"."+t]=i[t]}))}function ft(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function dt(e,t,r){function n(e){return 1===e?1:i*Math.pow(2,-10*e)*Qt((e-o)*a)+1}var i=1<=t?t:1,o=(a=(r||(e?.3:.45))/(t<1?t:1))/Wt*(Math.asin(1/i)||0),a=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:ft(n),Wt/a);return r.config=function(t,r){return dt(e,t,r)},r}function mt(e){function t(e){return e?--e*e*((r+1)*e+r)+1:0}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,n="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:ft(t);return n.config=function(t){return mt(e,t)},n}var vt,gt,yt,bt,xt,wt,St,Tt,_t,Mt,Et,Pt,kt,Rt,Ot,Ct,Lt,At,Dt,It,jt,Ut,Bt,Nt,Ft,zt={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Vt={duration:.5,overwrite:!1,delay:0},Ht=1e8,Gt=1/Ht,Wt=2*Math.PI,Xt=Wt/4,qt=0,Yt=Math.sqrt,Zt=Math.cos,Qt=Math.sin,Kt=function(e){return"string"==typeof e},Jt=function(e){return"function"==typeof e},$t=function(e){return"number"==typeof e},er=function(e){return"object"==Te(e)},tr=function(e){return!1!==e},rr="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},nr=Array.isArray,ir=/(?:-?\.?\d|\.)+/gi,or=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,ar=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,sr=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,lr=/[+-]=-?[.\d]+/,ur=/[^,'"\[\]\s]+/gi,cr=/[\d.+\-=]+(?:e[-+]\d*)*/i,hr={},pr={},fr=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},dr={},mr=[],vr={},gr={},yr={},br=30,xr=[],wr="",Sr=function(e){var t,r,n=e[0];if(er(n)||Jt(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(r=xr.length;r--&&!xr[r].targetTest(n););t=xr[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new fn(e[r],t)))||e.splice(r,1);return e},Tr=function(e){return e._gsap||Sr(Br(e))[0]._gsap},_r=function(e){return Math.round(1e7*e)/1e7||0},Mr=function(){var e,t,r=mr.length,n=mr.slice(0);for(vr={},e=mr.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},Er=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},Pr=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},kr=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=t._prev,o=t._next;i?i._next=o:e[r]===t&&(e[r]=o),o?o._prev=i:e[n]===t&&(e[n]=i),t._next=t._prev=t.parent=null},Rr=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},Or=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},Cr=function(e){return e._end=_r(e._start+(e._tDur/Math.abs(e._ts||e._rts||Gt)||0))},Lr=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=_r(r._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),Cr(e),r._dirty||Or(r,e)),e},Ar={_start:0,endTime:Oe,totalDuration:Oe},Dr=function(e,t){return e||0===e?t(e):t},Ir=function(e,t){return Kt(e)&&(t=cr.exec(e))?e.substr(t.index+t[0].length):""},jr=[].slice,Ur=function(e,t){return e&&er(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&er(e[0]))&&!e.nodeType&&e!==yt},Br=function(e,t,r){return!Kt(e)||r||!bt&&Yr()?nr(e)?function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return Kt(e)&&!t||Ur(e,1)?r.push.apply(r,we(Br(e))):r.push(e)}))||r}(e,r):Ur(e)?jr.call(e,0):e?[e]:[]:jr.call((t||xt).querySelectorAll(e),0)},Nr=function(e){return e.sort((function(){return.5-Math.random()}))},Fr=function(e){for(var t,r,n,i,o=0,a="";~(t=e.indexOf("random(",o));)n=e.indexOf(")",t),i="["===e.charAt(t+7),r=e.substr(t+7,n-t-7).match(i?ur:ir),a+=e.substr(o,t-o)+nt(i?r:+r[0],i?0:+r[1],+r[2]||1e-5),o=n+1;return a+e.substr(o,e.length-o)},zr=255,Vr={aqua:[0,zr,zr],lime:[0,zr,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,zr],navy:[0,0,128],white:[zr,zr,zr],olive:[128,128,0],yellow:[zr,zr,0],orange:[zr,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[zr,0,0],pink:[zr,192,203],cyan:[0,zr,zr],transparent:[zr,zr,zr,0]},Hr=function(e,t,r){var n,i,o,a,s,l,u,c=e?$t(e)?[e>>16,e>>8&zr,e&zr]:0:Vr.black;if(!c){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Vr[e])c=Vr[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(o=e.charAt(3))+o+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(c=parseInt(e.substr(1,6),16))>>16,c>>8&zr,c&zr,parseInt(e.substr(7),16)/255];c=[(e=parseInt(e.substr(1),16))>>16,e>>8&zr,e&zr]}else if("hsl"===e.substr(0,3))if(c=u=e.match(ir),t){if(~e.indexOf("="))return c=e.match(or),r&&c.length<4&&(c[3]=1),c}else a=+c[0]%360/360,s=+c[1]/100,n=2*(l=+c[2]/100)-(i=l<=.5?l*(s+1):l+s-l*s),3<c.length&&(c[3]*=1),c[0]=ut(a+1/3,n,i),c[1]=ut(a,n,i),c[2]=ut(a-1/3,n,i);else c=e.match(ir)||Vr.transparent;c=c.map(Number)}return t&&!u&&(n=c[0]/zr,i=c[1]/zr,o=c[2]/zr,l=((e=Math.max(n,i,o))+(t=Math.min(n,i,o)))/2,e===t?a=s=0:(u=e-t,s=.5<l?u/(2-e-t):u/(e+t),a=e===n?(i-o)/u+(i<o?6:0):e===i?(o-n)/u+2:(n-i)/u+4,a*=60),c[0]=~~(a+.5),c[1]=~~(100*s+.5),c[2]=~~(100*l+.5)),r&&c.length<4&&(c[3]=1),c},Gr=function(e){var t=[],r=[],n=-1;return e.split(Wr).forEach((function(e){e=e.match(ar)||[],t.push.apply(t,we(e)),r.push(n+=e.length+1)})),t.c=r,t},Wr=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Vr)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),Xr=/hsl[a]?\(/,qr=(Ot=Date.now,Ct=500,Lt=33,At=Ot(),Dt=At,jt=It=1e3/240,Bt={time:0,frame:0,tick:function(){en(!0)},deltaRatio:function(e){return kt/(1e3/(e||60))},wake:function(){wt&&(!bt&&Me()&&(yt=bt=window,xt=yt.document||{},hr.gsap=Ln,(yt.gsapVersions||(yt.gsapVersions=[])).push(Ln.version),Pe(pr||yt.GreenSockGlobals||!yt.gsap&&yt||{}),Pt=yt.requestAnimationFrame),Mt&&Bt.sleep(),Et=Pt||function(e){return setTimeout(e,jt-1e3*Bt.time+1|0)},_t=1,en(2))},sleep:function(){(Pt?yt.cancelAnimationFrame:clearTimeout)(Mt),_t=0,Et=Oe},lagSmoothing:function(e,t){Ct=e||1/Gt,Lt=Math.min(t,Ct,0)},fps:function(e){It=1e3/(e||240),jt=1e3*Bt.time+It},add:function(e){Ut.indexOf(e)<0&&Ut.push(e),Yr()},remove:function(e,t){~(t=Ut.indexOf(e))&&Ut.splice(t,1)&&t<=Rt&&Rt--},_listeners:Ut=[]}),Yr=function(){return!_t&&qr.wake()},Zr={},Qr=/^[\d.\-M][\d.\-,\s]/,Kr=/["']/g,Jr=function(e){return function(t){return 1-e(1-t)}},$r=function(e,t){return e&&(Jt(e)?e:Zr[e]||function(e){var t,r,n,i=(e+"").split("("),o=Zr[i[0]];return o&&1<i.length&&o.config?o.config.apply(null,~e.indexOf("{")?[function(e){for(var t,r,n,i={},o=e.substr(1,e.length-3).split(":"),a=o[0],s=1,l=o.length;s<l;s++)r=o[s],t=s!==l-1?r.lastIndexOf(","):r.length,n=r.substr(0,t),i[a]=isNaN(n)?n.replace(Kr,"").trim():+n,a=r.substr(t+1).trim();return i}(i[1])]:(t=(i=e).indexOf("(")+1,r=i.indexOf(")"),n=i.indexOf("(",t),i.substring(t,~n&&n<r?i.indexOf(")",r+1):r).split(",").map(De))):Zr._CE&&Qr.test(e)?Zr._CE("",e):o}(e))||t};function en(e){var t,r,n,i=Ot()-Dt,o=!0===e;if(Ct<i&&(At+=i-Lt),(0<(i=(r=(Dt+=i)-At)-jt)||o)&&(n=++Bt.frame,kt=r-1e3*Bt.time,Bt.time=r/=1e3,jt+=i+(It<=i?4:It-i),t=1),o||(Mt=Et(en)),t)for(Rt=0;Rt<Ut.length;Rt++)Ut[Rt](r,kt,n,e)}function tn(e){return e<Ft?Nt*e*e:e<.7272727272727273?Nt*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?Nt*(e-=2.25/2.75)*e+.9375:Nt*Math.pow(e-2.625/2.75,2)+.984375}function rn(e,t){var r,n,i,o,a,s,l,u,c,h,p,f,d,m=e.vars,v=m.ease,g=m.startAt,y=m.immediateRender,b=m.lazy,x=m.onUpdate,w=m.onUpdateParams,S=m.callbackScope,T=m.runBackwards,_=m.yoyoEase,M=m.keyframes,E=m.autoRevert,P=e._dur,k=e._startAt,R=e._targets,O=e.parent,C=O&&"nested"===O.data?O.parent._targets:R,L="auto"===e._overwrite&&!vt,A=e.timeline;if(e._ease=$r(v=!A||M&&v?v:"none",Vt.ease),e._yEase=_?Jr($r(!0===_?v:_,Vt.ease)):0,_&&e._yoyo&&!e._repeat&&(_=e._yEase,e._yEase=e._ease,e._ease=_),e._from=!A&&!!m.runBackwards,!A||M&&!m.stagger){if(f=(u=R[0]?Tr(R[0]).harness:0)&&m[u.prop],r=Pr(m,dr),k&&Rr(k.render(-1,!0)),g)if(Rr(e._startAt=wn.set(R,Er({data:"isStart",overwrite:!1,parent:O,immediateRender:!0,lazy:tr(b),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:S,stagger:0},g))),t<0&&!y&&!E&&e._startAt.render(-1,!0),y){if(0<t&&!E&&(e._startAt=0),P&&t<=0)return void(t&&(e._zTime=t))}else!1===E&&(e._startAt=0);else if(T&&P)if(k)E||(e._startAt=0);else if(i=Er({overwrite:!1,data:"isFromStart",lazy:(y=!t&&y)&&tr(b),immediateRender:y,stagger:0,parent:O},r),f&&(i[u.prop]=f),Rr(e._startAt=wn.set(R,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,y){if(!t)return}else rn(e._startAt,Gt);for(e._pt=0,b=P&&tr(b)||b&&!P,n=0;n<R.length;n++){if(l=(a=R[n])._gsap||Sr(R)[n]._gsap,e._ptLookup[n]=h={},vr[l.id]&&mr.length&&Mr(),p=C===R?n:C.indexOf(a),u&&!1!==(c=new u).init(a,f||r,e,p,C)&&(e._pt=o=new Rn(e._pt,a,c.name,0,1,c.render,c,0,c.priority),c._props.forEach((function(e){h[e]=o})),c.priority&&(s=1)),!u||f)for(i in r)gr[i]&&(c=yn(i,r,e,p,a,C))?c.priority&&(s=1):h[i]=o=gn.call(e,a,i,"get",r[i],p,C,0,m.stringFilter);e._op&&e._op[n]&&e.kill(a,e._op[n]),L&&e._pt&&(pn=e,gt.killTweensOf(a,h,e.globalTime(t)),d=!e.parent,pn=0),e._pt&&b&&(vr[l.id]=1)}s&&kn(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!d,M&&t<=0&&A.render(Ht,!0,!0)}function nn(e,t,r,n,i){return Jt(e)?e.call(t,r,n,i):Kt(e)&&~e.indexOf("random(")?Fr(e):e}function on(e,t,r){return e.setAttribute(t,r)}function an(e,t){var r=t._pt,n="";if(!e&&t.b)n=t.b;else if(1===e&&t.e)n=t.e;else{for(;r;)n=r.p+(r.m?r.m(r.s+r.c*e):Math.round(1e4*(r.s+r.c*e))/1e4)+n,r=r._next;n+=t.c}t.set(t.t,t.p,n,t)}function sn(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next}function ln(e,t,r,n){for(var i,o=this._pt;o;)i=o._next,o.p===n&&o.modifier(e,t,r),o=i}function un(e){for(var t,r,n=this._pt;n;)r=n._next,n.p===e&&!n.op||n.op===e?kr(this,n,"_pt"):n.dep||(t=1),n=r;return!t}function cn(e,t,r,n){n.mSet(e,t,n.m.call(n.tween,r,n.mt),n)}function hn(e,t){return{name:e,rawVars:1,init:function(e,r,n){n._onInit=function(e){var n,i;if(Kt(r)&&(n={},Le(r,(function(e){return n[e]=1})),r=n),t){for(i in n={},r)n[i]=t(r[i]);r=n}var o,a,s,l=e,u=r,c=l._targets;for(o in u)for(a=c.length;a--;)(s=(s=l._ptLookup[a][o])&&s.d)&&(s=s._pt?Cn(s,o):s)&&s.modifier&&s.modifier(u[o],l,c[a],o)}}}}Le("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var r=t<5?t+1:t;pt(e+",Power"+(r-1),t?function(e){return Math.pow(e,r)}:function(e){return e},(function(e){return 1-Math.pow(1-e,r)}),(function(e){return e<.5?Math.pow(2*e,r)/2:1-Math.pow(2*(1-e),r)/2}))})),Zr.Linear.easeNone=Zr.none=Zr.Linear.easeIn,pt("Elastic",dt("in"),dt("out"),dt()),Nt=7.5625,Ft=1/2.75,pt("Bounce",(function(e){return 1-tn(1-e)}),tn),pt("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),pt("Circ",(function(e){return-(Yt(1-e*e)-1)})),pt("Sine",(function(e){return 1===e?1:1-Zt(e*Xt)})),pt("Back",mt("in"),mt("out"),mt()),Zr.SteppedEase=Zr.steps=hr.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,r=1/e,n=e+(t?0:1),i=t?1:0,o=1-Gt;return function(e){return((n*$e(0,o,e)|0)+i)*r}}},Vt.ease=Zr["quad.out"],Le("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return wr+=e+","+e+"Params,"}));var pn,fn=be((function e(t,r){xe(this,e),this.id=qt++,(t._gsap=this).target=t,this.harness=r,this.get=r?r.get:Ce,this.set=r?r.getSetter:Mn})),dn=function(){function e(t){xe(this,e),this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,Ze(this,+t.duration,1,1),this.data=t.data,_t||qr.wake()}return be(e,[{key:"delay",value:function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay}},{key:"duration",value:function(e){return arguments.length?this.totalDuration(0<this._repeat?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur}},{key:"totalDuration",value:function(e){return arguments.length?(this._dirty=0,Ze(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Yr(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(Lr(this,e),r._dp&&!r.parent&&He(r,this);r&&r.parent;)r.parent._time!==r._start+(0<=r._ts?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&Ge(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Gt||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),Ae(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+Fe(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time}},{key:"totalProgress",value:function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio}},{key:"progress",value:function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+Fe(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*r,t):this._repeat?ze(this._tTime,r)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-Gt?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?Ve(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-Gt?0:this._rts,e=this.totalTime($e(-this._delay,this._tDur,t),!0)).parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;return Cr(this),this}},{key:"paused",value:function(e){return arguments.length?(this._ps!==e&&((this._ps=e)?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Yr(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==Gt&&(this._tTime-=Gt)))),this):this._ps}},{key:"startTime",value:function(e){var t;return arguments.length?(this._start=e,!(t=this.parent||this._dp)||!t._sort&&this.parent||Ge(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(tr(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)}},{key:"rawTime",value:function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?Ve(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,r=arguments.length?e:t.rawTime();t;)r=t._start+r/(t._ts||1),t=t._dp;return r}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,Qe(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,Qe(this),t?this.time(t):this):this._rDelay}},{key:"yoyo",value:function(e){return arguments.length?(this._yoyo=e,this):this._yoyo}},{key:"seek",value:function(e,t){return this.totalTime(Ke(this,e),tr(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,tr(t))}},{key:"play",value:function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)}},{key:"reverse",value:function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)}},{key:"pause",value:function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)}},{key:"resume",value:function(){return this.paused(!1)}},{key:"reversed",value:function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-Gt:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-Gt,this}},{key:"isActive",value:function(){var e=this.parent||this._dp,t=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(e=e.rawTime(!0))>=t&&e<this.endTime(!0)-Gt))}},{key:"eventCallback",value:function(e,t,r){var n=this.vars;return 1<arguments.length?(t?(n[e]=t,r&&(n[e+"Params"]=r),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(r){function n(){var e=t.then;t.then=null,Jt(i)&&(i=i(t))&&(i.then||i===t)&&(t.then=e),r(i),t.then=e}var i=Jt(e)?e:Ie;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){lt(this)}}]),e}(),mn=(Er(dn.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Gt,_prom:0,_ps:!1,_rts:1}),function(){fe(t,dn);var e=me(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=1<arguments.length?arguments[1]:void 0;return xe(this,t),(r=e.call(this,n)).labels={},r.smoothChildTiming=!!n.smoothChildTiming,r.autoRemoveChildren=!!n.autoRemoveChildren,r._sort=tr(n.sortChildren),gt&&Ge(n.parent||gt,ve(r),i),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&We(ve(r),n.scrollTrigger),r}return be(t,[{key:"to",value:function(e,t,r){return Je(0,arguments,this),this}},{key:"from",value:function(e,t,r){return Je(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return Je(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,Be(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new wn(e,t,Ke(this,r),1),this}},{key:"call",value:function(e,t,r){return Ge(this,wn.delayedCall(0,e,t),r)}},{key:"staggerTo",value:function(e,t,r,n,i,o,a){return r.duration=t,r.stagger=r.stagger||n,r.onComplete=o,r.onCompleteParams=a,r.parent=this,new wn(e,r,Ke(this,i)),this}},{key:"staggerFrom",value:function(e,t,r,n,i,o,a){return r.runBackwards=1,Be(r).immediateRender=tr(r.immediateRender),this.staggerTo(e,t,r,n,i,o,a)}},{key:"staggerFromTo",value:function(e,t,r,n,i,o,a,s){return n.startAt=r,Be(n).immediateRender=tr(n.immediateRender),this.staggerTo(e,t,n,i,o,a,s)}},{key:"render",value:function(e,t,r){var n,i,o,a,s,l,u,c,h,p,f=this._time,d=this._dirty?this.totalDuration():this._tDur,m=this._dur,v=e<=0?0:_r(e),g=this._zTime<0!=e<0&&(this._initted||!m);if((v=this!==gt&&d<v&&0<=e?d:v)!==this._tTime||r||g){if(f!==this._time&&m&&(v+=this._time-f,e+=this._time-f),n=v,c=this._start,s=!(u=this._ts),g&&(m||(f=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(g=this._yoyo,a=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*a+e,t,r);if(n=_r(v%a),v===d?(o=this._repeat,n=m):((o=~~(v/a))&&o===v/a&&(n=m,o--),m<n&&(n=m)),h=ze(this._tTime,a),g&&1&o&&(n=m-n,p=1),o!==(h=!f&&this._tTime&&h!==o?o:h)&&!this._lock){var y=g&&1&h;if(g=y===(g&&1&o),f=(y=o<h?!y:y)?0:m,this._lock=1,this.render(f||(p?0:_r(o*a)),t,!m)._lock=0,this._tTime=v,!t&&this.parent&&st(this,"onRepeat"),this.vars.repeatRefresh&&!p&&(this.invalidate()._lock=1),f&&f!==this._time||s!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,d=this._tDur,g&&(this._lock=2,this.render(f=y?m:-1e-4,!0),this.vars.repeatRefresh&&!p&&this.invalidate()),this._lock=0,!this._ts&&!s)return this;ht(this,p)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,r){var n;if(t<r)for(n=e._first;n&&n._start<=r;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=r;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,_r(f),_r(n)))&&(v-=n-(n=l._start)),this._tTime=v,this._time=n,this._act=!u,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,f=0),!f&&n&&!t&&(st(this,"onStart"),this._tTime!==v))return this;if(f<=n&&0<=e)for(b=this._first;b;){if(i=b._next,(b._act||n>=b._start)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,r);if(b.render(0<b._ts?(n-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(n-b._start)*b._ts,t,r),n!==this._time||!this._ts&&!s){l=0,i&&(v+=this._zTime=-Gt);break}}b=i}else for(var b=this._last,x=e<0?e:n;b;){if(i=b._prev,(b._act||x<=b._end)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,r);if(b.render(0<b._ts?(x-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(x-b._start)*b._ts,t,r),n!==this._time||!this._ts&&!s){l=0,i&&(v+=this._zTime=x?-Gt:Gt);break}}b=i}if(l&&!t&&(this.pause(),l.render(f<=n?0:-Gt)._zTime=f<=n?1:-1,this._ts))return this._start=c,Cr(this),this.render(e,t,r);this._onUpdate&&!t&&st(this,"onUpdate",!0),!(v===d&&d>=this.totalDuration()||!v&&f)||c!==this._start&&Math.abs(u)===Math.abs(this._ts)||this._lock||(!e&&m||!(v===d&&0<this._ts||!v&&this._ts<0)||Rr(this,1),t||e<0&&!f||!v&&!f&&d||(st(this,v===d&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||v<d&&0<this.timeScale()||this._prom()))}return this}},{key:"add",value:function(e,t){var r=this;if($t(t)||(t=Ke(this,t,e)),!(e instanceof dn)){if(nr(e))return e.forEach((function(e){return r.add(e,t)})),this;if(Kt(e))return this.addLabel(e,t);if(!Jt(e))return this;e=wn.delayedCall(0,e)}return this!==e?Ge(this,e,t):this}},{key:"getChildren",value:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Ht,i=[],o=this._first;o;)o._start>=n&&(o instanceof wn?t&&i.push(o):(r&&i.push(o),e&&i.push.apply(i,we(o.getChildren(!0,t,r))))),o=o._next;return i}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),r=t.length;r--;)if(t[r].vars.id===e)return t[r]}},{key:"remove",value:function(e){return Kt(e)?this.removeLabel(e):Jt(e)?this.killTweensOf(e):(kr(this,e),e===this._recent&&(this._recent=this._last),Or(this))}},{key:"totalTime",value:function(e,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=_r(qr.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),pe(ge(t.prototype),"totalTime",this).call(this,e,r),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=Ke(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,r){return(t=wn.delayedCall(0,t||Oe,r)).data="isPause",this._hasPause=1,Ge(this,t,Ke(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=Ke(this,e);t;)t._start===e&&"isPause"===t.data&&Rr(t),t=t._next}},{key:"killTweensOf",value:function(e,t,r){for(var n=this.getTweensOf(e,r),i=n.length;i--;)pn!==n[i]&&n[i].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var r,n=[],i=Br(e),o=this._first,a=$t(t);o;)o instanceof wn?function(e,t){for(var r=t.length,n=0;e.indexOf(t[n])<0&&++n<r;);return n<r}(o._targets,i)&&(a?(!pn||o._initted&&o._ts)&&o.globalTime(0)<=t&&o.globalTime(o.totalDuration())>t:!t||o.isActive())&&n.push(o):(r=o.getTweensOf(i,t)).length&&n.push.apply(n,we(r)),o=o._next;return n}},{key:"tweenTo",value:function(e,t){t=t||{};var r,n=this,i=Ke(n,e),o=(e=t).startAt,a=e.onStart,s=e.onStartParams,l=(e=e.immediateRender,wn.to(n,Er({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:i,overwrite:"auto",duration:t.duration||Math.abs((i-(o&&"time"in o?o.time:n._time))/n.timeScale())||Gt,onStart:function(){var e;n.pause(),r||(e=t.duration||Math.abs((i-(o&&"time"in o?o.time:n._time))/n.timeScale()),l._dur!==e&&Ze(l,e,0,1).render(l._time,!0,!0),r=1),a&&a.apply(l,s||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,r){return this.tweenTo(t,Er({startAt:{time:Ke(this,e)}},r))}},{key:"recent",value:function(){return this._recent}},{key:"nextLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return at(this,Ke(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return at(this,Ke(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+Gt)}},{key:"shiftChildren",value:function(e,t){for(var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=this._first,o=this.labels;i;)i._start>=n&&(i._start+=e,i._end+=e),i=i._next;if(t)for(r in o)o[r]>=n&&(o[r]+=e);return Or(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return pe(ge(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),Or(this)}},{key:"totalDuration",value:function(e){var t,r,n,i=0,o=this,a=o._last,s=Ht;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-e:e));if(o._dirty){for(n=o.parent;a;)t=a._prev,a._dirty&&a.totalDuration(),(r=a._start)>s&&o._sort&&a._ts&&!o._lock?(o._lock=1,Ge(o,a,r-a._delay,1)._lock=0):s=r,r<0&&a._ts&&(i-=r,(!n&&!o._dp||n&&n.smoothChildTiming)&&(o._start+=r/o._ts,o._time-=r,o._tTime-=r),o.shiftChildren(-r,!1,-1/0),s=0),a._end>i&&a._ts&&(i=a._end),a=t;Ze(o,o===gt&&o._time>i?o._time:i,1,1),o._dirty=0}return o._tDur}}],[{key:"updateRoot",value:function(e){if(gt._ts&&(Ae(gt,Ve(e,gt)),St=qr.frame),qr.frame>=br){br+=zt.autoSleep||120;var t=gt._first;if((!t||!t._ts)&&zt.autoSleep&&qr._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||qr.sleep()}}}}]),t}()),vn=(Er(mn.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,i,o,a){var s,l,u,c,h,p=new Rn(this._pt,e,t,0,1,an,null,i),f=0,d=0;for(p.b=r,p.e=n,r+="",(i=~(n+="").indexOf("random("))&&(n=Fr(n)),o&&(o(o=[r,n],e,t),r=o[0],n=o[1]),s=r.match(sr)||[];c=sr.exec(n);)u=c[0],c=n.substring(f,c.index),l?l=(l+1)%5:"rgba("===c.substr(-5)&&(l=1),u!==s[d++]&&(h=parseFloat(s[d-1])||0,p._pt={_next:p._pt,p:c||1===d?c:",",s:h,c:"="===u.charAt(1)?parseFloat(u.substr(2))*("-"===u.charAt(0)?-1:1):parseFloat(u)-h,m:l&&l<4?Math.round:0},f=sr.lastIndex);return p.c=f<n.length?n.substring(f,n.length):"",p.fp=a,(lr.test(n)||i)&&(p.e=0),this._pt=p}),gn=function(e,t,r,n,i,o,a,s,l){var u;if(Jt(n)&&(n=n(i||0,e,o)),i=e[t],o="get"!==r?r:Jt(i)?l?e[t.indexOf("set")||!Jt(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():i,r=Jt(i)?l?_n:Tn:Sn,Kt(n)&&"="===(n=~n.indexOf("random(")?Fr(n):n).charAt(1)&&(!(u=parseFloat(o)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(Ir(o)||0))&&0!==u||(n=u)),o!==n)return isNaN(o*n)||""===n?(i||t in e||fr(t,n),vn.call(this,e,t,o,n,r,s||zt.stringFilter,l)):(u=new Rn(this._pt,e,t,+o||0,n-(o||0),"boolean"==typeof i?Pn:En,0,r),l&&(u.fp=l),a&&u.modifier(a,this,e),this._pt=u)},yn=function(e,t,r,n,i,o){var a,s,l,u;if(gr[e]&&!1!==(a=new gr[e]).init(i,a.rawVars?t[e]:function(e,t,r,n,i){if(Jt(e)&&(e=nn(e,i,t,r,n)),!er(e)||e.style&&e.nodeType||nr(e)||rr(e))return Kt(e)?nn(e,i,t,r,n):e;var o,a={};for(o in e)a[o]=nn(e[o],i,t,r,n);return a}(t[e],n,i,o,r),r,n,o)&&(r._pt=s=new Rn(r._pt,i,e,0,1,a.render,a,0,a.priority),r!==Tt))for(l=r._ptLookup[r._targets.indexOf(i)],u=a._props.length;u--;)l[a._props[u]]=s;return a},bn=wr+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",xn={},wn=(Le(bn+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return xn[e]=1})),function(){fe(t,dn);var e=me(t);function t(r,n,i,o){xe(this,t),"number"==typeof n&&(i.duration=n,n=i,i=null);var a,s,l,u,c,h,p,f,d,m=(o=(a=e.call(this,o?n:Be(n))).vars).duration,v=o.delay,g=o.immediateRender,y=o.stagger,b=o.overwrite,x=o.keyframes,w=o.defaults,S=o.scrollTrigger,T=o.yoyoEase,_=(o=n.parent||gt,(nr(r)||rr(r)?$t(r[0]):"length"in n)?[r]:Br(r));if(a._targets=_.length?Sr(_):ke("GSAP target "+r+" not found. https://greensock.com",!zt.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=b,x||y||Ee(m)||Ee(v)){if(n=a.vars,(s=a.timeline=new mn({data:"nested",defaults:w||{}})).kill(),s.parent=s._dp=ve(a),s._start=0,y||Ee(m)||Ee(v)){if(c=_.length,f=y&&et(y),er(y))for(h in y)~bn.indexOf(h)&&((d=d||{})[h]=y[h]);for(l=0;l<c;l++)(u=Pr(n,xn)).stagger=0,T&&(u.yoyoEase=T),d&&je(u,d),p=_[l],u.duration=+nn(m,ve(a),l,p,_),u.delay=(+nn(v,ve(a),l,p,_)||0)-a._delay,!y&&1===c&&u.delay&&(a._delay=v=u.delay,a._start+=v,u.delay=0),s.to(p,u,f?f(l,p,_):0),s._ease=Zr.none;s.duration()?m=v=0:a.timeline=0}else if(x){Be(Er(s.vars.defaults,{ease:"none"})),s._ease=$r(x.ease||n.ease||"none");var M,E,P,k=0;if(nr(x))x.forEach((function(e){return s.to(_,e,">")}));else{for(h in u={},x)"ease"!==h&&"easeEach"!==h&&function(e,t,r,n){var i,o,a=t.ease||n||"power1.inOut";if(nr(t))o=r[e]||(r[e]=[]),t.forEach((function(e,r){return o.push({t:r/(t.length-1)*100,v:e,e:a})}));else for(i in t)o=r[i]||(r[i]=[]),"ease"!==i&&o.push({t:parseFloat(e),v:t[i],e:a})}(h,x[h],u,x.easeEach);for(h in u)for(M=u[h].sort((function(e,t){return e.t-t.t})),l=k=0;l<M.length;l++)(P={ease:(E=M[l]).e,duration:(E.t-(l?M[l-1].t:0))/100*m})[h]=E.v,s.to(_,P,k),k+=P.duration;s.duration()<m&&s.to({},{duration:m-s.duration()})}}m||a.duration(m=s.duration())}else a.timeline=0;return!0!==b||vt||(pn=ve(a),gt.killTweensOf(_),pn=0),Ge(o,ve(a),i),n.reversed&&a.reverse(),n.paused&&a.paused(!0),(g||!m&&!x&&a._start===_r(o._time)&&tr(g)&&Ne(ve(a))&&"nested"!==o.data)&&(a._tTime=-Gt,a.render(Math.max(0,-v))),S&&We(ve(a),S),a}return be(t,[{key:"render",value:function(e,t,r){var n,i,o=this._time,a=this._tDur,s=this._dur,l=a-Gt<e&&0<=e?a:e<Gt?0:e;if(s){if(l!==this._tTime||!e||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(m=l,d=this.timeline,this._repeat){if(h=s+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*h+e,t,r);if(m=_r(l%h),l===a?(g=this._repeat,m=s):((g=~~(l/h))&&g===l/h&&(m=s,g--),s<m&&(m=s)),(f=this._yoyo&&1&g)&&(p=this._yEase,m=s-m),y=ze(this._tTime,h),m===o&&!r&&this._initted)return this;g!==y&&(d&&this._yEase&&ht(d,f),!this.vars.repeatRefresh||f||this._lock||(this._lock=r=1,this.render(_r(h*g),!0).invalidate()._lock=0))}if(!this._initted){if(Xe(this,e<0?e:m,r,t))return this._tTime=0,this;if(s!==this._dur)return this.render(e,t,r)}if(this._tTime=l,this._time=m,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=i=(p||this._ease)(m/s),this._from&&(this.ratio=i=1-i),m&&!o&&!t&&(st(this,"onStart"),this._tTime!==l))return this;for(n=this._pt;n;)n.r(i,n.d),n=n._next;d&&d.render(e<0?e:!m&&f?-Gt:d._dur*d._ease(m/this._dur),t,r)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,r),st(this,"onUpdate")),this._repeat&&g!==y&&this.vars.onRepeat&&!t&&this.parent&&st(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&s||!(l===this._tDur&&0<this._ts||!l&&this._ts<0)||Rr(this,1),t||e<0&&!o||!l&&!o||(st(this,l===a?"onComplete":"onReverseComplete",!0),!this._prom||l<a&&0<this.timeScale()||this._prom()))}}else{var u,c,h=this,p=e,f=t,d=r,m=h.ratio,v=p<0||!p&&(!h._start&&qe(h)&&(h._initted||!Ye(h))||(h._ts<0||h._dp._ts<0)&&!Ye(h))?0:1,g=h._rDelay,y=0;if(g&&h._repeat&&(c=ze(y=$e(0,h._tDur,p),g),h._yoyo&&1&c&&(v=1-v),c!==ze(h._tTime,g)&&(m=1-v,h.vars.repeatRefresh&&h._initted&&h.invalidate())),v!==m||d||h._zTime===Gt||!p&&h._zTime){if(h._initted||!Xe(h,p,d,f)){for(c=h._zTime,h._zTime=p||(f?Gt:0),f=f||p&&!c,h.ratio=v,h._from&&(v=1-v),h._time=0,h._tTime=y,u=h._pt;u;)u.r(v,u.d),u=u._next;h._startAt&&p<0&&h._startAt.render(p,!0,!0),h._onUpdate&&!f&&st(h,"onUpdate"),y&&h._repeat&&!f&&h.parent&&st(h,"onRepeat"),(p>=h._tDur||p<0)&&h.ratio===v&&(v&&Rr(h,1),f||(st(h,v?"onComplete":"onReverseComplete",!0),h._prom&&h._prom()))}}else h._zTime||(h._zTime=p)}return this}},{key:"targets",value:function(){return this._targets}},{key:"invalidate",value:function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),pe(ge(t.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?lt(this):this;if(this.timeline)return p=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,pn&&!0!==pn.vars.overwrite)._first||lt(this),this.parent&&p!==this.timeline.totalDuration()&&Ze(this,this._dur*this.timeline._tDur/p,0,1),this;var r,n,i,o,a,s,l,u=this._targets,c=e?Br(e):u,h=this._ptLookup,p=this._pt;if((!t||"all"===t)&&function(e,t){for(var r=e.length,n=r===t.length;n&&r--&&e[r]===t[r];);return r<0}(u,c))return"all"===t&&(this._pt=0),lt(this);for(r=this._op=this._op||[],"all"!==t&&(Kt(t)&&(a={},Le(t,(function(e){return a[e]=1})),t=a),t=function(e,t){var r,n,i,o,a=(e=e[0]?Tr(e[0]).harness:0)&&e.aliases;if(!a)return t;for(n in r=je({},t),a)if(n in r)for(i=(o=a[n].split(",")).length;i--;)r[o[i]]=r[n];return r}(u,t)),l=u.length;l--;)if(~c.indexOf(u[l]))for(a in n=h[l],"all"===t?(r[l]=t,o=n,i={}):(i=r[l]=r[l]||{},o=t),o)(s=n&&n[a])&&("kill"in s.d&&!0!==s.d.kill(a)||kr(this,s,"_pt"),delete n[a]),"all"!==i&&(i[a]=1);return this._initted&&!this._pt&&p&&lt(this),this}}],[{key:"to",value:function(e,r){return new t(e,r,arguments[2])}},{key:"from",value:function(e,t){return Je(1,arguments)}},{key:"delayedCall",value:function(e,r,n,i){return new t(r,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:r,onReverseComplete:r,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:i})}},{key:"fromTo",value:function(e,t,r){return Je(2,arguments)}},{key:"set",value:function(e,r){return r.duration=0,r.repeatDelay||(r.repeat=0),new t(e,r)}},{key:"killTweensOf",value:function(e,t,r){return gt.killTweensOf(e,t,r)}}]),t}()),Sn=(Er(wn.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Le("staggerTo,staggerFrom,staggerFromTo",(function(e){wn[e]=function(){var t=new mn,r=jr.call(arguments,0);return r.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,r)}})),function(e,t,r){return e[t]=r}),Tn=function(e,t,r){return e[t](r)},_n=function(e,t,r,n){return e[t](n.fp,r)},Mn=function(e,t){return Jt(e[t])?Tn:_e(e[t])&&e.setAttribute?on:Sn},En=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},Pn=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},kn=function(e){for(var t,r,n,i,o=e._pt;o;){for(t=o._next,r=n;r&&r.pr>o.pr;)r=r._next;(o._prev=r?r._prev:i)?o._prev._next=o:n=o,(o._next=r)?r._prev=o:i=o,o=t}e._pt=n},Rn=function(){function e(t,r,n,i,o,a,s,l,u){xe(this,e),this.t=r,this.s=i,this.c=o,this.p=n,this.r=a||En,this.d=s||this,this.set=l||Sn,this.pr=u||0,(this._next=t)&&(t._prev=this)}return be(e,[{key:"modifier",value:function(e,t,r){this.mSet=this.mSet||this.set,this.set=cn,this.m=e,this.mt=r,this.tween=t}}]),e}(),On=(Le(wr+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(e){return dr[e]=1})),hr.TweenMax=hr.TweenLite=wn,hr.TimelineLite=hr.TimelineMax=mn,gt=new mn({sortChildren:!1,defaults:Vt,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),zt.stringFilter=function(e){var t=e.join(" ");if(Wr.lastIndex=0,Wr.test(t))return t=Xr.test(t),e[1]=ct(e[1],t),e[0]=ct(e[0],t,Gr(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,r=Jt(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:Oe,render:sn,add:gn,kill:un,modifier:ln,rawVars:0}),i={targetTest:0,get:0,getSetter:Mn,aliases:{},register:0};if(Yr(),e!==r){if(gr[t])return;Er(r,Er(Pr(e,n),i)),je(r.prototype,je(n,Pr(e,i))),gr[r.prop=t]=r,e.targetTest&&(xr.push(r),dr[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}Re(t,r),e.register&&e.register(Ln,r,Rn)}))},timeline:function(e){return new mn(e)},getTweensOf:function(e,t){return gt.getTweensOf(e,t)},getProperty:function(e,t,r,n){Kt(e)&&(e=Br(e)[0]);var i=Tr(e||{}).get,o=r?Ie:De;return"native"===r&&(r=""),e&&(t?o((gr[t]&&gr[t].get||i)(e,t,r,n)):function(t,r,n){return o((gr[t]&&gr[t].get||i)(e,t,r,n))})},quickSetter:function(e,t,r){var n,i;if(1<(e=Br(e)).length)return n=e.map((function(e){return Ln.quickSetter(e,t,r)})),i=n.length,function(e){for(var t=i;t--;)n[t](e)};e=e[0]||{};var o=gr[t],a=Tr(e),s=a.harness&&(a.harness.aliases||{})[t]||t,l=o?function(t){var n=new o;Tt._pt=0,n.init(e,r?t+r:t,Tt,0,[e]),n.render(1,n),Tt._pt&&sn(1,Tt)}:a.set(e,s);return o?l:function(t){return l(e,s,r?t+r:t,a,1)}},isTweening:function(e){return 0<gt.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=$r(e.ease,Vt.ease)),Ue(Vt,e||{})},config:function(e){return Ue(zt,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,n=e.plugins,i=e.defaults;e=e.extendTimeline,(n||"").split(",").forEach((function(e){return e&&!gr[e]&&!hr[e]&&ke(t+" effect requires "+e+" plugin.")})),yr[t]=function(e,t,n){return r(Br(e),Er(t||{},i),n)},e&&(mn.prototype[t]=function(e,r,n){return this.add(yr[t](e,er(r)?r:(n=r)&&{},this),n)})},registerEase:function(e,t){Zr[e]=$r(t)},parseEase:function(e,t){return arguments.length?$r(e,t):Zr},getById:function(e){return gt.getById(e)},exportRoot:function(){var e,t,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,i=new mn(r);for(i.smoothChildTiming=tr(r.smoothChildTiming),gt.remove(i),i._dp=0,i._time=i._tTime=gt._time,e=gt._first;e;)t=e._next,!n&&!e._dur&&e instanceof wn&&e.vars.onComplete===e._targets[0]||Ge(i,e,e._start-e._delay),e=t;return Ge(gt,i,0),i},utils:{wrap:function e(t,r,n){var i=r-t;return nr(t)?it(t,e(0,t.length),r):Dr(n,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,r,n){var i=r-t,o=2*i;return nr(t)?it(t,e(0,t.length-1),r):Dr(n,(function(e){return t+(i<(e=(o+(e-t)%o)%o||0)?o-e:e)}))},distribute:et,random:nt,snap:rt,normalize:function(e,t,r){return ot(e,t,0,1,r)},getUnit:Ir,clamp:function(e,t,r){return Dr(r,(function(r){return $e(e,t,r)}))},splitColor:Hr,toArray:Br,selector:function(e){return e=Br(e)[0]||ke("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Br(t,r.querySelectorAll?r:r===e?ke("Invalid scope")||xt.createElement("div"):e)}},mapRange:ot,pipe:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(r){return e(parseFloat(r))+(t||Ir(r))}},interpolate:function e(t,r,n,i){var o=isNaN(t+r)?0:function(e){return(1-e)*t+e*r};if(!o){var a,s,l,u,c,h=Kt(t),p={};if(!0===n&&(i=1)&&(n=null),h)t={p:t},r={p:r};else if(nr(t)&&!nr(r)){for(l=[],u=t.length,c=u-2,s=1;s<u;s++)l.push(e(t[s-1],t[s]));u--,o=function(e){e*=u;var t=Math.min(c,~~e);return l[t](e-t)},n=r}else i||(t=je(nr(t)?[]:{},t));if(!l){for(a in r)gn.call(p,t,a,"get",r[a]);o=function(e){return sn(e,p),h?t.p:t}}}return Dr(n,o)},shuffle:Nr},install:Pe,effects:yr,ticker:qr,updateRoot:mn.updateRoot,plugins:gr,globalTimeline:gt,core:{PropTween:Rn,globals:Re,Tween:wn,Timeline:mn,Animation:dn,getCache:Tr,_removeLinkedListItem:kr,suppressOverwrites:function(e){return vt=e}}}),Cn=(Le("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return On[e]=wn[e]})),qr.add(mn.updateRoot),Tt=On.to({},{duration:0}),function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r}),Ln=On.registerPlugin({name:"attr",init:function(e,t,r,n,i){var o,a;for(o in t)(a=this.add(e,"setAttribute",(e.getAttribute(o)||0)+"",t[o],n,i,0,0,o))&&(a.op=o),this._props.push(o)}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r])}},hn("roundProps",tt),hn("modifiers"),hn("snap",rt))||On;wn.version=mn.version=Ln.version="3.9.1",wt=1,Me()&&Yr(),Zr.Power0,Zr.Power1,Zr.Power2,Zr.Power3,Zr.Power4,Zr.Linear,Zr.Quad,Zr.Cubic,Zr.Quart,Zr.Quint,Zr.Strong,Zr.Elastic,Zr.Back,Zr.SteppedEase,Zr.Bounce,Zr.Sine,Zr.Expo,Zr.Circ;const An=i,Dn=["map","normalMap","aoMap"],In=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"];class jn{}const Un=class extends jn{constructor(e){super(),this.type="修改材质";var{target:e,info:t,newVal:r,oldVal:n,runScene:i}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=r,this.oldVal=n}_execute(e,t){console.log(this,e,"this,data"),this.target[this.info]=e,this.target.needsUpdate=!0,In.includes(this.info)&&(console.log(this.info,"this.info"),e&&this.runScene.uniqueEx.texture.addMaterial(e,{material:this.target,type:this.info}))}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,this.newVal)}redo(){this._execute(this.newVal,this.oldVal)}};var Bn=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};class Nn{constructor(e){this.allTextures=new Set,this.runScene=e}loadImagBit(e){return createImageBitmap(e,{imageOrientation:"flipY",resizeQuality:"pixelated"})}load(e){return Bn(this,void 0,void 0,(function*(){var t=yield this.loadImagBit(yield Xn(e));return t=new i.Texture(t),this.afterLoad(e,t)}))}clone(e){const t=new i.Texture(e.image);return t.userData=Object.assign({},e.userData),this._afterLoad(t)}getDef(e){return e=new i.Texture(e),this._afterLoad(e)}toThree(e){return e.mapping=An.EquirectangularReflectionMapping,e.needsUpdate=!0,e}toTwo(e){return e.mapping=300,e.needsUpdate=!0,e}_afterLoad(e){const{md5:t,blob:r}=e.userData;var n=this.getSameTexture(t,e);return n?(e.dispose(),n):(e.userData.url=URL.createObjectURL(r),e.userData.md5=t,e.userData.gm=Fn(e),e.format=-1!==r.type.indexOf("png")?1023:1022,e.needsUpdate=!0,e.flipY=!1,e.minFilter=An.LinearMipmapLinearFilter,this.addToAllTextures(e),e)}afterLoad(e,t){return Bn(this,void 0,void 0,(function*(){const r=yield Xn(e);t.userData.blob=r;var n=Yn(yield r.arrayBuffer());return t.userData.url=URL.createObjectURL(r),t.userData.md5=n,this._afterLoad(t)}))}getSameTexture(e,t){for(const n in this.runScene.uniqueEx.texture.map){var r=this.runScene.uniqueEx.texture.get(n);if(r.userData.md5===e&&r.mapping===t.mapping)return r}}bindData(e){return Bn(this,void 0,void 0,(function*(){if(this.setTexture(e),this.addToAllTextures(e),e.userData.gm=Fn(e),!e.userData.blob){const t=yield this.getBlob(e);return e.userData.md5=Yn(yield t.arrayBuffer()),e.userData.blob=t,e.userData.url=URL.createObjectURL(t),e}}))}setTexture(e){return e.magFilter=1003,e.wrapS=An.RepeatWrapping,e.wrapT=An.RepeatWrapping,e.encoding=3e3,e.needsUpdate=!0,e.version=3,e.minFilter=An.LinearMipmapLinearFilter,e}addToAllTextures(e){var t=this.runScene.uniqueEx.texture.getLength();this.runScene.uniqueEx.texture.add(e),this.runScene.uniqueEx.texture.getLength()!==t&&(this.setTexture(e),this.runScene.optionsEx.cb.texture.add.cb(e))}parse(e){return Bn(this,void 0,void 0,(function*(){var t=yield qn(e);return this.afterLoad(URL.createObjectURL(t),new i.Texture(yield this.loadImagBit(t)))}))}getBlob(e){return e.userData.blob||Gn(e.image)}getUrl(e){return console.log(e,"texture"),e.userData.url}getBlobAndBase64(e){return e.userData.blob?e.userData:Wn(e)}dispose(e){e.dispose()}reverseY(e){return createImageBitmap(e,{imageOrientation:"flipY"})}coverByImage(e,t){return Bn(this,void 0,void 0,(function*(){let r;r=t instanceof i.Texture?t:t?yield this.parse(t):null;var n=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(n){const t=[];(0,ue.js)(n,((n,i)=>{const o=this.runScene.uniqueEx.material.get(n);o&&i.forEach((n=>{t.push(new Un({target:o,info:n,newVal:r,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}removeTexture(e){this.runScene.optionsEx.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e)}}const Fn=e=>{var{width:e,height:t}=e.image;return e*t*4*1.33};var zn=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const Vn=(e,t,r,n,i)=>{let o=Object.assign({},e),a=new wn(o,r,t).eventCallback("onUpdate",(e=>n&&n(o))).eventCallback("onComplete",(e=>{i&&i(),wn.killTweensOf(a)}));return a},Hn=(e,t)=>(t.updateMatrixWorld(!0),t=new An.Vector3,e.getWorldPosition(t),t),Gn=e=>zn(void 0,void 0,void 0,(function*(){const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),new Promise((e=>{t.toBlob((t=>{e(t)}))}))})),Wn=e=>zn(void 0,void 0,void 0,(function*(){var t=e.image;const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d")),i=1023===e.format?"image/png":"image/jpeg";return n.drawImage(t,0,0,r.width,r.height),new Promise((e=>{r.toBlob((t=>{e({blob:t,base64:r.toDataURL(i)})}),i)}))})),Xn=e=>zn(void 0,void 0,void 0,(function*(){return(yield r().get(e,{responseType:"blob"})).data})),qn=e=>zn(void 0,void 0,void 0,(function*(){{let t=(yield(0,he.toResult)(e,"base64")).split(","),r=t[0].match(/:(.*?);/)[1],n=atob(t[1]),i=n.length,o=new Uint8Array(i);for(;i--;)o[i]=n.charCodeAt(i);return new Blob([o],{type:r})}})),Yn=e=>(0,ce.md5)(e);class Zn{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.eventsMap={down:{},up:{}},this.allFn={s_saveScene:()=>function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.events.runScene.optionsEx.log("正在保存","base","info"),yield this.events.runScene.optionsEx.cb.scene.saveNet.cb("")})),d_exporter_Gltf:()=>{this.events.runScene.exporter.gltf.scene()},alt_selectDom:()=>{console.log("多选dom")},r_runScript:()=>{console.log("运行脚本")},d_copyModel:()=>{console.log("复制模型")},g_createGroup:()=>{console.log("生成组")},meta_showMateriallLibrary:()=>{console.log("弹出材质库窗口")},f_focusModel:()=>{const e=this.events.runScene.modelEx.select;if(e){const{scene:r,camera:n,renderer:o,controls:a}=this.events.runScene.assetsEx.get(),s=new i.Vector3,l=new i.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){const e=this.events.runScene.helperEx.boxHelper;if(e.update(),!e||!e.object)return;var t=o.domElement.getBoundingClientRect();let r=t.width/t.height;const a=new i.Vector3;t=e.geometry.attributes.position.array,a.set(Math.abs(t[0]-t[3]),Math.abs(t[1]-t[7]),Math.abs(t[2]-t[14])),l.x=.5*(t[0]+t[3]),l.y=.5*(t[1]+t[7]),l.z=.5*(t[2]+t[14]);let u=new i.Vector3;u.subVectors(n.position,l),u.projectOnPlane(new i.Vector3(0,1,0)),u.normalize(),1<r&&(r=1/r),t=2*Math.tan(.5*n.fov*Math.PI/180),t=a.length()/r/t,s.addVectors(l,u.multiplyScalar(t))}else{r.updateMatrixWorld(!0),t=new i.Vector3,e.getWorldPosition(t),l.set(t.x,t.y,t.z);let o=new i.Vector3;o.subVectors(n.position,l),o.projectOnPlane(new i.Vector3(0,1,0)),o.normalize(),s.addVectors(l,o.multiplyScalar(3))}Vn({positionX:n.position.x,positionY:n.position.y,positionZ:n.position.z,targetX:a.target.x,targetY:a.target.y,targetZ:a.target.z},{positionX:s.x,positionY:s.y,positionZ:s.z,targetX:l.x,targetY:l.y,targetZ:l.z},.5,(e=>{n.position.set(e.positionX,e.positionY,e.positionZ),n.lookAt(e.targetX,e.targetY,e.targetZ),a.target.set(e.targetX,e.targetY,e.targetZ),a.update(),n.updateProjectionMatrix()}))}},z_undo:e=>{this.events.runScene.undoEx.undo()},y_redo:e=>{this.events.runScene.undoEx.redo()}},this.events=e}bindEvent(e,t,r){if(void 0!==this.eventsMap[e][t])throw SyntaxError("该函数名已存在");this.eventsMap[e][t]=r}init(e){"running"!==this.events.runScene.optionsEx.options.mode&&(document.addEventListener("keydown",this.keyDown.bind(this)),document.addEventListener("keyup",this.keyUp.bind(this)))}keyDown(e){const t=e.key.toLowerCase();switch((0,ue.js)(this.eventsMap.down,((r,n)=>{n(t,e)})),t){case"s":this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene());break;case"d":if(this.ctrl){e.preventDefault();var r=this.events.runScene.modelEx.select;if(!r)return;this.events.runScene.modelEx.selectNull();var n=this.events.runScene.modelEx.clone(r);if(!n)return;this.events.runScene.modelEx.add(n,r.parent,!0,!0)}break;case"alt":this.ctrl&&(e.preventDefault(),this.allFn.alt_selectDom()),this.alt=!0;break;case"control":case"ctrl":this.ctrl=!0;break;case"shift":this.shift=!0;break;case"w":e.preventDefault(),e.stopPropagation(),this.events.runScene.helperEx.transContro.changeMode("position");break;case"e":this.events.runScene.helperEx.transContro.changeMode("rotation");break;case"r":if(this.events.runScene.helperEx.transContro.changeMode("scale"),!this.ctrl)return;e.preventDefault(),this.allFn.r_runScript();break;case"g":this.events.runScene.optionsEx.cb.events.key.g.cb({event:e,eventKey:this});break;case"f":this.allFn.f_focusModel();break;case"delete":console.log("删除"),this.events.runScene.helperEx.unfocus(),n=this.events.runScene.multipSelector.getSelectedList("value"),this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||n),n&&this.events.runScene.multipSelector.delete();break;case"z":if(!this.ctrl)return;this.allFn.z_undo(e),console.log("撤销功能~~~~");break;case"y":if(!this.ctrl)return;this.allFn.y_redo(e),console.log("向前功能~~~~")}}keyUp(e){const t=e.key.toLowerCase();switch((0,ue.js)(this.eventsMap.up,((r,n)=>{n(t,e)})),t){case"meta":if(!this.ctrl)return;this.allFn.meta_showMateriallLibrary();break;case"s":if(this.ctrl)break;return;case"alt":this.alt=!1;break;case"control":case"ctrl":this.ctrl=!1;break;case"shift":this.shift=!1}}}class Qn{constructor(e){this.downPosition={x:0,y:0},this.enableUp=!0,this.fnMap={global:{down:{},up:{}},local:{down:{},up:{}}},this.down=e=>{(0,ue.js)(this.fnMap.local.down,((t,r)=>{r(e)})),this.downPosition={x:e.offsetX,y:e.offsetY}},this.up=e=>{var t,r,n,i;2===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||((0,ue.js)(this.fnMap.local.up,((t,r)=>{r(e)})),t=e.offsetX,r=e.offsetY,({x:n,y:i}=this.downPosition),t===n&&r===i&&this.trigger(e))},this.events=e}bindEvent(e){var{type:e,name:t,fn:r,local:n}=e;this.fnMap[n][e][t]=r}init(e){e.addEventListener("pointerdown",this.down.bind(this)),e.addEventListener("pointerup",this.up.bind(this)),window.addEventListener("pointerdown",(e=>{this.events.runScene.optionsEx.cb.events.pointer.down.cb(e)})),window.addEventListener("pointerup",(e=>{this.events.runScene.optionsEx.cb.events.pointer.up.cb(e)}))}getTriggerModels(e){const t=new i.Raycaster,r=new i.Vector2,{engineDom:n,camera:o,scene:a}=this.events.runScene.assetsEx.get();return r.x=e.offsetX/n.clientWidth*2-1,r.y=-e.offsetY/n.clientHeight*2+1,t.setFromCamera(r,o),e=a.children.filter((e=>{if((!this.events.runScene.helperEx.isHelper(e)||e.userData.id)&&!e.userData.unClick)return e})),t.intersectObjects(e,!0).map((e=>e.object))}removeHideModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)))}trigger(e){let t=this.removeHideModel(this.getTriggerModels(e));if(!t)return this.events.runScene.multipSelector.setEmpty(),void this.events.runScene.modelEx.selectNull();if(this.events.runScene.helperEx.isHelper(t)&&(e=this.events.runScene.uniqueEx.getId(t),t=this.events.runScene.uniqueEx.model.get(e)),!this.enableUp){if(t===this.events.runScene.helperEx.transContro.multipObj)return;this.enableUp=!0}if(console.log("鼠标按下选中的模型:",t),this.events.key.ctrl)return this.enableUp=!1,this.events.runScene.multipSelector.add(t);if(this.events.key.shift){const e=t.parent;return e?void e.children.map((e=>{this.events.runScene.multipSelector.add(e)})):void 0}this.events.runScene.modelEx.setSelectByModel(t),this.events.runScene.lightEx.isLight(t)&&this.events.runScene.lightEx.setSelect(t)}}t=a(356);var Kn=a.n(t),Jn=a(298);const $n=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector"];var ei=a(251);class ti{static create(){return new i.MeshStandardMaterial}static isDefval(e){for(const t in this.defVal){const r=this.defVal[t],n=e[t];if(r instanceof i.Color){if(r.getHexString()!==n.getHexString())return!1}else if("object"==typeof r){if(n.x!==r.x)return!1}else if(n!==r)return!1}for(const t of In)if(e[t])return!1;return!0}}ti.defVal={color:new i.Color(16777215),emissive:new i.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new i.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,opacity:1};class ri{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.runScene=e}undo(){if(0!==this.undos.length){const e=this.removeUndos(-1)[0];console.log(e,"last"),e&&(e instanceof Array?e.reverse().map((e=>e.undo())):e.undo(),this.redos.push(e))}}addUndos(e){var t;return this.undos.push(e),t=this.dataMap.history.push(e),this.dataMap.index=this.undos.length-1,this.runScene.optionsEx.cb.undo.addUndos.cb(e,this.undos),t}removeUndos(e){var t;return this.undos.splice(e),t=this.dataMap.history.splice(e),this.dataMap.index=this.undos.length-1,this.runScene.optionsEx.cb.undo.removeUndos.cb(e),t}undoByIndex(e){if(e>this.dataMap.index){const t=this.undos.slice(this.dataMap.index+1,e+1);t.map((e=>{e instanceof Array?e.map((e=>e.redo())):e.redo()})),console.log(t,"0")}else if(e<this.dataMap.index){const t=this.undos.slice(e+1,this.dataMap.index+1);t.reverse().map((e=>{e instanceof Array?e.map((e=>e.undo())):e.undo()})),console.log(t,this.undos,"ls1")}this.dataMap.index=e,this.runScene.optionsEx.cb.undo.undoByIndex.cb(e)}addUndo(e){this.dataMap.index!==this.undos.length&&this.removeUndos(this.dataMap.index+1),this.addUndos(e)}addRedo(e){this.redos.push(e)}redo(){if(0!==this.redos.length){const e=this.redos.splice(-1)[0];console.log(e,"last"),e&&(e instanceof Array?e.reverse().map((e=>e.redo())):e.redo(),this.addUndo(e))}}reset(){this.undos=[],this.redos=[],this.dataMap.history=[],this.dataMap.index=0,this.runScene.optionsEx.cb.undo.reset.cb(""),console.log(this,"this")}}function ni(e){if("object"!=typeof e)return e;if(null===e)return null;if(e){var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=ni(e[t]),n[t]=r);return n}}const ii=class extends jn{constructor(e){super(),this.type="多层级修改",this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,this.old=(0,ue.qR)(e.target,this.typeList)[(0,Jn.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,ue.qR)(this.target,this.typeList);t[(0,Jn.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t),"shadow"!==this.typeList[0]&&this.typeList[1]}undo(){this._execute(this.old)}redo(){this._execute(this.new)}};class oi{constructor(e){this.tools={type:"FakeInterior",getTextures(e){const t=[];return e.uniforms.ceilingTex.value&&t.push({type:"ceilingTex",texture:e.uniforms.ceilingTex.value}),e.uniforms.floorTex.value&&t.push({type:"floorTex",texture:e.uniforms.floorTex.value}),e.uniforms.sideWallTex.value&&t.push({type:"sideWallTex",texture:e.uniforms.sideWallTex.value}),e.uniforms.backWallTex.value&&t.push({type:"backWallTex",texture:e.uniforms.backWallTex.value}),t},parseData:e=>{const{textures:t,normal:r}=e,n=new i.ShaderMaterial({uniforms:ni(ai.uniforms),vertexShader:ai.vertexShader,fragmentShader:ai.fragmentShader});return t.forEach((e=>{"ceilingTex"===e.type?n.uniforms.ceilingTex.value=e.texture||null:"floorTex"===e.type?n.uniforms.floorTex.value=e.texture||null:"sideWallTex"===e.type?n.uniforms.sideWallTex.value=e.texture||null:"backWallTex"===e.type&&(n.uniforms.backWallTex.value=e.texture||null)})),Object.keys(r.uniforms).filter((e=>!oi.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];n.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new i.Vector4(t.x,t.y,t.z,t.w):t})),n.userData.tools=this.tools,n},toNormal:e=>{const t=bi(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),{}),n=e.uniforms,o=ai.uniforms;return Object.keys(n).filter((e=>!oi.TextureNames.includes(e))).map((e=>{var t,a,s,l,u,c,h=n[e].value,p=o[e].value;h instanceof i.Vector4?(({x:t,y:a,z:s}=h),({x:l,y:u,z:c}=p),t===l&&a===u&&s===c||(r[e]=h)):(console.log(h,p,"val,defVal"),h!==p&&(r[e]=h))})),console.log(r,"uniforms"),t.userData.normal.uniforms=r,console.log(t,"newMaterial"),t},clone:function(e,t){return e}},this.runScene=e}create(){const e=new i.ShaderMaterial({uniforms:ni(ai.uniforms),vertexShader:ai.vertexShader,fragmentShader:ai.fragmentShader});return e.userData.tools=this.tools,e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new ii({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}oi.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"];const ai={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new i.Vector4(1,1,1,1)},sideWallTex:{value:null},backWallTex:{value:null},floorTex:{value:null},ceilingTex:{value:null},sideWallTexTiling:{value:.097},backWallTexTiling:{value:.097},floorTexTiling:{value:.15},ceilingTexTiling:{value:.15},roomTile:{value:.3},roomsXYZPropsW:{value:new i.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new i.Vector4(4.7,2,-11,-3)}},vertexShader:"\n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vUv = uv;\n vPos = position;\n vModelMatrix = modelMatrix;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform float roomIntensity;\n uniform vec4 roomColorTint;\n \n uniform sampler2D sideWallTex;\n uniform sampler2D backWallTex;\n uniform sampler2D floorTex;\n uniform sampler2D ceilingTex;\n \n uniform float sideWallTexTiling;\n uniform float backWallTexTiling;\n uniform float floorTexTiling;\n uniform float ceilingTexTiling;\n \n uniform float roomTile;\n uniform vec4 roomsXYZPropsW;\n uniform vec4 positionOffsetRoomsXYZPropsW;\n \n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vec4 interpVertexPos = vec4(vPos.xyz, vPos.z);\n // 将相机世界空间坐标转换为对象空间坐标\n vec4 cameraObjectPos = inverse(vModelMatrix) * vec4(cameraPosition, 1.0);\n vec4 transCameraPos = vec4(cameraObjectPos.xyz, cameraObjectPos.z);\n \n vec4 temp1 = (interpVertexPos - positionOffsetRoomsXYZPropsW);\n vec4 temp2 = ((roomsXYZPropsW + vec4(-1E-05, -1E-05, -1E-05, -1E-05)) * roomTile);\n vec4 V2 = transCameraPos - positionOffsetRoomsXYZPropsW;\n vec4 V1 = temp1 - V2;\n vec4 middleman = ((floor(temp2 * temp1) + step(vec4(0, 0, 0, 0), V1)) / temp2 - V2) / V1;\n \n // Side Walls\n vec2 sideWallUv = (middleman.x * V1 + V2).zy * sideWallTexTiling;\n vec4 sideWallColor = texture2D(sideWallTex, sideWallUv);\n \n // Back Wall\n vec2 backWallUv = (middleman.z * V1 + V2).xy * backWallTexTiling;\n vec4 backWallColor = texture2D(backWallTex, backWallUv);\n \n // Floor Ceiling\n vec2 floorUv = ((middleman.y * V1) + V2).xz * floorTexTiling;\n vec2 ceilingUv = ((middleman.y * V1) + V2).xz * ceilingTexTiling;\n vec4 floorColor = texture2D(floorTex, floorUv);\n vec4 ceilingColor = texture2D(ceilingTex, ceilingUv);\n vec4 cfColor = mix(floorColor, ceilingColor, step(0.0, V1.y));\n \n // Mix\n float compareXZ = 0.0;\n float stepXZ = step(middleman.z, middleman.x);\n if(stepXZ <= 0.0)\n compareXZ = middleman.x;\n else\n compareXZ = middleman.z;\n \n vec4 wallColor = vec4(0);\n if(stepXZ <= 0.0)\n wallColor = sideWallColor;\n else\n wallColor = backWallColor;\n \n vec4 finalColor = vec4(0);\n if(middleman.y <= compareXZ)\n finalColor = cfColor;\n else\n finalColor = wallColor;\n \n // Tint Room\n vec4 tintColor = roomColorTint * finalColor * roomIntensity;\n \n gl_FragColor = tintColor;\n }\n "},si={uniforms:{tDiffuse:new i.Uniform(null),h:new i.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"},li={uniforms:{tDiffuse:new i.Uniform(null),v:new i.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"};new i.Uniform(null),new i.Uniform(null),new i.Uniform(0),new i.Uniform(0),new i.Uniform(0),new i.Uniform(new i.Vector2),new i.Uniform(.1),new i.Uniform(1e3);class ui{constructor(e){this.materials={},this.render=()=>{(0,ue.js)(this.materials,((e,t)=>{const{model:r,material:n}=t;n.update(r)}))},this.tools={type:"Reflector",getTextures:e=>wi(e),parseData:e=>{const{textures:t,normal:r,models:n,material:i}=e,o=xi(i,new ci(void 0,void 0,this.runScene));return o.name=i.name,t.forEach((e=>{o[e.type]=e.texture})),Object.keys(r.uniforms).filter((e=>!ui.TextureNames.includes(e))).map((e=>{o[e]=r.uniforms[e]})),o.setRTSize(o.resolution),o.setBlurPass(o.blurSize),o.insertReflectorShader(),o.userData.tools=this.tools,this.bindData({model:n[0],material:o}),o},toNormal:e=>{const t=xi(e,bi()),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),t.name=e.name,{}),n=hi.uniforms;return Object.keys(n).filter((e=>!ui.TextureNames.includes(e))).map((t=>{var i=e[t],o=n[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?i.value!==o&&(r[t]=i):i!==o&&(r[t]=i)})),t.userData.normal.uniforms=r,t},clone:(e,t)=>this.create(t)},this.runScene=e,this.init()}init(){this.runScene.optionsEx.cb.render.add("Reflector-render",this.render),this.runScene.optionsEx.cb.model.add.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,this.materials[t.userData.id]||(this.materials[t.userData.id]={model:e,material:t}))})),this.runScene.optionsEx.cb.model.remove.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,delete this.materials[t.userData.id])}))}bindData(e){const t=e.material;var r=(0,ei.getId)();t.userData.id=r,this.materials[r]=e}create(e){const t=new ci(void 0,void 0,this.runScene);return t.insertReflectorShader(),t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name=e.name),this.bindData({model:e,material:t}),t}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new ii({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}ui.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"];class ci extends i.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=hi.uniforms.opacity.value,this.transparent=hi.uniforms.transparent.value,this.roughness=hi.uniforms.roughness.value,this.metalness=hi.uniforms.metalness.value),this.runScene=r,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new i.Uniform(t.mirror),this.mixBlur=new i.Uniform(t.mixBlur),this.mixStrength=new i.Uniform(t.mixStrength),this.mixContrast=new i.Uniform(t.mixContrast)):(this.resolution=hi.uniforms.resolution.value,this.blurSize=hi.uniforms.blurSize.value,this.mirror=new i.Uniform(hi.uniforms.mirror.value),this.mixBlur=new i.Uniform(hi.uniforms.mixBlur.value),this.mixStrength=new i.Uniform(hi.uniforms.mixStrength.value),this.mixContrast=new i.Uniform(hi.uniforms.mixContrast.value)),this.textureMatrix=new i.Uniform(new i.Matrix4),this.reflectorWorldPosition=new i.Vector3,this.cameraWorldPosition=new i.Vector3,this.rotationMatrix=new i.Matrix4,this.normal=new i.Vector3,this.view=new i.Vector3,this.lookAtPosition=new i.Vector3,this.target=new i.Vector3,this.tempQuaternion=new i.Vector4,this.virtualCamera=new i.PerspectiveCamera,this.reflectorPlane=new i.Plane,this.clipPlane=new i.Vector4,e={minFilter:i.LinearFilter,magFilter:i.LinearFilter,type:i.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new i.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new i.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new i.Uniform(this.glRT1.texture),this.tDiffuseBlur=new i.Uniform(this.glRT2.texture),this.hBlurPass=new y(si),this.hBlurPass.uniforms.h.value=1/this.blurSize,this.hBlurPass.clear=!1,this.hBlurPass.renderToScreen=!1,this.hBlurPass.enabled=0<this.blurSize,this.hBlurPass.material.depthWrite=!1,this.vBlurPass=new y(li),this.vBlurPass.uniforms.v.value=1/this.blurSize,this.vBlurPass.clear=!1,this.vBlurPass.renderToScreen=!1,this.vBlurPass.enabled=0<this.blurSize,this.vBlurPass.material.depthWrite=!1}insertReflectorShader(){this.onBeforeCompile=e=>{var t;null!=(t=e.defines)&&t.USE_UV||(e.defines.USE_UV=""),null!=(t=e.defines)&&t.USE_BLUR||(e.defines.USE_BLUR=""),e.uniforms.tDiffuse=this.tDiffuse,e.uniforms.tDiffuseBlur=this.tDiffuseBlur,e.uniforms.textureMatrix=this.textureMatrix,e.uniforms.mirror=this.mirror,e.uniforms.mixBlur=this.mixBlur,e.uniforms.mixStrength=this.mixStrength,e.uniforms.mixContrast=this.mixContrast,e.vertexShader=hi.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",hi.vertexShader),e.fragmentShader=hi.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",hi.fragmentShader)}}setRTSize(e){this.glRT1.setSize(e,e),this.glRT2.setSize(e,e),this.hBlurPass.setSize(e,e),this.vBlurPass.setSize(e,e)}setBlurPass(e){this.hBlurPass.enabled=0<e,this.hBlurPass.enabled&&(this.hBlurPass.uniforms.h.value=1/e),this.vBlurPass.enabled=0<e,this.vBlurPass.enabled&&(this.vBlurPass.uniforms.v.value=1/e)}copy(e){return super.copy(e),this.resolution=e.resolution,this.blurSize=e.blurSize,this.mirror.value=e.mirror.value,this.mixBlur.value=e.mixBlur.value,this.mixStrength.value=e.mixStrength.value,this.mixContrast.value=e.mixContrast.value,this}swapBuffers(){var e=this.glRT1;this.glRT1=this.glRT2,this.glRT2=e}beforeRender(e){if(this.reflectorWorldPosition.setFromMatrixPosition(e.matrixWorld),this.cameraWorldPosition.setFromMatrixPosition(this.runScene.assetsEx.get().camera.matrixWorld),this.rotationMatrix.extractRotation(e.matrixWorld),this.normal.set(0,0,1),this.normal.applyMatrix4(this.rotationMatrix),this.reflectorWorldPosition.addScaledVector(this.normal,0),this.view.subVectors(this.reflectorWorldPosition,this.cameraWorldPosition),!(0<this.view.dot(this.normal))){this.view.reflect(this.normal).negate(),this.view.add(this.reflectorWorldPosition),this.rotationMatrix.extractRotation(this.runScene.assetsEx.get().camera.matrixWorld),this.lookAtPosition.set(0,0,-1),this.lookAtPosition.applyMatrix4(this.rotationMatrix),this.lookAtPosition.add(this.cameraWorldPosition),this.target.subVectors(this.reflectorWorldPosition,this.lookAtPosition),this.target.reflect(this.normal).negate(),this.target.add(this.reflectorWorldPosition),this.virtualCamera.position.copy(this.view),this.virtualCamera.up.set(0,1,0),this.virtualCamera.up.applyMatrix4(this.rotationMatrix),this.virtualCamera.up.reflect(this.normal),this.virtualCamera.lookAt(this.target),this.virtualCamera.far=this.runScene.assetsEx.get().camera.far,this.virtualCamera.updateMatrixWorld(),this.virtualCamera.projectionMatrix.copy(this.runScene.assetsEx.get().camera.projectionMatrix),this.textureMatrix.value.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.value.multiply(this.virtualCamera.projectionMatrix),this.textureMatrix.value.multiply(this.virtualCamera.matrixWorldInverse),this.textureMatrix.value.multiply(e.matrixWorld),this.reflectorPlane.setFromNormalAndCoplanarPoint(this.normal,this.reflectorWorldPosition),this.reflectorPlane.applyMatrix4(this.virtualCamera.matrixWorldInverse),this.clipPlane.set(this.reflectorPlane.normal.x,this.reflectorPlane.normal.y,this.reflectorPlane.normal.z,this.reflectorPlane.constant);const t=this.virtualCamera.projectionMatrix;this.tempQuaternion.x=(Math.sign(this.clipPlane.x)+t.elements[8])/t.elements[0],this.tempQuaternion.y=(Math.sign(this.clipPlane.y)+t.elements[9])/t.elements[5],this.tempQuaternion.z=-1,this.tempQuaternion.w=(1+t.elements[10])/t.elements[14],this.clipPlane.multiplyScalar(2/this.clipPlane.dot(this.tempQuaternion)),t.elements[2]=this.clipPlane.x,t.elements[6]=this.clipPlane.y,t.elements[10]=this.clipPlane.z+1,t.elements[14]=this.clipPlane.w}}update(e){e&&e.visible&&(this.beforeRender(e),e.visible=!1,this.runScene.assetsEx.get().renderer.setRenderTarget(this.glRT1),this.runScene.assetsEx.get().renderer.clear(),this.runScene.assetsEx.get().renderer.render(this.runScene.assetsEx.get().scene,this.virtualCamera),this.hBlurPass&&this.hBlurPass.enabled&&(this.hBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),this.vBlurPass&&this.vBlurPass.enabled&&(this.vBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),e.visible=!0,this.runScene.assetsEx.get().renderer.setRenderTarget(null))}}const hi={uniforms:{opacity:new i.Uniform(1),transparent:new i.Uniform(!1),roughness:new i.Uniform(1),metalness:new i.Uniform(.6),resolution:new i.Uniform(1024),blurSize:new i.Uniform(1024),mirror:new i.Uniform(0),mixBlur:new i.Uniform(10),mixStrength:new i.Uniform(2),mixContrast:new i.Uniform(1)},vertexParas:"\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n ",vertexShader:"\n #include <project_vertex>\n my_vUv = textureMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n ",fragmentParas:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float mirror;\n uniform float mixBlur;\n uniform float mixStrength;\n uniform float mixContrast;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n ",fragmentShader:"\n #include <emissivemap_fragment>\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n \n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n \n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n \n float blurFactor = 0.0;\n float depthFactor = 0.0001;\n \n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n #endif\n \n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n \n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n \n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n "};class pi{constructor(e){this.tools={type:"Fresnel",getTextures(e){const t=[];return e.envMap&&t.push({type:"envMap",texture:e.envMap}),t},parseData:e=>{const{textures:t,normal:r,material:n}=e,i=xi(n,new fi(void 0,void 0,this.runScene));return i.name=n.name,t.forEach((e=>{i[e.type]=e.texture})),Object.keys(r.uniforms).filter((e=>!pi.TextureNames.includes(e))).map((e=>{i[e]=r.uniforms[e]})),i.insertFresnelShader(),i.userData.tools=this.tools,i},toNormal:e=>{const t=xi(e,bi()),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),t.name=e.name,{}),n=di.uniforms;return Object.keys(n).filter((e=>!pi.TextureNames.includes(e))).map((t=>{var i=e[t],o=n[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t?i.value!==o&&(r[t]=i):i!==o&&(r[t]=i)})),t.userData.normal.uniforms=r,t},clone:(e,t)=>this.create(t)},this.runScene=e}create(e){console.log("Fresnel Create");const t=new fi(void 0,void 0,this.runScene);return t.insertFresnelShader(),t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name=e.name),t}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new ii({target:e,typeList:[...t],newVal:r}).execute())}}pi.TextureNames=["envMap"];class fi extends i.MeshPhysicalMaterial{constructor(e,t,r){if(e?super(e):(super(),this.emissive=new i.Color(65535),this.envMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=r,t?(this.fresnelBias=new i.Uniform(t.fresnelBias),this.fresnelScale=new i.Uniform(t.fresnelScale),this.fresnelPower=new i.Uniform(t.fresnelPower)):(this.fresnelBias=new i.Uniform(di.uniforms.fresnelBias.value),this.fresnelScale=new i.Uniform(di.uniforms.fresnelScale.value),this.fresnelPower=new i.Uniform(di.uniforms.fresnelPower.value)),!this.cubeCamera){const e=new i.WebGLCubeRenderTarget(2048);e.texture.mapping=i.CubeRefractionMapping,this.cubeCamera=new i.CubeCamera(.1,1e5,e),this.runScene.assetsEx.scene.add(this.cubeCamera),console.log("cubeCamera"),this.runScene.optionsEx.cb.render.add("Fresnel",(()=>{this.update()}))}}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vWorldPosition;/g,di.vertexParas),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,di.vertexShader),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,di.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,di.fragmentShaderEmissive)}}update(){this.cubeCamera&&(this.cubeCamera.position.copy(this.runScene.assetsEx.camera.position),this.cubeCamera.update(this.runScene.assetsEx.renderer,this.runScene.assetsEx.scene))}}const di={uniforms:{fresnelBias:new i.Uniform(0),fresnelScale:new i.Uniform(1),fresnelPower:new i.Uniform(3)},vertexParas:"\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader:"\n vWorldPosition = worldPosition.xyz;\n vWorldNormal = normalize(vec3(modelMatrix * vec4(normal, 0.0)));\n ",fragmentParas:"\n #include <transmission_pars_fragment>\n varying vec3 vWorldNormal;\n uniform float fresnelBias;\n uniform float fresnelScale;\n uniform float fresnelPower;\n ",fragmentShaderEmissive:"\n vec3 viewDir = normalize(cameraPosition - vWorldPosition);\n float fresnelNdot = dot(viewDir, vWorldNormal);\n float fresnelValue = fresnelBias + fresnelScale * pow(1.0 - fresnelNdot, fresnelPower);\n // fresnelValue = [0, 1], 0=center,1=edge\n \n vec3 totalEmissiveRadiance = emissive * fresnelValue;\n "},mi=class extends jn{constructor(e){super(),this.type="修改属性",this.cb=e=>{};var{target:e,info:t,oldVal:r,newVal:n,runScene:i,cb:o,executeCb:a}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,o&&(this.cb=o),a&&(this.executeCb=a)}_execute(e){var{target:t,info:r}=this;if(this.executeCb)return this.executeCb({target:t,info:r,val:e});this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(t=this.runScene.uniqueEx.model.parseName(this.target),this.runScene.optionsEx.cb.model.changeName.cb({model:this.target,name:e=t||e})):"material"===this.info?this.runScene.uniqueEx.material.addModel(this.target,e,e===this.newVal?this.oldVal:this.newVal):"visible"===this.info&&this.runScene.optionsEx.cb.model.setVisible.cb({model:this.target,visible:e}),this.cb(this.target)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal)}redo(){this._execute(this.newVal)}},vi={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,vertexColors:!0,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1},gi=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest"];class yi{constructor(e){this.defMaterialMap={BaseMaterial:ti,SpriteMaterial:Si,FakeInterior:oi,Reflector:ui,Fresnel:pi},this.defMaterial=bi(),this.addCb=e=>{this.runScene.optionsEx.cb.material.add.cb(e)},this.runScene=e,this.runScene.optionsEx.cb.unique.material.add.add("engine-material-add",(e=>{"SpriteMaterial"!==e.type&&this.addCb(e)})),this.defMaterialMap={BaseMaterial:ti,SpriteMaterial:Si,FakeInterior:new oi(e),Reflector:new ui(e),Fresnel:new pi(e)}}add(e,t,r){this.runScene.uniqueEx.material.add(e,t,r)}create(){var e=new i.MeshStandardMaterial;return this.add(e),e}clone(e){const t=e.clone();return t.userData.id=(0,ei.getId)(),t}setNormal(e,t=!0){return e=new Un(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTexture(e,t=!0){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var{info:r,newVal:n}=e,n=(n instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(n)),"envMap"===r&&this.runScene.textureEx.toThree(e.newVal),new Un(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute());return t&&this.runScene.undoEx.addUndo(n),e.newVal}))}resetMaterial(e,t,r=!0){var n;e&&t&&e.material&&(n=new mi({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:e.material}).execute(),this.runScene.modelEx.select===e&&this.runScene.optionsEx.cb.setSelectMaterial.cb(t),r&&this.runScene.undoEx.addUndo(n))}getBase(e){const t=this.defMaterialMap[e];if(("SpriteMaterial"!==e||"Sprite"===(null==(e=this.runScene.modelEx.select)?void 0:e.type))&&t)return t.create()}toNromal(e){var t;const r=(null==(t=e.userData.tools)?void 0:t.toNormal(e))||e.clone();return r.userData=Object.assign(Object.assign({},r.userData),e.userData),r}setSelect(e){this.runScene.optionsEx.cb.setSelectMaterial.cb(e)}getDataByType(e,t){return this.defMaterialMap[e].tools.parseData(t)}dispose(){this.defMaterialMap.Reflector.dispose(),this.runScene.optionsEx.cb.material.dispose.cb("")}remove(e){}getDefNromals(e){var t;if(null!=(t=null==(t=e.userData)?void 0:t.tools)&&t.type)return{};const r={};return(0,ue.js)(vi,((t,n)=>{const i=e[t];if("object"==typeof i)for(const e in i)if(i[e]!==n[e])return void(r[t]=i.clone());i!==n&&(r[t]=i)})),r}parseNromals(e,t){(0,ue.js)(e,((e,r)=>{var n,i,o,a,s;void 0!==vi[e]&&("object"==typeof r?(({x:o,y:a,z:s}=r),null!=(i=null==(n=t[e])?void 0:n.set)&&i.call(n,o,a,s)):t[e]=r)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&!e.userData.isTimeLineUsed&&ti.isDefval(e)}}const bi=()=>{const e=new i.MeshStandardMaterial;return e.userData.id=(0,ei.getId)(),e},xi=(e,t)=>(gi.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),wi=e=>{var t=e.userData.textures||In.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture));return delete e.userData.textures,t};class Si{static create(){const e=new i.SpriteMaterial;return e.userData.tools=this.tools,e}}Si.modelTools={merge(e,t){t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.renderOrder=e.renderOrder,t.castShadow=e.castShadow,t.receiveShadow=e.receiveShadow,1===e.layers.mask?t.layers.set(0):t.layers.enable(1)},toNormal:e=>{const t=Ri("Box");return t.userData.normal={type:"MySpriteMaterial"},Si.modelTools.merge(e,t),t},parseData:(e,t)=>{const r=Ri("Sprite");return Si.modelTools.merge(e,r),r.material=e.material,r}},Si.tools={type:"SpriteMaterial",getTextures:function(e){return["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e))},parseData:function(e){const{textures:t,material:r}=e,n=xi(r,Si.create());return t.map((e=>{var{type:e,texture:t}=e;n[e]=t})),n},toNormal:e=>{const t=xi(e,bi());return t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:Si.tools.type},textures:Si.tools.getTextures(e)}),t},clone:function(e,t){return e}};class Ti{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:r,addTree:n,isClone:i,runScene:o}=e;this.runScene=o,this.model=e,this.parent=t,!1===n&&(this.addTree=n),!0===i&&(this.isClone=i),r&&(this.cb=r)}remove(e){const{model:t,parent:r,addTree:n,runScene:i}=e;i.modelEx.select===t&&i.modelEx.selectNull(),r.remove(t),n&&i.uniqueEx.model.remove(t),n&&i.optionsEx.cb.model.remove.cb({model:t,parent:r}),this.cb(t,"remove"),i.uniqueEx.material.addModel(t,void 0,t.material)}add(e){const{model:t,parent:r,addTree:n,isClone:i,runScene:o}=e;r.add(t),n&&o.uniqueEx.model.add(t),n&&o.optionsEx.cb.model.add.cb({model:t,parent:r,isClone:i}),this.cb(t,"add"),o.uniqueEx.material.addModel(t,t.material)}}class _i extends Ti{constructor(e){super(e),this.type="添加模型"}_execute(e){return Promise.reject()}undo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}redo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}execute(){return this.redo(),this}}const Mi=class extends jn{constructor(e){super(),this.type="修改父元素",this.runScene=e.runScene,this.oldParent=e.oldParent,this.newParent=e.newParent,this.target=e.target}execute(){return this.redo(),this}_execute(e){e.attach(this.target),this.runScene.optionsEx.cb.model.setParent.cb({model:this.target,parent:e})}undo(){this._execute(this.oldParent)}redo(){this._execute(this.newParent)}};class Ei extends Ti{constructor(e){super(e),this.type="移除模型"}undo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}redo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}_execute(e){return Promise.reject()}execute(){return this.redo(),this}}const Pi=class extends jn{constructor(e){super(),this.type="三维矩阵修改";var{target:e,info:t,newV3:r,oldV3:n,runScene:i}=e;this.target=e,this.info=t,this.runScene=i,this.newV3=r,this.oldV3=n,this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.optionsEx.cb.model.setSelect.cb(null),this.runScene.optionsEx.cb.model.setSelect.cb(this.target))}_execute(e){console.log(e,"data"),this.target[this.info].copy(e),this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&this.runScene.helperEx.focus(this.target)}execute(){return this.redo(),this}undo(){this._execute(this.oldV3)}redo(){console.log(1,"1"),this._execute(this.newV3)}};class ki{constructor(e){this._selectModel=void 0,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.deepIsVisible=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&this.deepIsVisible(e.parent),this.runScene=e}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}add(e,t,r=!0,n=!1,i=!0){if(e instanceof Array)return e.map((e=>this.add(e,t,r,n,i)));n&&(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.optionsEx.cb.model.clone.cb(e));var o=new _i({model:e,parent:t||this.runScene.sceneEx.get(),isClone:n,runScene:this.runScene}).execute();!0===r&&this.runScene.undoEx.addUndo(o),i&&this.setSelectByModel(e,{isDomTreeActive:!1,isClone:n})}setSelectByModel(e,t){var r,{isDomTreeActive:t,isClone:n}=t||{};if(this.runScene.events.key.shift&&this._selectModel)return(r=this.getBeTweenChildByTwoModel(this._selectModel,e))?void this.runScene.multipSelector.add([...r,e],!0):void 0;if(this.runScene.events.key.ctrl&&!n)this.runScene.multipSelector.add(e);else{if(this.runScene.multipSelector.isEmpty()||this.runScene.multipSelector.setEmpty(),this._selectModel){if(this._selectModel===e)return void(this.runScene.helperEx.focusModelId||this.runScene.helperEx.focus(e));this.runScene.lightEx.setNull(this._selectModel),this.runScene.optionsEx.cb.model.unFocus.cb(this._selectModel)}e&&(e.isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)),this.runScene.optionsEx.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.optionsEx.cb.model.setSelect.cb(e),this._selectModel=e)}}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){if(e instanceof Array)return e.map((e=>this.remove(e)));e=new Ei({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute(),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t=0){var{x:e,y:r,z:n}=e;return e+r+n===t}isNavieV2(e,t=0){var{x:e,y:r}=e;return e===t&&r===t}isUnless(e){return!e.material&&this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&0===e.children.length}isUnlessLevel(e){return this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&1===e.children.length}create(){return Kn().model.getModelByType("Box")}clone(e){if(!this.runScene.lightEx.isLight(e)){let n=e.clone();n.userData.cloneId=e.userData.id;var t,r=null==e?void 0:e.material;return null!=(t=null==r?void 0:r.userData)&&t.tools&&(t=null==(t=r.userData.tools)?void 0:t.clone(r,n))&&t.uuid!==r.uuid&&(this.runScene.materialEx.resetMaterial(n,t,!0),this.runScene.materialEx.add(t,e,r)),this.runScene.uniqueEx.model.add(n,{reset:!0}),n}this.runScene.lightEx.clone(e)}getLevel(e,t=0){return e.parent&&"Scene"!==e.parent.type?this.getLevel(e.parent,++t):t}selectNull(){var e=this._selectModel;e&&(this.runScene.optionsEx.cb.model.unFocus.cb(e),this.runScene.materialEx.setSelect(null),this.runScene.lightEx.setNull(e)),this._selectModel=void 0,this.runScene.optionsEx.cb.model.setSelect.cb(null),this.runScene.helperEx.unfocus()}cloneV3(e){return e.clone()}setParent(e,t,r=!0){if(t=new Mi({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!r)return t;this.runScene.undoEx.addUndo(t)}setV3(e,t=!0,r=!0){var{model:e,info:n,newV3:i,oldV3:o}=e;const a=new Pi({target:e,info:n,oldV3:o,newV3:i,runScene:this.runScene});r&&a.execute(),t&&this.runScene.undoEx.addUndo(a)}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new mi({target:e,info:r,runScene:this.runScene,oldVal:e[r],newVal:n}).execute(),t&&this.runScene.undoEx.addUndo(e)}setMaterial(e,t,r=!0){var n=new mi({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t}).execute();this.select===e&&this.runScene.optionsEx.cb.setSelectMaterial.cb(t),e.material.needsUpdate=!0,r&&this.runScene.undoEx.addUndo(n)}addDef(e){this.add(Ri(e))}isModel(e){return!(e.isLight||e.isCamera)}getSphere(){var e=new i.MeshBasicMaterial,t=new i.SphereGeometry(.7,150,150);return new i.Mesh(t,e)}getIndexByModel(e){var t;return e.parent?null==(t=e.parent)?void 0:t.children.findIndex((t=>t===e)):-1}getBeTweenChildByTwoModel(e,t){if(e.parent.uuid===t.parent.uuid){var r=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==r&&-1!==t){const n=Math.max(r,t),i=r===n?t:r;return e.parent.children.map(((e,t)=>t>i&&t<n&&e)).filter((e=>e))}}}setMultip(e){var{model:e,typeList:t,newVal:r}=e;this.runScene.undoEx.addUndo(new ii({target:e,typeList:t,newVal:r}).execute())}createGroup(e,t,r){const n=t||new i.Group,o=[];o.push(new _i({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?o.push(...e.map((e=>new Mi({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):o.push(new Mi({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()),r&&this.runScene.optionsEx.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.optionsEx.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.optionsEx.cb.model.setMainStatue.cb({status:!0,model:n}),this.runScene.undoEx.addUndo(o),this.setSelectByModel(n)}cleanGroup(e,t=!0){if(e instanceof Array){const t=(0,Jn.multiArrToArr)(e.map((e=>(this.runScene.optionsEx.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.optionsEx.cb.model.unFocus.cb(e),0!==e.children.length){const r=[],n=e.children.map((e=>{if(e.parent.parent)return new Mi({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return r.push(...n.map((e=>e.execute()))),r.push(new Ei({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(r),r}}hideOther(e){const t=e.uuid,r=0<e.children.length,n=this.runScene.sceneEx.getClearModels(),i=[];n.map((n=>{n.traverse((n=>{r?!1===Kn().model.deepFindParentByUuid(n,t)&&n.uuid!==e.uuid&&i.push(n):n.uuid!==e.uuid&&i.push(n)}))}));var o=i.map((e=>new mi({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(o),Kn().model.setParentVisible(e,!0)}showAll(){const e=this.runScene.sceneEx.getClearModels(),t=[];e.map((e=>{e.traverse((e=>{"materialHelper"!==e.name&&!1===e.visible&&t.push(e)}))}));var r=t.map((e=>new mi({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(r)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,r=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{r.push(new Ei({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(r)}}const Ri=e=>{if($n.includes(e)){const t=Kn().model.getModelByType(e);return"Sprite"===t.type&&(t.material.userData.tools=Si.tools),t}throw TypeError("")};class Oi{constructor(){this.optionsConfigs={}}getParse(e){return this.optionsConfigs[e]}addOption(e){var t=e.type;if(this.optionsConfigs[t])throw TypeError("该配置项已被挂载");this.optionsConfigs[t]=e}getOptions(e){return Object.values(this.optionsConfigs).map((t=>{const{process:r,type:n}=t;return{type:n,data:r(e)}}))}}class Ci{constructor(e){this.JsonMaterialMap={},this.materialMap={},this.textureMap={},this.runScene=e}setMaterialMap(e){var{materialMap:e,textureMap:t}=e;this.materialMap=e,this.textureMap=t}parseMaterial(e){const{material:t,materialDef:r}=e;r.id=t.userData.id,this.parseNormal(t)}parseNormal(e){this.materialMap[e.userData.id]||(this.materialMap[e.userData.id]={normal:{},textures:{}}),this.materialMap[e.userData.id].normal=Object.assign(Object.assign({},this.materialMap[e.userData.id].normal),this.runScene.materialEx.getDefNromals(e))}setMaterialDef(e){const{type:t,data:r,normal:n}=e;n[t]=r}processTexture(e){const{texture:t,textureDef:r}=e;r.md5=t.userData.md5,r.id=t.userData.id}done(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var{textureMap:t,materialMap:r}=this;e.asset.ex=Object.assign(Object.assign({},e.asset.ex),{textureMap:t,materialMap:r})}))}}class Li{constructor(e){this.runScene=e}init(){}done(e){var t=this.runScene.sceneEx.get();e.asset.ex=Object.assign(Object.assign({},e.asset.ex),{lights:this.getLights(),camera:this.getCamera(),sceneEx:this.getSceneEx(t),timeLine:this.runScene.timeLineEx.getSavedData(),controls:this.getControls(),options:this.runScene.exporter.gltf.options.getOptions(t)})}getSceneEx(e){const t=Object.assign({},e.userData.ex);return e.fog&&(t.fog=this.runScene.sceneEx.getFogJson(e.fog)),e.background instanceof i.Color&&(t.backgroundColor=e.background.getHexString()),t}getLights(){return this.runScene.lightEx.getLightsByScene().map((e=>{var t=e.type;return this.runScene.lightEx.lightExMap[t].toJSON(e)}))}getCamera(){return this.runScene.cameraEx.get().toJSON()}getControls(){return this.runScene.assetsEx.controls.target}}class Ai{constructor(e,t){this.helperModels=[],this.runScene=t,this.type=e,this.material=new Ci(t),this.scene=new Li(t)}init(){this.scene.init()}parseNode(e){const{object:t,nodeDef:r}=e;(0,ue.js)(this.runScene.modelEx.defNodeMap,((e,n)=>{t[e]!==n&&(r[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,r.wireframe=!0)}parseSprite(){}done(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){e.asset.ex||(e.asset.ex={type:this.type}),console.log(e,"json"),"scene"===this.type&&(yield this.scene.done(e)),yield this.material.done(e)}))}}var Di=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};class Ii{constructor(e,t){this.materialMap={},this.textureMap={},this.json={materialMap:{},textureMap:{}},this.modelType={Sprite:Si},this.type=e,this.runScene=t}parse(e){return Di(this,void 0,void 0,(function*(){const t=new i.Group;return t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),"scene"===this.type&&this.parseScene(t),this.parseMaterial(e),yield Promise.all(this.materialMapToJson()),this.setMultipMaterial(t,Object.keys(this.textureMap)),this.json}))}parseScene(e){const t=this.runScene.sceneEx.get();if(t.background instanceof i.Texture||t.environment instanceof i.Texture){this.runScene.bloom.glow.setUpdate(!1),t.userData.ex={};var{background:r,environment:n}=t;this.runScene.bloom.glow.setUpdate(!0);const o=this.runScene.modelEx.create(),a=bi();o.material=a,e.add(o),e=(0,ei.getId)(),t.userData.ex.materialId=e,a.userData.id=e,this.materialMap[e]={material:a},r instanceof i.Texture&&303===(a.map=r).mapping&&(t.userData.ex.backgroundMapping=303),n instanceof i.Texture&&(a.envMap=n)}}_processMaterial(e){if(e.material){var t=this.runScene.materialEx.isBaseMaterial(e.material),r=this.materialMap[e.material.userData.id];return r?(r.normalMaterial&&(e.material=r.normalMaterial),void(null!=(r=r.models)&&r.push(e))):(console.log(e.material.userData.id,"material.userData.id"),r=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.runScene.materialEx.defMaterial:this.runScene.materialEx.toNromal(e.material),e.material=r,console.log(r.userData.id,"material.userData.id"),this.materialMap[r.userData.id]={material:r,normalMaterial:r,models:[e]},r)}}compressLocal(e){var{x:t,y:r,z:n}=e.position;0===t&&0===r&&0===n||(e.position.set(0,0,0),e.userData.local=t+","+r+","+n)}_processModel(e,t){const r=this.modelType[e.type];if(!r)return e;const n=r.modelTools.toNormal(e);return t&&(n.material=t),e.parent.add(n),e.parent.remove(e),n}parseMaterial(e){const t=new Set;e.traverse((e=>t.add(e))),t.forEach((e=>{var t=this._processMaterial(e);e=this._processModel(e,t),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(e)}))}materialMapToJson(){return(0,ue.js)(this.materialMap,((e,t)=>Di(this,void 0,void 0,(function*(){var e=t.material,r=wi(e);return this.json.materialMap[e.userData.id]={normal:e.userData.normal||{},textures:{}},this.mergeAndRemoveTexture(r,e)}))))}mergeSame(e){var t=e.userData;for(const i in this.textureMap){var{md5:r,texture:n}=this.textureMap[i];if(t.md5===r&&e.mapping===n.mapping)return{isSame:!0,texture:n}}return this.textureMap[e.userData.id]=Object.assign(Object.assign({},t),{texture:e}),{isSame:!1,texture:e}}mergeAndRemoveTexture(e,t){return Di(this,void 0,void 0,(function*(){return e.map((e=>{const{type:r,texture:n}=e;this.runScene.uniqueEx.texture.add(n),t[r]=null;var{isSame:e,texture:i}=this.mergeSame(n);if(e)this.runScene.textureEx.dispose(n);else if(!this.json.textureMap[n.userData.id]){var o,{format:a,repeat:s,center:l,rotation:u,offset:c}=n;const e={format:a};this.runScene.modelEx.isNavieV2(s,1)||(({x:a,y:o}=s),e.repeat=a===o?a:s),this.runScene.modelEx.isNavieV2(l,0)||(({x:o,y:a}=l),e.center=o===a?o:l),this.runScene.modelEx.isNavieV2(c,0)||(({x:s,y:a}=c),e.offset=s===a?s:c),0!==u&&(e.rotation=u),this.json.textureMap[n.userData.id]=e}"normalMap"!==r||n.userData.isNormalMap||(n.userData.isNormalMap=!0),this.json.materialMap[t.userData.id].textures[r]=i.userData.id}))}))}setMultipMaterial(e,t){const r=this.runScene.modelEx.create(),n=bi();r.material=n,e.add(r);for(const e of Dn){if(!t.length)return;var i=t.pop();if(!i)return;n[e]=this.textureMap[i].texture}t.length&&this.setMultipMaterial(e,t)}}function ji(){ji=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(f="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=f.asyncIterator||"@@asyncIterator",o=f.toStringTag||"@@toStringTag";function a(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(t){a=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i,o,a,s;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(i=e,o=r,a=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,u):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}(r,a),r)){if(r===u)continue;return r}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);if(s="executing","normal"===(r=l(i,o,a)).type){if(s=a.done?"completed":"suspendedYield",r.arg===u)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s="completed",a.method="throw",a.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function c(){}function h(){}function p(){}var f,d,m=(a(f={},n,(function(){return this})),(d=(d=Object.getPrototypeOf)&&d(d(w([]))))&&d!==t&&r.call(d,n)&&(f=d),p.prototype=c.prototype=Object.create(f));function v(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var n;this._invoke=function(i,o){function a(){return new t((function(n,a){!function n(i,o,a,s){var u;if("throw"!==(i=l(e[i],e,o)).type)return(o=(u=i.arg).value)&&"object"==Bi(o)&&r.call(o,"__await")?t.resolve(o.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(o).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,s)}));s(i.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function w(e){if(e){var t,i=e[n];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=i}return{next:S}}function S(){return{value:void 0,done:!0}}return a(m,"constructor",h.prototype=p),a(p,"constructor",h),h.displayName=a(p,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},v(g.prototype),a(g.prototype,i,(function(){return this})),e.AsyncIterator=g,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new g(s(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},v(m),a(m,o,"Generator"),a(m,n,(function(){return this})),a(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}var a=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),b(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,b(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function Ui(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function Bi(e){return(Bi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ni(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fi(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function zi(e,t,r){t&&Fi(e.prototype,t),r&&Fi(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var Vi=function(){function e(){Ni(this,e),this.pluginCallbacks=[],this.register((function(e){return new to(e)})),this.register((function(e){return new ro(e)})),this.register((function(e){return new no(e)})),this.register((function(e){return new oo(e)})),this.register((function(e){return new ao(e)})),this.register((function(e){return new io(e)}))}return zi(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){"object"===Bi(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new eo,o=[],a=0,s=this.pluginCallbacks.length;a<s;a++)o.push(this.pluginCallbacks[a](i));i.setPlugins(o),i.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,n,i,t)}))}}]),e}(),Hi=5121,Gi=5123,Wi=(t=9728,9729),Xi=9984,qi=9986,Yi={},Zi=(Yi[i.NearestFilter]=t,Yi[i.NearestMipmapNearestFilter]=Xi,Yi[i.NearestMipmapLinearFilter]=qi,Yi[i.LinearFilter]=Wi,Yi[i.LinearMipmapNearestFilter]=9985,Yi[i.LinearMipmapLinearFilter]=9987,Yi[i.ClampToEdgeWrapping]=33071,Yi[i.RepeatWrapping]=10497,Yi[i.MirroredRepeatWrapping]=33648,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function Qi(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Ki(e){return 4*Math.ceil(e/4)}function Ji(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Ki(e.byteLength);if(n===e.byteLength)return e;var i=new Uint8Array(n);if(i.set(new Uint8Array(e)),0!==r)for(var o=e.byteLength;o<n;o++)i[o]=r;return i.buffer}var $i=null,eo=function(){function e(){Ni(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,r;return zi(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=ji().mark((function e(t,r,n){var i,o,a,s,l,u,c;return ji().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=5,Promise.all(this.pending);case 5:return o=(i=this).buffers,a=i.json,n=i.options,e.next=11,i.options.myOptions.helper.done(a);case 11:l=i.extensionsUsed,s=new Blob(o,{type:"application/octet-stream"}),0<(l=Object.keys(l)).length&&(a.extensionsUsed=l),a.buffers&&0<a.buffers.length&&(a.buffers[0].byteLength=s.size),!0===n.binary?((u=new window.FileReader).readAsArrayBuffer(s),u.onloadend=function(){var e=Ji(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Ji(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;for(var t=new Uint8Array(new ArrayBuffer(e.length)),r=0,n=e.length;r<n;r++){var i=e.charCodeAt(r);t[r]=255<i?32:i}return t.buffer}(JSON.stringify(a)),32)),i=new DataView(new ArrayBuffer(8)),o=(i.setUint32(0,n.byteLength,!0),i.setUint32(4,1313821514,!0),new ArrayBuffer(12)),s=((l=new DataView(o)).setUint32(0,1179937895,!0),l.setUint32(4,2,!0),12+i.byteLength+n.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,s,!0),new Blob([o,i,n,t,e],{type:"application/octet-stream"})),c=new window.FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){r(c.result)}}):a.buffers&&0<a.buffers.length?((c=new window.FileReader).readAsDataURL(s),c.onloadend=function(){var e=c.result;a.buffers[0].uri=e,r(a)}):r(a);case 17:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(e){Ui(o,n,i,a,s,"next",e)}function s(e){Ui(o,n,i,a,s,"throw",e)}a(void 0)}))},function(e,t,n){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&i.gltfExtensions){for(var o in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[o]=i.gltfExtensions[o],n[o]=!0;delete i.gltfExtensions}0<Object.keys(i).length&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new i.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),n=new i.Vector3,o=0,a=r.count;o<a;o++)n.fromBufferAttribute(r,o),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(o,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildORMTexture",value:function(e){var t=null==(t=e.aoMap)?void 0:t.image,r=null==(r=e.roughnessMap)?void 0:r.image,n=null==(n=e.metalnessMap)?void 0:n.image;if(t===r&&r===n)return e.aoMap;if(t||r||n){e=Math.max((null==t?void 0:t.width)||0,(null==r?void 0:r.width)||0,(null==n?void 0:n.width)||0);var o=Math.max((null==t?void 0:t.height)||0,(null==r?void 0:r.height)||0,(null==n?void 0:n.height)||0),a=document.createElement("canvas"),s=(a.width=e,a.height=o,a.getContext("2d")),l=(s.fillStyle="#ffffff",s.fillRect(0,0,e,o),s.getImageData(0,0,e,o));if(t){s.drawImage(t,0,0,e,o);for(var u=s.getImageData(0,0,e,o).data,c=0;c<u.length;c+=4)l.data[c]=u[c]}if(r){s.drawImage(r,0,0,e,o);for(var h=s.getImageData(0,0,e,o).data,p=1;p<h.length;p+=4)l.data[p]=h[p]}if(n){s.drawImage(n,0,0,e,o);for(var f=s.getImageData(0,0,e,o).data,d=2;d<f.length;d+=4)l.data[d]=f[d]}return s.putImageData(l,0,0),new i.Texture(a)}}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,i){for(var o,a=this.json,s=(a.bufferViews||(a.bufferViews=[]),o=t===Hi?1:t===Gi?2:4,Ki(n*e.itemSize*o)),l=new DataView(new ArrayBuffer(s)),u=0,c=r;c<r+n;c++)for(var h=0;h<e.itemSize;h++){var p=void 0;4<e.itemSize?p=e.array[c*e.itemSize+h]:0===h?p=e.getX(c):1===h?p=e.getY(c):2===h?p=e.getZ(c):3===h&&(p=e.getW(c)),5126===t?l.setFloat32(u,p,!0):5125===t?l.setUint32(u,p,!0):t===Gi?l.setUint16(u,p,!0):t===Hi&&l.setUint8(u,p),u+=o}var f={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:s};return void 0!==i&&(f.target=i),34962===i&&(f.byteStride=e.itemSize*o),this.byteOffset+=s,a.bufferViews.push(f),{id:a.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n,i){var o=new window.FileReader;if(!(e instanceof Blob))return i();o.readAsArrayBuffer(e),o.onloadend=function(){var e=Ji(o.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var i,o=this.options,a=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Uint16Array)i=Gi;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=Hi}if(void 0===r&&(r=0),void 0===n&&(n=e.count),o.truncateDrawRange&&void 0!==t&&null===t.index&&(o=r+n,l=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count,r=Math.max(r,t.drawRange.start),(n=Math.min(o,l)-r)<0&&(n=0)),0===n)return null;o=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+r;i++)for(var o=0;o<e.itemSize;o++){var a=void 0;4<e.itemSize?a=e.array[i*e.itemSize+o]:0===o?a=e.getX(i):1===o?a=e.getY(i):2===o?a=e.getZ(i):3===o&&(a=e.getW(i)),n.min[o]=Math.min(n.min[o],a),n.max[o]=Math.max(n.max[o],a)}return n}(e,r,n);var s,l=(void 0!==t&&(s=e===t.index?34963:34962),this.processBufferView(e,i,r,n,s));return t={bufferView:l.id,byteOffset:l.byteOffset,componentType:i,count:n,max:o.max,min:o.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),a.accessors||(a.accessors=[]),a.accessors.push(t)-1}},{key:"processImage",value:function(e,t,r,n){var o,a=this,s=a.cache,l=a.json,u=a.options,c=a.pending,h=(s.images.has(e)||s.images.set(e,{}),s=s.images.get(e),null==(h=n.userData)?void 0:h.blob),p=n.userData.isNormalMap,f=(o=a.options.myOptions.optionsEx.exporterOptions.compressTexture)?"image/webp":"image/png";if(void 0!==s[(o&&(h=!!p),o=f+":flipY/"+r.toString())])return s[o];l.images||(l.images=[]);var d={mimeType:f};if(!0===u.binary&&h)c.push(new Promise((function(e){a.processBufferViewImage(n.userData.blob).then((function(t){d.bufferView=t,e()}))})));else if(u.embedImages){var m=$i=$i||document.createElement("canvas");if((m.width=Math.min(e.width,u.maxTextureSize),m.height=Math.min(e.height,u.maxTextureSize),p=m.getContext("2d")).translate(0,m.height),p.scale(1,-1),"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)p.drawImage(e,0,0,m.width,m.height);else{t!==i.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>u.maxTextureSize||e.height>u.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var v=new Uint8ClampedArray(e.height*e.width*4),g=0;g<v.length;g+=4)v[g+0]=e.data[g+0],v[g+1]=e.data[g+1],v[g+2]=e.data[g+2],v[g+3]=e.data[g+3];p.putImageData(new ImageData(v,e.width,e.height),0,0)}!0===u.binary?c.push(new Promise((function(e){m.toBlob((function(t){a.processBufferViewImage(t).then((function(t){d.bufferView=t,e()}))}),f)}))):d.uri=m.toDataURL(f)}else d.uri=e.src;return r=l.images.push(d)-1,s[o]=r}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Yi[e.magFilter],minFilter:Yi[e.minFilter],wrapS:Yi[e.wrapS],wrapT:Yi[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e)};return e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r=r.textures.push(n)-1,t.textures.set(e,r),this.options.myOptions.helper.material.processTexture({texture:e,textureDef:n}),r}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n,o={pbrMetallicRoughness:{}},a=(Qi((this.options.myOptions.helper.material.parseMaterial({material:e,materialDef:o,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),a=e.color.toArray().concat([e.opacity])),[1,1,1,1])||(o.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(o.pbrMetallicRoughness.metallicFactor=e.metalness,o.pbrMetallicRoughness.roughnessFactor=e.roughness):(o.pbrMetallicRoughness.metallicFactor=.5,o.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a={index:this.processTexture(null)},this.applyTextureTransform(a,e.metalnessMap||e.roughnessMap),o.pbrMetallicRoughness.metallicRoughnessTexture=a),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),o.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(n=Math.max(a.r,a.g,a.b))&&(a.multiplyScalar(1/n),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<n&&(o.emissiveFactor=a.toArray()),e.emissiveMap&&(n={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(n,e.emissiveMap),o.emissiveTexture=n)),e.normalMap&&(a={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),o.normalTexture=a),e.aoMap&&(n={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(n.strength=e.aoMapIntensity),this.applyTextureTransform(n,e.aoMap),o.occlusionTexture=n),e.transparent?o.alphaMode="BLEND":0<e.alphaTest&&(o.alphaMode="MASK",o.alphaCutoff=e.alphaTest),e.side===i.DoubleSide&&(o.doubleSided=!0),""!==e.name&&(o.name=e.name),this.serializeUserData(e,o),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,o)})),r.materials.push(o)-1);return t.materials.set(e,a),a}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var o=0,a=e.material.length;o<a;o++)n.push(e.material[o].uuid);else n.push(e.material.uuid);var s=n.join(":");if(t.meshes.has(s))return t.meshes.get(s);var l=e.geometry,u=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4;if(!0!==l.isBufferGeometry)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var c,h,p,f={},d={},m=[],v=[],g={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},y=l.getAttribute("normal"),b=(void 0===y||this.isNormalizedNormalAttribute(y)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(y))),null);for(h in l.attributes)"morph"!==h.slice(0,5)&&(c=l.attributes[h],h=g[h]||h.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(h)||(h="_"+h),t.attributes.has(this.getUID(c))?d[h]=t.attributes.get(this.getUID(c)):(b=null,p=c.array,"JOINTS_0"!==h||p instanceof Uint16Array||p instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new i.BufferAttribute(new Uint16Array(p),c.itemSize,c.normalized)),null!==(p=this.processAccessor(b||c,l))&&(d[h]=p,t.attributes.set(this.getUID(c),p))));if(void 0!==y&&l.setAttribute("normal",y),0===Object.keys(d).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var T in e.morphTargetDictionary)S[e.morphTargetDictionary[T]]=T;for(var _=0;_<e.morphTargetInfluences.length;++_){var M,E={},P=!1;for(M in l.morphAttributes)if("position"!==M&&"normal"!==M)P||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),P=!0);else{var k=l.morphAttributes[M][_],R=M.toUpperCase(),O=l.attributes[M];if(t.attributes.has(this.getUID(k)))E[R]=t.attributes.get(this.getUID(k));else{var C=k.clone();if(!l.morphTargetsRelative)for(var L=0,A=k.count;L<A;L++)C.setXYZ(L,k.getX(L)-O.getX(L),k.getY(L)-O.getY(L),k.getZ(L)-O.getZ(L));E[R]=this.processAccessor(C,l),t.attributes.set(this.getUID(O),E[R])}}v.push(E),x.push(e.morphTargetInfluences[_]),void 0!==e.morphTargetDictionary&&w.push(S[_])}f.weights=x,0<w.length&&(f.extras={},f.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===l.groups.length)return null;for(var D=y?e.material:[e.material],I=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],j=0,U=I.length;j<U;j++){var B={mode:u,attributes:d},N=(this.serializeUserData(l,B),0<v.length&&(B.targets=v),null!==l.index&&(N=this.getUID(l.index),void 0===I[j].start&&void 0===I[j].count||(N+=":"+I[j].start+":"+I[j].count),t.attributes.has(N)?B.indices=t.attributes.get(N):(B.indices=this.processAccessor(l.index,l,I[j].start,I[j].count),t.attributes.set(N,B.indices)),null===B.indices&&delete B.indices),this.processMaterial(D[I[j].materialIndex]));null!==N&&(B.material=N),m.push(B)}return f.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,f)})),y=r.meshes.push(f)-1,t.meshes.set(s,y),y}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:i.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,o=(r.animations||(r.animations=[]),(e=Vi.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),a=[],s=[],l=0;l<o.length;++l){var u=o[l],c=i.PropertyBinding.parseTrackName(u.name),h=i.PropertyBinding.findNode(t,c.nodeName),p=Zi[c.propertyName];if(!(h="bones"===c.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(c.objectIndex):void 0:h)||!p)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name),null;c=u.values.length/u.times.length;var f=void(p===Zi.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(f="CUBICSPLINE",c/=3):f=u.getInterpolation()===i.InterpolateDiscrete?"STEP":"LINEAR",s.push({input:this.processAccessor(new i.BufferAttribute(u.times,1)),output:this.processAccessor(new i.BufferAttribute(u.values,c)),interpolation:f}),a.push({sampler:s.length-1,target:{node:n.get(h),path:p}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:s,channels:a}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],o=e.skeleton;if(void 0===o)return null;var a=e.skeleton.bones[0];if(void 0===a)return null;for(var s=[],l=new Float32Array(16*o.bones.length),u=new i.Matrix4,c=0;c<o.bones.length;++c)s.push(r.get(o.bones[c])),u.copy(o.boneInverses[c]),u.multiply(e.bindMatrix).toArray(l,16*c);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new i.BufferAttribute(l,16)),joints:s,skeleton:r.get(a)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,i=this.options,o=this.nodeMap,a=(n.nodes||(n.nodes=[]),{});if(i.myOptions.helper.parseNode({object:e,nodeDef:a,options:this}),i.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),Qi(r,[0,0,0,1])||(a.rotation=r),Qi(h,[0,0,0])||(a.translation=h),Qi(t,[1,1,1])||(a.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Qi(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(a.matrix=e.matrix.elements)),""!==e.name&&(a.name=String(e.name)),this.serializeUserData(e,a),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(a.mesh=r):e.isCamera&&(a.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var s=[],l=0,u=e.children.length;l<u;l++){var c=e.children[l];!c.visible&&!1!==i.onlyVisible||null!==(c=this.processNode(c))&&s.push(c)}0<s.length&&(a.children=s)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,a)}));var h=n.nodes.push(a)-1;return o.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),o=0,a=e.children.length;o<a;o++){var s=e.children[o];!s.visible&&!1!==r.onlyVisible||null!==(s=this.processNode(s))&&i.push(s)}0<i.length&&(n.nodes=i),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new i.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,r,n=this.options,o=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),a=0;a<e.length;a++)e[a]instanceof i.Scene?this.processScene(e[a]):o.push(e[a]);1===o.length?(t=o[0],["Group","Object3D"].includes(t.type)||((r=new i.Group).name="glb_model",r.add(t),t=r),this.processScene(t)):1<o.length&&this.processObjects(o);for(var s=0;s<this.skins.length;++s)this.processSkin(this.skins[s]);for(var l=0;l<n.animations.length;++l)this.processAnimation(n.animations[l],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),to=function(){function e(t){Ni(this,e),this.writer=t,this.name="KHR_lights_punctual"}return zi(e,[{key:"writeNode",value:function(e,t){var r,n,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(i=this.writer).json,i=i.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},i[this.name]=!0),(i=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:i.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),ro=function(){function e(t){Ni(this,e),this.writer=t,this.name="KHR_materials_unlit"}return zi(e,[{key:"writeMaterial",value:function(e,t){e.isMeshBasicMaterial&&(e=this.writer.extensionsUsed,t.extensions=t.extensions||{},t.extensions[this.name]={},e[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9)}}]),e}(),no=function(){function e(t){Ni(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return zi(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isGLTFSpecularGlossinessMaterial&&(n=(r=this.writer).extensionsUsed,i={},t.pbrMetallicRoughness.baseColorFactor&&(i.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor),e.specular.toArray(o=[1,1,1],0),i.specularFactor=o,i.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(i.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap&&(o={index:r.processTexture(e.specularMap)},r.applyTextureTransform(o,e.specularMap),i.specularGlossinessTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),io=function(){function e(t){Ni(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return zi(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&(n=(r=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(o={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(o,e.clearcoatMap),i.clearcoatTexture=o),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(o={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(o,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=o),e.clearcoatNormalMap&&(o={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(o,e.clearcoatNormalMap),i.clearcoatNormalTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),oo=function(){function e(t){Ni(this,e),this.writer=t,this.name="KHR_materials_transmission"}return zi(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(o={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(o,e.transmissionMap),i.transmissionTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),ao=function(){function e(t){Ni(this,e),this.writer=t,this.name="KHR_materials_volume"}return zi(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(o={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(o,e.thicknessMap),i.thicknessTexture=o),i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),so=(Vi.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),o=new e.ValueBufferType(e.values.length+n),a=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){i[0]=t;for(var s=0;s<n;s++)o[s]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;i[0]=t,i.set(e.times,1),o.set(a.evaluate(t),0),o.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),o.set(e.values,0),o.set(a.evaluate(t),e.values.length),r=i.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){i.set(e.times.slice(0,l+1),0),i[l+1]=t,i.set(e.times.slice(l+1),l+2),o.set(e.values.slice(0,(l+1)*n),0),o.set(a.evaluate(t),(l+1)*n),o.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=i,e.values=o,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},o=e.tracks,a=0;a<o.length;++a){var s=o[a],l=i.PropertyBinding.parseTrackName(s.name),u=i.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.push(s);else{if(s.createInterpolant!==s.InterpolantFactoryMethodDiscrete&&s.createInterpolant!==s.InterpolantFactoryMethodLinear){if(s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(s=s.clone()).setInterpolation(i.InterpolateLinear)}var c=u.morphTargetInfluences.length,h=u.morphTargetDictionary[l.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var p=void 0;if(void 0===n[u.uuid]){for(var f=new((p=s.clone()).ValueBufferType)(c*p.times.length),d=0;d<p.times.length;d++)f[d*c+h]=p.values[d];p.name=(l.nodeName||"")+".morphTargetInfluences",p.values=f,n[u.uuid]=p,r.push(p)}else{var m=s.createInterpolant(new s.ValueBufferType(1));p=n[u.uuid];for(var v=0;v<p.times.length;v++)p.values[v*c+h]=m.evaluate(p.times[v]);for(var g=0;g<s.times.length;g++){var y=this.insertKeyframe(p,s.times[g]);p.values[y*c+h]=s.values[g]}}}}return e.tracks=r,e}},function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))});class lo{constructor(e){this._gltf=new Vi,this.options=new Oi,this.runScene=e}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t="scene"){return so(this,void 0,void 0,(function*(){const r=new Ai(t,this.runScene),n=new Ii(t,this.runScene);var i=yield n.parse(e);return r.material.setMaterialMap(i),new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:r,optionsEx:this.runScene.optionsEx}})}))}))}export(e){return so(this,void 0,void 0,(function*(){var t=yield this.getArrayBuffer(e);(0,he.downloadFile)(new Blob([t]),"scene.glb")}))}model(){return so(this,void 0,void 0,(function*(){const e=this.runScene.modelEx.select;var t;e&&(t=yield this.getArrayBuffer(e.clone(),"model"),(0,he.downloadFile)(new Blob([t]),"scene.glb"))}))}material(){var e;return so(this,void 0,void 0,(function*(){var t=null==(e=this.runScene.modelEx.select)?void 0:e.material;if(t){const e=Ri("Box");e.material=t,t=yield this.getArrayBuffer(e,"material"),(0,he.downloadFile)(new Blob([t]),"material.glb")}}))}scene(){return so(this,void 0,void 0,(function*(){var e=yield this.getArrayBuffer();(0,he.downloadFile)(new Blob([e]),"scene.glb")}))}}class uo{constructor(e){this.runScene=e,this.gltf=new lo(e)}}var co={},ho=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},po=function(e){return new Worker(e)};try{URL.revokeObjectURL(ho(""))}catch(Mo){ho=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},po=function(e){return new Worker(e,{type:"module"})}}for(var fo=Uint8Array,mo=Uint16Array,vo=Uint32Array,go=new fo([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),yo=new fo([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),bo=new fo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),xo=(t=function(e,t){for(var r=new mo(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var i=new vo(r[30]);for(n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return[r,i]},(Xi=t(go,2))[0]),wo=Xi[1],So=(xo[28]=258,wo[258]=28,qi=t(yo,0))[0],To=qi[1],_o=new mo(32768),Mo=0;Mo<32768;++Mo){var Eo=(43690&Mo)>>>1|(21845&Mo)<<1;_o[Mo]=((65280&(Eo=(61680&(Eo=(52428&Eo)>>>2|(13107&Eo)<<2))>>>4|(3855&Eo)<<4))>>>8|(255&Eo)<<8)>>>1}var Po=function(e,t,r){for(var n=e.length,i=0,o=new mo(t);i<n;++i)++o[e[i]-1];var a=new mo(t);for(i=0;i<t;++i)a[i]=a[i-1]+o[i-1]<<1;if(r){var s=new mo(1<<t),l=15-t;for(i=0;i<n;++i)if(e[i])for(var u=i<<4|e[i],c=t-e[i],h=a[e[i]-1]++<<c,p=h|(1<<c)-1;h<=p;++h)s[_o[h]>>>l]=u}else for(s=new mo(n),i=0;i<n;++i)e[i]&&(s[i]=_o[a[e[i]-1]++]>>>15-e[i]);return s},ko=new fo(288);for(Mo=0;Mo<144;++Mo)ko[Mo]=8;for(Mo=144;Mo<256;++Mo)ko[Mo]=9;for(Mo=256;Mo<280;++Mo)ko[Mo]=7;for(Mo=280;Mo<288;++Mo)ko[Mo]=8;var Ro=new fo(32);for(Mo=0;Mo<32;++Mo)Ro[Mo]=5;function Oo(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){return e.push(t.data[0],t.data[1])}}function Co(e,t,r,n,i){var o,a=sa(e,n,i,(function(e,r){e?(a.terminate(),t.ondata.call(t,e)):(r[1]&&a.terminate(),t.ondata.call(t,e,r[0],r[1]))}));a.postMessage(r),t.push=function(e,r){if(o)throw"stream finished";if(!t.ondata)throw"no stream handler";a.postMessage([e,o=r],[e.buffer])},t.terminate=function(){a.terminate()}}function Lo(e,t){return ya(e,t)+4294967296*ya(e,t+4)}var Ao=Po(ko,9,0),Do=Po(ko,9,1),Io=Po(Ro,5,0),jo=Po(Ro,5,1),Uo=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Bo=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},No=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},Fo=function(e){return(e/8|0)+(7&e&&1)},zo=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof mo?mo:e instanceof vo?vo:fo)(r-(t=null==t||t<0?0:t));return n.set(e.subarray(t,r)),n},Vo=function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new fo(0);function i(e){var r=t.length;r<e&&((r=new fo(Math.max(2*r,e))).set(t),t=r)}var o=!t||r,a=!r||r.i,s=(r=r||{},t=t||new fo(3*n),r.f||0),l=r.p||0,u=r.b||0,c=r.l,h=r.d,p=r.m,f=r.n,d=8*n;do{if(!c){r.f=s=Bo(e,l,1);var m=Bo(e,l+1,3);if(l+=3,!m){var v=e[(M=Fo(l)+4)-4]|e[M-3]<<8;if(n<(S=M+v)){if(a)throw"unexpected EOF";break}o&&i(u+v),t.set(e.subarray(M,S),u),r.b=u+=v,r.p=l=8*S;continue}if(1==m)c=Do,h=jo,p=9,f=5;else{if(2!=m)throw"invalid block type";v=Bo(e,l,31)+257;for(var g=Bo(e,l+10,15)+4,y=v+Bo(e,l+5,31)+1,b=(l+=14,new fo(y)),x=new fo(19),w=0;w<g;++w)x[bo[w]]=Bo(e,l+3*w,7);l+=3*g;var S,T=(1<<(S=Uo(x)))-1,_=Po(x,S,1);for(w=0;w<y;){var M,E=_[Bo(e,l,T)];if(l+=15&E,(M=E>>>4)<16)b[w++]=M;else{var P=0,k=0;for(16==M?(k=3+Bo(e,l,3),l+=2,P=b[w-1]):17==M?(k=3+Bo(e,l,7),l+=3):18==M&&(k=11+Bo(e,l,127),l+=7);k--;)b[w++]=P}}m=b.subarray(0,v);var R=b.subarray(v);p=Uo(m),f=Uo(R),c=Po(m,p,1),h=Po(R,f,1)}if(d<l){if(a)throw"unexpected EOF";break}}o&&i(u+131072);for(var O=(1<<p)-1,C=(1<<f)-1,L=l;;L=l){var A=(P=c[No(e,l)&O])>>>4;if(d<(l+=15&P)){if(a)throw"unexpected EOF";break}if(!P)throw"invalid length/literal";if(A<256)t[u++]=A;else{if(256==A){L=l,c=null;break}var D,I=A-254,j=(264<A&&(D=go[w=A-257],I=Bo(e,l,(1<<D)-1)+xo[w],l+=D),(A=h[No(e,l)&C])>>>4);if(!A)throw"invalid distance";if(l+=15&A,R=So[j],3<j&&(D=yo[j],R+=No(e,l)&(1<<D)-1,l+=D),d<l){if(a)throw"unexpected EOF";break}o&&i(u+131072);for(var U=u+I;u<U;u+=4)t[u]=t[u-R],t[u+1]=t[u+1-R],t[u+2]=t[u+2-R],t[u+3]=t[u+3-R];u=U}}r.l=c,r.p=L,r.b=u,c&&(s=1,r.m=p,r.d=h,r.n=f)}while(!s);return u==t.length?t:zo(t,0,u)},Ho=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8},Go=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8,e[2+n]|=r>>>16},Wo=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,o=r.slice();if(!i)return[Jo,0];if(1==i)return(m=new fo(r[0].s+1))[r[0].s]=1,[m,1];r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var a=r[0],s=r[1],l=0,u=1,c=2;for(r[0]={s:-1,f:a.f+s.f,l:a,r:s};u!=i-1;)a=r[r[l].f<r[c].f?l++:c++],s=r[l!=u&&r[l].f<r[c].f?l++:c++],r[u++]={s:-1,f:a.f+s.f,l:a,r:s};var h=o[0].s;for(n=1;n<i;++n)o[n].s>h&&(h=o[n].s);var p=new mo(h+1),f=Xo(r[u-1],p,0);if(t<f){n=0;var d=0,m=f-t,v=1<<m;for(o.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));n<i;++n){var g=o[n].s;if(!(p[g]>t))break;d+=v-(1<<f-p[g]),p[g]=t}for(d>>>=m;0<d;){var y=o[n].s;p[y]<t?d-=1<<t-p[y]++-1:++n}for(;0<=n&&d;--n){var b=o[n].s;p[b]==t&&(--p[b],++d)}f=t}return[new fo(p),f]},Xo=function e(t,r,n){return-1==t.s?Math.max(e(t.l,r,n+1),e(t.r,r,n+1)):r[t.s]=n},qo=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new mo(++t),n=0,i=e[0],o=1,a=function(e){r[n++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++o;else{if(!i&&2<o){for(;138<o;o-=138)a(32754);2<o&&(a(10<o?o-11<<5|28690:o-3<<5|12305),o=0)}else if(3<o){for(a(i),--o;6<o;o-=6)a(8304);2<o&&(a(o-3<<5|8208),o=0)}for(;o--;)a(i);o=1,i=e[s]}return[r.subarray(0,n),t]},Yo=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},Zo=function(e,t,r){var n=r.length,i=Fo(t+2);e[i]=255&n,e[i+1]=n>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o<n;++o)e[i+o+4]=r[o];return 8*(i+4+n)},Qo=function(e,t,r,n,i,o,a,s,l,u,c){Ho(t,c++,r),++i[256];for(var h=(r=Wo(i,15))[0],p=(r=r[1],(f=Wo(o,15))[0]),f=f[1],d=(m=qo(h))[0],m=m[1],v=(g=qo(p))[0],g=g[1],y=new mo(19),b=0;b<d.length;++b)y[31&d[b]]++;for(b=0;b<v.length;++b)y[31&v[b]]++;for(var x=(w=Wo(y,7))[0],w=w[1],S=19;4<S&&!x[bo[S-1]];--S);var T,_=u+5<<3,M=Yo(i,ko)+Yo(o,Ro)+a;if(i=Yo(i,h)+Yo(o,p)+a+14+3*S+Yo(y,x)+(2*y[16]+3*y[17]+7*y[18]),_<=M&&_<=i)return Zo(t,c,e.subarray(l,l+u));if(Ho(t,c,1+(i<M)),c+=2,i<M){var E=Po(h,r,0),P=h,k=Po(p,f,0),R=p,O=Po(x,w,0);for(Ho(t,c,m-257),Ho(t,c+5,g-1),Ho(t,c+10,S-4),c+=14,b=0;b<S;++b)Ho(t,c+3*b,x[bo[b]]);c+=3*S;for(var C=[d,v],L=0;L<2;++L){var A=C[L];for(b=0;b<A.length;++b){var D=31&A[b];Ho(t,c,O[D]),c+=x[D],15<D&&(Ho(t,c,A[b]>>>5&127),c+=A[b]>>>12)}}}else E=Ao,P=ko,k=Io,R=Ro;for(b=0;b<s;++b)255<n[b]?(D=n[b]>>>18&31,Go(t,c,E[D+257]),c+=P[D+257],7<D&&(Ho(t,c,n[b]>>>23&31),c+=go[D]),T=31&n[b],Go(t,c,k[T]),c+=R[T],3<T&&(Go(t,c,n[b]>>>5&8191),c+=yo[T])):(Go(t,c,E[n[b]]),c+=P[n[b]]);return Go(t,c,E[256]),c+P[256]},Ko=new vo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Jo=new fo(0),$o=function(e,t,r,n,i,o){var a=e.length,s=new fo(n+a+5*(1+Math.ceil(a/7e3))+i),l=s.subarray(n,s.length-i),u=0;if(!t||a<8)for(var c=0;c<=a;c+=65535){var h=c+65535;u=h<a?Zo(l,u,e.subarray(c,h)):(l[c]=o,Zo(l,u,e.subarray(c,a)))}else{for(var p=(t=Ko[t-1])>>>13,f=8191&t,d=(1<<r)-1,m=new mo(32768),v=new mo(1+d),g=Math.ceil(r/3),y=2*g,b=function(t){return(e[t]^e[t+1]<<g^e[t+2]<<y)&d},x=new vo(25e3),w=new mo(288),S=new mo(32),T=0,_=0,M=(c=0,0),E=0,P=0;c<a;++c){var k=b(c),R=32767&c,O=v[k];if(m[R]=O,v[k]=R,E<=c){var C=a-c;if((7e3<T||24576<M)&&423<C){u=Qo(e,l,0,x,w,S,_,M,P,c-P,u),M=T=_=0,P=c;for(var L=0;L<286;++L)w[L]=0;for(L=0;L<30;++L)S[L]=0}var A=2,D=0,I=f,j=R-O&32767;if(2<C&&k==b(c-j))for(var U=Math.min(p,C)-1,B=Math.min(32767,c),N=Math.min(258,C);j<=B&&--I&&R!=O;){if(e[c+A]==e[c+A-j]){for(var F=0;F<N&&e[c+F]==e[c+F-j];++F);if(A<F){if(D=j,U<(A=F))break;var z=Math.min(j,F-2),V=0;for(L=0;L<z;++L){var H=c-j+L+32768&32767,G=H-m[H]+32768&32767;V<G&&(V=G,O=H)}}}j+=(R=O)-(O=m[R])+32768&32767}D?(x[M++]=268435456|wo[A]<<18|To[D],k=31&wo[A],C=31&To[D],_+=go[k]+yo[C],++w[257+k],++S[C],E=c+A,++T):(x[M++]=e[c],++w[e[c]])}}u=Qo(e,l,o,x,w,S,_,M,P,c-P,u),!o&&7&u&&(u=Zo(l,u+1,Jo))}return zo(s,0,n+Fo(u)+i)},ea=function(){for(var e=new vo(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),ta=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=ea[255&r^t[n]]^r>>>8;e=r},d:function(){return~e}}},ra=function(){var e=1,t=0;return{p:function(r){for(var n=e,i=t,o=r.length,a=0;a!=o;){for(var s=Math.min(a+2655,o);a<s;++a)i+=n+=r[a];n=(65535&n)+15*(n>>16),i=(65535&i)+15*(i>>16)}e=n,t=i},d:function(){return(255&(e%=65521))<<24|e>>>8<<16|(255&(t%=65521))<<8|t>>>8}}},na=function(e,t,r,n,i){return $o(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,r,n,!i)},ia=function(e,t){var r,n={};for(r in e)n[r]=e[r];for(r in t)n[r]=t[r];return n},oa=function(e,t,r){for(var n=e(),i=(e=e.toString()).slice(e.indexOf("[")+1,e.lastIndexOf("]")).replace(/ /g,"").split(","),o=0;o<n.length;++o){var a=n[o],s=i[o];if("function"==typeof a){t+=";"+s+"=";var l=a.toString();if(a.prototype)if(-1!=l.indexOf("[native code]")){var u=l.indexOf(" ",8)+1;t+=l.slice(u,l.indexOf("(",u))}else for(var c in t+=l,a.prototype)t+=";"+s+".prototype."+c+"="+a.prototype[c].toString();else t+=l}else r[s]=a}return[t,r]},aa=[],sa=function(e,t,r,n){var i;if(!aa[r]){for(var o="",a={},s=e.length-1,l=0;l<s;++l)o=(i=oa(e[l],o,a))[0],a=i[1];aa[r]=oa(e[s],o,a)}var u=ia({},aa[r][1]);return function(e,t,r,n,i){return(t=po(co[t]||(co[t]=ho(e)))).onerror=function(e){return i(e.error,null)},t.onmessage=function(e){return i(null,e.data)},t.postMessage(r,n),t}(aa[r][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",r,u,function(e){var t,r=[];for(t in e)(e[t]instanceof fo||e[t]instanceof mo||e[t]instanceof vo)&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r}(u),n)},la=function(){return[fo,mo,vo,go,yo,bo,xo,So,Do,jo,_o,Po,Uo,Bo,No,Fo,zo,Vo,Da,da,ma]},ua=function(){return[fo,mo,vo,go,yo,bo,wo,To,Ao,ko,Io,Ro,_o,Ko,Jo,Po,Ho,Go,Wo,Xo,qo,Yo,Zo,Qo,Fo,zo,$o,na,Oa,da]},ca=function(){return[xa,Ta,ba,ta,ea]},ha=function(){return[wa,Sa]},pa=function(){return[_a,ba,ra]},fa=function(){return[Ma]},da=function(e){return postMessage(e,[e.buffer])},ma=function(e){return e&&e.size&&new fo(e.size)},va=function(e,t,r,n,i,o){var a=sa(r,n,i,(function(e,t){a.terminate(),o(e,t)}));return a.postMessage([e,t],t.consume?[e.buffer]:[]),function(){a.terminate()}},ga=function(e,t){return e[t]|e[t+1]<<8},ya=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},ba=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},xa=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&ba(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var n=0;n<=r.length;++n)e[n+10]=r.charCodeAt(n)}},wa=function(e){if(31!=e[0]||139!=e[1]||8!=e[2])throw"invalid gzip data";var t=e[3],r=10;4&t&&(r+=e[10]|2+(e[11]<<8));for(var n=(t>>3&1)+(t>>4&1);0<n;n-=!e[r++]);return r+(2&t)},Sa=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Ta=function(e){return 10+(e.filename&&e.filename.length+1||0)},_a=function(e,t){t=0==(t=t.level)?0:t<6?1:9==t?3:2,e[0]=120,e[1]=t<<6|(t?32-2*t:1)},Ma=function(e){if(8!=(15&e[0])||7<e[0]>>>4||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"};function Ea(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var Pa=function(){function e(e,t){t||"function"!=typeof e||(t=e,e={}),this.ondata=t,this.o=e||{}}return e.prototype.p=function(e,t){this.ondata(na(e,this.o,0,0,!t),t)},e.prototype.push=function(e,t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=t,this.p(e,t||!1)},e}(),ka=function(e,t){Co([ua,function(){return[Oo,Pa]}],this,Ea.call(this,e,t),(function(e){e=new Pa(e.data),onmessage=Oo(e)}),6)};function Ra(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return va(e,t,[ua],(function(e){return da(Oa(e.data[0],e.data[1]))}),0,r)}function Oa(e,t){return na(e,t||{},0,0)}var Ca=function(){function e(e){this.s={},this.p=new fo(0),this.ondata=e}return e.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,r=new fo(t+e.length);r.set(this.p),r.set(e,t),this.p=r},e.prototype.c=function(e){this.d=this.s.i=e||!1,e=this.s.b;var t=Vo(this.p,this.o,this.s);this.ondata(zo(t,e,this.s.b),this.d),this.o=zo(t,this.s.b-32768),this.s.b=this.o.length,this.p=zo(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),La=function(e){this.ondata=e,Co([la,function(){return[Oo,Ca]}],this,0,(function(){var e=new Ca;onmessage=Oo(e)}),7)};function Aa(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return va(e,t,[la],(function(e){return da(Da(e.data[0],ma(e.data[1])))}),1,r)}function Da(e,t){return Vo(e,t)}var Ia=function(){function e(e,t){this.c=ta(),this.l=0,this.v=1,Pa.call(this,e,t)}return e.prototype.push=function(e,t){Pa.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length,e=na(e,this.o,this.v&&Ta(this.o),t&&8,!t),this.v&&(xa(e,this.o),this.v=0),t&&(ba(e,e.length-8,this.c.d()),ba(e,e.length-4,this.l)),this.ondata(e,t)},e}(),ja=function(e,t){Co([ua,ca,function(){return[Oo,Pa,Ia]}],this,Ea.call(this,e,t),(function(e){e=new Ia(e.data),onmessage=Oo(e)}),8)};function Ua(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return va(e,t,[ua,ca,function(){return[Ba]}],(function(e){return da(Ba(e.data[0],e.data[1]))}),2,r)}function Ba(e,t){t=t||{};var r=ta(),n=e.length,i=(r.p(e),e=na(e,t,Ta(t),8)).length;return xa(e,t),ba(e,i-8,r.d()),ba(e,i-4,n),e}var Na=function(){function e(e){this.v=1,Ca.call(this,e)}return e.prototype.push=function(e,t){if(Ca.prototype.e.call(this,e),this.v){if((e=3<this.p.length?wa(this.p):4)>=this.p.length&&!t)return;this.p=this.p.subarray(e),this.v=0}if(t){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}Ca.prototype.c.call(this,t)},e}(),Fa=function(e){this.ondata=e,Co([la,ha,function(){return[Oo,Ca,Na]}],this,0,(function(){var e=new Na;onmessage=Oo(e)}),9)};function za(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return va(e,t,[la,ha,function(){return[Va]}],(function(e){return da(Va(e.data[0]))}),3,r)}function Va(e,t){return Vo(e.subarray(wa(e),-8),t||new fo(Sa(e)))}var Ha=function(){function e(e,t){this.c=ra(),this.v=1,Pa.call(this,e,t)}return e.prototype.push=function(e,t){Pa.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),e=na(e,this.o,this.v&&2,t&&4,!t),this.v&&(_a(e,this.o),this.v=0),t&&ba(e,e.length-4,this.c.d()),this.ondata(e,t)},e}(),Ga=function(e,t){Co([ua,pa,function(){return[Oo,Pa,Ha]}],this,Ea.call(this,e,t),(function(e){e=new Ha(e.data),onmessage=Oo(e)}),10)};function Wa(e,t){t=t||{};var r=ra();return r.p(e),e=na(e,t,2,4),_a(e,t),ba(e,e.length-4,r.d()),e}var Xa=function(){function e(e){this.v=1,Ca.call(this,e)}return e.prototype.push=function(e,t){if(Ca.prototype.e.call(this,e),this.v){if(this.p.length<2&&!t)return;this.p=this.p.subarray(2),this.v=0}if(t){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}Ca.prototype.c.call(this,t)},e}(),qa=function(e){this.ondata=e,Co([la,fa,function(){return[Oo,Ca,Xa]}],this,0,(function(){var e=new Xa;onmessage=Oo(e)}),11)};function Ya(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return va(e,t,[la,fa,function(){return[Za]}],(function(e){return da(Za(e.data[0],ma(e.data[1])))}),5,r)}function Za(e,t){return Vo((Ma(e),e.subarray(2,-4)),t)}var Qa=function(){function e(e){this.G=Na,this.I=Ca,this.Z=Xa,this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";var r,n;this.s?this.s.push(e,t):(this.p&&this.p.length?((r=new fo(this.p.length+e.length)).set(this.p),r.set(e,this.p.length)):this.p=e,2<this.p.length&&((n=this).s=new(31==this.p[0]&&139==this.p[1]&&8==this.p[2]?this.G:8!=(15&this.p[0])||7<this.p[0]>>4||(this.p[0]<<8|this.p[1])%31?this.I:this.Z)((function(){n.ondata.apply(n,arguments)})),this.s.push(this.p,t),this.p=null))},e}(),Ka=function(){function e(e){this.G=Fa,this.I=La,this.Z=qa,this.ondata=e}return e.prototype.push=function(e,t){Qa.prototype.push.call(this,e,t)},e}(),Ja=function e(t,r,n,i){for(var o in t){var a=t[o];o=r+o,a instanceof fo?n[o]=[a,i]:Array.isArray(a)?n[o]=[a[0],ia(i,a[1])]:e(a,o+"/",n,i)}},$a="undefined"!=typeof TextEncoder&&new TextEncoder,es="undefined"!=typeof TextDecoder&&new TextDecoder,ts=0;try{es.decode(Jo,{stream:!0}),ts=1}catch(Mo){}var rs=function(e){for(var t="",r=0;;){var n=e[r++],i=(127<n)+(223<n)+(239<n);if(r+i>e.length)return[t,zo(e,r-1)];i?3==i?(n=((15&n)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t+=String.fromCharCode(55296|n>>10,56320|1023&n)):t+=1&i?String.fromCharCode((31&n)<<6|63&e[r++]):String.fromCharCode((15&n)<<12|(63&e[r++])<<6|63&e[r++]):t+=String.fromCharCode(n)}},ns=function(){function e(e){this.ondata=e,ts?this.t=new TextDecoder:this.p=Jo}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t=!!t,this.t){if(this.ondata(this.t.decode(e,{stream:!0}),t),t){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}}else{if(!this.p)throw"stream finished";var r=((r=new fo(this.p.length+e.length)).set(this.p),r.set(e,this.p.length),e=rs(r))[0];if(e=e[1],t){if(e.length)throw"invalid utf-8 data";this.p=null}else this.p=e;this.ondata(r,t)}},e}(),is=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(os(e),this.d=t||!1)},e}();function os(e,t){if(t){for(var r=new fo(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if($a)return $a.encode(e);var i=e.length,o=new fo(e.length+(e.length>>1)),a=0,s=function(e){o[a++]=e};for(n=0;n<i;++n){a+5>o.length&&((l=new fo(a+8+(i-n<<1))).set(o),o=l);var l=e.charCodeAt(n);l<128||t?s(l):(l<2048?s(192|l>>6):(55295<l&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++n))>>18),s(128|l>>12&63)):s(224|l>>12),s(128|l>>6&63)),s(128|63&l))}return zo(o,0,a)}function as(e,t){if(t){for(var r="",n=0;n<e.length;n+=16384)r+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return r}if(es)return es.decode(e);var i=(t=rs(e))[0];if(t[1].length)throw"invalid utf-8 data";return i}function ss(e){return 1==e?3:e<6?2:9==e?1:0}var ls=function(e,t){return t+30+ga(e,t+26)+ga(e,t+28)},us=function(e,t,r){var n=ga(e,t+28),i=as(e.subarray(t+46,t+46+n),!(2048&ga(e,t+8))),o=(n=t+46+n,ya(e,t+20)),a=(o=(r=r&&4294967295==o?cs(e,n):[o,ya(e,t+24),ya(e,t+42)])[0],r[1]);return r=r[2],[ga(e,t+10),o,a,i,n+ga(e,t+30)+ga(e,t+32),r]},cs=function(e,t){for(;1!=ga(e,t);t+=4+ga(e,t+2));return[Lo(e,t+12),Lo(e,t+4),Lo(e,t+20)]},hs=function(e){var t=0;if(e)for(var r in e){if(65535<(r=e[r].length))throw"extra field too long";t+=r+4}return t},ps=function(e,t,r,n,i,o,a,s){var l=n.length,u=r.extra,c=s&&s.length,h=hs(u),p=(ba(e,t,null!=a?33639248:67324752),t+=4,null!=a&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(null==o&&8),e[t++]=i&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8,i=new Date(null==r.mtime?Date.now():r.mtime)).getFullYear()-1980;if(p<0||119<p)throw"date not in range 1980-2099";if(ba(e,t,p<<25|i.getMonth()+1<<21|i.getDate()<<16|i.getHours()<<11|i.getMinutes()<<5|i.getSeconds()>>>1),t+=4,null!=o&&(ba(e,t,r.crc),ba(e,t+4,o),ba(e,t+8,r.size)),ba(e,t+12,l),ba(e,t+14,h),t+=16,null!=a&&(ba(e,t,c),ba(e,t+6,r.attrs),ba(e,t+10,a),t+=14),e.set(n,t),t+=l,h)for(var f in u){var d=u[f],m=d.length;ba(e,t,+f),ba(e,t+2,m),e.set(d,t+4),t+=4+m}return c&&(e.set(s,t),t+=c),t},fs=function(e,t,r,n,i){ba(e,t,101010256),ba(e,t+8,r),ba(e,t+10,r),ba(e,t+12,n),ba(e,t+16,i)},ds=function(){function e(e){this.filename=e,this.c=ta(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}(),ms=function(){function e(e,t){var r=this;t=t||{},ds.call(this,e),this.d=new Pa(t,(function(e,t){r.ondata(null,e,t)})),this.compression=8,this.flag=ss(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){ds.prototype.push.call(this,e,t)},e}(),vs=function(){function e(e,t){var r=this;t=t||{},ds.call(this,e),this.d=new ka(t,(function(e,t,n){r.ondata(e,t,n)})),this.compression=8,this.flag=ss(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){ds.prototype.push.call(this,e,t)},e}(),gs=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(2&this.d)throw"stream finished";var r=os(e.filename),n=r.length,i=(o=e.comment)&&os(o),o=n!=e.filename.length||i&&o.length!=i.length,a=n+hs(e.extra)+30;if(65535<n)throw"filename too long";function s(){for(var e=0,r=l;e<r.length;e++){var n=r[e];t.ondata(null,n,!1)}l=[]}n=new fo(a);var l=(ps(n,0,e,r,o),[n]),u=this.d,c=(this.d=0,this.u.length),h=ia(e,{f:r,u:o,o:i,t:function(){e.terminate&&e.terminate()},r:function(){var e;s(),u&&((e=t.u[c+1])?e.r():t.d=1),u=1}}),p=0;e.ondata=function(r,n,i){r?(t.ondata(r,n,i),t.terminate()):(p+=n.length,l.push(n),i?(r=new fo(16),ba(r,0,134695760),ba(r,4,e.crc),ba(r,8,p),ba(r,12,e.size),l.push(r),h.c=p,h.b=a+p+16,h.crc=e.crc,h.size=e.size,u&&h.r(),u=1):u&&s())},this.u.push(h)},e.prototype.end=function(){var e=this;if(2&this.d){if(1&this.d)throw"stream finishing";throw"stream finished"}this.d?this.e():this.u.push({r:function(){1&e.d&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,r=0,n=0,i=this.u;n<i.length;n++)r+=46+(l=i[n]).f.length+hs(l.extra)+(l.o?l.o.length:0);for(var o=new fo(r+22),a=0,s=this.u;a<s.length;a++){var l=s[a];ps(o,e,l,l.f,l.u,l.c,t,l.o),e+=46+l.f.length+hs(l.extra)+(l.o?l.o.length:0),t+=l.b}fs(o,e,this.u.length,r,t),this.ondata(null,o,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}(),ys=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),bs=function(){function e(){var e=this;this.i=new Ca((function(t,r){e.ondata(null,t,r)}))}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(r){this.ondata(r,e,t)}},e.compression=8,e}(),xs=function(){function e(e,t){var r=this;t<32e4?this.i=new Ca((function(e,t){r.ondata(null,e,t)})):(this.i=new La((function(e,t,n){r.ondata(e,t,n)})),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=zo(e,0)),this.i.push(e,t)},e.compression=8,e}(),ws=function(){function e(e){this.onfile=e,this.k=[],this.o={0:ys},this.p=Jo}return e.prototype.push=function(e,t){var r=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(0<this.c){var n=Math.min(this.c,e.length),i=e.subarray(0,n);if(this.c-=n,this.d?this.d.push(i,!this.c):this.k[0].push(i),(e=e.subarray(n)).length)return this.push(e,t)}else{for(var o=0,a=0,s=void 0,l=void 0,u=(this.p.length?e.length?((l=new fo(this.p.length+e.length)).set(this.p),l.set(e,this.p.length)):l=this.p:l=e,l.length),c=this.c,h=(i=c&&this.d,this);a<u-4&&"break"!==function(){var e,t,n,i,p,f,d,m,v,g,y,b=ya(l,a);return 67324752==b?(o=1,s=a,h.d=null,h.c=0,n=ga(l,a+6),e=ga(l,a+8),t=2048&n,n&=8,i=ga(l,a+26),p=ga(l,a+28),a+30+i+p<u&&(h.k.unshift(f=[]),o=2,d=ya(l,a+18),m=ya(l,a+22),v=as(l.subarray(a+30,a+=30+i),!t),4294967295==d?(i=n?[-2]:cs(l,a),d=i[0],m=i[1]):n&&(d=-1),a+=p,h.c=d,y={name:v,compression:e,start:function(){if(!y.ondata)throw"no callback";if(d){var t=r.o[e];if(!t)throw"unknown compression type "+e;(g=d<0?new t(v):new t(v,d,m)).ondata=function(e,t,r){y.ondata(e,t,r)};for(var n=0,i=f;n<i.length;n++)g.push(i[n],!1);r.k[0]==f&&r.c?r.d=g:g.push(Jo,!0)}else y.ondata(null,Jo,!0)},terminate:function(){g&&g.terminate&&g.terminate()}},0<=d&&(y.size=d,y.originalSize=m),h.onfile(y)),"break"):c?134695760==b?(s=a+=12+(-2==c&&8),o=3,h.c=0,"break"):33639248==b?(s=a-=4,o=3,h.c=0,"break"):void 0:void 0}();++a);if(this.p=Jo,c<0&&(n=o?l.subarray(0,s-12-(-2==c&&8)-(134695760==ya(l,s-16)&&4)):l.subarray(0,a),i?i.push(n,!!o):this.k[+(2==o)].push(n)),2&o)return this.push(l.subarray(a),t);this.p=l.subarray(a)}if(t){if(this.c)throw"invalid zip file";this.p=null}},e.prototype.register=function(e){this.o[e.compression]=e},e}();function Ss(e,t,r){var n=r.length-e-1;if(t>=r[n])return n-1;if(t<=r[e])return e;for(var i=e,o=n,a=Math.floor((i+o)/2);t<r[a]||t>=r[a+1];)t<r[a]?o=a:i=a,a=Math.floor((i+o)/2);return a}function Ts(e,t,r,n){for(var i=[],o=[],a=[],s=i[0]=1;s<=r;++s){o[s]=t-n[e+1-s],a[s]=n[e+s]-t;for(var l=0,u=0;u<s;++u){var c=a[u+1],h=o[s-u],p=i[u]/(c+h);i[u]=l+c*p,l=h*p}i[s]=l}return i}function _s(e,t,r,n,o){for(var a=o<e?o:e,s=[],l=Ss(e,n,t),u=function(e,t,r,n,i){for(var o=[],a=0;a<=r;++a)o[a]=0;for(var s=[],l=0;l<=n;++l)s[l]=o.slice(0);for(var u=[],c=0;c<=r;++c)u[c]=o.slice(0);u[0][0]=1;for(var h=o.slice(0),p=o.slice(0),f=1;f<=r;++f){h[f]=t-i[e+1-f],p[f]=i[e+f]-t;for(var d=0,m=0;m<f;++m){var v=p[m+1],g=h[f-m],y=(u[f][m]=v+g,u[m][f-1]/u[f][m]);u[m][f]=d+v*y,d=g*y}u[f][f]=d}for(var b=0;b<=r;++b)s[0][b]=u[b][r];for(var x=0;x<=r;++x){for(var w=0,S=1,T=[],_=0;_<=r;++_)T[_]=o.slice(0);for(var M=T[0][0]=1;M<=n;++M){var E=0,P=x-M,k=r-M;M<=x&&(T[S][0]=T[w][0]/u[1+k][P],E=T[S][0]*u[P][k]);for(var R=x-1<=k?M-1:r-x,O=-1<=P?1:-P;O<=R;++O)T[S][O]=(T[w][O]-T[w][O-1])/u[1+k][P+O],E+=T[S][O]*u[P+O][k];x<=k&&(T[S][M]=-T[w][M-1]/u[1+k][x],E+=T[S][M]*u[x][k]),s[M][x]=E;var C=w;w=S,S=C}}for(var L=r,A=1;A<=n;++A){for(var D=0;D<=r;++D)s[A][D]*=L;L*=r-A}return s}(l,n,e,a,t),c=[],h=0;h<r.length;++h){var p=r[h].clone(),f=p.w;p.x*=f,p.y*=f,p.z*=f,c[h]=p}for(var d=0;d<=a;++d){for(var m=c[l-e].clone().multiplyScalar(u[d][0]),v=1;v<=e;++v)m.add(c[l-e+v].clone().multiplyScalar(u[d][v]));s[d]=m}for(var g=a+1;g<=o+1;++g)s[g]=new i.Vector4(0,0,0);return s}function Ms(e){for(var t=e.length,r=[],n=[],o=0;o<t;++o){var a=e[o];r[o]=new i.Vector3(a.x,a.y,a.z),n[o]=a.w}for(var s=[],l=0;l<t;++l){for(var u=r[l].clone(),c=1;c<=l;++c)u.sub(s[l-c].clone().multiplyScalar(function(e,t){for(var r=1,n=2;n<=e;++n)r*=n;for(var i=1,o=2;o<=t;++o)i*=o;for(var a=2;a<=e-t;++a)i*=a;return r/i}(l,c)*n[c]));s[l]=u.divideScalar(n[0])}return s}function Es(e){return(Es="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ps(e,t){return(Ps=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ks(e){return(ks=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Rs,Os,Cs,Ls=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ps(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ks(e);if(r=t?(r=ks(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Es(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,o,a,s){var l;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(l=r.call(this)).degree=e,l.knots=t,l.controlPoints=[],l.startKnot=a||0,l.endKnot=s||l.knots.length-1;for(var u=0;u<o.length;++u){var c=o[u];l.controlPoints[u]=new i.Vector4(c.x,c.y,c.z,c.w)}return l}return t=n,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new i.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,r,n){for(var o=Ss(e,n,t),a=Ts(o,n,e,t),s=new i.Vector4(0,0,0,0),l=0;l<=e;++l){var u=r[o-e+l],c=a[l],h=u.w*c;s.x+=u.x*h,s.y+=u.y*h,s.z+=u.z*h,s.w+=u.w*c}return s}(this.degree,this.knots,this.controlPoints,e),1!==e.w&&e.divideScalar(e.w),t.set(e.x,e.y,e.z)}},{key:"getTangent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new i.Vector3,r=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),Ms(_s(r=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(r[1]).normalize(),t}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(i.Curve);function As(e){return(As="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ds(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Is(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function js(e,t,r){t&&Is(e.prototype,t),r&&Is(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Us(e,t){return(Us=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Bs(e){return(Bs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ns=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Us(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Bs(e);if(r=t?(r=Bs(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===As(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){return Ds(this,n),r.call(this,e)}return js(n,[{key:"load",value:function(e,t,r,n){var o=this,a=""===o.path?i.LoaderUtils.extractUrlBase(e):o.path,s=new i.FileLoader(this.manager);s.setPath(o.path),s.setResponseType("arraybuffer"),s.setRequestHeader(o.requestHeader),s.setWithCredentials(o.withCredentials),s.load(e,(function(r){try{t(o.parse(r,a))}catch(r){n?n(r):console.error(r),o.manager.itemError(e)}}),r,n)}},{key:"parse",value:function(e,t){if(n="Kaydara FBX Binary \0",(r=e).byteLength>=n.length&&n===rl(r,0,n.length))Rs=(new Gs).parse(e);else{if(!function(e){for(var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0,n=0;n<t.length;++n)if(function(t){var n=e[0];return e=e.slice(r+1),r++,n}()===t[n])return;return 1}(r=rl(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(qs(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+qs(r));Rs=(new Hs).parse(r)}var r,n=new i.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Fs(n,this.manager).parse(Rs)}}]),n}(i.Loader),Fs=function(){function e(t,r){Ds(this,e),this.textureLoader=t,this.manager=r}return js(e,[{key:"parse",value:function(){Os=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new zs).parse(t);return this.parseScene(t,r,e),Cs}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in Rs&&Rs.Connections.connections.forEach((function(t){var r=t[0],n=t[1],i=(t=t[2],e.has(r)||e.set(r,{parents:[],children:[]}),{ID:n,relationship:t});e.get(r).parents.push(i),e.has(n)||e.set(n,{parents:[],children:[]}),i={ID:r,relationship:t},e.get(n).children.push(i)})),e}},{key:"parseImages",value:function(){var e,t={},r={};if("Video"in Rs.Objects){var n,i=Rs.Objects.Video;for(n in i){var o,a,s=i[n];t[parseInt(n)]=s.RelativeFilename||s.Filename,"Content"in s&&(a=s.Content instanceof ArrayBuffer&&0<s.Content.byteLength,o="string"==typeof s.Content&&""!==s.Content,(a||o)&&(a=this.parseImage(i[n]),r[s.RelativeFilename||s.Filename]=a))}}for(e in t){var l=t[e];void 0!==r[l]?t[e]=r[l]:t[e]=t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,r=e.Content,n=e.RelativeFilename||e.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}return"string"==typeof r?"data:"+t+";base64,"+r:(e=new Uint8Array(r),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in Rs.Objects){var r,n=Rs.Objects.Texture;for(r in n){var i=this.parseTexture(n[r],e);t.set(parseInt(r),i)}}return t}},{key:"parseTexture",value:function(e,t){var r=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),n=e.WrapModeV;return r=void 0!==r?r.value:0,n=void 0!==n?n.value:0,t.wrapS=0===r?i.RepeatWrapping:i.ClampToEdgeWrapping,t.wrapT=0===n?i.RepeatWrapping:i.ClampToEdgeWrapping,"Scaling"in e&&(r=e.Scaling.value,t.repeat.x=r[0],t.repeat.y=r[1]),"Translation"in e&&(n=e.Translation.value,t.offset.x=n[0],t.offset.y=n[1]),t}},{key:"loadTexture",value:function(e,t){var r,n=this.textureLoader.path,o=Os.get(e.id).children;return o="tga"===(void 0!==o&&0<o.length&&void 0!==t[o[0].ID]&&(0!==(r=t[o[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0)),t=e.FileName.slice(-3).toLowerCase())?null===(o=this.manager.getHandler(".tga"))?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),new i.Texture):(o.setPath(this.textureLoader.path),o.load(r)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new i.Texture):this.textureLoader.load(r),this.textureLoader.setPath(n),o}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in Rs.Objects){var r,n=Rs.Objects.Material;for(r in n){var i=this.parseMaterial(n[r],e);null!==i&&t.set(parseInt(r),i)}}return t}},{key:"parseMaterial",value:function(e,t){var r,n=e.id,o=e.attrName,a=e.ShadingModel;if("object"===As(a)&&(a=a.value),!Os.has(n))return null;switch(e=this.parseParameters(e,t,n),a.toLowerCase()){case"phong":r=new i.MeshPhongMaterial;break;case"lambert":r=new i.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),r=new i.MeshPhongMaterial}return r.setValues(e),r.name=o,r}},{key:"parseParameters",value:function(e,t,r){var n={},o=(e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=(new i.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(n.color=(new i.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=(new i.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(n.emissive=(new i.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=(new i.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(n.specular=(new i.Color).fromArray(e.SpecularColor.value)),this);return Os.get(r).children.forEach((function(e){var r=e.relationship;switch(r){case"Bump":n.bumpMap=o.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":n.aoMap=o.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=o.getTexture(t,e.ID),void 0!==n.map&&(n.map.encoding=i.sRGBEncoding);break;case"DisplacementColor":n.displacementMap=o.getTexture(t,e.ID);break;case"EmissiveColor":n.emissiveMap=o.getTexture(t,e.ID),void 0!==n.emissiveMap&&(n.emissiveMap.encoding=i.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=o.getTexture(t,e.ID);break;case"ReflectionColor":n.envMap=o.getTexture(t,e.ID),void 0!==n.envMap&&(n.envMap.mapping=i.EquirectangularReflectionMapping,n.envMap.encoding=i.sRGBEncoding);break;case"SpecularColor":n.specularMap=o.getTexture(t,e.ID),void 0!==n.specularMap&&(n.specularMap.encoding=i.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=o.getTexture(t,e.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in Rs.Objects&&t in Rs.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Os.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in Rs.Objects){var r,n=Rs.Objects.Deformer;for(r in n){var i,o=n[r],a=Os.get(parseInt(r));"Skin"===o.attrType?((i=this.parseSkeleton(a,n)).ID=r,1<a.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),i.geometryID=a.parents[0].ID,e[r]=i):"BlendShape"===o.attrType&&((i={id:r}).rawTargets=this.parseMorphTargets(a,n),i.id=r,1<a.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=i)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var r=[];return e.children.forEach((function(e){var n=t[e.ID];"Cluster"===n.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new i.Matrix4).fromArray(n.TransformLink.a)},"Indexes"in n&&(e.indices=n.Indexes.a,e.weights=n.Weights.a),r.push(e))})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var r=[],n=0;n<e.children.length;n++){var i=e.children[n],o=t[i.ID],a={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if("BlendShapeChannel"!==o.attrType)return;a.geoID=Os.get(parseInt(i.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(a)}return r}},{key:"parseScene",value:function(e,t,r){Cs=new i.Group;var n=this.parseModels(e.skeletons,t,r),o=Rs.Objects.Model,a=this;n.forEach((function(e){var t=o[e.ID];a.setLookAtProperties(e,t),Os.get(e.ID).parents.forEach((function(t){void 0!==(t=n.get(t.ID))&&t.add(e)})),null===e.parent&&Cs.add(e)})),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),Cs.traverse((function(e){var t;e.userData.transformData&&(e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld),t=$s(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new Vs).parse(),1===Cs.children.length&&Cs.children[0].isGroup&&(Cs.children[0].animations=r,Cs=Cs.children[0]),Cs.animations=r}},{key:"parseModels",value:function(e,t,r){var n,o=new Map,a=Rs.Objects.Model;for(n in a){var s=parseInt(n),l=a[n],u=Os.get(s),c=this.buildSkeleton(u,e,s,l.attrName);if(!c){switch(l.attrType){case"Camera":c=this.createCamera(u);break;case"Light":c=this.createLight(u);break;case"Mesh":c=this.createMesh(u,t,r);break;case"NurbsCurve":c=this.createCurve(u,t);break;case"LimbNode":case"Root":c=new i.Bone;break;default:c=new i.Group}c.name=l.attrName?i.PropertyBinding.sanitizeNodeName(l.attrName):"",c.ID=s}this.getTransformData(c,l),o.set(s,c)}return o}},{key:"buildSkeleton",value:function(e,t,r,n){var o=null;return e.parents.forEach((function(e){for(var a in t)!function(a){var s=t[a];s.rawBones.forEach((function(t,a){var l;t.ID===e.ID&&(l=o,(o=new i.Bone).matrixWorld.copy(t.transformLink),o.name=n?i.PropertyBinding.sanitizeNodeName(n):"",o.ID=r,s.bones[a]=o,null!==l&&o.add(l))}))}(a)})),o}},{key:"createCamera",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Rs.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new i.Object3D;else{var n=0,o=(void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1),1),a=(void 0!==r.NearPlane&&(o=r.NearPlane.value/1e3),1e3),s=(void 0!==r.FarPlane&&(a=r.FarPlane.value/1e3),window.innerWidth),l=window.innerHeight,u=(void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(s=r.AspectWidth.value,l=r.AspectHeight.value),s/l),c=45,h=(void 0!==r.FieldOfView&&(c=r.FieldOfView.value),r.FocalLength?r.FocalLength.value:null);switch(n){case 0:t=new i.PerspectiveCamera(c,u,o,a),null!==h&&t.setFocalLength(h);break;case 1:t=new i.OrthographicCamera(-s/2,s/2,l/2,-l/2,o,a);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new i.Object3D}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Rs.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new i.Object3D;else{e=void 0===r.LightType?0:r.LightType.value;var n=16777215,o=(void 0!==r.Color&&(n=(new i.Color).fromArray(r.Color.value)),void 0===r.Intensity?1:r.Intensity.value/100),a=(void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(o=0),0);switch(void 0!==r.FarAttenuationEnd&&(a=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),e){case 0:t=new i.PointLight(n,o,a,1);break;case 1:t=new i.DirectionalLight(n,o);break;case 2:var s=Math.PI/3,l=(void 0!==r.InnerAngle&&(s=i.MathUtils.degToRad(r.InnerAngle.value)),0);void 0!==r.OuterAngle&&(l=i.MathUtils.degToRad(r.OuterAngle.value),l=Math.max(l,1)),t=new i.SpotLight(n,o,a,s,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new i.PointLight(n,o)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,r){var n,o=null,a=null,s=[];return e.children.forEach((function(e){t.has(e.ID)&&(o=t.get(e.ID)),r.has(e.ID)&&s.push(r.get(e.ID))})),1<s.length?a=s:0<s.length?a=s[0]:(a=new i.MeshPhongMaterial({color:13421772}),s.push(a)),"color"in o.attributes&&s.forEach((function(e){e.vertexColors=!0})),o.FBX_Deformer?(n=new i.SkinnedMesh(o,a)).normalizeSkinWeights():n=new i.Mesh(o,a),n}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,r){return t.has(r.ID)?t.get(r.ID):e}),null);var r=new i.LineBasicMaterial({color:3342591,linewidth:1});return new i.Line(e,r)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?el(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&Os.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=Rs.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),Cs.add(e.target)):e.lookAt((new i.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,r){var n,o=this.parsePoseNodes();for(n in e)!function(n){var a=e[n];Os.get(parseInt(a.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,Os.get(e).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new i.Skeleton(a.bones),o[e.ID])})))}))}(n)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in Rs.Objects){var t,r,n=Rs.Objects.Pose;for(t in n)"BindPose"===n[t].attrType&&0<n[t].NbPoseNodes&&(r=n[t].PoseNode,Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new i.Matrix4).fromArray(t.Matrix.a)})):e[r.Node]=(new i.Matrix4).fromArray(r.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,r;"GlobalSettings"in Rs&&"AmbientColor"in Rs.GlobalSettings&&(r=(t=Rs.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new i.Color(r,e,t),Cs.add(new i.AmbientLight(r,1))))}}]),e}(),zs=function(){function e(){Ds(this,e)}return js(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in Rs.Objects){var r,n=Rs.Objects.Geometry;for(r in n){var i=Os.get(parseInt(r));i=this.parseGeometry(i,n[r],e),t.set(parseInt(r),i)}}return t}},{key:"parseGeometry",value:function(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,r){var n,i=r.skeletons,o=[],a=e.parents.map((function(e){return Rs.Objects.Model[e.ID]}));if(0!==a.length)return n=e.children.reduce((function(e,t){return void 0!==i[t.ID]?i[t.ID]:e}),null),e.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&o.push(r.morphTargets[e.ID])})),e=a[0],a={},"RotationOrder"in e&&(a.eulerOrder=el(e.RotationOrder.value)),"InheritType"in e&&(a.inheritType=parseInt(e.InheritType.value)),"GeometricTranslation"in e&&(a.translation=e.GeometricTranslation.value),"GeometricRotation"in e&&(a.rotation=e.GeometricRotation.value),"GeometricScaling"in e&&(a.scale=e.GeometricScaling.value),e=$s(a),this.genGeometry(t,n,o,e)}},{key:"genGeometry",value:function(e,t,r,n){var o,a,s=new i.BufferGeometry,l=(e.attrName&&(s.name=e.attrName),this.parseGeoNode(e,t)),u=this.genBuffers(l),c=new i.Float32BufferAttribute(u.vertex,3);return c.applyMatrix4(n),s.setAttribute("position",c),0<u.colors.length&&s.setAttribute("color",new i.Float32BufferAttribute(u.colors,3)),t&&(s.setAttribute("skinIndex",new i.Uint16BufferAttribute(u.weightsIndices,4)),s.setAttribute("skinWeight",new i.Float32BufferAttribute(u.vertexWeights,4)),s.FBX_Deformer=t),0<u.normal.length&&(c=(new i.Matrix3).getNormalMatrix(n),(t=new i.Float32BufferAttribute(u.normal,3)).applyNormalMatrix(c),s.setAttribute("normal",t)),u.uvs.forEach((function(e,t){var r="uv"+(t+1).toString();s.setAttribute(r=0===t?"uv":r,new i.Float32BufferAttribute(u.uvs[t],2))})),l.material&&"AllSame"!==l.material.mappingType&&(o=u.materialIndex[0],a=0,u.materialIndex.forEach((function(e,t){e!==o&&(s.addGroup(a,t-a,o),o=e,a=t)})),0<s.groups.length&&(t=(c=s.groups[s.groups.length-1]).start+c.count)!==u.materialIndex.length&&s.addGroup(t,u.materialIndex.length-t,o),0===s.groups.length&&s.addGroup(0,u.materialIndex.length,u.materialIndex[0])),this.addMorphTargets(s,e,r,n),s}},{key:"parseGeoNode",value:function(e,t){var r={};if(r.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],r.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];for(var n=0;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return r.weightTable={},null!==t&&(r.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(n,i){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:t,weight:e.weights[i]})}))})),r}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,i=!1,o=[],a=[],s=[],l=[],u=[],c=[],h=this;return e.vertexIndices.forEach((function(p,f){var d,m,v,g,y=!1,b=(p<0&&(p^=-1,y=!0),[]),x=[];if(o.push(3*p,3*p+1,3*p+2),e.color&&(g=Qs(f,r,p,e.color),s.push(g[0],g[1],g[2])),e.skeleton){for(void 0!==e.weightTable[p]&&e.weightTable[p].forEach((function(e){x.push(e.weight),b.push(e.id)})),4<x.length&&(i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0),m=[0,0,0,0],v=[0,0,0,0],x.forEach((function(e,t){var r=e,n=b[t];v.forEach((function(e,t,i){e<r&&(i[t]=r,r=e,i=m[t],m[t]=n,n=i)}))})),b=m,x=v);x.length<4;)x.push(0),b.push(0);for(var w=0;w<4;++w)u.push(x[w]),c.push(b[w])}e.normal&&(g=Qs(f,r,p,e.normal),a.push(g[0],g[1],g[2])),e.material&&"AllSame"!==e.material.mappingType&&(d=Qs(f,r,p,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=Qs(f,r,p,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),n++,y&&(h.genFace(t,e,o,d,a,s,l,u,c,n),r++,n=0,o=[],a=[],s=[],l=[],u=[],c=[])})),t}},{key:"genFace",value:function(e,t,r,n,i,o,a,s,l,u){for(var c=2;c<u;c++)!function(u){e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[3*(u-1)]]),e.vertex.push(t.vertexPositions[r[3*(u-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(u-1)+2]]),e.vertex.push(t.vertexPositions[r[3*u]]),e.vertex.push(t.vertexPositions[r[3*u+1]]),e.vertex.push(t.vertexPositions[r[3*u+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[4*(u-1)]),e.vertexWeights.push(s[4*(u-1)+1]),e.vertexWeights.push(s[4*(u-1)+2]),e.vertexWeights.push(s[4*(u-1)+3]),e.vertexWeights.push(s[4*u]),e.vertexWeights.push(s[4*u+1]),e.vertexWeights.push(s[4*u+2]),e.vertexWeights.push(s[4*u+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(u-1)]),e.weightsIndices.push(l[4*(u-1)+1]),e.weightsIndices.push(l[4*(u-1)+2]),e.weightsIndices.push(l[4*(u-1)+3]),e.weightsIndices.push(l[4*u]),e.weightsIndices.push(l[4*u+1]),e.weightsIndices.push(l[4*u+2]),e.weightsIndices.push(l[4*u+3])),t.color&&(e.colors.push(o[0]),e.colors.push(o[1]),e.colors.push(o[2]),e.colors.push(o[3*(u-1)]),e.colors.push(o[3*(u-1)+1]),e.colors.push(o[3*(u-1)+2]),e.colors.push(o[3*u]),e.colors.push(o[3*u+1]),e.colors.push(o[3*u+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(u-1)]),e.normal.push(i[3*(u-1)+1]),e.normal.push(i[3*(u-1)+2]),e.normal.push(i[3*u]),e.normal.push(i[3*u+1]),e.normal.push(i[3*u+2])),t.uv&&t.uv.forEach((function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(a[r][0]),e.uvs[r].push(a[r][1]),e.uvs[r].push(a[r][2*(u-1)]),e.uvs[r].push(a[r][2*(u-1)+1]),e.uvs[r].push(a[r][2*u]),e.uvs[r].push(a[r][2*u+1])}))}(c)}},{key:"addMorphTargets",value:function(e,t,r,n){var i;0!==r.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],i=this,r.forEach((function(r){r.rawTargets.forEach((function(r){var o=Rs.Objects.Geometry[r.geoID];void 0!==o&&i.genMorphGeometry(e,t,o,n,r.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,r,n,o){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var a=void 0!==r.Vertices?r.Vertices.a:[],s=void 0!==r.Indexes?r.Indexes.a:[],l=3*e.attributes.position.count,u=new Float32Array(l),c=0;c<s.length;c++){var h=3*s[c];u[h]=a[3*c],u[1+h]=a[3*c+1],u[2+h]=a[3*c+2]}l=this.genBuffers({vertexIndices:t,vertexPositions:u}),(t=new i.Float32BufferAttribute(l.vertex,3)).name=o||r.attrName,t.applyMatrix4(n),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.Normals.a,i=[];return"IndexToDirect"===r&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:i,mappingType:t,referenceType:r}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:2,buffer:e.UV.a,indices:n="IndexToDirect"===r?e.UVIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:4,buffer:e.Colors.a,indices:n="IndexToDirect"===r?e.ColorIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=e.Materials.a,i=[],o=0;o<n.length;++o)i.push(o);return{dataSize:1,buffer:n,indices:i,mappingType:t,referenceType:r}}},{key:"parseNurbsGeometry",value:function(e){if(void 0===Ls)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new i.BufferGeometry;var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new i.BufferGeometry;for(var r=t-1,n=(t=e.KnotVector.a,[]),o=e.Points.a,a=0,s=o.length;a<s;a+=4)n.push((new i.Vector4).fromArray(o,a));if("Closed"===e.Form)n.push(n[0]);else if("Periodic"===e.Form)for(var l=r,u=t.length-1-l,c=0;c<r;++c)n.push(n[c]);return e=new Ls(r,t,n,l,u).getPoints(12*n.length),(new i.BufferGeometry).setFromPoints(e)}}]),e}(),Vs=function(){function e(){Ds(this,e)}return js(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var r in t)r=t[r],r=this.addClip(r),e.push(r);return e}},{key:"parseClips",value:function(){var e;if(void 0!==Rs.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=Rs.Objects.AnimationCurveNode,r=new Map;for(e in t){var n=t[e];null!==n.attrName.match(/S|R|T|DeformPercent/)&&(n={id:n.id,attr:n.attrName,curves:{}},r.set(n.id,n))}return r}},{key:"parseAnimationCurves",value:function(e){var t,r=Rs.Objects.AnimationCurve;for(t in r){var n,i={id:r[t].id,times:r[t].KeyTime.a.map(Ys),values:r[t].KeyValueFloat.a},o=Os.get(i.id);void 0!==o&&(n=o.parents[0].ID,(o=o.parents[0].relationship).match(/X/)?e.get(n).curves.x=i:o.match(/Y/)?e.get(n).curves.y=i:o.match(/Z/)?e.get(n).curves.z=i:o.match(/d|DeformPercent/)&&e.has(n)&&(e.get(n).curves.morph=i))}}},{key:"parseAnimationLayers",value:function(e){var t,r=Rs.Objects.AnimationLayer,n=new Map;for(t in r)!function(t){var r=[],o=Os.get(parseInt(t));void 0!==o&&(o.children.forEach((function(t,n){if(e.has(t.ID)){var o=e.get(t.ID);if(void 0!==o.curves.x||void 0!==o.curves.y||void 0!==o.curves.z){if(void 0===r[n]){var a=Os.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==a){var s=Rs.Objects.Model[a.toString()];if(void 0===s)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var l={modelName:s.attrName?i.PropertyBinding.sanitizeNodeName(s.attrName):"",ID:s.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Cs.traverse((function(e){e.ID===s.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new i.Matrix4),"PreRotation"in s&&(l.preRotation=s.PreRotation.value),"PostRotation"in s&&(l.postRotation=s.PostRotation.value),r[n]=l}}r[n]&&(r[n][o.attr]=o)}else void 0!==o.curves.morph&&(void 0===r[n]&&(a=Os.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=Os.get(a).parents[0].ID,t=Os.get(t).parents[0].ID,t=Os.get(t).parents[0].ID,t={modelName:(t=Rs.Objects.Model[t]).attrName?i.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:Rs.Objects.Deformer[a].attrName},r[n]=t),r[n][o.attr]=o)}})),n.set(parseInt(t),r))}(t);return n}},{key:"parseAnimStacks",value:function(e){var t,r=Rs.Objects.AnimationStack,n={};for(t in r){var i=(1<(i=Os.get(parseInt(t)).children).length&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers."),e.get(i[0].ID));n[t]={name:r[t].attrName,layer:i}}return n}},{key:"addClip",value:function(e){var t=[],r=this;return e.layer.forEach((function(e){t=t.concat(r.generateTracks(e))})),new i.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new i.Vector3,n=new i.Quaternion,o=new i.Vector3;return e.transform&&e.transform.decompose(r,n,o),r=r.toArray(),n=(new i.Euler).setFromQuaternion(n,e.eulerOrder).toArray(),o=o.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(r=this.generateVectorTrack(e.modelName,e.T.curves,r,"position"))&&t.push(r),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(r=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(r),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale"))&&t.push(n),void 0!==e.DeformPercent&&void 0!==(r=this.generateMorphTrack(e))&&t.push(r),t}},{key:"generateVectorTrack",value:function(e,t,r,n){var o=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(o,t,r),new i.VectorKeyframeTrack(e+"."+n,o,t)}},{key:"generateRotationTrack",value:function(e,t,r,n,o,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(i.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(i.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(i.MathUtils.degToRad));for(var s=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(s,t,r),u=(void 0!==n&&((n=n.map(i.MathUtils.degToRad)).push(a),n=(new i.Euler).fromArray(n),n=(new i.Quaternion).setFromEuler(n)),void 0!==o&&((o=o.map(i.MathUtils.degToRad)).push(a),o=(new i.Euler).fromArray(o),o=(new i.Quaternion).setFromEuler(o).invert()),new i.Quaternion),c=new i.Euler,h=[],p=0;p<l.length;p+=3)c.set(l[p],l[p+1],l[p+2],a),u.setFromEuler(c),void 0!==n&&u.premultiply(n),void 0!==o&&u.multiply(o),u.toArray(h,p/3*4);return new i.QuaternionKeyframeTrack(e+".quaternion",s,h)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),n=Cs.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new i.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,r)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),1<(t=(t=void 0!==e.z?t.concat(e.z.times):t).sort((function(e,t){return e-t}))).length){for(var r=1,n=t[0],i=1;i<t.length;i++){var o=t[i];o!==n&&(n=t[r]=o,r++)}t=t.slice(0,r)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,r){var n=r,i=[],o=-1,a=-1,s=-1;return e.forEach((function(e){t.x&&(o=t.x.times.indexOf(e)),t.y&&(a=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),-1!==o?(e=t.x.values[o],i.push(e),n[0]=e):i.push(n[0]),-1!==a?(e=t.y.values[a],i.push(e),n[1]=e):i.push(n[1]),-1!==s?(e=t.z.values[s],i.push(e),n[2]=e):i.push(n[2])})),i}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var r=e.values[t-1],n=e.values[t]-r;if(180<=(i=Math.abs(n))){for(var i,o=n/(i/=180),a=r+o,s=(n=e.times[t-1],(e.times[t]-n)/i),l=n+s,u=[],c=[];l<e.times[t];)u.push(l),l+=s,c.push(a),a+=o;e.times=nl(e.times,t,u),e.values=nl(e.values,t,c)}}}}]),e}(),Hs=function(){function e(){Ds(this,e)}return js(e,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(e){this.nodeStack.push(e),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),--this.currentIndent}},{key:"setCurrentProp",value:function(e,t){this.currentProp=e,this.currentPropName=t}},{key:"parse",value:function(e){this.currentIndent=0,this.allNodes=new Xs,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,r=e.split(/[\r\n]+/);return r.forEach((function(e,n){var i,o=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);o||a||(o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),a=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),i=e.match("^\\t{"+(t.currentIndent-1)+"}}"),o?t.parseNodeBegin(e,o):a?t.parseNodeProperty(e,a,r[++n]):i?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var r=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:r}),i=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(r,n):r in i?("PoseNode"===r?i.PoseNode.push(n):void 0!==i[r].id&&(i[r]={},i[r][i[r].id]=i[r]),""!==t.id&&(i[r][t.id]=n)):"number"==typeof t.id?(i[r]={},i[r][t.id]=n):"Properties70"!==r&&(i[r]="PoseNode"===r?[n]:n),"number"==typeof t.id&&(n.id=t.id),""!==t.name&&(n.attrName=t.name),""!==t.type&&(n.attrType=t.type),this.pushStack(n)}},{key:"parseNodeAttr",value:function(e){var t=e[0],r=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),n="";return 1<e.length&&(r=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:r,type:n}}},{key:"parseNodeProperty",value:function(e,t,r){var n=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===n&&","===t&&(t=r.replace(/"/g,"").replace(/,$/,"").trim()),r=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,n,t);else{if("C"===n){e=t.split(",").slice(1);for(var i=parseInt(e[0]),o=(e=parseInt(e[1]),(o=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),a=(n="connections",t=[i,e]),s=o,l=0,u=a.length,c=s.length;l<c;l++,u++)a[u]=s[l];void 0===r[n]&&(r[n]=[])}"Node"===n&&(r.id=t),n in r&&Array.isArray(r[n])?r[n].push(t):"a"!==n?r[n]=t:r.a=t,this.setCurrentProp(r,n),"a"===n&&","!==t.slice(-1)&&(r.a=tl(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=tl(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,r){r=r.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":s=parseFloat(s);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":s=tl(s)}this.getPrevNode()[n]={type:i,type2:o,flag:a,value:s},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),Gs=function(){function t(){Ds(this,t)}return js(t,[{key:"parse",value:function(e){var t=new Ws(e),r=(t.skip(23),t.getUint32());if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new Xs;!this.endOfContent(t);){var i=this.parseNode(t,r);null!==i&&n.add(i.name,i)}return n}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var r={},n=7500<=t?e.getUint64():e.getUint32(),i=7500<=t?e.getUint64():e.getUint32(),o=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),a=e.getString(o);if(0===n)return null;for(var s=[],l=0;l<i;l++)s.push(this.parseProperty(e));o=0<s.length?s[0]:"";var u=1<s.length?s[1]:"",c=2<s.length?s[2]:"";for(r.singleProperty=1===i&&e.getOffset()===n;n>e.getOffset();){var h=this.parseNode(e,t);null!==h&&this.parseSubNode(a,r,h)}return r.propertyList=s,"number"==typeof o&&(r.id=o),""!==u&&(r.attrName=u),""!==c&&(r.attrType=c),""!==a&&(r.name=a),r}},{key:"parseSubNode",value:function(e,t,r){var n,i,o,a,s;!0===r.singleProperty?(i=r.propertyList[0],Array.isArray(i)?(t[r.name]=r).a=i:t[r.name]=i):"Connections"===e&&"C"===r.name?(n=[],r.propertyList.forEach((function(e,t){0!==t&&n.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(n)):"Properties70"===r.name?Object.keys(r).forEach((function(e){t[e]=r[e]})):"Properties70"===e&&"P"===r.name?(i=r.propertyList[0],e=r.propertyList[1],o=r.propertyList[2],a=r.propertyList[3],0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),s="Color"===(e=0===e.indexOf("Lcl ")?e.replace("Lcl ","Lcl_"):e)||"ColorRGB"===e||"Vector"===e||"Vector3D"===e||0===e.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[i]={type:e,type2:o,flag:a,value:s}):void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)}},{key:"parseProperty",value:function(t){var r=t.getString(1);switch(r){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return i=t.getUint32(),t.getArrayBuffer(i);case"S":return i=t.getUint32(),t.getString(i);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var n=t.getUint32(),i=t.getUint32(),o=t.getUint32();if(0===i)switch(r){case"b":case"c":return t.getBooleanArray(n);case"d":return t.getFloat64Array(n);case"f":return t.getFloat32Array(n);case"i":return t.getInt32Array(n);case"l":return t.getInt64Array(n)}void 0===e&&console.error("THREE.FBXLoader: External library fflate.min.js required."),i=Za(new Uint8Array(t.getArrayBuffer(o)));var a=new Ws(i.buffer);switch(r){case"b":case"c":return a.getBooleanArray(n);case"d":return a.getFloat64Array(n);case"f":return a.getFloat32Array(n);case"i":return a.getInt32Array(n);case"l":return a.getInt64Array(n)}default:throw new Error("THREE.FBXLoader: Unknown property type "+r)}}}]),t}(),Ws=function(){function e(t,r){Ds(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r}return js(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,-(4294967296*(t=4294967295==(e=4294967295&~e)?t+1&4294967295:t)+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){for(var t=[],r=0;r<e;r++)t[r]=this.getUint8();var n=t.indexOf(0);return 0<=n&&(t=t.slice(0,n)),i.LoaderUtils.decodeText(new Uint8Array(t))}}]),e}(),Xs=function(){function e(){Ds(this,e)}return js(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function qs(e){if(e=e.match(/FBXVersion: (\d+)/))return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Ys(e){return e/46186158e3}var Zs=[];function Qs(e,t,r,n){var i;switch(n.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=r;break;case"AllSame":i=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}for(var o=(i="IndexToDirect"===n.referenceType?n.indices[i]:i)*n.dataSize,a=o+n.dataSize,s=Zs,l=n.buffer,u=a,c=o,h=0;c<u;c++,h++)s[h]=l[c];return s}var Ks=new i.Euler,Js=new i.Vector3;function $s(e){var t=new i.Matrix4,r=new i.Matrix4,n=new i.Matrix4,o=new i.Matrix4,a=new i.Matrix4,s=new i.Matrix4,l=new i.Matrix4,u=new i.Matrix4,c=new i.Matrix4,h=new i.Matrix4,p=new i.Matrix4,f=new i.Matrix4,d=e.inheritType||0,m=(e.translation&&t.setPosition(Js.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(i.MathUtils.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(Ks.fromArray(m))),e.rotation&&((m=e.rotation.map(i.MathUtils.degToRad)).push(e.eulerOrder),n.makeRotationFromEuler(Ks.fromArray(m))),e.postRotation&&((m=e.postRotation.map(i.MathUtils.degToRad)).push(e.eulerOrder),o.makeRotationFromEuler(Ks.fromArray(m)),o.invert()),e.scale&&a.scale(Js.fromArray(e.scale)),e.scalingOffset&&l.setPosition(Js.fromArray(e.scalingOffset)),e.scalingPivot&&s.setPosition(Js.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(Js.fromArray(e.rotationOffset)),e.rotationPivot&&c.setPosition(Js.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(p.copy(e.parentMatrix),h.copy(e.parentMatrixWorld)),r.clone().multiply(n).multiply(o)),v=(((e=new i.Matrix4).extractRotation(h),v=new i.Matrix4).copyPosition(h),v.clone().invert().multiply(h)),g=(v=e.clone().invert().multiply(v),a),y=new i.Matrix4;return 0===d?y.copy(e).multiply(m).multiply(v).multiply(g):1===d?y.copy(e).multiply(v).multiply(m).multiply(g):(d=(new i.Matrix4).scale((new i.Vector3).setFromMatrixScale(p)).clone().invert(),p=v.clone().multiply(d),y.copy(e).multiply(m).multiply(p).multiply(g)),v=c.clone().invert(),d=s.clone().invert(),e=t.clone().multiply(u).multiply(c).multiply(r).multiply(n).multiply(o).multiply(v).multiply(l).multiply(s).multiply(a).multiply(d),m=(new i.Matrix4).copyPosition(e),p=h.clone().multiply(m),f.copyPosition(p),(e=f.clone().multiply(y)).premultiply(h.invert()),e}function el(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function tl(e){return e.split(",").map((function(e){return parseFloat(e)}))}function rl(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),i.LoaderUtils.decodeText(new Uint8Array(e,t,r))}function nl(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function il(e){return(il="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ol(e,t){return(ol=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function al(e){return(al=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var sl=/^[og]\s*(.+)?/,ll=/^mtllib /,ul=/^usemtl /,cl=/^usemap /,hl=new i.Vector3,pl=new i.Vector3,fl=new i.Vector3,dl=new i.Vector3,ml=new i.Vector3,vl=new i.Color;function gl(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var r=this._finalize(!1);return r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==r?r:this).smooth,groupStart:void 0!==r?r.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){return(e={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1}).clone=this.clone.bind(e),e}},this.materials.push(e),e},currentMaterial:function(){if(0<this.materials.length)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var r=this.materials.length-1;0<=r;r--)this.materials[r].groupCount<=0&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone&&((e=r.clone(0)).inherited=!0,this.object.materials.push(e)),this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseNormalIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseUVIndex:function(e,t){return 2*(0<=(e=parseInt(e,10))?e-1:e+t/2)},addVertex:function(e,t,r){var n=this.vertices,i=this.object.geometry.vertices;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[r+0],n[r+1],n[r+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){var n=this.normals,i=this.object.geometry.normals;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[r+0],n[r+1],n[r+2])},addFaceNormal:function(e,t,r){var n=this.vertices,i=this.object.geometry.normals;hl.fromArray(n,e),pl.fromArray(n,t),fl.fromArray(n,r),ml.subVectors(fl,pl),dl.subVectors(hl,pl),ml.cross(dl),ml.normalize(),i.push(ml.x,ml.y,ml.z),i.push(ml.x,ml.y,ml.z),i.push(ml.x,ml.y,ml.z)},addColor:function(e,t,r){var n=this.colors,i=this.object.geometry.colors;void 0!==n[e]&&i.push(n[e+0],n[e+1],n[e+2]),void 0!==n[t]&&i.push(n[t+0],n[t+1],n[t+2]),void 0!==n[r]&&i.push(n[r+0],n[r+1],n[r+2])},addUV:function(e,t,r){var n=this.uvs,i=this.object.geometry.uvs;i.push(n[e+0],n[e+1]),i.push(n[t+0],n[t+1]),i.push(n[r+0],n[r+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,n,i,o,a,s,l){var u=this.vertices.length;e=this.parseVertexIndex(e,u),t=this.parseVertexIndex(t,u),r=this.parseVertexIndex(r,u),this.addVertex(e,t,r),this.addColor(e,t,r),void 0!==a&&""!==a?(u=this.normals.length,e=this.parseNormalIndex(a,u),t=this.parseNormalIndex(s,u),r=this.parseNormalIndex(l,u),this.addNormal(e,t,r)):this.addFaceNormal(e,t,r),void 0!==n&&""!==n?(a=this.uvs.length,e=this.parseUVIndex(n,a),t=this.parseUVIndex(i,a),r=this.parseUVIndex(o,a),this.addUV(e,t,r),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,r=0,n=e.length;r<n;r++){var i=this.parseVertexIndex(e[r],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,n=this.uvs.length,i=0,o=e.length;i<o;i++)this.addVertexLine(this.parseVertexIndex(e[i],r));for(var a=0,s=t.length;a<s;a++)this.addUVLine(this.parseUVIndex(t[a],n))}};return e.startObject("",!1),e}var yl=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ol(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=al(e);if(r=t?(r=al(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===il(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"load",value:function(e,t,r,n){var o=this,a=new i.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(r){try{t(o.parse(r))}catch(r){n?n(r):console.error(r),o.manager.itemError(e)}}),r,n)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t,r,n,o=new gl,a=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),s="",l=[],u="function"==typeof"".trimLeft,c=0,h=a.length;c<h;c++)if(s=a[c],0!==(s=u?s.trimLeft():s.trim()).length&&"#"!==(t=s.charAt(0)))if("v"===t){var p=s.split(/\s+/);switch(p[0]){case"v":o.vertices.push(parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3])),7<=p.length?(vl.setRGB(parseFloat(p[4]),parseFloat(p[5]),parseFloat(p[6])).convertSRGBToLinear(),o.colors.push(vl.r,vl.g,vl.b)):o.colors.push(void 0,void 0,void 0);break;case"vn":o.normals.push(parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3]));break;case"vt":o.uvs.push(parseFloat(p[1]),parseFloat(p[2]))}}else if("f"===t){for(var f=s.slice(1).trim().split(/\s+/),d=[],m=0,v=f.length;m<v;m++){var g=f[m];0<g.length&&(g=g.split("/"),d.push(g))}for(var y=d[0],b=1,x=d.length-1;b<x;b++){var w=d[b],S=d[b+1];o.addFace(y[0],w[0],S[0],y[1],w[1],S[1],y[2],w[2],S[2])}}else if("l"===t){var T=s.substring(1).trim().split(" "),_=[],M=[];if(-1===s.indexOf("/"))_=T;else for(var E=0,P=T.length;E<P;E++){var k=T[E].split("/");""!==k[0]&&_.push(k[0]),""!==k[1]&&M.push(k[1])}o.addLineGeometry(_,M)}else"p"===t?(r=s.slice(1).trim().split(" "),o.addPointGeometry(r)):null!==(l=sl.exec(s))?(r=(" "+l[0].slice(1).trim()).slice(1),o.startObject(r)):ul.test(s)?o.object.startMaterial(s.substring(7).trim(),o.materialLibraries):ll.test(s)?o.materialLibraries.push(s.substring(7).trim()):cl.test(s)?console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'):"s"===t?(1<(l=s.split(" ")).length?(n=l[1].trim().toLowerCase(),o.object.smooth="0"!==n&&"off"!==n):o.object.smooth=!0,(n=o.object.currentMaterial())&&(n.smooth=o.object.smooth)):"\0"!==s&&console.warn('THREE.OBJLoader: Unexpected line: "'+s+'"');o.finalize();var R,O=new i.Group;if(1==(O.materialLibraries=[].concat(o.materialLibraries),e=!(1===o.objects.length&&0===o.objects[0].geometry.vertices.length)))for(var C=0,L=o.objects.length;C<L;C++){var A=o.objects[C],D=A.geometry,I=A.materials,j="Line"===D.type,U="Points"===D.type,B=!1;if(0!==D.vertices.length){for(var N=new i.BufferGeometry,F=(N.setAttribute("position",new i.Float32BufferAttribute(D.vertices,3)),0<D.normals.length&&N.setAttribute("normal",new i.Float32BufferAttribute(D.normals,3)),0<D.colors.length&&(B=!0,N.setAttribute("color",new i.Float32BufferAttribute(D.colors,3))),!0===D.hasUVIndices&&N.setAttribute("uv",new i.Float32BufferAttribute(D.uvs,2)),[]),z=0,V=I.length;z<V;z++){var H,G=I[z],W=G.name+"_"+G.smooth+"_"+B,X=o.materials[W];null!==this.materials&&(X=this.materials.create(G.name),!j||!X||X instanceof i.LineBasicMaterial?!U||!X||X instanceof i.PointsMaterial||(H=new i.PointsMaterial({size:10,sizeAttenuation:!1}),i.Material.prototype.copy.call(H,X),H.color.copy(X.color),H.map=X.map,X=H):(H=new i.LineBasicMaterial,i.Material.prototype.copy.call(H,X),H.color.copy(X.color),X=H)),void 0===X&&((X=j?new i.LineBasicMaterial:U?new i.PointsMaterial({size:1,sizeAttenuation:!1}):new i.MeshPhongMaterial).name=G.name,X.flatShading=!G.smooth,X.vertexColors=B,o.materials[W]=X),F.push(X)}if(D=void 0,1<F.length){for(var q=0,Y=I.length;q<Y;q++){var Z=I[q];N.addGroup(Z.groupStart,Z.groupCount,q)}D=new(j?i.LineSegments:U?i.Points:i.Mesh)(N,F)}else D=new(j?i.LineSegments:U?i.Points:i.Mesh)(N,F[0]);D.name=A.name,O.add(D)}}else 0<o.vertices.length&&(e=new i.PointsMaterial({size:1,sizeAttenuation:!1}),(R=new i.BufferGeometry).setAttribute("position",new i.Float32BufferAttribute(o.vertices,3)),0<o.colors.length&&void 0!==o.colors[0]&&(R.setAttribute("color",new i.Float32BufferAttribute(o.colors,3)),e.vertexColors=!0),R=new i.Points(R,e),O.add(R));return O}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(i.Loader),bl=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};class xl{constructor(e){this.parses={fbx:new Ns,obj:new yl},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parse(e){if(e instanceof Array)return e.map((e=>this.parse(e)));if(-1!==e.type.indexOf("image"))return this.img(e);let t;switch(this.getBack(e).toLowerCase()){case"gltf":case"glb":t=this.glb(e);break;case"fbx":t=this.fbx(e);break;case"obj":t=this.obj(e)}return t}img(e){console.log(e,"file")}glb(e){return bl(this,void 0,void 0,(function*(){var t=yield(0,he.toResult)(e,"arrayBuffer");return this.runScene.loaderer.gltf.parse(t)}))}fbx(e){return bl(this,void 0,void 0,(function*(){var t=yield(0,he.toResult)(e,"arrayBuffer");const r=this.parses.fbx.parse(t,"");r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),this.runScene.modelEx.add(this.runScene.sceneEx.cleanUnlessLevel(r))}))}obj(e){return bl(this,void 0,void 0,(function*(){var t=yield(0,he.toResult)(e,"text");const r=this.parses.obj.parse(t);r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),this.runScene.modelEx.add(this.runScene.sceneEx.cleanUnlessLevel(r))}))}}function wl(e){return(wl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Sl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tl(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _l(e,t,r){t&&Tl(e.prototype,t),r&&Tl(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Ml(){return(Ml="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ol(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function El(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Pl(e,t)}function Pl(e,t){return(Pl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function kl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ol(e);if(r=t?(r=Ol(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===wl(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Rl(n)}}function Rl(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ol(e){return(Ol=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Cl=new i.Raycaster,Ll=new i.Vector3,Al=new i.Vector3,Dl=new i.Quaternion,Il={X:new i.Vector3(1,0,0),Y:new i.Vector3(0,1,0),Z:new i.Vector3(0,0,1)},jl={type:"change"},Ul={type:"mouseDown"},Bl={type:"mouseUp",mode:null},Nl={type:"objectChange"};function Fl(e,t,r){for(var n=t.intersectObject(e,!0),i=0;i<n.length;i++)if(n[i].object.visible||r)return n[i];return!1}Wi=function(){El(t,i.Object3D);var e=kl(t);function t(r,n){Sl(this,t),o=e.call(this),void 0===n&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),n=document),o.visible=!1,o.domElement=n,o.domElement.style.touchAction="none";var o,a=new tu,s=(o._gizmo=a,o.add(a),new ru),l=(o._plane=s,o.add(s),Rl(o));function u(e,t){var r=t;Object.defineProperty(l,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,s[e]=t,a[e]=t,l.dispatchEvent({type:e+"-changed",value:t}),l.dispatchEvent(jl))}}),l[e]=t,s[e]=t,a[e]=t}u("camera",r),u("object",void 0),u("enabled",!0),u("axis",null),u("mode","translate"),u("translationSnap",null),u("rotationSnap",null),u("scaleSnap",null),u("space","world"),u("size",1),u("dragging",!1),u("showX",!0),u("showY",!0),u("showZ",!0),n=new i.Vector3,r=new i.Vector3;var c=new i.Quaternion,h=new i.Quaternion,p=new i.Vector3,f=new i.Quaternion,d=new i.Vector3,m=new i.Vector3,v=new i.Vector3,g=new i.Vector3;return u("worldPosition",n),u("worldPositionStart",r),u("worldQuaternion",c),u("worldQuaternionStart",h),u("cameraPosition",p),u("cameraQuaternion",f),u("pointStart",d),u("pointEnd",m),u("rotationAxis",v),u("rotationAngle",0),u("eye",g),o._offset=new i.Vector3,o._startNorm=new i.Vector3,o._endNorm=new i.Vector3,o._cameraScale=new i.Vector3,o._parentPosition=new i.Vector3,o._parentQuaternion=new i.Quaternion,o._parentQuaternionInv=new i.Quaternion,o._parentScale=new i.Vector3,o._worldScaleStart=new i.Vector3,o._worldQuaternionInv=new i.Quaternion,o._worldScale=new i.Vector3,o._positionStart=new i.Vector3,o._quaternionStart=new i.Quaternion,o._scaleStart=new i.Vector3,o._getPointer=function(e){var t;return this.domElement.ownerDocument.pointerLockElement?{x:0,y:0,button:e.button}:(t=this.domElement.getBoundingClientRect(),{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button})}.bind(Rl(o)),o._onPointerDown=function(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}.bind(Rl(o)),o._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(Rl(o)),o._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(Rl(o)),o._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(Rl(o)),o.domElement.addEventListener("pointerdown",o._onPointerDown),o.domElement.addEventListener("pointermove",o._onPointerHover),o.domElement.addEventListener("pointerup",o._onPointerUp),o}return _l(t,[{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),Ml(Ol(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(Cl.setFromCamera(e,this.camera),e=Fl(this._gizmo.picker[this.mode],Cl),this.axis=e?e.object.name:null)}},{key:"pointerDown",value:function(e){void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis&&(Cl.setFromCamera(e,this.camera),(e=Fl(this._plane,Cl,!0))&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,Ul.mode=this.mode,this.dispatchEvent(Ul))}},{key:"pointerMove",value:function(e){var t=this.axis,r=this.mode,n=this.object,i=this.space;"scale"===r?i="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(i="world"),void 0!==n&&null!==t&&!1!==this.dragging&&-1===e.button&&(Cl.setFromCamera(e,this.camera),(e=Fl(this._plane,Cl,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===r?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===i&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),("local"===i&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart):this._offset.applyQuaternion(this._parentQuaternionInv)).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===i&&(n.position.applyQuaternion(Dl.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),"world"===i&&(n.parent&&n.position.add(Ll.setFromMatrixPosition(n.parent.matrixWorld)),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(Ll.setFromMatrixPosition(n.parent.matrixWorld))))):"scale"===r?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),Al.set(e,e,e)):(Ll.copy(this.pointStart),Al.copy(this.pointEnd),Ll.applyQuaternion(this._worldQuaternionInv),Al.applyQuaternion(this._worldQuaternionInv),Al.divide(Ll),-1===t.search("X")&&(Al.x=1),-1===t.search("Y")&&(Al.y=1),-1===t.search("Z")&&(Al.z=1)),n.scale.copy(this._scaleStart).multiply(Al),this.scaleSnap&&(-1!==t.search("X")&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===r&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(Ll.setFromMatrixPosition(this.camera.matrixWorld)),"E"===t?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Ll.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(Il[t]),Ll.copy(Il[t]),"local"===i&&Ll.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(Ll.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===i&&"E"!==t&&"XYZE"!==t?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(Dl.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(Dl.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(jl),this.dispatchEvent(Nl)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(Bl.mode=this.mode,this.dispatchEvent(Bl)),this.dragging=!1,this.axis=null)}},{key:"dispose",value:function(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,this}},{key:"reset",value:function(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(jl),this.dispatchEvent(Nl),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return Cl}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSize",value:function(e){this.size=e}},{key:"setSpace",value:function(e){this.space=e}},{key:"update",value:function(){console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}}]),t}(),Wi.prototype.isTransformControls=!0;var zl=new i.Euler,Vl=new i.Vector3(0,1,0),Hl=new i.Vector3(0,0,0),Gl=new i.Matrix4,Wl=new i.Quaternion,Xl=new i.Quaternion,ql=new i.Vector3,Yl=new i.Matrix4,Zl=new i.Vector3(1,0,0),Ql=new i.Vector3(0,1,0),Kl=new i.Vector3(0,0,1),Jl=new i.Vector3,$l=new i.Vector3,eu=new i.Vector3,tu=function(){El(t,i.Object3D);var e=kl(t);function t(){Sl(this,t),(r=e.call(this)).type="TransformControlsGizmo";var r,n=new i.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=new i.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),a=n.clone(),s=((((a.opacity=.15,o=o.clone()).opacity=.5,x=n.clone()).color.setHex(16711680),w=n.clone()).color.setHex(65280),n.clone()),l=(s.color.setHex(255),n.clone()),u=(l.color.setHex(16711680),l.opacity=.5,n.clone()),c=(u.color.setHex(65280),u.opacity=.5,n.clone()),h=(c.color.setHex(255),c.opacity=.5,n.clone());(h.opacity=.25,y=n.clone()).color.setHex(16776960),y.opacity=.25,n.clone().color.setHex(16776960);var p=(((n=n.clone()).color.setHex(7895160),m=new i.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new i.BoxGeometry(.08,.08,.08)),f=(p.translate(0,.04,0),new i.BufferGeometry);function d(e,t){return(e=new i.TorusGeometry(e,.0075,3,64,t*Math.PI*2)).rotateY(Math.PI/2),e.rotateX(Math.PI/2),e}(f.setAttribute("position",new i.Float32BufferAttribute([0,0,0,1,0,0],3)),S=new i.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var m={X:[[new i.Mesh(m,x),[.5,0,0],[0,0,-Math.PI/2]],[new i.Mesh(m,x),[-.5,0,0],[0,0,Math.PI/2]],[new i.Mesh(S,x),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new i.Mesh(m,w),[0,.5,0]],[new i.Mesh(m,w),[0,-.5,0],[Math.PI,0,0]],[new i.Mesh(S,w)]],Z:[[new i.Mesh(m,s),[0,0,.5],[Math.PI/2,0,0]],[new i.Mesh(m,s),[0,0,-.5],[-Math.PI/2,0,0]],[new i.Mesh(S,s),null,[Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.OctahedronGeometry(.1,0),h.clone()),[0,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),c.clone()),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),l.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},v={X:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),a),[.3,0,0],[0,0,-Math.PI/2]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),a),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),a),[0,.3,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),a),[0,-.3,0],[0,0,Math.PI]]],Z:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),a),[0,0,.3],[Math.PI/2,0,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),a),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.OctahedronGeometry(.2,0),a)]],XY:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),a),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),a),[.15,0,.15],[-Math.PI/2,0,0]]]},g={START:[[new i.Mesh(new i.OctahedronGeometry(.01,2),o),null,null,null,"helper"]],END:[[new i.Mesh(new i.OctahedronGeometry(.01,2),o),null,null,null,"helper"]],DELTA:[[new i.Line(((g=new i.BufferGeometry).setAttribute("position",new i.Float32BufferAttribute([0,0,0,1,1,1],3)),g),o),null,null,null,"helper"]],X:[[new i.Line(f,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new i.Line(f,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new i.Line(f,o.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},y=(n={XYZE:[[new i.Mesh(d(.5,1),n),null,[0,Math.PI/2,0]]],X:[[new i.Mesh(d(.5,.5),x)]],Y:[[new i.Mesh(d(.5,.5),w),null,[0,0,-Math.PI/2]]],Z:[[new i.Mesh(d(.5,.5),s),null,[0,Math.PI/2,0]]],E:[[new i.Mesh(d(.75,1),y),null,[0,Math.PI/2,0]]]},{AXIS:[[new i.Line(f,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),b={XYZE:[[new i.Mesh(new i.SphereGeometry(.25,10,8),a)]],X:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),a),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),a),[0,0,0],[Math.PI/2,0,0]]],Z:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),a),[0,0,0],[0,0,-Math.PI/2]]],E:[[new i.Mesh(new i.TorusGeometry(.75,.1,2,24),a)]]},x={X:[[new i.Mesh(p,x),[.5,0,0],[0,0,-Math.PI/2]],[new i.Mesh(S,x),[0,0,0],[0,0,-Math.PI/2]],[new i.Mesh(p,x),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(p,w),[0,.5,0]],[new i.Mesh(S,w)],[new i.Mesh(p,w),[0,-.5,0],[0,0,Math.PI]]],Z:[[new i.Mesh(p,s),[0,0,.5],[Math.PI/2,0,0]],[new i.Mesh(S,s),[0,0,0],[Math.PI/2,0,0]],[new i.Mesh(p,s),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),c),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),u),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.BoxGeometry(.1,.1,.1),h.clone())]]},w={X:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),a),[.3,0,0],[0,0,-Math.PI/2]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),a),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),a),[0,.3,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),a),[0,-.3,0],[0,0,Math.PI]]],Z:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),a),[0,0,.3],[Math.PI/2,0,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),a),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),a),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),a),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.2),a),[0,0,0]]]},S={X:[[new i.Line(f,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new i.Line(f,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new i.Line(f,o.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function T(e){var t,r=new i.Object3D;for(t in e)for(var n=e[t].length;n--;){var o=e[t][n][0].clone(),a=e[t][n][1],s=e[t][n][2],l=e[t][n][3],u=e[t][n][4];(o.name=t,o.tag=u,a&&o.position.set(a[0],a[1],a[2]),s&&o.rotation.set(s[0],s[1],s[2]),l&&o.scale.set(l[0],l[1],l[2]),o.updateMatrix(),u=o.geometry.clone()).applyMatrix4(o.matrix),o.geometry=u,o.renderOrder=1/0,o.position.set(0,0,0),o.rotation.set(0,0,0),o.scale.set(1,1,1),r.add(o)}return r}return r.gizmo={},r.picker={},r.helper={},r.add(r.gizmo.translate=T(m)),r.add(r.gizmo.rotate=T(n)),r.add(r.gizmo.scale=T(x)),r.add(r.picker.translate=T(v)),r.add(r.picker.rotate=T(b)),r.add(r.picker.scale=T(w)),r.add(r.helper.translate=T(g)),r.add(r.helper.rotate=T(y)),r.add(r.helper.scale=T(S)),r.picker.translate.visible=!1,r.picker.rotate.visible=!1,r.picker.scale.visible=!1,r}return _l(t,[{key:"updateMatrixWorld",value:function(e){var r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:Xl,i=(this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode,[]);i=(i=(i=i.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var o=0;o<i.length;o++)!function(e){var t=i[e];if(t.visible=!0,t.rotation.set(0,0,0),e=void t.position.copy(r.worldPosition),e=r.camera.isOrthographicCamera?(r.camera.top-r.camera.bottom)/r.camera.zoom:r.worldPosition.distanceTo(r.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*r.camera.fov/360)/r.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*r.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.position.copy(r.worldPositionStart),t.visible=!!r.axis,"X"===r.axis&&(Dl.setFromEuler(zl.set(0,0,0)),t.quaternion.copy(n).multiply(Dl),.9<Math.abs(Vl.copy(Zl).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(Dl.setFromEuler(zl.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(Dl),.9<Math.abs(Vl.copy(Ql).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(Dl.setFromEuler(zl.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(Dl),.9<Math.abs(Vl.copy(Kl).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(Dl.setFromEuler(zl.set(0,Math.PI/2,0)),Vl.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(Gl.lookAt(Hl,Vl,Ql)),t.quaternion.multiply(Dl),t.visible=r.dragging),"E"===r.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(r.worldPositionStart),t.visible=r.dragging):"END"===t.name?(t.position.copy(r.worldPosition),t.visible=r.dragging):"DELTA"===t.name?(t.position.copy(r.worldPositionStart),t.quaternion.copy(r.worldQuaternionStart),Ll.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),Ll.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(Ll),t.visible=r.dragging):(t.quaternion.copy(n),r.dragging?t.position.copy(r.worldPositionStart):t.position.copy(r.worldPosition),r.axis&&(t.visible=-1!==r.axis.search(t.name)));t.quaternion.copy(n),"translate"===r.mode||"scale"===r.mode?("X"===t.name&&.99<Math.abs(Vl.copy(Zl).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(Vl.copy(Ql).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(Vl.copy(Kl).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(Vl.copy(Kl).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(Vl.copy(Zl).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(Vl.copy(Ql).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(Wl.copy(n),Vl.copy(r.eye).applyQuaternion(Dl.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(Gl.lookAt(r.eye,Hl,Ql)),"X"===t.name&&(Dl.setFromAxisAngle(Zl,Math.atan2(-Vl.y,Vl.z)),Dl.multiplyQuaternions(Wl,Dl),t.quaternion.copy(Dl)),"Y"===t.name&&(Dl.setFromAxisAngle(Ql,Math.atan2(Vl.x,Vl.z)),Dl.multiplyQuaternions(Wl,Dl),t.quaternion.copy(Dl)),"Z"===t.name&&(Dl.setFromAxisAngle(Kl,Math.atan2(Vl.y,Vl.x)),Dl.multiplyQuaternions(Wl,Dl),t.quaternion.copy(Dl))),t.visible=t.visible&&(-1===t.name.indexOf("X")||r.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||r.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||r.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||r.showX&&r.showY&&r.showZ),t.material._color=t.material._color||t.material.color.clone(),t.material._opacity=t.material._opacity||t.material.opacity,t.material.color.copy(t.material._color),t.material.opacity=t.material._opacity,r.enabled&&r.axis&&(t.name===r.axis||r.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}(o);Ml(Ol(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),ru=(tu.prototype.isTransformControlsGizmo=!0,function(){El(t,i.Mesh);var e=kl(t);function t(){var r;return Sl(this,t),(r=e.call(this,new i.PlaneGeometry(1e5,1e5,2,2),new i.MeshBasicMaterial({visible:!1,wireframe:!0,side:i.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).type="TransformControlsPlane",r}return _l(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),Jl.copy(Zl).applyQuaternion("local"===r?this.worldQuaternion:Xl),$l.copy(Ql).applyQuaternion("local"===r?this.worldQuaternion:Xl),eu.copy(Kl).applyQuaternion("local"===r?this.worldQuaternion:Xl),Vl.copy($l),this.mode){case"translate":case"scale":switch(this.axis){case"X":Vl.copy(this.eye).cross(Jl),ql.copy(Jl).cross(Vl);break;case"Y":Vl.copy(this.eye).cross($l),ql.copy($l).cross(Vl);break;case"Z":Vl.copy(this.eye).cross(eu),ql.copy(eu).cross(Vl);break;case"XY":ql.copy(eu);break;case"YZ":ql.copy(Jl);break;case"XZ":Vl.copy(eu),ql.copy($l);break;case"XYZ":case"E":ql.set(0,0,0)}break;default:ql.set(0,0,0)}0===ql.length()?this.quaternion.copy(this.cameraQuaternion):(Yl.lookAt(Ll.set(0,0,0),ql,Vl),this.quaternion.setFromRotationMatrix(Yl)),Ml(Ol(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}());ru.prototype.isTransformControlsPlane=!0;class nu extends Wi{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new i.Vector3,this.beginScale=new i.Vector3,this.posStart=new i.Vector2,this.posEnd=new i.Vector2,this.deleteRedundantParts()}deleteRedundantParts(){this.transGizmo.gizmo.translate.children.splice(1,1),this.transGizmo.gizmo.translate.children.splice(3,1),this.transGizmo.gizmo.translate.children.splice(5,1),this.transGizmo.gizmo.scale.children.splice(0,1),this.transGizmo.gizmo.scale.children.splice(2,1),this.transGizmo.gizmo.scale.children.splice(4,1)}pointerDown(e){void 0===this.object||null===this.axis||this.dragging||0!==e.button||(this.posStart.set(e.x,e.y),this.beginScale.set(this.object.scale.x,this.object.scale.y,this.object.scale.z),super.pointerDown(e))}pointerMove(e){if(super.pointerMove(e),void 0!==this.object&&null!==this.axis&&this.dragging&&-1===e.button&&"scale"===this.mode&&-1!==this.axis.search("XYZ")){this.posEnd.set(e.x,e.y),e=(Math.abs(this.beginScale.x)+Math.abs(this.beginScale.y)+Math.abs(this.beginScale.z))/3;let t=12*this.pointStart.distanceTo(this.pointEnd)/e;this.posEnd.x>this.posStart.x&&(t*=-1),(t=-1.1<t&&t<1.1?1:t)<0&&(t=-1.1/t),this.scaleCoefficient.set(t,t,t),this.object.scale.copy(this._scaleStart).multiply(this.scaleCoefficient)}}}class iu{constructor(e){this.grid=null,this.transContro=null,this.boxHelper=null,this.deepIsHelper=e=>"Scene"===e.type||!this.isHelper(e)&&!!e.parent&&this.deepIsHelper(e.parent),this.getBoxHelper=e=>(e=new i.BoxHelper(e),this.setHelper(e),this.runScene.assetsEx.get().scene.add(e),e),this.runScene=e,"running"!==this.runScene.optionsEx.options.mode&&(this.transContro=new class{constructor(e){this.tansControls=null,this.controlsMode="position",this.isDraggingChange=!1,this.modelNewVal=new An.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.multipObj=null,this.worldOldVal=new An.Vector3,this.draggingChanged=e=>{const t=this.runScene.assetsEx.get().controls;var r=this.controlsMode;let n=this.runScene.modelEx.select;if(e.value){if(!this.runScene.multipSelector.isEmpty()){t.enabled=!1;const e=this.runScene.multipSelector.getLast();this.multipSelectLast=e,this.worldOldVal=Hn(e,this.runScene.sceneEx.get())}}else if(!t.enabled&&!this.runScene.multipSelector.isEmpty()&&this.multipSelectLast){const e=this.multipSelectLast;this.multipObj=e,this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene);var i=Hn(e,this.runScene.sceneEx.get());this.runScene.multipSelector.setInfo(e,r,this.modelNewVal,e[r],i,this.worldOldVal),this.runScene.modelEx.selectNull(),this.multipSelectLast=void 0}if(this.runScene.multipSelector.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,!n){if(this.runScene.multipSelector.isEmpty())return;n=this.runScene.multipSelector.getLast()}t.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(n[r]),this.isDraggingChange=!0,this.worldOldVal=Hn(n,this.runScene.sceneEx.get())):(this.runScene.multipSelector.isEmpty()?this.runScene.modelEx.setV3({model:n,info:r,newV3:this.runScene.modelEx.cloneV3(n[r]),oldV3:this.modelNewVal},!0,!1):(this.multipObj=n,this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),i=Hn(n,this.runScene.sceneEx.get()),this.runScene.multipSelector.setInfo(n,r,this.modelNewVal,n[r],i,this.worldOldVal)),this.isDraggingChange=!1),this.runScene.assetsEx.get().controls.enabled=!e.value},this.runScene=e}init(){const{camera:e,renderer:t,scene:r}=this.runScene.assetsEx;this.tansControls=new nu(e,t.domElement),this.tansControls.addEventListener("dragging-changed",this.draggingChanged),this.tansControls.addEventListener("change",this.transChangeFn.bind(this)),this.tansControls.name="helper",r.add(this.tansControls),this.tansControls.traverse((e=>e.isHelper=!0))}changeMode(e){this.controlsMode=e,this.tansControls.setMode(this.transControlsStatusMap[e])}transControSize(e){this.tansControls.setSize(e?this.tansControls.size+.1:Math.max(this.tansControls.size-.1,.1))}changeState(e){this.tansControls.enabled=e}addObject(e){this.removeFocus(),this.tansControls.attach(e)}removeFocus(){this.tansControls.detach()}changeSpaceState(){this.tansControls.setSpace("local"===this.tansControls.space?"world":"local"),this.tansControls.detach()}transChangeFn(e){var t=this.runScene.modelEx.select;t&&(this.runScene.lightEx.update(t),this.runScene.helperEx.boxHelper.setFromObject(t))}close(){this.tansControls.enabled=!1}open(){this.tansControls.enabled=!0}reset(){this.dispose(),this.init()}dispose(){this.tansControls&&(this.tansControls.removeEventListener("dragging-changed",this.draggingChanged),this.tansControls.removeEventListener("change",this.transChangeFn),this.tansControls.dispose(),this.runScene.assetsEx.get().scene.remove(this.tansControls))}}(e),this.grid=this.createGrid(),console.log(this.transContro,"this.transContro "))}init(){"running"!==this.runScene.optionsEx.options.mode&&(this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid))}createGrid(){const e=new An.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material instanceof i.Material&&(e.material.opacity=.75,e.material.transparent=!0),e}dispose(){}reset(){"running"!==this.runScene.optionsEx.options.mode&&this.transContro.reset()}isHelper(e){return"GridHelper"===e.type||"CubeCamera"===e.type||e.isTransformControls||e.userData.isHelper}setHelper(e,t=!1,r){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,r&&r(e)})),e}focus(e){"running"!==this.runScene.optionsEx.options.mode&&(this.boxHelper||(this.boxHelper=this.getBoxHelper(e)),this.transContro.addObject(e),this.boxHelper.setFromObject(e),this.focusModelId=this.runScene.uniqueEx.getId(e))}unfocus(){var e;"running"!==this.runScene.optionsEx.options.mode&&(this.transContro.removeFocus(),null!=(e=this.boxHelper)&&e.setFromObject(this.runScene.assetsEx.get().scene),this.focusModelId=void 0)}}function ou(e){return(ou="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function au(e,t){return(au=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function su(e){return(su=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var lu=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&au(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=su(e);if(r=t?(r=su(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ou(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var o=new i.BufferGeometry,a=(o.setAttribute("position",new i.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),o.computeBoundingSphere(),new i.LineBasicMaterial({fog:!1}));return((o=r.call(this,o,a)).light=e,o.color=t,o.type="RectAreaLightHelper",a=new i.BufferGeometry).setAttribute("position",new i.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),a.computeBoundingSphere(),o.add(new i.Mesh(a,new i.MeshBasicMaterial({side:i.BackSide,fog:!1}))),o}return t=n,(e=[{key:"updateMatrixWorld",value:function(){var e,t;this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color?(this.material.color.set(this.color),this.children[0].material.color.set(this.color)):(this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),e=this.material.color,1<(t=Math.max(e.r,e.g,e.b))&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)),this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(i.Line);class uu{constructor(e){this.runScene=e}toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:o}=e;return{type:t,intensity:r,name:n,visible:i,color:o.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("AmbientLight",{addUndo:!1});var{type:e,intensity:r,name:n,visible:i,color:o}=e;return t.intensity=r,t.type=e,t.name=n,t.visible=i,t.color=new An.Color("#"+o),t}}class cu{constructor(e){this.runScene=e}toJSON(e){const{intensity:t,name:r,type:n,position:i,visible:o,color:a,castShadow:s,shadow:l,rotation:u,target:c}=e;var{mapSize:e,camera:h}=l,{scale:h,near:p,far:f}=h;return{type:n,intensity:t,name:r,visible:o,color:a.getHexString(),castShadow:s,shadow:{mapSize:e.x,camera:{near:p,far:f,scale:h.x}},position:{x:i.x,y:i.y,z:i.z},rotation:{x:u.x,y:u.y,z:u.z},targetPosition:{x:c.position.x,y:c.position.y,z:c.position.z}}}parseJSON(e){const t=this.runScene.lightEx.get("DirectionalLight",{addUndo:!1});var{targetPosition:e,intensity:r,name:n,position:i,visible:o,color:a,castShadow:s,shadow:l,rotation:u,type:c}=e,{mapSize:l,camera:h}=l,{scale:h,near:p,far:f}=h;return t.intensity=r,t.type=c,t.name=n,t.visible=o,t.castShadow=s,t.color=new An.Color("#"+a),t.position.set(i.x,i.y,i.z),t.rotation.set(u.x,u.y,u.z),t.target.position.set(e.x,e.y,e.z),t.shadow.mapSize.x=l,t.shadow.mapSize.y=l,t.shadow.camera.scale.x=h,t.shadow.camera.scale.y=h,t.shadow.camera.scale.z=h,t.shadow.camera.near=p,t.shadow.camera.far=f,t.shadow.camera.updateProjectionMatrix(),t.cameraHelper.update(),t}}class hu{constructor(e){this.runScene=e}toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:o,groundColor:a,position:s}=e;return{name:n,type:t,intensity:r,visible:i,position:{x:s.x,y:s.y,z:s.z},groundColor:a.getHexString(),color:o.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("HemisphereLight",{addUndo:!1});var{type:e,intensity:r,name:n,visible:i,color:o,groundColor:a,position:s}=e;return t.type=e,t.intensity=r,t.name=n,t.visible=i,t.color=new An.Color("#"+o),t.groundColor=new An.Color("#"+a),t.position.set(s.x,s.y,s.z),t}}class pu{constructor(e){this.runScene=e}toJSON(e){const{name:t,type:r,intensity:n,distance:i,decay:o,renderOrder:a,color:s,visible:l,castShadow:u,shadow:c,position:h}=e;var{mapSize:e,camera:p,bias:f,radius:d}=c,{scale:p,near:m,far:v}=p;return{name:t,type:r,intensity:n,visible:l,color:s.getHexString(),castShadow:u,distance:i,decay:o,renderOrder:a,shadow:{mapSize:e.x,camera:{near:m,far:v,scale:p.x},radius:d,bias:f},position:{x:h.x,y:h.y,z:h.z}}}parseJSON(e){const t=this.runScene.lightEx.get("PointLight",{addUndo:!1});var{name:e,type:r,intensity:n,distance:i,decay:o,renderOrder:a,color:s,visible:l,castShadow:u,shadow:c,position:h}=e,{mapSize:c,camera:p,bias:f,radius:d}=c,{scale:p,near:m,far:v}=p;return t.intensity=n,t.type=r,t.name=e,t.visible=l,t.castShadow=u,t.distance=i,t.renderOrder=a,t.color=new An.Color("#"+s),t.position.set(h.x,h.y,h.z),t.shadow.mapSize.x=c,t.shadow.mapSize.y=c,t.shadow.bias=f,t.decay=o,t.shadow.radius=d,t.shadow.camera.scale.x=p,t.shadow.camera.scale.y=p,t.shadow.camera.scale.z=p,t.shadow.camera.near=m,t.shadow.camera.far=v,t.shadow.camera.updateProjectionMatrix(),t}}class fu{constructor(e){this.runScene=e}toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:o,position:a}=e;return{name:n,type:t,intensity:r,visible:i,position:{x:a.x,y:a.y,z:a.z},color:o.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("RectAreaLight",{addUndo:!1});var{type:e,intensity:r,name:n,visible:i,color:o,position:a}=e;return t.type=e,t.intensity=r,t.name=n,t.visible=i,t.color=new An.Color("#"+o),t.position.set(a.x,a.y,a.z),t}}class du{constructor(e){this.runScene=e}toJSON(e){const{name:t,type:r,color:n,distance:i,decay:o,intensity:a,angle:s,penumbra:l,visible:u,castShadow:c,shadow:h,renderOrder:p,position:f,target:d}=e;var{bias:e,camera:m,normalBias:v,mapSize:g,radius:y}=h,m=m.near;return{type:r,intensity:a,name:t,visible:u,distance:i,angle:s,decay:o,penumbra:l,renderOrder:p,color:n.getHexString(),castShadow:c,shadow:{bias:e,normalBias:v,mapSize:g.x,camera:{near:m},radius:y},position:{x:f.x,y:f.y,z:f.z},targetPosition:{x:d.position.x,y:d.position.y,z:d.position.z}}}parseJSON(e){const t=this.runScene.lightEx.get("SpotLight",{addUndo:!1});var{name:e,type:r,color:n,distance:i,decay:o,intensity:a,angle:s,penumbra:l,visible:u,castShadow:c,shadow:h,renderOrder:p,position:f,targetPosition:d}=e,{bias:h,camera:m,normalBias:v,mapSize:g,radius:y}=h,m=m.near;return t.intensity=a,t.type=r,t.name=e,t.visible=u,t.distance=i,t.decay=o,t.angle=s,t.penumbra=l,t.renderOrder=p,t.castShadow=c,t.color=new An.Color("#"+n),t.position.set(f.x,f.y,f.z),t.shadow.mapSize.x=g,t.shadow.mapSize.y=g,t.shadow.camera.near=m,t.target.position.set(d.x,d.y,d.z),t.shadow.bias=h,t.shadow.normalBias=v,t.shadow.radius=y,t.shadow.camera.updateProjectionMatrix(),t}}class mu{constructor(e){this.shadowList=["DirectionalLight","PointLight","SpotLight"],this.helperList=["DirectionalLight","PointLight","SpotLight","RectAreaLight","HemisphereLight"],this.lightDom=void 0,this.helperUpdateList=["DirectionalLight","PointLight","SpotLight","HemisphereLight"],this.runScene=e,this.lightExMap={DirectionalLight:new cu(e),PointLight:new pu(e),SpotLight:new du(e),RectAreaLight:new fu(e),HemisphereLight:new hu(e),AmbientLight:new uu(e)}}getLightsByScene(e=this.runScene.sceneEx.get()){return e.children.filter((e=>e.isLight))}get(e,t){var{isClone:t,id:r,addUndo:n}=t||{};let i=new An[e];if(i.position.y=10,i.name=e,i.userData.id=r,this.shadowList.includes(e)&&(i.castShadow=!0),this.setLight(i),this.helperList.includes(i.type)){const t=this.setLightHelper(i);t.push({model:i,parent:this.runScene.sceneEx.get(),addTree:!0}),r=t.map((e=>new _i(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute())),void 0!==n&&n&&this.runScene.undoEx.addUndo(r),null!=(e=i.lightHelper)&&e.update()}else this.runScene.modelEx.add(i,void 0,n);return this.runScene.modelEx.setSelectByModel(i,{isClone:t}),i}setNull(e){e.userData.light&&this.setNull(e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper.visible=!1:"SpotLight"===e.type&&(e.cameraHelper.visible=!1,e.helper.visible=!1))}setSelect(e){e.userData.light&&this.setSelect(e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper.visible=!0:"SpotLight"===e.type&&(e.cameraHelper.visible=!0,e.helper.visible=!0))}update(e){var t;e.userData.isLightTarget&&e.userData.light&&(e=e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type||"SpotLight"===e.type?(e.helper.update(),e.cameraHelper.update()):null!=(t=null==(e=e.helper)?void 0:e.update)&&t.call(e))}remove(e,t=!0){let r;return this.runScene.helperEx.unfocus(),r="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>new Ei({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute())):[e,e.helper].map((t=>{if(t)return new Ei({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)),t&&r&&this.runScene.undoEx.addUndo(r),r}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const r=this.runScene.uniqueEx.getId(t);let n,i=[];switch(e){case"RectAreaLight":n=new lu(t,16773120);break;case"DirectionalLight":if(n=new An.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new An.Object3D;(t.target=e).name="helperModel",e.position.y=-10,t.shadow.autoUpdate=!0,e.userData.isLightTarget=!0,(e.userData.light=t).add(e)}t.shadow.camera.layers.set(1),t.shadow.camera.far=1e5,t.shadowCameraLeft=-5,t.shadowCameraRight=5,t.shadowCameraTop=5,t.shadowCameraBottom=-5,t.shadow.camera.updateProjectionMatrix();const e=new An.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(e,!0,(e=>{e.userData.id=r,e.userData.unClick=!0})),e.userData.id=r,e.userData.unClick=!0,t.cameraHelper=e,i.push({model:e,parent:this.runScene.sceneEx.get(),addTree:!1});break;case"PointLight":n=new An.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new An.SpotLightHelper(t);let o=new An.Object3D;(t.target=o).name="helperModel",o.userData.isLightTarget=!0,o.userData.light=t,o.position.y=-10,t.shadow.autoUpdate=!0,t.add(o);const a=new An.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(a,!0,(e=>{e.userData.id=r})),a.userData.id=r,t.cameraHelper=a,i.push({model:a,parent:this.runScene.sceneEx.get(),addTree:!1});break;case"HemisphereLight":n=new An.HemisphereLightHelper(t,1,16773135)}return n.name="helperModel",this.runScene.helperEx.setHelper(n,!0,(e=>{e.userData.id=r})),n.userData.id=r,(n.light=t).helper=n,i.push({model:n,parent:this.runScene.sceneEx.get(),addTree:!1}),i}setLightHelper(e){return this.getLightHelper(e.type,e)}isUpdateHelper(e){return this.helperUpdateList.includes(e)}initLight(e){console.log("初始化灯光helper:",e),e.forEach((e=>this.setLightHelper(e)))}setNormal(e,t=0){var{model:e,info:r,val:n,cb:i}=e;return new mi({target:e,runScene:this.runScene,info:r,oldVal:e[r],newVal:n,cb:i}).execute()}setMultip(e,t,r=!0,n=!0){if(e instanceof Array)return i=e.map((e=>{var{model:e,typeList:n,newVal:i}=e;const o=new ii({target:e,typeList:n,newVal:i,cb:t});return r?o.execute():o})),n&&this.runScene.undoEx.addUndo(i),i;{var{model:i,typeList:e,newVal:o}=e;const a=new ii({target:i,typeList:e,newVal:o,cb:t});return n&&this.runScene.undoEx.addUndo(a),r?a.execute():a}}isLight(e){return null==(e=e.userData)?void 0:e.isLight}setLight(e){e.userData.isLight=!0}isHelperTarget(e){return e.userData.isLightTarget}clone(e){return this.runScene.modelEx.selectNull(),this.get(e.type,{isClone:!0,id:(0,ei.getId)()})}}function vu(e){return(vu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function gu(e,t){return(gu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function yu(e){return(yu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var bu=new WeakMap,xu=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gu(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=yu(e);if(r=t?(r=yu(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===vu(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).decoderPath="",e.decoderConfig={},e.decoderBinary=null,e.decoderPending=null,e.workerLimit=4,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},e.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},e;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,r,n){var o=this,a=new i.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(e){var r={attributeIDs:o.defaultAttributeIDs,attributeTypes:o.defaultAttributeTypes,useUniqueIDs:!1};o.decodeGeometry(e,r).then(t).catch(n)}),r,n)}},{key:"decodeDracoFile",value:function(e,t,r,n){n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r},this.decodeGeometry(e,n).then(t)}},{key:"decodeGeometry",value:function(e,t){var r,n=this;for(r in t.attributeTypes){var i=t.attributeTypes[r];void 0!==i.BYTES_PER_ELEMENT&&(t.attributeTypes[r]=i.name)}var o,a=JSON.stringify(t);if(bu.has(e)){if((l=bu.get(e)).key===a)return l.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var s=this.workerNextTaskID++,l=e.byteLength;return l=this._getWorker(s,l).then((function(r){return o=r,new Promise((function(r,n){o._callbacks[s]={resolve:r,reject:n},o.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))})).then((function(e){return n._createGeometry(e.geometry)})),l.catch((function(){return!0})).then((function(){o&&s&&n._releaseTask(o,s)})),bu.set(e,{key:a,promise:l}),l}},{key:"_createGeometry",value:function(e){var t=new i.BufferGeometry;e.index&&t.setIndex(new i.BufferAttribute(e.index.array,1));for(var r=0;r<e.attributes.length;r++){var n=(a=e.attributes[r]).name,o=a.array,a=a.itemSize;t.setAttribute(n,new i.BufferAttribute(o,a))}return t}},{key:"_loadLibrary",value:function(e,t){var r=new i.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((function(t,n){r.load(e,t,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":vu(WebAssembly))||"js"===this.decoderConfig.type,r=[];return t?r.push(this._loadLibrary("draco_decoder.js","text")):(r.push(this._loadLibrary("draco_wasm_wrapper.js","text")),r.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(r).then((function(r){var n=r[0];t||(e.decoderConfig.wasmBinary=r[1]),r=function(){var e,t;onmessage=function(r){var n=r.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var i=n.buffer,o=n.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,r=new e.DecoderBuffer;r.Init(new Int8Array(i),i.byteLength);try{var a=function(e,t,r,n){var i,o=n.attributeIDs,a=n.attributeTypes,s=t.GetEncodedGeometryType(r);if(s===e.TRIANGULAR_MESH)i=new e.Mesh,g=t.DecodeBufferToMesh(r,i);else{if(s!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");i=new e.PointCloud,g=t.DecodeBufferToPointCloud(r,i)}if(!g.ok()||0===i.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());var l,u,c,h,p,f,d,m,v,g,y,b,x,w={index:null,attributes:[]};for(l in o){var S=self[a[l]],T=void 0,_=void 0;if(n.useUniqueIDs)_=o[l],T=t.GetAttributeByUniqueId(i,_);else{if(-1===(_=t.GetAttributeId(i,e[o[l]])))continue;T=t.GetAttribute(i,_)}w.attributes.push((_=e,u=t,c=i,h=l,p=T.num_components(),d=(f=c.num_points()*p)*S.BYTES_PER_ELEMENT,m=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(_,S),v=_._malloc(d),u.GetAttributeDataArrayForAllPoints(c,T,m,d,v),u=new S(_.HEAPF32.buffer,v,f).slice(),_._free(v),{name:h,array:u,itemSize:p}))}return s===e.TRIANGULAR_MESH&&(w.index=(r=e,g=t,b=4*(y=3*(s=i).num_faces()),x=r._malloc(b),g.GetTrianglesUInt32Array(s,b,x),g=new Uint32Array(r.HEAPF32.buffer,x,y).slice(),r._free(x),{array:g,itemSize:1})),e.destroy(i),w}(e,t,r,o),s=a.attributes.map((function(e){return e.array.buffer}));a.index&&s.push(a.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:a},s)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{e.destroy(r),e.destroy(t)}}))}}}.toString(),n=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n"),e.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var r=this;return this._initDecoder().then((function(){r.workerPool.length<r.workerLimit?((n=new Worker(r.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},r.workerPool.push(n)):r.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n,i=r.workerPool[r.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(i.Loader),wu={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};var Su=new(function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,r,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var i=this,o=!1,a=0,s=0,l=void 0,u=[];this.onStart=void 0,this.onLoad=t,this.onProgress=r,this.onError=n,this.itemStart=function(e){s++,!1===o&&void 0!==i.onStart&&i.onStart(e,a,s),o=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,s),a===s&&(o=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return u.push(e,t),this},this.removeHandler=function(e){return-1!==(e=u.indexOf(e))&&u.splice(e,2),this},this.getHandler=function(e){for(var t=0,r=u.length;t<r;t+=2){var n=u[t],i=u[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}})));var Tu=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:Su,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,r;return t=e,(r=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.load(e,n,t,i)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function _u(e){return(_u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Mu(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Eu(e,t){return(Eu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Pu(e){return(Pu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ku=function(){var e=n,t=Tu;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Eu(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Pu(e);if(r=t?(r=Pu(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===_u(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return e=r.call(this,e),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),e.options={premultiplyAlpha:"none"},e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,r,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,o=wu.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout((function(){t&&t(o),i.manager.itemEnd(e)}),0),o;var a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then((function(e){return e.blob()})).then((function(e){return Promise.all([createImageBitmap(e,Object.assign(i.options,{imageOrientation:"flipY"})),Promise.resolve(e)])})).then((function(r){r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),2!==o.length);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}(e)||function(e,t){if(e){if("string"==typeof e)return Mu(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Mu(e,2):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r);var n=r[0];r=r[1],wu.add(e,n),t&&t(n,r),i.manager.itemEnd(e)})).catch((function(t){n&&n(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function Ru(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}(e,t)||Cu(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ou(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Cu(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}function Cu(e,t){if(e){if("string"==typeof e)return Lu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Lu(e,t):void 0}}function Lu(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Au(e){return(Au="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Du(){return(Du="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Vu(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function Iu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ju(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Uu(e,t,r){return t&&ju(e.prototype,t),r&&ju(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bu(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Nu(e,t)}function Nu(e,t){return(Nu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Fu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Vu(e);if(r=t?(r=Vu(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Au(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return zu(n)}}function zu(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Vu(e){return(Vu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}ku.prototype.isImageBitmapLoader=!0;var Hu=function(){Bu(t,i.Loader);var e=Fu(t);function t(r){return Iu(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new Yu(e)})),r.register((function(e){return new ec(e)})),r.register((function(e){return new tc(e)})),r.register((function(e){return new Zu(e)})),r.register((function(e){return new Qu(e)})),r.register((function(e){return new Ku(e)})),r.register((function(e){return new Ju(e)})),r.register((function(e){return new $u(e)})),r.register((function(e){return new Xu(e)})),r.register((function(e){return new rc(e)})),r}return Uu(t,[{key:"load",value:function(e,t,r,n){function o(t){n?n(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)}var a=this,s=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:i.LoaderUtils.extractUrlBase(e),l=(this.manager.itemStart(e),new i.FileLoader(this.manager));l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(r){try{a.parse(r,s,(function(r){t(r),a.manager.itemEnd(e)}),o)}catch(r){o(r)}}),r,o)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n,o){var a,s={},l={};if("string"==typeof e)a=e;else if(i.LoaderUtils.decodeText(new Uint8Array(e,0,4))===nc){try{s[Wu.KHR_BINARY_GLTF]=new ic(e)}catch(e){return void(n&&n(e))}a=s[Wu.KHR_BINARY_GLTF].content}else a=i.LoaderUtils.decodeText(new Uint8Array(e));var u=JSON.parse(a);if(void 0===u.asset||u.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{o.helper.beforeLoader(u);var c=new _c(u,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder,myOptions:o});c.fileLoader.setRequestHeader(this.requestHeader);for(var h=0;h<this.pluginCallbacks.length;h++){var p=this.pluginCallbacks[h](c);s[(l[p.name]=p).name]=!0}if(u.extensionsUsed)for(var f=0;f<u.extensionsUsed.length;++f){var d=u.extensionsUsed[f],m=u.extensionsRequired||[];switch(d){case Wu.KHR_MATERIALS_UNLIT:s[d]=new qu;break;case Wu.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:s[d]=new lc;break;case Wu.KHR_DRACO_MESH_COMPRESSION:s[d]=new oc(u,this.dracoLoader);break;case Wu.KHR_TEXTURE_TRANSFORM:s[d]=new ac;break;case Wu.KHR_MESH_QUANTIZATION:s[d]=new uc;break;default:0<=m.indexOf(d)&&void 0===l[d]&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}c.setExtensions(s),c.setPlugins(l),c.parse(r,n)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,t,n,i)}))}}]),t}();function Gu(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var Wu={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"},Xu=function(){function e(t){Iu(this,e),this.parser=t,this.name=Wu.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return Uu(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,n=t.length;r<n;r++){var i=t[r];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,r="light:"+e,n=t.cache.get(r);if(n)return n;var o,a=t.json,s=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],l=new i.Color(16777215),u=(void 0!==s.color&&l.fromArray(s.color),void 0!==s.range?s.range:0);switch(s.type){case"directional":(o=new i.DirectionalLight(l)).target.position.set(0,0,-1),o.add(o.target);break;case"point":(o=new i.PointLight(l)).distance=u;break;case"spot":(o=new i.SpotLight(l)).distance=u,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,o.angle=s.spot.outerConeAngle,o.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return o.position.set(0,0,0),o.decay=2,void 0!==s.intensity&&(o.intensity=s.intensity),o.name=t.createUniqueName(s.name||"light_"+e),n=Promise.resolve(o),t.cache.add(r,n),n}},{key:"createNodeAttachment",value:function(e){var t=this,r=this.parser,n=((e=r.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}]),e}(),qu=function(){function e(){Iu(this,e),this.name=Wu.KHR_MATERIALS_UNLIT}return Uu(e,[{key:"getMaterialType",value:function(){return i.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,r){var n,o=[];return e.color=new i.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(n=t.baseColorFactor,e.color.fromArray(n),e.opacity=n[3]),void 0!==t.baseColorTexture&&o.push(r.assignTexture(e,"map",t.baseColorTexture))),Promise.all(o)}}]),e}(),Yu=function(){function e(t){Iu(this,e),this.parser=t,this.name=Wu.KHR_MATERIALS_CLEARCOAT}return Uu(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?i.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&n.push(r.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&n.push(r.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(n.push(r.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(r=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new i.Vector2(r,r))),Promise.all(n)}}]),e}(),Zu=function(){function e(t){Iu(this,e),this.parser=t,this.name=Wu.KHR_MATERIALS_SHEEN}return Uu(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?i.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(t.sheenColor=new i.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,e=e.extensions[this.name]).sheenColorFactor&&t.sheenColor.fromArray(e.sheenColorFactor),void 0!==e.sheenRoughnessFactor&&(t.sheenRoughness=e.sheenRoughnessFactor),void 0!==e.sheenColorTexture&&n.push(r.assignTexture(t,"sheenColorMap",e.sheenColorTexture)),void 0!==e.sheenRoughnessTexture&&n.push(r.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(n)}}]),e}(),Qu=function(){function e(t){Iu(this,e),this.parser=t,this.name=Wu.KHR_MATERIALS_TRANSMISSION}return Uu(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?i.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(n)}}]),e}(),Ku=function(){function e(t){Iu(this,e),this.parser=t,this.name=Wu.KHR_MATERIALS_VOLUME}return Uu(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?i.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){if(!(e=(n=this.parser).json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var r=[],n=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&r.push(n.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new i.Color(n[0],n[1],n[2]),Promise.all(r)}}]),e}(),Ju=function(){function e(t){Iu(this,e),this.parser=t,this.name=Wu.KHR_MATERIALS_IOR}return Uu(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?i.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(e=e.extensions[this.name],t.ior=void 0!==e.ior?e.ior:1.5,Promise.resolve()):Promise.resolve()}}]),e}(),$u=function(){function e(t){Iu(this,e),this.parser=t,this.name=Wu.KHR_MATERIALS_SPECULAR}return Uu(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?i.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[],o=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&n.push(r.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new i.Color(o[0],o[1],o[2]),void 0!==e.specularColorTexture&&n.push(r.assignTexture(t,"specularColorMap",e.specularColorTexture).then((function(e){e.encoding=i.sRGBEncoding}))),Promise.all(n)}}]),e}(),ec=function(){function e(t){Iu(this,e),this.parser=t,this.name=Wu.KHR_TEXTURE_BASISU}return Uu(e,[{key:"loadTexture",value:function(e){var t=this.parser,r=t.json;if(!(n=r.textures[e]).extensions||!n.extensions[this.name])return null;var n=n.extensions[this.name],i=t.options.ktx2Loader;if(i)return t.loadTextureImage(e,n.source,i);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}}]),e}(),tc=function(){function e(t){Iu(this,e),this.parser=t,this.name=Wu.EXT_TEXTURE_WEBP,this.isSupported=null}return Uu(e,[{key:"loadTexture",value:function(e){var t=this.name,r=this.parser,n=r.json;if(!(i=n.textures[e]).extensions||!i.extensions[t])return null;var i=i.extensions[t],o=n.images[i.source],a=r.textureLoader;return o.uri&&null!==(i=r.options.manager.getHandler(o.uri))&&(a=i),this.detectSupport().then((function(i){if(i)return r.loadTextureImage(e,o,a);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),rc=function(){function e(t){Iu(this,e),this.name=Wu.EXT_MESHOPT_COMPRESSION,this.parser=t}return Uu(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var r=e.extensions[this.name],n=(e=this.parser.getDependency("buffer",r.buffer),this.parser.options.meshoptDecoder);if(n&&n.supported)return Promise.all([e,n.ready]).then((function(e){var t=r.byteOffset||0,i=r.byteLength||0,o=r.count,a=r.byteStride,s=new ArrayBuffer(o*a);return e=new Uint8Array(e[0],t,i),n.decodeGltfBuffer(new Uint8Array(s),o,a,e,r.mode,r.filter),s}));if(t.extensionsRequired&&0<=t.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return null}}]),e}(),nc="glTF",ic=Uu((function e(t){Iu(this,e),this.name=Wu.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,12);if(this.header={magic:i.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==nc)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=this.header.length-12,o=new DataView(t,12),a=0;a<n;){var s,l=o.getUint32(a,!0),u=(a+=4,o.getUint32(a,!0));a+=4,1313821514===u?(s=new Uint8Array(t,12+a,l),this.content=i.LoaderUtils.decodeText(s)):5130562===u&&(this.body=t.slice(s=12+a,s+l)),a+=l}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),oc=function(){function e(t,r){if(Iu(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Wu.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return Uu(e,[{key:"decodePrimitive",value:function(e,t){var r,n,i=this.json,o=this.dracoLoader,a=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,l={},u={},c={};for(r in s){var h=gc[r]||r.toLowerCase();l[h]=s[r]}for(n in e.attributes){var p,f,d=gc[n]||n.toLowerCase();void 0!==s[n]&&(p=i.accessors[e.attributes[n]],f=fc[p.componentType],c[d]=f,u[d]=!0===p.normalized)}return t.getDependency("bufferView",a).then((function(e){return new Promise((function(t){o.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r];void 0!==(r=u[r])&&(n.normalized=r)}t(e)}),l,c)}))}))}}]),e}(),ac=function(){function e(){Iu(this,e),this.name=Wu.KHR_TEXTURE_TRANSFORM}return Uu(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}]),e}(),sc=function(){Bu(t,i.MeshStandardMaterial);var e=Fu(t);function t(r){Iu(this,t),(n=e.call(this)).isGLTFSpecularGlossinessMaterial=!0;var n,o=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),a=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),s=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),l=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),u=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),c={specular:{value:(new i.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};return n._extraUniforms=c,n.onBeforeCompile=function(e){for(var t in c)e.uniforms[t]=c[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",o).replace("#include <metalnessmap_pars_fragment>",a).replace("#include <roughnessmap_fragment>",s).replace("#include <metalnessmap_fragment>",l).replace("#include <lights_physical_fragment>",u)},Object.defineProperties(zu(n),{specular:{get:function(){return c.specular.value},set:function(e){c.specular.value=e}},specularMap:{get:function(){return c.specularMap.value},set:function(e){(c.specularMap.value=e)?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return c.glossiness.value},set:function(e){c.glossiness.value=e}},glossinessMap:{get:function(){return c.glossinessMap.value},set:function(e){(c.glossinessMap.value=e)?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete n.metalness,delete n.roughness,delete n.metalnessMap,delete n.roughnessMap,n.setValues(r),n}return Uu(t,[{key:"copy",value:function(e){return Du(Vu(t.prototype),"copy",this).call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}]),t}(),lc=function(){function e(){Iu(this,e),this.name=Wu.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}return Uu(e,[{key:"getMaterialType",value:function(){return sc}},{key:"extendParams",value:function(e,t,r){t=t.extensions[this.name];var n,o=(e.color=new i.Color(1,1,1),e.opacity=1,[]);return Array.isArray(t.diffuseFactor)&&(n=t.diffuseFactor,e.color.fromArray(n),e.opacity=n[3]),void 0!==t.diffuseTexture&&o.push(r.assignTexture(e,"map",t.diffuseTexture)),e.emissive=new i.Color(0,0,0),e.glossiness=void 0!==t.glossinessFactor?t.glossinessFactor:1,e.specular=new i.Color(1,1,1),Array.isArray(t.specularFactor)&&e.specular.fromArray(t.specularFactor),void 0!==t.specularGlossinessTexture&&(n=t.specularGlossinessTexture,o.push(r.assignTexture(e,"glossinessMap",n)),o.push(r.assignTexture(e,"specularMap",n))),Promise.all(o)}},{key:"createMaterial",value:function(e){var t=new sc(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=i.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}]),e}(),uc=Uu((function e(){Iu(this,e),this.name=Wu.KHR_MESH_QUANTIZATION})),cc=function(){Bu(t,i.Interpolant);var e=Fu(t);function t(r,n,i,o){return Iu(this,t),e.call(this,r,n,i,o)}return Uu(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=e*n*3+n,o=0;o!==n;o++)t[o]=r[i+o];return t}}]),t}(),hc=(cc.prototype.beforeStart_=cc.prototype.copySampleValue_,cc.prototype.afterEnd_=cc.prototype.copySampleValue_,cc.prototype.interpolate_=function(e,t,r,n){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=2*a,l=3*a,u=n-t,c=e*l,h=c-l,p=-2*(t=(r=(n=(r-t)/u)*n)*n)+3*r,f=t-r,d=1-p,m=f-r+n,v=0;v!==a;v++){var g=o[h+v+a],y=o[h+v+s]*u,b=o[c+v+a],x=o[c+v]*u;i[v]=d*g+m*y+p*b+f*x}return i},new i.Quaternion),pc=function(){Bu(t,cc);var e=Fu(t);function t(){return Iu(this,t),e.apply(this,arguments)}return Uu(t,[{key:"interpolate_",value:function(e,r,n,i){return e=Du(Vu(t.prototype),"interpolate_",this).call(this,e,r,n,i),hc.fromArray(e).normalize().toArray(e),e}}]),t}(),fc={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},dc={9728:i.NearestFilter,9729:i.LinearFilter,9984:i.NearestMipmapNearestFilter,9985:i.LinearMipmapNearestFilter,9986:i.NearestMipmapLinearFilter,9987:i.LinearMipmapLinearFilter},mc={33071:i.ClampToEdgeWrapping,33648:i.MirroredRepeatWrapping,10497:i.RepeatWrapping},vc={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},gc={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},yc={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},bc={CUBICSPLINE:void 0,LINEAR:i.InterpolateLinear,STEP:i.InterpolateDiscrete};function xc(e,t,r){for(var n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function wc(e,t){void 0!==t.extras&&("object"===Au(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Sc(e){for(var t="",r=Object.keys(e).sort(),n=0,i=r.length;n<i;n++)t+=r[n]+":"+e[r[n]]+";";return t}function Tc(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var _c=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};Iu(this,e),this.json=t,this.extensions={},this.plugins={},this.options=r,this.cache=new Gu,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox|^((?!chrome|android).)*safari/i.test(navigator.userAgent)?this.textureLoader=new ku(this.options.manager):this.textureLoader=new i.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new i.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return Uu(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all([this.options.myOptions.helper.processInput(n,this)].concat(function(e){return function(e){if(Array.isArray(e))return Lu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Cu(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){var o={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};xc(i,o,n),wc(o,n),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(o)}))).then((function(){r.options.myOptions.helper.done(o),e(o)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],n=0,i=t.length;n<i;n++)for(var o=t[n].joints,a=0,s=o.length;a<s;a++)e[o[a]].isBone=!0;for(var l=0,u=e.length;l<u;l++){var c=e[l];void 0!==c.mesh&&(this._addNodeRef(this.meshCache,c.mesh),void 0!==c.skin&&(r[c.mesh].isSkinnedMesh=!0)),void 0!==c.camera&&this._addNodeRef(this.cameraCache,c.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,r){var n=this;if(e.refs[t]<=1)return r;var i=r.clone();return function e(t,r){var i,o=n.associations.get(t),a=(null!=o&&n.associations.set(r,o),Ou(t.children.entries()));try{for(a.s();!(i=a.n()).done;){var s=Ru(i.value,2),l=s[0];e(s[1],r.children[l])}}catch(e){a.e(e)}finally{a.f()}}(r,i),i.name+="_instance_"+e.uses[t]++,i}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var n=e(t[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),r=(t.unshift(this),[]),n=0;n<t.length;n++){var i=e(t[n]);i&&r.push(i)}return r}},{key:"getDependency",value:function(e,t){var r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this.loadNode(t);break;case"mesh":n=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":n=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":n=this.loadSkin(t);break;case"animation":n=this.loadAnimation(t);break;case"camera":n=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(e){var t,r,n=this.cache.get(e);return n||(r=(t=this).json[e+("mesh"===e?"es":"s")]||[],n=Promise.all(r.map((function(r,n){return t.getDependency(e,n)}))),this.cache.add(e,n)),n}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[Wu.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(e,o){r.load(i.LoaderUtils.resolveURL(t.uri,n.path),e,void 0,(function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+r)}))}},{key:"loadAccessor",value:function(e){var t=this,r=this.json,n=this.json.accessors[e];return void 0===n.bufferView&&void 0===n.sparse?Promise.resolve(null):(e=[],void 0!==n.bufferView?e.push(this.getDependency("bufferView",n.bufferView)):e.push(null),void 0!==n.sparse&&(e.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),e.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(e).then((function(e){var o,a=e[0],s=vc[n.type],l=fc[n.componentType],u=l.BYTES_PER_ELEMENT,c=n.byteOffset||0,h=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,p=!0===n.normalized,f=h&&h!==u*s?(d=Math.floor(c/h),m="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+d+":"+n.count,(v=t.cache.get(m))||(o=new l(a,d*h,n.count*h/u),v=new i.InterleavedBuffer(o,h/u),t.cache.add(m,v)),new i.InterleavedBufferAttribute(v,s,c%h/u,p)):(o=null===a?new l(n.count*s):new l(a,c,n.count*s),new i.BufferAttribute(o,s,p));if(void 0!==n.sparse){var d=fc[n.sparse.indices.componentType],m=n.sparse.indices.byteOffset||0,v=n.sparse.values.byteOffset||0,g=new d(e[1],m,n.sparse.count*vc.SCALAR),y=new l(e[2],v,n.sparse.count*s);null!==a&&(f=new i.BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(var b=0,x=g.length;b<x;b++){var w=g[b];if(f.setX(w,y[b*s]),2<=s&&f.setY(w,y[b*s+1]),3<=s&&f.setZ(w,y[b*s+2]),4<=s&&f.setW(w,y[b*s+3]),5<=s)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f})))}},{key:"loadTexture",value:function(e){var t=this.json,r=this.options,n=t.textures[e].source,i=(t=t.images[n],this.textureLoader);return t.uri&&null!==(r=r.manager.getHandler(t.uri))&&(i=r),this.loadTextureImage(e,n,i)}},{key:"loadTextureImage",value:function(e,t,r){var n=this,o=this.json,a=o.textures[e],s=((s=o.images[t]).uri||s.bufferView)+":"+a.sampler;return this.textureCache[s]?this.textureCache[s]:(t=this.loadImageSource(t,r).then((function(t){t.flipY=!1,a.name&&(t.name=a.name);var r=(o.samplers||{})[a.sampler]||{};return t.magFilter=dc[r.magFilter]||i.LinearFilter,t.minFilter=dc[r.minFilter]||i.LinearMipmapLinearFilter,t.wrapS=mc[r.wrapS]||i.RepeatWrapping,t.wrapT=mc[r.wrapT]||i.RepeatWrapping,n.associations.set(t,{textures:e}),n.options.myOptions.helper.material.processTexture({texture:t,textureDef:a}),t})).catch((function(){return null})),this.textureCache[s]=t)}},{key:"loadImageSource",value:function(e,t){var r=this.json,n=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()})).catch((function(e){throw e}));var o=r.images[e],a=self.URL||self.webkitURL,s=o.uri||"";if(void 0!==o.bufferView)s=this.getDependency("bufferView",o.bufferView).then((function(e){return e=new Blob([e],{type:o.mimeType}),s=a.createObjectURL(e)}));else if(void 0===o.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return r=Promise.resolve(s).then((function(e){return new Promise((function(r,o){var a=r;!0===t.isImageBitmapLoader&&(a=function(e,t){(e=new i.Texture(e)).needsUpdate=!0,r({texture:e,blob:t})}),t.load(i.LoaderUtils.resolveURL(e,n.path),a,void 0,o)}))})).then((function(e){var t=e.texture;return e=e.blob,t.userData.url=s,t.userData.blob=e,t.url=s,t})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e})),this.sourceCache[e]=r}},{key:"assignTexture",value:function(e,t,r){var n=this;return this.getDependency("texture",r.index).then((function(i){var o,a;return void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),n.extensions[Wu.KHR_TEXTURE_TRANSFORM]&&(o=void 0!==r.extensions?r.extensions[Wu.KHR_TEXTURE_TRANSFORM]:void 0)&&(a=n.associations.get(i),i=n.extensions[Wu.KHR_TEXTURE_TRANSFORM].extendTexture(i,o),n.associations.set(i,a)),e[t]=i}))}},{key:"assignFinalMaterial",value:function(e){var t,r,n=e.geometry,o=e.material,a=void 0===n.attributes.tangent,s=void 0!==n.attributes.color,l=void 0===n.attributes.normal;e.isPoints?(t="PointsMaterial:"+o.uuid,(r=this.cache.get(t))||(r=new i.PointsMaterial,i.Material.prototype.copy.call(r,o),r.color.copy(o.color),r.map=o.map,r.sizeAttenuation=!1,this.cache.add(t,r)),o=r):e.isLine&&(t="LineBasicMaterial:"+o.uuid,(r=this.cache.get(t))||(r=new i.LineBasicMaterial,i.Material.prototype.copy.call(r,o),r.color.copy(o.color),this.cache.add(t,r)),o=r),(a||s||l)&&(t="ClonedMaterial:"+o.uuid+":",o.isGLTFSpecularGlossinessMaterial&&(t+="specular-glossiness:"),a&&(t+="derivative-tangents:"),s&&(t+="vertex-colors:"),l&&(t+="flat-shading:"),(r=this.cache.get(t))||(r=o.clone(),s&&(r.vertexColors=!0),l&&(r.flatShading=!0),a&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(t,r),this.associations.set(r,this.associations.get(o))),o=r),o.aoMap&&void 0===n.attributes.uv2&&void 0!==n.attributes.uv&&n.setAttribute("uv2",n.attributes.uv),this.options.myOptions.helper.material.process({material:o,materialDef:o.userData,model:e}),e.material=o}},{key:"getMaterialType",value:function(){return i.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,r=this,n=this.json,o=this.extensions,a=n.materials[e],s={},l=[],u=((n=a.extensions||{})[Wu.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]?(u=o[Wu.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS],t=u.getMaterialType(),l.push(u.extendParams(s,a,r))):n[Wu.KHR_MATERIALS_UNLIT]?(u=o[Wu.KHR_MATERIALS_UNLIT],t=u.getMaterialType(),l.push(u.extendParams(s,a,r))):(n=a.pbrMetallicRoughness||{},s.color=new i.Color(1,1,1),s.opacity=1,Array.isArray(n.baseColorFactor)&&(u=n.baseColorFactor,s.color.fromArray(u),s.opacity=u[3]),void 0!==n.baseColorTexture&&l.push(r.assignTexture(s,"map",n.baseColorTexture)),s.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,s.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(l.push(r.assignTexture(s,"metalnessMap",n.metallicRoughnessTexture)),l.push(r.assignTexture(s,"roughnessMap",n.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),l.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)}))))),!0===a.doubleSided&&(s.side=i.DoubleSide),a.alphaMode||"OPAQUE");return"BLEND"===u?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===u&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==i.MeshBasicMaterial&&(l.push(r.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new i.Vector2(1,1),void 0!==a.normalTexture.scale&&(n=a.normalTexture.scale,s.normalScale.set(n,n))),void 0!==a.occlusionTexture&&t!==i.MeshBasicMaterial&&(l.push(r.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==i.MeshBasicMaterial&&(s.emissive=(new i.Color).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==i.MeshBasicMaterial&&l.push(r.assignTexture(s,"emissiveMap",a.emissiveTexture)),Promise.all(l).then((function(){var n=t===sc?o[Wu.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new t(s);return a.name&&(n.name=a.name),n.map&&(n.map.encoding=i.sRGBEncoding),n.emissiveMap&&(n.emissiveMap.encoding=i.sRGBEncoding),wc(n,a),r.associations.set(n,{materials:e}),a.extensions&&xc(o,n,a),n}))}},{key:"createUniqueName",value:function(e){for(var t=i.PropertyBinding.sanitizeNodeName(e||""),r=t,n=1;this.nodeNamesUsed[r];++n)r=t+"_"+n;return this.nodeNamesUsed[r]=!0,r}},{key:"loadGeometries",value:function(e){for(var t=this,r=this.extensions,n=this.primitiveCache,o=[],a=0,s=e.length;a<s;a++){var l=e[a],u=(c=void 0,c=(c=(u=l).extensions&&u.extensions[Wu.KHR_DRACO_MESH_COMPRESSION])?"draco:"+c.bufferView+":"+c.indices+":"+Sc(c.attributes):u.indices+":"+Sc(u.attributes)+":"+u.mode),c=n[u];c?o.push(c.promise):(c=void 0,c=l.extensions&&l.extensions[Wu.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[Wu.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return Mc(r,e,t)}))}(l):Mc(new i.BufferGeometry,l,t),n[u]={primitive:l,promise:c},o.push(c))}return Promise.all(o)}},{key:"loadMesh",value:function(e){for(var t=this,r=this.json,n=this.extensions,o=r.meshes[e],a=o.primitives,s=[],l=0,u=a.length;l<u;l++){var c=void 0===a[l].material?(void 0===(c=this.cache).DefaultMaterial&&(c.DefaultMaterial=new i.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:i.FrontSide})),c.DefaultMaterial):this.getDependency("material",a[l].material);c.then((function(e){})),s.push(c)}return s.push(t.loadGeometries(a)),Promise.all(s).then((function(r){for(var s=r.slice(0,r.length-1),l=r[r.length-1],u=[],c=0,h=l.length;c<h;c++){var p=l[c],f=a[c],d=void 0,m=s[c];if(4===f.mode||5===f.mode||6===f.mode||void 0===f.mode)!0!==(d=new(!0===o.isSkinnedMesh?i.SkinnedMesh:i.Mesh)(p,m)).isSkinnedMesh||d.geometry.attributes.skinWeight.normalized||d.normalizeSkinWeights(),5===f.mode?d.geometry=Ec(d.geometry,i.TriangleStripDrawMode):6===f.mode&&(d.geometry=Ec(d.geometry,i.TriangleFanDrawMode));else if(1===f.mode)d=new i.LineSegments(p,m);else if(3===f.mode)d=new i.Line(p,m);else if(2===f.mode)d=new i.LineLoop(p,m);else{if(0!==f.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);d=new i.Points(p,m)}if(0<Object.keys(d.geometry.morphAttributes).length){S=w=x=b=y=v=void 0;var v=d,g=o;if(v.updateMorphTargets(),void 0!==g.weights)for(var y=0,b=g.weights.length;y<b;y++)v.morphTargetInfluences[y]=g.weights[y];if(g.extras&&Array.isArray(g.extras.targetNames)){var x=g.extras.targetNames;if(v.morphTargetInfluences.length===x.length){v.morphTargetDictionary={};for(var w=0,S=x.length;w<S;w++)v.morphTargetDictionary[x[w]]=w}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}d.name=t.createUniqueName(o.name||"mesh_"+e),wc(d,o),f.extensions&&xc(n,d,f),t.assignFinalMaterial(d),u.push(d)}for(var T=0,_=u.length;T<_;T++)t.associations.set(u[T],{meshes:e,primitives:T});if(1===u.length)return u[0];var M=new i.Group;t.associations.set(M,{meshes:e});for(var E=0,P=u.length;E<P;E++)M.add(u[E]);return M}))}},{key:"loadCamera",value:function(e){var t,r=(e=this.json.cameras[e])[e.type];if(r)return"perspective"===e.type?t=new i.PerspectiveCamera(i.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===e.type&&(t=new i.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),wc(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){var t={joints:(e=this.json.skins[e]).joints};return void 0===e.inverseBindMatrices?Promise.resolve(t):this.getDependency("accessor",e.inverseBindMatrices).then((function(e){return t.inverseBindMatrices=e,t}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],r=[],n=[],o=[],a=[],s=[],l=0,u=t.channels.length;l<u;l++){var c=t.channels[l],h=t.samplers[c.sampler],p=void 0!==(c=c.target).node?c.node:c.id,f=void 0!==t.parameters?t.parameters[h.input]:h.input,d=void 0!==t.parameters?t.parameters[h.output]:h.output;r.push(this.getDependency("node",p)),n.push(this.getDependency("accessor",f)),o.push(this.getDependency("accessor",d)),a.push(h),s.push(c)}return Promise.all([Promise.all(r),Promise.all(n),Promise.all(o),Promise.all(a),Promise.all(s)]).then((function(r){for(var n=r[0],o=r[1],a=r[2],s=r[3],l=r[4],u=[],c=0,h=n.length;c<h;c++)!function(e){var t=n[e],r=o[e],c=a[e],h=s[e],p=l[e];if(void 0!==t){t.updateMatrix(),t.matrixAutoUpdate=!0;var f=void 0;switch(yc[p.path]){case yc.weights:f=i.NumberKeyframeTrack;break;case yc.rotation:f=i.QuaternionKeyframeTrack;break;default:f=i.VectorKeyframeTrack}e=t.name||t.uuid;var d=void 0!==h.interpolation?bc[h.interpolation]:i.InterpolateLinear,m=[],v=(yc[p.path]===yc.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),c.array);if(c.normalized){for(var g=Tc(v.constructor),y=new Float32Array(v.length),b=0,x=v.length;b<x;b++)y[b]=v[b]*g;v=y}for(var w=0,S=m.length;w<S;w++){var T=new f(m[w]+"."+yc[p.path],r.array,v,d);"CUBICSPLINE"===h.interpolation&&(T.createInterpolant=function(e){return new(this instanceof i.QuaternionKeyframeTrack?pc:cc)(this.times,this.values,this.getValueSize()/3,e)},T.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(T)}}}(c);return r=t.name||"animation_"+e,new i.AnimationClip(r,void 0,u)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,r=this,n=t.nodes[e];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(e){return e=r._getNodeRef(r.meshCache,n.mesh,e),void 0!==n.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,r=n.weights.length;t<r;t++)e.morphTargetInfluences[t]=n.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t,r=this.json,n=this.extensions,o=this,a=r.nodes[e],s=a.name?o.createUniqueName(a.name):"";return t=[],(r=o._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})))&&t.push(r),void 0!==a.camera&&t.push(o.getDependency("camera",a.camera).then((function(e){return o._getNodeRef(o.cameraCache,a.camera,e)}))),o._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),Promise.all(t).then((function(t){var r,l=!0===a.isBone?new i.Bone:1<t.length?new i.Group:1===t.length?t[0]:new i.Object3D;if(l!==t[0])for(var u=0,c=t.length;u<c;u++)l.add(t[u]);return a.name&&(l.userData.name=a.name,l.name=s),wc(l,a),a.extensions&&xc(n,l,a),void 0!==a.matrix?((r=new i.Matrix4).fromArray(a.matrix),l.applyMatrix4(r)):(void 0!==a.translation&&l.position.fromArray(a.translation),void 0!==a.rotation&&l.quaternion.fromArray(a.rotation),void 0!==a.scale&&l.scale.fromArray(a.scale)),o.associations.has(l)||o.associations.set(l,{}),o.associations.get(l).nodes=e,o.options.myOptions.helper.processNode({node:l,nodeDef:a})||l}))}},{key:"loadScene",value:function(e){for(var t=this.json,r=this.extensions,n=(e=this.json.scenes[e],this),o=(n.options.myOptions,new i.Group),a=(e.name&&(o.name=n.createUniqueName(e.name)),wc(o,e),e.extensions&&xc(r,o,e),e.nodes||[]),s=[],l=0,u=a.length;l<u;l++)s.push(function e(t,r,n,o){var a=n.nodes[t];return o.getDependency("node",t).then((function(e){return void 0===a.skin?e:o.getDependency("skin",a.skin).then((function(e){for(var r=[],n=0,i=(t=e).joints.length;n<i;n++)r.push(o.getDependency("node",t.joints[n]));return Promise.all(r)})).then((function(r){return e.traverse((function(e){if(e.isMesh){for(var n=[],o=[],a=0,s=r.length;a<s;a++){var l=r[a];l?(n.push(l),l=new i.Matrix4,void 0!==t.inverseBindMatrices&&l.fromArray(t.inverseBindMatrices.array,16*a),o.push(l)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}e.bind(new i.Skeleton(n,o),e.matrixWorld)}})),e}));var t})).then((function(t){r.add(t);var i=[];if(a.children)for(var s=a.children,l=0,u=s.length;l<u;l++){var c=s[l];i.push(e(c,t,n,o))}return Promise.all(i)}))}(a[l],o,t,n));return Promise.all(s).then((function(){var e;return console.log(o,o.children,"scene"),null!=(e=n.options.myOptions)&&e.models.push(o),n.associations=function(e){var t,r=new Map,o=Ou(n.associations);try{for(o.s();!(t=o.n()).done;){var a=Ru(t.value,2),s=a[0],l=a[1];(s instanceof i.Material||s instanceof i.Texture)&&r.set(s,l)}}catch(e){o.e(e)}finally{o.f()}return e.traverse((function(e){var t=n.associations.get(e);null!=t&&r.set(e,t)})),r}(o),o}))}}]),e}();function Mc(e,t,r){var n,o=t.attributes,a=[];for(n in o){var s=gc[n]||n.toLowerCase();s in e.attributes||a.push(function(t,n){return r.getDependency("accessor",t).then((function(t){e.setAttribute(n,t)}))}(o[n],s))}void 0===t.indices||e.index||(l=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),a.push(l)),wc(e,t);var l=e,u=t,c=r,h=u.attributes,p=new i.Box3;if(void 0!==h.POSITION){var f=(h=c.json.accessors[h.POSITION]).min,d=h.max;if(void 0===f||void 0===d)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{p.set(new i.Vector3(f[0],f[1],f[2]),new i.Vector3(d[0],d[1],d[2])),h.normalized&&(f=Tc(fc[h.componentType]),p.min.multiplyScalar(f),p.max.multiplyScalar(f));var m=u.targets;if(void 0!==m){for(var v=new i.Vector3,g=new i.Vector3,y=0,b=m.length;y<b;y++){var x,w,S=m[y];void 0!==S.POSITION&&(w=(S=c.json.accessors[S.POSITION]).min,x=S.max,void 0!==w&&void 0!==x?(g.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),g.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),g.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),S.normalized&&(w=Tc(fc[S.componentType]),g.multiplyScalar(w)),v.max(g)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}p.expandByVector(v)}l.boundingBox=p,d=new i.Sphere,p.getCenter(d.center),d.radius=p.min.distanceTo(p.max)/2,l.boundingSphere=d}}return Promise.all(a).then((function(){if(void 0===t.targets)return e;for(var n=e,i=t.targets,o=r,a=!1,s=!1,l=!1,u=0,c=i.length;u<c;u++){var h=i[u];if(void 0!==h.POSITION&&(a=!0),void 0!==h.NORMAL&&(s=!0),void 0!==h.COLOR_0&&(l=!0),a&&s&&l)break}if(!a&&!s&&!l)return Promise.resolve(n);for(var p=[],f=[],d=[],m=0,v=i.length;m<v;m++){var g,y=i[m];a&&(g=void 0!==y.POSITION?o.getDependency("accessor",y.POSITION):n.attributes.position,p.push(g)),s&&(g=void 0!==y.NORMAL?o.getDependency("accessor",y.NORMAL):n.attributes.normal,f.push(g)),l&&(y=void 0!==y.COLOR_0?o.getDependency("accessor",y.COLOR_0):n.attributes.color,d.push(y))}return Promise.all([Promise.all(p),Promise.all(f),Promise.all(d)]).then((function(e){var t=e[0],r=e[1];return e=e[2],a&&(n.morphAttributes.position=t),s&&(n.morphAttributes.normal=r),l&&(n.morphAttributes.color=e),n.morphTargetsRelative=!0,n}))}))}function Ec(e,t){var r=e.getIndex();if(null===r){var n=[],o=e.getAttribute("position");if(void 0===o)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var a=0;a<o.count;a++)n.push(a);e.setIndex(n),r=e.getIndex()}var s=r.count-2,l=[];if(t===i.TriangleFanDrawMode)for(var u=1;u<=s;u++)l.push(r.getX(0)),l.push(r.getX(u)),l.push(r.getX(u+1));else for(var c=0;c<s;c++)c%2==0?(l.push(r.getX(c)),l.push(r.getX(c+1)),l.push(r.getX(c+2))):(l.push(r.getX(c+2)),l.push(r.getX(c+1)),l.push(r.getX(c)));return l.length/3!=s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(l),t}class Pc{constructor(e){this.materialMap={},this.textureMap={},this.materialIns={},this.textureIns={},this.parser=null,this.baseMaterialTextures=[],this.processBaseMaterialTextures=e=>{const{textures:t,material:r}=e;(0,ue.js)(t,((e,t)=>{var n;(t=this.textureIns[t])&&(this.runScene.optionsEx.options.lazyLoadTexture&&"scene"===(null==(n=this.parser)?void 0:n.json.asset.ex.type)&&(null==(n=this.parser)?void 0:n.json.asset.ex.sceneEx.materialId)!==r.userData.id?this.baseMaterialTextures.push({material:r,type:e,texture:t}):(this.runScene.uniqueEx.texture.addMaterial(t,{material:r,type:e}),r[e]=t))}))},this.lazyLoad=(()=>{const e=t=>{var r=this.baseMaterialTextures[t];if(!r)return this.runScene.optionsEx.cb.load.lazyLoadedTexture.cb(""),void this.runScene.optionsEx.log("贴图懒加载完毕","base","success");const{texture:n,type:i,material:o}=r;this.runScene.uniqueEx.texture.addMaterial(n,{material:o,type:i}),o[i]=n,o.needsUpdate=!0,setTimeout((()=>{e(++t)}),this.runScene.optionsEx.options.lazyLoadTextureBetween)};return()=>{if(!this.runScene.optionsEx.options.lazyLoadTexture)return this.runScene.optionsEx.cb.load.lazyLoadedTexture.cb(""),void this.runScene.optionsEx.log("贴图加载完毕","base","success");e(0)}})(),this.runScene=e}processInput(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.parser=t}))}processTexture(e){const{textureDef:t,texture:r}=e;e=t.md5,r.userData.md5=t.md5,e&&(e=this.runScene.textureEx.getSameTexture(e,r))?this.textureIns[t.id]=e:this.textureIns[t.id]=r}process(e){var{materialDef:e,material:t,model:r}=e;console.log(e,"materialDef.id"),this.materialIns[e.id]||(this.materialIns[e.id]={material:t,models:[]}),this.materialIns[e.id].models.push(r)}done(e){var{materialMap:e,textureMap:t}=e.asset.ex||{};this.processTextureMap(t||{}),this.processMaterialMap(e||{}),setTimeout((()=>{this.lazyLoad()}))}processTextureMap(e){(0,ue.js)(e,((e,t)=>{var{format:t,center:r,rotation:n,offset:i,repeat:o}=t;const a=this.textureIns[e];a&&(a.format=t,void 0!==o&&(({x:e,y:t}="object"==typeof o?o:{x:o,y:o}),a.repeat.x=e,a.repeat.y=t),void 0!==r&&(({x:o,y:e}="object"==typeof r?r:{x:r,y:r}),a.center.x=o,a.center.y=e),void 0!==i&&(({x:t,y:r}="object"==typeof i?i:{x:i,y:i}),a.offset.x=t,a.offset.y=r),n&&(a.rotation=n),this.runScene.textureEx.bindData(a))}))}processMaterialMap(e){(0,ue.js)(e,((e,t)=>{const{material:r,models:n}=this.materialIns[e];if(r){var{normal:e,textures:i}=t;if(e.type){const t=(0,ue.js)(i,((e,t)=>({type:e,texture:this.textureIns[t]}))),o=this.runScene.materialEx.getDataByType(e.type,{normal:e,textures:t,models:n,material:r});if(this.runScene.materialEx.parseNromals(e,o),!o)return;n.map((e=>e.material=o))}else this.runScene.optionsEx.options.notTexture||this.processBaseMaterialTextures({material:r,textures:i}),this.runScene.materialEx.parseNromals(e,r),n.map((e=>e.material=r));r.needsUpdate=!0}}))}}class kc{constructor(e){this.runScene=e}done(e){var t,r,n,i;e.asset.ex&&(({camera:e,lights:t,sceneEx:r,options:n,controls:i}=e.asset.ex),this.camera(e),this.controls(i),this.lights(t),this.ex(r),this.options(n))}controls(e){var t,r;e&&(({x:e,y:t,z:r}=e),this.runScene.assetsEx.controls.target.set(e,t,r),this.runScene.assetsEx.controls.update())}camera(e){var{position:e,far:t,near:r,fov:n,name:i,userData:o}=this.runScene.loaderer.object.parse(e);const a=this.runScene.assetsEx.get().camera;a.position.copy(e),a.far=t,a.near=r,a.fov=n,a.name=i,a.updateProjectionMatrix(),a.userData.id=o.id,this.runScene.uniqueEx.model.add(a),this.runScene.assetsEx.get().controls.update()}lights(e){e.map((e=>{var t=e.type;(t=this.runScene.lightEx.lightExMap[t].parseJSON(e)).target&&this.runScene.modelEx.setSelectByModel(t.target),this.runScene.lightEx.setNull(t)}))}ex(e){var t,r;e=e.fog;const n=this.runScene.sceneEx.get();e&&(({color:e,near:t,far:r}=e),n.fog=new i.Fog(e,t,r),this.runScene.optionsEx.cb.setScene.cb({scene:n,type:"fog"}))}options(e){e.map((e=>{var{type:e,data:t}=e;const r=this.runScene.exporter.gltf.options.getParse(e);null!=r&&r.parse(t)}))}}class Rc{constructor(e){this.parser=null,this.helperModels=[],this.nodeType={MySpriteMaterial:Si},this.cloneMap={},this.runScene=e,this.material=new Pc(e),this.scene=new kc(e)}processInput(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){try{return yield this.material.processInput(e,t),Promise.resolve()}catch(e){console.log(e,"e")}}))}beforeLoader(e){this.runScene.loaderer.gltf.beforeParse(null==(e=null==(e=e.asset)?void 0:e.ex)?void 0:e.type)}processNode(e){var t;let{node:r,nodeDef:n}=e;if(console.log(n,r,"nodeDef"),(0,ue.js)(this.runScene.modelEx.defNodeMap,((e,t)=>{var i=n[e];null!=i&&(r[e]=i)})),n.extras){const{layers:o,normal:a,local:s,cloneId:l,id:u}=n.extras;if(l&&(this.cloneMap[l]||(this.cloneMap[l]=new Set),u&&this.cloneMap[l].add(u)),s&&([e,t,i]=s.split(","),r.position.set(e,t,i)),o&&(r.layers.enable(1),this.runScene.optionsEx.cb.model.setLayers.cb({model:r,val:1})),n.extras.isHelper&&this.helperModels.push(r),a){const n=this.nodeType[null==a?void 0:a.type].modelTools.parseData(r,a);var i=null==(t=null==(e=null==r?void 0:r.material)?void 0:e.userData)?void 0:t.id;if(i){const e=this.material.materialIns[i];if(e){const t=[];e.models.map((e=>{e===r?t.push(n):t.push(e)})),e.models=t}}r=n}}return n.wireframe&&(r.material.wireframe=!0),r}done(e){var t;this.material.done(e),"scene"===(null==(t=e.asset.ex)?void 0:t.type)&&(this.scene.done(e),this.sceneEx(e)),this.removeHelperModel(),this.runScene.optionsEx.cb.load.done.cb("")}mergeGeometry(){}mergeClone(){this.runScene.optionsEx.options.instanceClone&&((0,ue.js)(this.cloneMap,((e,t)=>{const r=this.runScene.uniqueEx.model.get(e);(e=[...t].map((e=>{if((null==(e=this.runScene.uniqueEx.model.get(e))?void 0:e.material)===r.material)return this.runScene.modelEx.remove(e,!1),e})).filter((e=>e))).length&&(t=((e,t)=>{var{material:r,geometry:n}=e;const i=new An.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{i.setMatrixAt(t,e.matrix)})),i})(r,e),this.runScene.modelEx.add(t,r.parent),this.runScene.modelEx.remove(r,!1))})),console.log(this.cloneMap,"this.cloneMap"))}sceneEx(e){const t=this.runScene.sceneEx.get();var r=this.material.materialIns,{materialId:e,backgroundMapping:n,backgroundColor:o,fog:a}=e.asset.ex.sceneEx;if(e&&(e=null==(r=r[e])?void 0:r.material)){const{map:r,envMap:i}=e;r&&(r.mapping=n||300,r.needsUpdate=!0,this.runScene.sceneEx.setBackground(r,!1),r.userData.isBackgroud=!0),i&&(t.environment=this.runScene.textureEx.toThree(i))}o&&(t.background=new i.Color("#"+o)),a&&(({color:r,far:e,near:n}=a),t.fog=new i.Fog("#"+r,n,e),t.fog.open="true"),this.runScene.optionsEx.cb.setScene.cb({scene:t,type:"any"})}removeHelperModel(){this.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}}class Oc{constructor(e){this.dracoPath="./draco/",this._gltf=new Hu,this.runScene=e;const t=new xu;t.setDecoderPath((null==(e=this.runScene.optionsEx.options)?void 0:e.decodePath)||this.dracoPath),this._gltf.dracoLoader=t}parse(e){return new Promise((t=>{try{e instanceof ArrayBuffer&&this._gltf.parse(e,"",(e=>{t(e),this.afterParse(e.parser.options.myOptions,e)}),(e=>{console.log(e,"a")}),{rootModel:this.runScene.assetsEx.get().scene,models:[],helper:new Rc(this.runScene),runScene:this.runScene})}catch(e){console.log(e,"e")}}))}beforeParse(e){"scene"===e&&this.runScene.optionsEx.sceneOptions.loaded&&this.runScene.sceneEx.clean()}afterParse(e,t){const r=e.models;if("material"===t.asset.ex.type){var n,[n]=r;if(!(n=this.runScene.sceneEx.cleanUnlessLevel(n).material))return;this.runScene.materialEx.add(n);var i=this.runScene.modelEx.select;i&&this.runScene.materialEx.resetMaterial(i,n)}else i=r[0].children.filter((e=>{if(!this.runScene.modelEx.isUnless(e))return"model"===t.asset.ex.type&&(e.userData.id=(0,ei.getId)()),e})),this.runScene.modelEx.add(i,void 0,!1,!1,!1),"scene"===t.asset.ex.type&&this.runScene.timeLineEx.parseSavedGroupMap(t.asset.ex.timeLine||{}),this.runScene.modelEx.selectNull(),this.runScene.helperEx.unfocus(),e.helper.mergeClone();console.log(t,e,"json,options"),(0,ue.js)(t,(e=>delete t[e])),t=null,this.runScene.optionsEx.sceneOptions.loaded=!0}}class Cc{constructor(e){this.imgBitMap=new i.ImageBitmapLoader,this.object=new i.ObjectLoader,this.runScene=e,this.gltf=new Oc(e)}}var Lc=a(185);class Ac{constructor(e){this.selectors={},this.boxHelperMap={},this.runScene=e,console.log(e,"runScene.events"),e.events.mouse.bindEvent({type:"up",local:"local",name:"MultipSelector",fn:t=>{e.events.key.ctrl||this.setEmpty()}})}add(e,t=!1){if("array"===(0,Lc.getType)(e))return e.map((e=>this.add(e)));var r=this.runScene.modelEx.select;if(r&&(this.runScene.modelEx.selectNull(),delete this.selectors[e.uuid],this.add(r)),"BoxHelper"!==e.type){if(this.selectors[e.uuid]){if(this.remove(e),this.removeBoxHelper(e),!t)return;this.add(e)}this.addBoxHelper(e),this.selectors[e.uuid]=e,this.runScene.optionsEx.cb.model.focus.cb({model:e,status:!0,domActive:!0}),this.runScene.helperEx.focus(e)}}setInfo(e,t,r,n,i,o){"position"!==t&&(i=n,o=r);const a=this.getSelectedList("value");var{x:i,y:s,z:l}=i;const u=i-o.x,c=s-o.y,h=l-o.z,p=[new Pi({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];a.map((r=>{if(r!==e){var{x:n,y:i,z:o}=r[t],n=n+=u,i=i+=c,o=o+=h;let e=r[t].clone();e.x=n,e.y=i,e.z=o,n=new Pi({target:r,info:t,oldV3:this.runScene.modelEx.cloneV3(r[t]),newV3:e,runScene:this.runScene}).execute(),p.push(n),this.boxHelperMap[r.uuid].setFromObject(r)}})),this.runScene.undoEx.addUndo(p)}getLast(){var e=this.getSelectedList("value");return e[e.length-1]}addBoxHelper(e){var t=this.runScene.helperEx.getBoxHelper(e);this.boxHelperMap[e.uuid]=t}removeBoxHelper(e){this.runScene.assetsEx.get().scene.remove(this.boxHelperMap[e.uuid]),this.boxHelperMap[e.uuid]=null,delete this.selectors[e.uuid]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));this.runScene.optionsEx.cb.model.unFocus.cb(e),this.selectors[e.uuid]=null,delete this.selectors[e.uuid]}isEmpty(){return 0===this.getSelectedList("key").length}getSelectedList(e){return"key"===e?Object.keys(this.selectors):Object.values(this.selectors)}getSelect(){var e=Object.values(this.selectors);return 0!==e.length?e:void 0}selectedLoop(e){return Object.keys(this.selectors).map((t=>e(t,this.selectors[t])))}delete(){this.setBoxHelperEmpty(),this.setEmpty(),this.runScene.helperEx.unfocus()}setBoxHelperEmpty(){var e=Object.values(this.boxHelperMap);this.runScene.assetsEx.get().scene.remove(...e),this.boxHelperMap={}}setEmpty(){this.getSelectedList("value").map((e=>{this.runScene.optionsEx.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={}}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new i.Group;const t=new i.Group;this.runScene.modelEx.add(e,void 0,!1),this.runScene.modelEx.add(t);var r=[...this.getSelectedList("value")],n=(this.runScene.optionsEx.cb.model.multipDrop.cb(this.getSelectedList("value"),e),Kn().group.getCenter(e));t.position.copy(n),this.runScene.optionsEx.cb.model.multipDrop.cb(r,t),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new i.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}}class Dc{constructor(){this.cbs=[]}cb(e,t){return Promise.all(this.cbs.map((r=>r.fn(e,t))))}add(e,t){return this.cbs.push({fn:t,name:e})}}class Ic{constructor(){this.resize=new Dc,this.setSelectMaterial=new Dc,this.setScene=new Dc,this.reset=new Dc,this.render=new Dc,this.baseLog=new Dc,this.inited=new Dc,this.texture={add:new Dc,remove:new Dc},this.model={setSelect:new Dc,add:new Dc,remove:new Dc,multipDrop:new Dc,focus:new Dc,unFocus:new Dc,changeName:new Dc,setOpen:new Dc,setMainStatue:new Dc,setVisible:new Dc,setParent:new Dc,setLayers:new Dc,clone:new Dc,dispose:new Dc},this.material={add:new Dc,dispose:new Dc,setName:new Dc},this.unique={material:{add:new Dc}},this.undo={addUndos:new Dc,removeUndos:new Dc,undoByIndex:new Dc,reset:new Dc},this.scene={save:new Dc,saveNet:new Dc},this.timeLine={setProgress:new Dc,playGroup:new Dc,setGroupMap:new Dc,reset:new Dc,closeGroup:new Dc},this.events={key:{g:new Dc},mouse:{move:new Dc,down:new Dc,up:new Dc},pointer:{down:new Dc,up:new Dc}},this.bloom={glow:{setData:new Dc}},this.load={lazyLoadedTexture:new Dc,done:new Dc,models:new Dc}}}function jc(){var e=0,t=document.createElement("div");function r(e){return t.appendChild(e.dom),e}function n(r){for(var n=0;n<t.children.length;n++)t.children[n].style.display=n===r?"block":"none";e=r}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(r){r.preventDefault(),n(++e%t.children.length)}),!1);var i,o=(performance||Date).now(),a=o,s=0,l=r(new jc.Panel("FPS","#0ff","#002")),u=r(new jc.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=r(new jc.Panel("MB","#f08","#201"))),n(0),{REVISION:16,dom:t,addPanel:r,showPanel:n,begin:function(){o=(performance||Date).now()},end:function(){s++;var e,t=(performance||Date).now();return u.update(t-o,200),a+1e3<=t&&(l.update(1e3*s/(t-a),100),a=t,s=0,i&&(e=performance.memory,i.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576))),t},update:function(){o=this.end()},domElement:t,setMode:n}}jc.Panel=function(e,t,r){var n=1/0,i=0,o=Math.round,a=o(window.devicePixelRatio||1),s=80*a,l=48*a,u=3*a,c=2*a,h=3*a,p=15*a,f=74*a,d=30*a,m=document.createElement("canvas"),v=(m.width=s,m.height=l,m.style.cssText="width:80px;height:48px",m.getContext("2d"));return v.font="bold "+9*a+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=r,v.fillRect(0,0,s,l),v.fillStyle=t,v.fillText(e,u,c),v.fillRect(h,p,f,d),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(h,p,f,d),{dom:m,update:function(l,g){n=Math.min(n,l),i=Math.max(i,l),v.fillStyle=r,v.globalAlpha=1,v.fillRect(0,0,s,p),v.fillStyle=t,v.fillText(o(l)+" "+e+" ("+o(n)+"-"+o(i)+")",u,c),v.drawImage(m,h+a,p,f-a,d,h,p,f-a,d),v.fillRect(h+f-a,p,a,d),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(h+f-a,p,a,o((1-l/g)*d))}}};const Uc=jc;class Bc{constructor(e){this.options={msg:{show:!0,level:"base"},run:!0,decodePath:"./draco/",showFps:!1,loadInterval:2e3,mode:"running",lazyLoadTexture:!1,lazyLoadTextureBetween:16.6,notTexture:!1,hideLocal:!1,instanceClone:!1},this.exporterOptions={compressTexture:!1,notMaterial:!1},this.sceneOptions={loaded:!1},this.setLoadInterval=(()=>{let e=null;return t=>{const{inputInterval:r,cb:n}=t;e&&clearTimeout(e),e=setTimeout((()=>{n(),e=null,clearTimeout(e)}),r)}})(),this.cb=new Ic,this.runScene=e}init(e){this.options=Object.assign(this.options,e),this.options.showFps&&(this.addFps(),this.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(){this.stats=Uc(),this.stats.showPanel(0),this.runScene.assetsEx.engineDom.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",r="success"){var n;null!=(n=null==(n=this.options)?void 0:n.msg)&&n.show&&("base"===this.options.msg.level&&"base"===t&&this.cb.baseLog.cb(e,r),console.log(e))}}class Nc{constructor(e){this.setSize=(e,t)=>{var{w:r,h:n}=this.getDomSize(),r=(e=e||r,t||n);const{camera:i,renderer:o}=this.runScene.assetsEx.get();i.aspect=e/r,i.updateProjectionMatrix(),o.setSize(e,r),this.runScene.bloom.glow.setSize(e,r)},this.runScene=e}create(e){let t=new i.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance"});return t.domElement.style.position="absolute",t.setPixelRatio(window.devicePixelRatio),t.shadowMap.enabled=!0,t.shadowMap.type=i.PCFSoftShadowMap,t.physicallyCorrectLights=!0,t.localClippingEnabled=!0,e.appendChild(t.domElement),t}getDomSize(){var{clientWidth:e,clientHeight:t}=this.runScene.assetsEx.get().engineDom;return{w:e,h:t}}}const Fc=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()};class zc{constructor(e){this.oldFog=null,this.removeMap={light:{valid:e=>this.runScene.lightEx.isLight(e),remove:e=>this.runScene.lightEx.remove(e)}},this.runScene=e}each(e){return this.runScene.assetsEx.get().scene.traverseAncestors(e)}get(){return new Proxy(this.runScene.assetsEx.get().scene,{set:(e,t,r)=>(e[t]=r,!0)})}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}remove(e){var t;if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const r in this.removeMap){const{valid:n,remove:i}=this.removeMap[r];if(n(e))return t.push(...(0,Jn.multiArrToArr)(i(e)))}t.push(new Ei({model:e,runScene:this.runScene,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(t),t}for(const t in this.removeMap){const{valid:r,remove:n}=this.removeMap[t];if(r(e))return n(e)}this.runScene.modelEx.remove(e),null!=(t=this.runScene.helperEx.boxHelper)&&t.setFromObject(this.get())}}cleanUnlessLevel(e){return this.runScene.modelEx.isUnlessLevel(e)&&!this.runScene.helperEx.isHelper(e)&&0!==e.children.length&&1===e.children.length?this.cleanUnlessLevel(e.children[0]):e}getClearModels(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)))}getClear(){const e=this.get(),t=new i.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e))).map((e=>{console.log(e,"model"),t.add(e.clone())})),this.runScene.helperEx.setHelper(t),this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){e.background=null,e.environment=null,e.fog=null}setBackground(e,t=!0){e instanceof i.Texture&&(e.userData.isBackgroud=!0);var r=this.get(),n=new mi({target:r,info:"background",newVal:e,oldVal:r.background,runScene:this.runScene,cb:e=>{this.runScene.bloom.glow.setBackground(e.background)}}).execute();return t&&this.runScene.undoEx.addUndo(n),this.runScene.optionsEx.cb.setScene.cb({scene:r,type:"background"}),this.runScene.bloom.glow.setBackground(e),e}isBackground(e){return e.userData.isBackgroud}clean(){this.runScene.helperEx.unfocus();const e=this.getClearModels();let t=[];e.map((e=>{e.traverse((e=>t.push(e)))})),t.map((e=>{((e,t)=>{t=(t||{}).remove;const{geomerty:r,material:n}=e;if(r&&(null!=r&&r.dispose(),delete e.geometry),n){{var i=e.material;i.dispose();const t=wi(i);0!==t.length&&t.map((e=>{(e=>{if(e){const r=e.image;var t=e.userData.url;r.close(),URL.revokeObjectURL(t),e.dispose()}})(e=e.texture)}))}e.material.dispose(),delete e.material}!1!==t&&e.parent&&e.parent.remove(e)})(e,{remove:!1}),this.runScene.optionsEx.cb.model.dispose.cb(e)})),Fc(this.runScene.assetsEx.get().renderer),this.runScene.assetsEx.get().controls.dispose(),this.runScene.assetsEx.reset(),this.runScene.modelEx.selectNull(),this.cleanSceneInfo(this.get()),this.runScene.cameraEx.reset(this.runScene.assetsEx.get().camera),this.cleanNormal(),this.runScene.assetsEx.get().renderer.resetState(),this.runScene.assetsEx.get().controls.update(),this.runScene.uniqueEx.dispose(),this.runScene.materialEx.dispose(),this.runScene.undoEx.reset(),this.runScene.timeLineEx.reset(),this.runScene.bloom.glow.dispose(),this.runScene.bloom.glow.init(this.runScene.assetsEx.get()),this.runScene.helperEx.reset(),this.runScene.optionsEx.cb.reset.cb(this.get())}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),Fc(e),t.dispose(),this.runScene.bloom.glow.dispose(),i.Cache.clear()}render(){}create(){return new i.Scene}setEnv(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){let r;return t instanceof File&&(r=this.runScene.textureEx.toThree(yield this.runScene.textureEx.parse(t))),null!=t&&t.isTexture&&(r=this.runScene.textureEx.toThree(this.runScene.textureEx.clone(t))),this.setNormal({model:e,info:"environment",val:r}),this.runScene.optionsEx.cb.setScene.cb({scene:e,type:"environment"}),r}))}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new mi({target:e,info:r,oldVal:e[r],newVal:n,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setFogShow(e){var{show:e,color:t,scene:r}=e;e?this.setNormal({model:r,info:"fog",val:this.oldFog||new i.Fog(t)}):(this.oldFog=r.fog,this.setNormal({model:r,info:"fog",val:null})),this.runScene.optionsEx.cb.setScene.cb({scene:r,type:"fog"})}setFog(e){var{scene:e,type:t,val:r}=e;e=new ii({target:e,typeList:["fog",t],newVal:r}).execute(),this.runScene.undoEx.addUndo(e)}getFogJson(e){const{color:t,far:r,near:n}=e;return{color:t.getHexString(),far:r,near:n}}sreenShotDefFile(){this.runScene.helperEx.unfocus();var{w:e,h:t}=this.runScene.renderEx.getDomSize();const r=this.runScene.assetsEx.get().renderer.domElement,{renderer:n,scene:i,camera:o}=(r.width=1920,r.height=1080,this.runScene.renderEx.setSize(1920,1080),this.runScene.assetsEx.get());n.render(i,o);var a=r.toDataURL("image/webp",1);return a=(0,he.base64ToFile)(a,"screenShot.jpg"),r.width=e,r.height=t,this.runScene.renderEx.setSize(),n.render(i,o),a}}class Vc{constructor(e,t){this.showTransform=!1,this.data=new Proxy({},{set:(e,t,r)=>(e[t]=r,console.log(e,t,r,"a,b,c"),!0)}),this.uuid="",this.getAnimaByModelData=(()=>{const e=(e,t,r,n)=>{const i={},o={};if(e=Vc.isNotNow(e)?this.getAllData():e,(0,ue.js)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(i[r]=t[r],o[r]=e[r]):"color"===n&&(0,ue.js)(e[r],((e,n)=>{var a=r+e;i[a]=t[r][e],o[a]=n})))})),!(0,ue.CV)(i))return{begin:i,end:o}};return(t,r,n,i=!1,o)=>{let a=i?n.time:0;const s=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,Jn.lastArrayEle)(s),u=i?"0.00":String(n.time);return l!==u&&(t[u]=Object.assign({},l),s.push(u)),s.map((s=>{var l=t[String(s)],u=.001*((u=i?a-s:s-a)<=0?.001:u)*n.speed;a=s;{var c=r,h=l,p=u,f=o;const t={color(e){const{animaData:t,defType:r}=e,n={};(0,ue.js)(t,(e=>{var i;-1!==e.indexOf(r)&&(i=e.substring(r.length),["r","g","b"].includes(i)&&(n[i]=t[e]))}));var{r:e,g:i,b:o}=n;if((0,Lc.isTrue)(e)&&(0,Lc.isTrue)(i)&&(0,Lc.isTrue)(o))return n}};return()=>{let r;return{promise:new Promise((n=>{var i=e(h,c,0,f);if(console.log(i,"leftAndRight"),!i)return n(0);var{begin:i,end:o}=i;return r=Vn(i,o,p,(e=>{(0,ue.js)(f,((r,n)=>{n=n.type;var i,o=e[r];"number"===n?c[r]=o:"color"===n&&(o=t.color({animaData:e,defType:r}))&&(({r:n,g:o,b:i}=o),c[r].setRGB(n,o,i))}))}),n)})),anima:r}}}}))}})(),this.runScene=t,this.target=e,this.target.userData.isTimeLineUsed=!0,this.uuid=this.getId(e)}toJSON(){var{data:e,type:t}=this;return{data:e,type:t}}addData(e,t,r=!1){return 1e3<Number(e)&&(e="1000.00"),r?this.data[e]=this.getAllData():(this.data[e]||(this.data[e]={}),this.data[e][t]=this.getData(t)),this.data[e]}addTriggerNowData(e){return this.data[e]=this.getAllData(!0)}removeData(e){delete this.data[e]}static isNotNow(e){return"notNow"===Object.values(e)[0]}static getAllDefValByType(e,t,r=!1){const n={};return(0,ue.js)(e,(i=>{n[i]=r?"notNow":Vc.getValByType(t,i,e)})),n}static getValByType(e,t,r){var n,i;return r=r[t].type,e=e[t],"number"===r?e:"color"===r?(({r:t,g:n,b:i}=e),{r:t,g:n,b:i}):"V3"===r?Kn().model.v3ToMap(e):""}static SetTargetByData(e){const{baseType:t,data:r,defType:n,target:i}=e;var o,a;"number"===t?i[n]=r:"color"===t&&(({r:e,g:o,b:a}=r),i[n].setRGB(e,o,a))}getAllData(e=!1){return Vc.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return Vc.getValByType(this.target,e,this.defOptions)}static getTarget(e,t){}getAnima(e,t){return this.getAnimaByModelData(this.data,this.target,e,t,this.defOptions)}setTargetByBetween(e,t,r){Vc.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,Gc[r])(e);return n.data=t,n}reset(){(0,ue.js)(this.defOptions,((e,t)=>{Vc.SetTargetByData({baseType:t.type,data:Vc.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}Vc.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,i,o)=>{(0,ue.js)(i,((i,a)=>{var s,l,u,c,h,p;a=a.type,void 0!==t[i]&&void 0!==r[i]&&Vc.SetTargetByData({baseType:a,data:(s=t[i],l=r[i],u=n,"number"===a?e(s,l,u):"color"===a?(({r:a,g:s,b:c}=s),({r:l,g:h,b:p}=l),{r:e(a,l,u),g:e(s,h,u),b:e(c,p,u)}):void 0),defType:i,target:o})}))}})();const Hc=Vc,Gc={model:class extends Hc{constructor(e,t){super(e,t),this.type="model",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:i}=e,{x:t,y:o,z:a}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==o?(o-n)*r+n:n,z:i!==a?(a-i)*r+i:i}};return(t,r,n)=>{var i,{position:t,scale:o,rotation:a}=t,{position:r,scale:s,rotation:l}=r;t&&r&&(({x:t,y:r,z:i}=e(t,r,n)),this.target.position.set(t,r,i)),o&&s&&(({x:t,y:r,z:i}=e(o,s,n)),this.target.scale.set(t,r,i)),a&&l&&(({x:o,y:s,z:t}=e(a,l,n)),this.target.rotation.set(o,s,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:i}=t,{position:e,scale:o,rotation:a}=Hc.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},o?{sx:n.x,sy:n.y,sz:n.z}:{},a?{rx:i.x,ry:i.y,rz:i.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},o?{sx:o.x,sy:o.y,sz:o.z}:{},a?{rx:a.x,ry:a.y,rz:a.z}:{})}};return(t,r,n,i=!1)=>{let o=i?n.time:0;const a=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,Jn.lastArrayEle)(a),l=i?"0.00":String(n.time)+".00";return s!==l&&(console.log(s,"last"),t[l]={position:"notNow",rotation:"notNow",scale:"notNow"},a.push(l)),a.map((a=>{var s,l,u,c,h=t[String(a)],p=.001*((p=i?o-a:a-o)<=0?.001:p)*n.speed;return o=a,s=r,l=h,u=p,c=n,()=>{let t;return{promise:new Promise((r=>{var{begin:n,end:i}=e(l,s,c);return t=Vn(n,i,u,(e=>{var{px:e,py:t,pz:r,sx:n,sy:i,sz:o,rx:a,ry:u,rz:c}=e;l.position&&s.position.set(e,t,r),l.scale&&s.scale.set(n,i,o),l.rotation&&s.rotation.set(a,u,c)}),r)})),anima:t}}}))}})(),this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}isRemoved(){return!(this.target&&this.target.parent)}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z)}},camera:class extends Hc{constructor(e,t){super(e,t),this.type="camera",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"},target:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:i}=e,{x:t,y:o,z:a}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==o?(o-n)*r+n:n,z:i!==a?(a-i)*r+i:i}};return(t,r,n)=>{var i,{position:t,scale:o,rotation:a,target:s}=t,{position:r,scale:l,rotation:u,target:c}=r;t&&r&&(({x:t,y:r,z:i}=e(t,r,n)),this.target.position.set(t,r,i)),o&&l&&(({x:t,y:r,z:i}=e(o,l,n)),this.target.scale.set(t,r,i)),a&&u&&(({x:o,y:l,z:t}=e(a,u,n)),this.target.rotation.set(o,l,t)),s&&c&&(({x:r,y:i,z:a}=e(s,c,n)),this.controls.target.set(r,i,a))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:i}=t,{position:e,scale:o,rotation:a,target:s}=Hc.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},o?{sx:n.x,sy:n.y,sz:n.z}:{},a?{rx:i.x,ry:i.y,rz:i.z}:{},s?{tx:this.controls.target.x,ty:this.controls.target.y,tz:this.controls.target.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},o?{sx:o.x,sy:o.y,sz:o.z}:{},a?{rx:a.x,ry:a.y,rz:a.z}:{},s?{tx:s.x,ty:s.y,tz:s.z}:{})}},t=(t,r,n,i)=>()=>{let o;return{promise:new Promise((a=>{var{begin:s,end:l}=e(r,t,i);return o=Vn(s,l,n,(e=>{var{px:e,py:n,pz:i,sx:o,sy:a,sz:s,rx:l,ry:u,rz:c,tx:h,ty:p,tz:f}=e;r.position&&t.position.set(e,n,i),r.scale&&t.scale.set(o,a,s),r.rotation&&t.rotation.set(l,u,c),r.target&&this.controls.target.set(h,p,f)}),a)})),anima:Vn}};return(e,r,n,i=!1)=>{let o=i?n.time:0;const a=Object.keys(e).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,Jn.lastArrayEle)(a),l=i?"0.00":String(n.time);return s!==l&&(e[l]=Object.assign({},s),a.push(l)),a.map((a=>{var s=e[String(a)],l=.001*((l=i?o-a:a-o)<=0?.001:l)*n.speed;return o=a,t(r,s,l,n)}))}})(),this.controls=this.runScene.assetsEx.get().controls,this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}getBeginData(e){return this.getAllData()}isRemoved(){return!this.target}getAllData(e=!1){var{position:t,scale:r,rotation:n}=this.target;return{position:e?"notNow":Kn().model.v3ToMap(t),scale:e?"notNow":Kn().model.v3ToMap(r),rotation:e?"notNow":Kn().model.v3ToMap(n),target:e?"notNow":Kn().model.v3ToMap(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let i;if("position"===e)i=Kn().model.v3ToMap(t);else if("scale"===e)i=Kn().model.v3ToMap(r);else if("rotation"===e)i=Kn().model.v3ToMap(n);else{if("target"!==e)throw TypeError("输入值不存在");i=Kn().model.v3ToMap(this.controls.target)}return i}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r,target:n}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z),this.controls.target.set(n.x,n.y,n.z)}},material:class extends Hc{constructor(e,t){super(e,t),this.type="material",this.defOptions={roughness:{type:"number"},metalness:{type:"number"},opacity:{type:"number"},emissive:{type:"color"},color:{type:"color"}},console.log("new timeLineMap"),this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.material.get(e)}isRemoved(){return!0}getId(){return this.runScene.uniqueEx.getId(this.target)}}};class Wc{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,r){if(e.userData){let n=e.userData.id;n||(n=(0,ei.getId)(),e.userData.id=n),this.map[n]||(this.map[n]={material:e,models:new Set},this.unique.runScene.optionsEx.cb.unique.material.add.cb(e),t&&this.addModel(t,e,r))}}addModel(e,t,r){t&&t.userData&&(t=t.userData.id,null!=(t=this.map[t])&&t.models.add(e)),r&&null!=(t=this.map[r.userData.id])&&t.models.delete(e)}get(e){return console.log(this.map,e,"this.map[id]?.material"),null==(e=this.map[e])?void 0:e.material}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&(this.removes.push(e.uuid),console.log("添加材质到移除列表",e,"material"))}dispose(){(0,ue.js)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var Xc=a(1);class qc extends class{constructor(e){this.map={},this.unique=e}add(e){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,ei.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]=e,t)}get(e){return this.map[e]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));delete this.map[e.userData.id]}}{constructor(){super(...arguments),this.nameMap={},this.parseName=(()=>{const e=e=>{var t=e.lastIndexOf("_");return-1===t?-1:(e=e.slice(t+1),Xc.type.isNumber(e)?Number.parseInt(e):-1)},t=(r,n)=>{var i=(t=>{if(-1===e(t))return t;var r=t.lastIndexOf("_");return-1===r?t:t.slice(0,r)})(r)+"_"+n++;return this.nameMap[i]?t(r,n):i},r=["PerspectiveCamera"];return n=>{if(r.includes(n.type))return n.name=n.type;let i=n.name;if(Xc.valid.isTrue(i)||(i=n.type),this.nameMap[i]){var o=this.nameMap[i];if(this.unique.model.get(o)!==n)return o=-1===(o=e(i))?0:o,o=t(i,o),this.nameMap[o]=this.unique.getId(n),n.name=o}else this.nameMap[i]=this.unique.getId(n)}})()}add(e,t){var{reset:r,hasReset:n}=t||{};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e){let i=e.userData.id;if(i&&!r||(i=(0,ei.getId)(),e.userData.id=i),this.map[i]){if(!n)return;i=(0,ei.getId)(),e.userData.id=i}return this.map[i]=e,this.parseName(e),e.material&&this.unique.material.add(e.material,e),e.children.length?this.add(e.children,t):i}}get(e){return this.map[e]}getByName(e){return this.nameMap[e]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));e.traverse((e=>{delete this.nameMap[e.name]})),delete this.map[e.userData.id]}dispose(){this.map={},this.nameMap={}}}class Yc{constructor(e){this.map={},this.unique=e}add(e){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,ei.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]={texture:e,materialMap:{}},t)}getLength(){return Object.keys(this.map).length}addMaterial(e,t,r){var n=e.userData.id;this.map[n]||this.add(e),t&&(({material:e,type:t}=t),this.map[n].materialMap[e.userData.id]||(this.map[n].materialMap[e.userData.id]=new Set),this.map[n].materialMap[e.userData.id].add(t)),r&&(({material:e,type:t}=r),this.map[n].materialMap[e.userData.id]&&this.map[n].materialMap[e.userData.id].delete(t))}get(e){return null==(e=this.map[e])?void 0:e.texture}getMaterials(e){return null==(e=this.map[e])?void 0:e.materialMap}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));delete this.map[e.userData.id]}dispose(){(0,ue.js)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}}class Zc{constructor(e){this.runScene=e,this.model=new qc(this),this.material=new Wc(this),this.texture=new Yc(this)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}const Qc=class{constructor(e){this.uniqueEx=new Zc(this),this.fileEx=new xl(this),this.optionsEx=new Bc(this),this.undoEx=new ri(this),this.textureEx=new Nn(this),this.controlsEx=new se,this.assetsEx=new n(this),this.renderEx=new Nc(this),this.events=new class{constructor(e){this.key=new Zn(this),this.mouse=new Qn(this),this.drag=new le(this),this.mouseEventMap={move:{timeLineMove:e=>{}},down:{},up:{timeLineUp:e=>{}}},this.mouseDown=e=>{},this.mouseUp=e=>{this.runScene.optionsEx.cb.events.mouse.up.cb(e),Object.values(this.mouseEventMap.up).map((t=>t(e)))},this.mouseMove=e=>{this.runScene.optionsEx.cb.events.mouse.move.cb(e),Object.values(this.mouseEventMap.move).map((t=>t(e)))},this.runScene=e}init(e){this.key.init(e),this.mouse.init(e),window.addEventListener("resize",(()=>{this.runScene.renderEx.setSize(),this.runScene.optionsEx.cb.resize.cb("")})),window.addEventListener("mousemove",this.mouseMove),window.addEventListener("mousedown",this.mouseDown),window.addEventListener("mouseup",this.mouseUp)}}(this),this.multipSelector=new Ac(this),this.helperEx=null,this.materialEx=new yi(this),this.cameraEx=new K(this),this.sceneEx=new zc(this),this.modelEx=new ki(this),this.loaderer=new Cc(this),this.exporter=new uo(this),this.lightEx=new mu(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.animaMap={},this.groupMap={},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var r,n,i=((e,t)=>{let r=-1,n=1e3;const i=Object.keys(e).sort(((e,t)=>Number(e)-Number(t)));if(1!==i.length&&(i.map(((e,i)=>{e=Number(e),0<(e=t-e)&&e<n&&(n=e,r=i)})),-1!==r)){var o=i[r],a=i[r+1],s=e[o];if(e=e[a],s&&e){var l=Object.values(s)[0],u=Object.values(e)[0];if("notNow"!==l&&"notNow"!==u)return{left:s,right:e,progress:(t-Number(o))/(Number(a)-Number(o))}}}})(e.data,t);i&&(({left:i,right:r,progress:n}=i),e.setTargetByBetween(i,r,n))}))},this.runScene=e}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.optionsEx.cb.timeLine.reset.cb("")}closeGroup(e){var t,r;console.log(e,"groupName"),this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1,this.runScene.optionsEx.cb.timeLine.closeGroup.cb(e);const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.clean=!0}))}resetGroup(e){var t=this.groupMap[e];t&&(this.closeGroup(e),this.runScene.optionsEx.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,ue.js)(this.groupMap,((e,t)=>{t.run=!1})),console.log(this.groupMap,"this.groupMap"),this.groupMap}parseSavedGroupMap(e){Object.keys(e).map((t=>{const r=e[t],n={};(0,ue.js)(r.data,((e,t)=>{var{type:r,data:i}=t;console.log(t,"modelData");const o=Gc[r];if(t=o.getTarget(e,this.runScene),console.log(t,"target"),t){const r=new o(t,this.runScene);r.data=i,n[e]=r}})),r.data=n,this.groupMap[t]=r,this.runScene.optionsEx.cb.timeLine.setGroupMap.cb({group:r,groupName:t})}))}playGroup(e){this.runScene.helperEx.unfocus();const t=this.groupMap[e];if(t&&!t.run){t.run=!0;const n=Object.keys(t.data).map((e=>{const r=t.data[e],n=(r.data=new Proxy(r.data,{set:(e,t,r)=>(e[t]=r,!0)}),r.getAnima(t));return t.reverse&&(e=r.getAnima(t,!0),n.push(...e)),n})),i=(this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=n.map((e=>(0,Jn.eachTriggerArrGetControls)(e))),t.time*t.speed*(t.reverse?2:1)),o=(new Date).valueOf(),a=i;var r=setInterval((()=>{var t=((new Date).valueOf()-o)/a;this.runScene.optionsEx.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);let s;const l=new Promise((e=>s=setTimeout(e,i)));return this.timerMap[e]={setProgressTime:r,awaitRuned:s},l.then((()=>{if(clearInterval(this.timerMap[e].setProgressTime),t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}}}(this),this.bloom={glow:new Q(this)};var{rootDom:t,options:r}=e;if(console.log(t,"rootDom"),!t)throw TypeError("根节点或路径不可为空");(t=(r||{}).loadInterval)&&0<t?this.optionsEx.setLoadInterval({inputInterval:t,cb:this.load.bind(this,e)}):this.load(e)}load(e){var{path:e,rootDom:t,options:r}=e;this.optionsEx.init(r||{}),this.events.init(t),this.assetsEx.init(t),this.helperEx=new iu(this),this.helperEx.init();const{camera:n,controls:i}=this.assetsEx.get();this.uniqueEx.model.add(n),this.renderEx.setSize(),i.update(),(window.engine=this).bloom.glow.init(this.assetsEx.get()),this.optionsEx.cb.inited.cb(""),this.cameraEx.reset(n),this.loadScene(e)}loadScene(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){if(e){this.optionsEx.log("正在拉取场景","base","info");var t=yield r().get(e,{responseType:"arraybuffer"}).then((e=>e.data));if(t)return this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(t)}}))}render(){var e;null!=(e=this.optionsEx.options)&&e.run&&(this.optionsEx.cb.render.cb(""),this.bloom.glow.update())}dispose(){this.sceneEx.clean()}}})(),u.default;function a(e){var t=l[e];return void 0!==t||(t=l[e]={exports:{}},s[e].call(t.exports,t,t.exports,a)),t.exports}var s,l,u}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios"),require("js-funcs"),require("three"),require("@allex/md5")):"function"==typeof define&&define.amd?define(["axios","js-funcs","three","@allex/md5"],t):"object"==typeof exports?exports.RunScene=t(require("axios"),require("js-funcs"),require("three"),require("@allex/md5")):e.RunScene=t(e.axios,e["js-funcs"],e.three,e["@allex/md5"])}(self,((__WEBPACK_EXTERNAL_MODULE__3300__,__WEBPACK_EXTERNAL_MODULE__6001__,__WEBPACK_EXTERNAL_MODULE__8881__,__WEBPACK_EXTERNAL_MODULE__1129__)=>(()=>{"use strict";var __webpack_modules__={2958:(e,t,r)=>{function n(){return(n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===f(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(n)}}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return void 0===e}function g(){return"undefined"!=typeof window}function v(e){return Ge(e)||Ve(e)}function b(e){return(nt=k(e,rt))&&Sr}function y(e,t){return!t&&console.warn(e)}function x(e,t){return e&&(rt[e]=t)&&nt&&(nt[e]=t)||rt}function w(){return 0}function S(e,t,r){return(r=e[t])&&Ge(r)?e[t]():m(r)&&e.getAttribute&&e.getAttribute(t)||r}function M(e,t){(e=e.split(",")).forEach(t)}function T(e,t,r,n){st.length&&gt(),e.render(t,r,n),st.length&&gt()}function _(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(et).length<2?t:Ve(e)?e.trim():e}function E(e){return e}function k(e,t){for(var r in t)e[r]=t[r];return e}function D(e,t){for(var r in t)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=We(t[r])?D(e[r]||(e[r]={}),t[r]):t[r]);return e}function P(e){var t,r=e.parent||le,n=e.keyframes?(t=Ze(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):vt;if(qe(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function A(e){return!e||e._ts&&A(e.parent)}function O(e){return e._repeat?C(e._tTime,e=e.duration()+e._rDelay)*e:0}function C(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function R(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function L(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=R(e.rawTime(),t),(!t._dur||H(0,t.totalDuration(),r)-t._tTime>Ie)&&t.render(r,!0)),wt(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(r=e;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;e._zTime=-Ie}}function I(e,t,r,n){return t.parent&&xt(t),t._start=mt((He(r)?r:r||e!==le?V(e,r,t):e._time)+t._delay),t._end=mt(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=4<arguments.length?arguments[4]:void 0,s=e[a];if(i)for(r=t[i];s&&s[i]>r;)s=s._prev;s?(t._next=s._next,s._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[a]=t,t._prev=s,t.parent=t._dp=e}(e,t,"_first","_last",e._sort?"_start":0),F(t)||(e._recent=t),n||L(e,t),e}function B(e,t){(rt.ScrollTrigger||at("scrollTrigger",t))&&rt.ScrollTrigger.create(t,e)}function U(e,t,r,n){return Kt(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&pe!==jt.frame?(st.push(e),e._lazy=[t,n]):void 0:1}function j(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||j(e))}function F(e){return"isFromStart"===(e=e.data)||"isStart"===e}function N(e,t,r,n){var a=e._repeat,i=mt(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=i/e._dur),e._dur=i,e._tDur=a?a<0?1e10:mt(i*(a+1)+e._rDelay*a):i,0<t&&!n?Mt(e,e._tTime=e._tDur*t):e.parent&&St(e),r||wt(e.parent,e),e}function z(e){return e instanceof ir?wt(e):N(e,e._dur)}function V(e,t,r){var n,a,i,s=e.labels,o=e._recent||Tt,l=e.duration()>=Le?o.endTime(!1):e._dur;return Ve(t)&&(isNaN(t)||t in s)?(a=t.charAt(0),i="%"===t.substr(-1),n=t.indexOf("="),"<"===a||">"===a?(0<=n&&(t=t.replace(/=/,"")),("<"===a?o._start:o.endTime(0<=o._repeat))+(parseFloat(t.substr(1))||0)*(i?(n<0?o:r).totalDuration()/100:1)):n<0?(t in s||(s[t]=l),s[t]):(a=parseFloat(t.charAt(n-1)+t.substr(n+1)),i&&r&&(a=a/100*(Ze(r)?r[0]:r).totalDuration()),1<n?V(e,t.substr(0,n-1),r)+a:l+a)):null==t?l:+t}function G(e,t,r){var n,a,i=He(t[1]),s=(i?2:1)+(e<2?0:1),o=t[s];if(i&&(o.duration=t[1]),o.parent=r,e){for(n=o,a=r;a&&!("immediateRender"in n);)n=a.vars.defaults||{},a=qe(a.vars.inherit)&&a.parent;o.immediateRender=qe(n.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new hr(t[0],o,t[1+s])}function H(e,t,r){return r<e?e:t<r?t:r}function W(e){if(Ge(e))return e;var t=We(e)?e:{each:e},r=Ht(t.ease),n=t.from||0,a=parseFloat(t.base)||0,i={},s=(e=0<n&&n<1,isNaN(n)||e),o=t.axis,l=n,c=n;return Ve(n)?l=c={center:.5,edges:.5,end:1}[n]||0:!e&&s&&(l=n[0],c=n[1]),function(e,u,h){var d,p,f,m,g,v,b,y,x=(h||t).length,w=i[x];if(!w){if(!(y="auto"===t.grid?0:(t.grid||[1,Le])[1])){for(v=-Le;v<(v=h[y++].getBoundingClientRect().left)&&y<x;);y--}for(w=i[x]=[],d=s?Math.min(y,x)*l-.5:n%y,p=y===Le?0:s?x*c/y-.5:n/y|0,b=Le,g=v=0;g<x;g++)m=g%y-d,f=p-(g/y|0),w[g]=m=o?Math.abs("y"===o?f:m):Fe(m*m+f*f),v<m&&(v=m),m<b&&(b=m);"random"===n&&At(w),w.max=v-b,w.min=b,w.v=x=(parseFloat(t.amount)||parseFloat(t.each)*(x<y?x-1:o?"y"===o?x/y:y:Math.max(y,x/y))||0)*("edges"===n?-1:1),w.b=x<0?a-x:a,w.u=Et(t.amount||t.each)||0,r=r&&x<0?Gt(r):r}return x=(w[e]-w.min)/w.max||0,mt(w.b+(r?r(x):x)*w.v)+w.u}}function q(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var n=Math.round(parseFloat(r)/e)*e*t;return(n-n%1)/t+(He(r)?0:Et(r))}}function K(e,t){var r,n,a=Ze(e);return!a&&We(e)&&(r=a=e.radius||Le,e.values?(e=Pt(e.values),(n=!He(e[0]))&&(r*=r)):e=q(e.increment)),_t(t,a?Ge(e)?function(t){return n=e(t),Math.abs(n-t)<=r?n:t}:function(t){for(var a,i,s=parseFloat(n?t.x:t),o=parseFloat(n?t.y:0),l=Le,c=0,u=e.length;u--;)(a=n?(a=e[u].x-s)*a+(i=e[u].y-o)*i:Math.abs(e[u]-s))<l&&(l=a,c=u);return c=!r||l<=r?e[c]:t,n||c===t||He(t)?c:c+Et(t)}:q(e))}function Z(e,t,r,n){return _t(Ze(e)?!t:!0===r?!!(r=0):!n,(function(){return Ze(e)?e[~~(Math.random()*e.length)]:(r=r||1e-5)&&(n=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((e-r/2+Math.random()*(t-e+.99*r))/r)*r*n)/n}))}function X(e,t,r){return _t(r,(function(r){return e[~~t(r)]}))}function Q(e,t,r,n,a){var i=t-e,s=n-r;return _t(a,(function(t){return r+((t-e)/i*s||0)}))}function Y(e,t,r){var n,a,i,s=e.labels,o=Le;for(n in s)(a=s[n]-t)<0==!!r&&a&&o>(a=Math.abs(a))&&(i=n,o=a);return i}function J(e,t,r){var n=e.vars,a=n[t];a&&(t=n[t+"Params"],n=n.callbackScope||e,r&&st.length&&gt(),t?a.apply(n,t):a.call(n))}function $(e){return xt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&J(e,"onInterrupt"),e}function ee(e,t,r){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(r-t)*e*6:e<.5?r:3*e<2?t+(r-t)*(2/3-e)*6:t)*Ct+.5|0}function te(e,t,r){var n,a,i,s,o="",l=(e+o).match(Bt),c=t?"hsla(":"rgba(",u=0;if(!l)return e;if(l=l.map((function(e){return(e=Lt(e,t,1))&&c+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(i=It(e),(n=r.c).join(o)!==i.c.join(o)))for(s=(a=e.replace(Bt,"1").split(Ye)).length-1;u<s;u++)o+=a[u]+(~n.indexOf(u)?l.shift()||c+"0,0,0,0)":(i.length?i:l.length?l:r).shift());if(!a)for(s=(a=e.split(Bt)).length-1;u<s;u++)o+=a[u]+l[u];return o+a[s]}function re(e,t){for(var r,n=e._first;n;)n instanceof ir?re(n,t):!n.vars.yoyoEase||n._yoyo&&n._repeat||n._yoyo===t||(n.timeline?re(n.timeline,t):(r=n._ease,n._ease=n._yEase,n._yEase=r,n._yoyo=t)),n=n._next}function ne(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},a={easeIn:t,easeOut:n,easeInOut:3<arguments.length&&void 0!==arguments[3]?arguments[3]:function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2}};M(e,(function(e){for(var t in Nt[e]=rt[e]=a,Nt[r=e.toLowerCase()]=n,a)Nt[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=Nt[e+"."+t]=a[t]}))}function ae(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function ie(e,t,r){function n(e){return 1===e?1:a*Math.pow(2,-10*e)*ze((e-i)*s)+1}var a=1<=t?t:1,i=(s=(r||(e?.3:.45))/(t<1?t:1))/Be*(Math.asin(1/a)||0),s=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:ae(n),Be/s);return r.config=function(t,r){return ie(e,t,r)},r}function se(e){function t(e){return e?--e*e*((r+1)*e+r)+1:0}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,n="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:ae(t);return n.config=function(t){return se(e,t)},n}r.d(t,{Q3:()=>hr});var oe,le,ce,ue,he,de,pe,fe,me,ge,ve,be,ye,xe,we,Se,Me,Te,_e,Ee,ke,De,Pe,Ae,Oe,Ce={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Re={duration:.5,overwrite:!1,delay:0},Le=1e8,Ie=1/Le,Be=2*Math.PI,Ue=Be/4,je=0,Fe=Math.sqrt,Ne=Math.cos,ze=Math.sin,Ve=function(e){return"string"==typeof e},Ge=function(e){return"function"==typeof e},He=function(e){return"number"==typeof e},We=function(e){return"object"==f(e)},qe=function(e){return!1!==e},Ke="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Ze=Array.isArray,Xe=/(?:-?\.?\d|\.)+/gi,Qe=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Ye=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Je=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,$e=/[+-]=-?[.\d]+/,et=/[^,'"\[\]\s]+/gi,tt=/[\d.+\-=]+(?:e[-+]\d*)*/i,rt={},nt={},at=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},it={},st=[],ot={},lt={},ct={},ut=30,ht=[],dt="",pt=function(e){var t,r,n=e[0];if(We(n)||Ge(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(r=ht.length;r--&&!ht[r].targetTest(n););t=ht[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new nr(e[r],t)))||e.splice(r,1);return e},ft=function(e){return e._gsap||pt(Pt(e))[0]._gsap},mt=function(e){return Math.round(1e7*e)/1e7||0},gt=function(){var e,t,r=st.length,n=st.slice(0);for(ot={},e=st.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},vt=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},bt=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},yt=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",a=t._prev,i=t._next;a?a._next=i:e[r]===t&&(e[r]=i),i?i._prev=a:e[n]===t&&(e[n]=a),t._next=t._prev=t.parent=null},xt=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},wt=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},St=function(e){return e._end=mt(e._start+(e._tDur/Math.abs(e._ts||e._rts||Ie)||0))},Mt=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=mt(r._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),St(e),r._dirty||wt(r,e)),e},Tt={_start:0,endTime:w,totalDuration:w},_t=function(e,t){return e||0===e?t(e):t},Et=function(e,t){return Ve(e)&&(t=tt.exec(e))?e.substr(t.index+t[0].length):""},kt=[].slice,Dt=function(e,t){return e&&We(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&We(e[0]))&&!e.nodeType&&e!==ce},Pt=function(e,t,r){return!Ve(e)||r||!ue&&Ft()?Ze(e)?function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return Ve(e)&&!t||Dt(e,1)?r.push.apply(r,d(Pt(e))):r.push(e)}))||r}(e,r):Dt(e)?kt.call(e,0):e?[e]:[]:kt.call((t||he).querySelectorAll(e),0)},At=function(e){return e.sort((function(){return.5-Math.random()}))},Ot=function(e){for(var t,r,n,a,i=0,s="";~(t=e.indexOf("random(",i));)n=e.indexOf(")",t),a="["===e.charAt(t+7),r=e.substr(t+7,n-t-7).match(a?et:Xe),s+=e.substr(i,t-i)+Z(a?r:+r[0],a?0:+r[1],+r[2]||1e-5),i=n+1;return s+e.substr(i,e.length-i)},Ct=255,Rt={aqua:[0,Ct,Ct],lime:[0,Ct,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Ct],navy:[0,0,128],white:[Ct,Ct,Ct],olive:[128,128,0],yellow:[Ct,Ct,0],orange:[Ct,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Ct,0,0],pink:[Ct,192,203],cyan:[0,Ct,Ct],transparent:[Ct,Ct,Ct,0]},Lt=function(e,t,r){var n,a,i,s,o,l,c,u=e?He(e)?[e>>16,e>>8&Ct,e&Ct]:0:Rt.black;if(!u){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Rt[e])u=Rt[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(n=e.charAt(1))+n+(a=e.charAt(2))+a+(i=e.charAt(3))+i+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(u=parseInt(e.substr(1,6),16))>>16,u>>8&Ct,u&Ct,parseInt(e.substr(7),16)/255];u=[(e=parseInt(e.substr(1),16))>>16,e>>8&Ct,e&Ct]}else if("hsl"===e.substr(0,3))if(u=c=e.match(Xe),t){if(~e.indexOf("="))return u=e.match(Qe),r&&u.length<4&&(u[3]=1),u}else s=+u[0]%360/360,o=+u[1]/100,n=2*(l=+u[2]/100)-(a=l<=.5?l*(o+1):l+o-l*o),3<u.length&&(u[3]*=1),u[0]=ee(s+1/3,n,a),u[1]=ee(s,n,a),u[2]=ee(s-1/3,n,a);else u=e.match(Xe)||Rt.transparent;u=u.map(Number)}return t&&!c&&(n=u[0]/Ct,a=u[1]/Ct,i=u[2]/Ct,l=((e=Math.max(n,a,i))+(t=Math.min(n,a,i)))/2,e===t?s=o=0:(c=e-t,o=.5<l?c/(2-e-t):c/(e+t),s=e===n?(a-i)/c+(a<i?6:0):e===a?(i-n)/c+2:(n-a)/c+4,s*=60),u[0]=~~(s+.5),u[1]=~~(100*o+.5),u[2]=~~(100*l+.5)),r&&u.length<4&&(u[3]=1),u},It=function(e){var t=[],r=[],n=-1;return e.split(Bt).forEach((function(e){e=e.match(Ye)||[],t.push.apply(t,d(e)),r.push(n+=e.length+1)})),t.c=r,t},Bt=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Rt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),Ut=/hsl[a]?\(/,jt=(we=Date.now,Se=500,Me=33,Te=we(),_e=Te,ke=Ee=1e3/240,Pe={time:0,frame:0,tick:function(){Wt(!0)},deltaRatio:function(e){return ye/(1e3/(e||60))},wake:function(){de&&(!ue&&g()&&(ce=ue=window,he=ce.document||{},rt.gsap=Sr,(ce.gsapVersions||(ce.gsapVersions=[])).push(Sr.version),b(nt||ce.GreenSockGlobals||!ce.gsap&&ce||{}),be=ce.requestAnimationFrame),ge&&Pe.sleep(),ve=be||function(e){return setTimeout(e,ke-1e3*Pe.time+1|0)},me=1,Wt(2))},sleep:function(){(be?ce.cancelAnimationFrame:clearTimeout)(ge),me=0,ve=w},lagSmoothing:function(e,t){Se=e||1/Ie,Me=Math.min(t,Se,0)},fps:function(e){Ee=1e3/(e||240),ke=1e3*Pe.time+Ee},add:function(e){De.indexOf(e)<0&&De.push(e),Ft()},remove:function(e,t){~(t=De.indexOf(e))&&De.splice(t,1)&&t<=xe&&xe--},_listeners:De=[]}),Ft=function(){return!me&&jt.wake()},Nt={},zt=/^[\d.\-M][\d.\-,\s]/,Vt=/["']/g,Gt=function(e){return function(t){return 1-e(1-t)}},Ht=function(e,t){return e&&(Ge(e)?e:Nt[e]||function(e){var t,r,n,a=(e+"").split("("),i=Nt[a[0]];return i&&1<a.length&&i.config?i.config.apply(null,~e.indexOf("{")?[function(e){for(var t,r,n,a={},i=e.substr(1,e.length-3).split(":"),s=i[0],o=1,l=i.length;o<l;o++)r=i[o],t=o!==l-1?r.lastIndexOf(","):r.length,n=r.substr(0,t),a[s]=isNaN(n)?n.replace(Vt,"").trim():+n,s=r.substr(t+1).trim();return a}(a[1])]:(t=(a=e).indexOf("(")+1,r=a.indexOf(")"),n=a.indexOf("(",t),a.substring(t,~n&&n<r?a.indexOf(")",r+1):r).split(",").map(_))):Nt._CE&&zt.test(e)?Nt._CE("",e):i}(e))||t};function Wt(e){var t,r,n,a=we()-_e,i=!0===e;if(Se<a&&(Te+=a-Me),(0<(a=(r=(_e+=a)-Te)-ke)||i)&&(n=++Pe.frame,ye=r-1e3*Pe.time,Pe.time=r/=1e3,ke+=a+(Ee<=a?4:Ee-a),t=1),i||(ge=ve(Wt)),t)for(xe=0;xe<De.length;xe++)De[xe](r,ye,n,e)}function qt(e){return e<Oe?Ae*e*e:e<.7272727272727273?Ae*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?Ae*(e-=2.25/2.75)*e+.9375:Ae*Math.pow(e-2.625/2.75,2)+.984375}function Kt(e,t){var r,n,a,i,s,o,l,c,u,h,d,p,f,m=e.vars,g=m.ease,v=m.startAt,b=m.immediateRender,y=m.lazy,x=m.onUpdate,w=m.onUpdateParams,S=m.callbackScope,M=m.runBackwards,T=m.yoyoEase,_=m.keyframes,E=m.autoRevert,k=e._dur,D=e._startAt,P=e._targets,A=e.parent,O=A&&"nested"===A.data?A.parent._targets:P,C="auto"===e._overwrite&&!oe,R=e.timeline;if(e._ease=Ht(g=!R||_&&g?g:"none",Re.ease),e._yEase=T?Gt(Ht(!0===T?g:T,Re.ease)):0,T&&e._yoyo&&!e._repeat&&(T=e._yEase,e._yEase=e._ease,e._ease=T),e._from=!R&&!!m.runBackwards,!R||_&&!m.stagger){if(p=(c=P[0]?ft(P[0]).harness:0)&&m[c.prop],r=bt(m,it),D&&xt(D.render(-1,!0)),v)if(xt(e._startAt=hr.set(P,vt({data:"isStart",overwrite:!1,parent:A,immediateRender:!0,lazy:qe(y),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:S,stagger:0},v))),t<0&&!b&&!E&&e._startAt.render(-1,!0),b){if(0<t&&!E&&(e._startAt=0),k&&t<=0)return void(t&&(e._zTime=t))}else!1===E&&(e._startAt=0);else if(M&&k)if(D)E||(e._startAt=0);else if(a=vt({overwrite:!1,data:"isFromStart",lazy:(b=!t&&b)&&qe(y),immediateRender:b,stagger:0,parent:A},r),p&&(a[c.prop]=p),xt(e._startAt=hr.set(P,a)),t<0&&e._startAt.render(-1,!0),e._zTime=t,b){if(!t)return}else Kt(e._startAt,Ie);for(e._pt=0,y=k&&qe(y)||y&&!k,n=0;n<P.length;n++){if(l=(s=P[n])._gsap||pt(P)[n]._gsap,e._ptLookup[n]=h={},ot[l.id]&&st.length&&gt(),d=O===P?n:O.indexOf(s),c&&!1!==(u=new c).init(s,p||r,e,d,O)&&(e._pt=i=new yr(e._pt,s,u.name,0,1,u.render,u,0,u.priority),u._props.forEach((function(e){h[e]=i})),u.priority&&(o=1)),!c||p)for(a in r)lt[a]&&(u=lr(a,r,e,d,s,O))?u.priority&&(o=1):h[a]=i=or.call(e,s,a,"get",r[a],d,O,0,m.stringFilter);e._op&&e._op[n]&&e.kill(s,e._op[n]),C&&e._pt&&(rr=e,le.killTweensOf(s,h,e.globalTime(t)),f=!e.parent,rr=0),e._pt&&y&&(ot[l.id]=1)}o&&br(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!f,_&&t<=0&&R.render(Le,!0,!0)}function Zt(e,t,r,n,a){return Ge(e)?e.call(t,r,n,a):Ve(e)&&~e.indexOf("random(")?Ot(e):e}function Xt(e,t,r){return e.setAttribute(t,r)}function Qt(e,t){var r=t._pt,n="";if(!e&&t.b)n=t.b;else if(1===e&&t.e)n=t.e;else{for(;r;)n=r.p+(r.m?r.m(r.s+r.c*e):Math.round(1e4*(r.s+r.c*e))/1e4)+n,r=r._next;n+=t.c}t.set(t.t,t.p,n,t)}function Yt(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next}function Jt(e,t,r,n){for(var a,i=this._pt;i;)a=i._next,i.p===n&&i.modifier(e,t,r),i=a}function $t(e){for(var t,r,n=this._pt;n;)r=n._next,n.p===e&&!n.op||n.op===e?yt(this,n,"_pt"):n.dep||(t=1),n=r;return!t}function er(e,t,r,n){n.mSet(e,t,n.m.call(n.tween,r,n.mt),n)}function tr(e,t){return{name:e,rawVars:1,init:function(e,r,n){n._onInit=function(e){var n,a;if(Ve(r)&&(n={},M(r,(function(e){return n[e]=1})),r=n),t){for(a in n={},r)n[a]=t(r[a]);r=n}var i,s,o,l=e,c=r,u=l._targets;for(i in c)for(s=u.length;s--;)(o=(o=l._ptLookup[s][i])&&o.d)&&(o=o._pt?wr(o,i):o)&&o.modifier&&o.modifier(c[i],l,u[s],i)}}}}M("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var r=t<5?t+1:t;ne(e+",Power"+(r-1),t?function(e){return Math.pow(e,r)}:function(e){return e},(function(e){return 1-Math.pow(1-e,r)}),(function(e){return e<.5?Math.pow(2*e,r)/2:1-Math.pow(2*(1-e),r)/2}))})),Nt.Linear.easeNone=Nt.none=Nt.Linear.easeIn,ne("Elastic",ie("in"),ie("out"),ie()),Ae=7.5625,Oe=1/2.75,ne("Bounce",(function(e){return 1-qt(1-e)}),qt),ne("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),ne("Circ",(function(e){return-(Fe(1-e*e)-1)})),ne("Sine",(function(e){return 1===e?1:1-Ne(e*Ue)})),ne("Back",se("in"),se("out"),se()),Nt.SteppedEase=Nt.steps=rt.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,r=1/e,n=e+(t?0:1),a=t?1:0,i=1-Ie;return function(e){return((n*H(0,i,e)|0)+a)*r}}},Re.ease=Nt["quad.out"],M("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return dt+=e+","+e+"Params,"}));var rr,nr=u((function e(t,r){h(this,e),this.id=je++,(t._gsap=this).target=t,this.harness=r,this.get=r?r.get:S,this.set=r?r.getSetter:mr})),ar=function(){function e(t){h(this,e),this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,N(this,+t.duration,1,1),this.data=t.data,me||jt.wake()}return u(e,[{key:"delay",value:function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay}},{key:"duration",value:function(e){return arguments.length?this.totalDuration(0<this._repeat?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur}},{key:"totalDuration",value:function(e){return arguments.length?(this._dirty=0,N(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Ft(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(Mt(this,e),r._dp&&!r.parent&&L(r,this);r&&r.parent;)r.parent._time!==r._start+(0<=r._ts?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&I(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Ie||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),T(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+O(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time}},{key:"totalProgress",value:function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio}},{key:"progress",value:function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+O(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*r,t):this._repeat?C(this._tTime,r)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-Ie?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?R(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-Ie?0:this._rts,e=this.totalTime(H(-this._delay,this._tDur,t),!0)).parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;return St(this),this}},{key:"paused",value:function(e){return arguments.length?(this._ps!==e&&((this._ps=e)?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Ft(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==Ie&&(this._tTime-=Ie)))),this):this._ps}},{key:"startTime",value:function(e){var t;return arguments.length?(this._start=e,!(t=this.parent||this._dp)||!t._sort&&this.parent||I(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(qe(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)}},{key:"rawTime",value:function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?R(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,r=arguments.length?e:t.rawTime();t;)r=t._start+r/(t._ts||1),t=t._dp;return r}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,z(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,z(this),t?this.time(t):this):this._rDelay}},{key:"yoyo",value:function(e){return arguments.length?(this._yoyo=e,this):this._yoyo}},{key:"seek",value:function(e,t){return this.totalTime(V(this,e),qe(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,qe(t))}},{key:"play",value:function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)}},{key:"reverse",value:function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)}},{key:"pause",value:function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)}},{key:"resume",value:function(){return this.paused(!1)}},{key:"reversed",value:function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-Ie:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-Ie,this}},{key:"isActive",value:function(){var e=this.parent||this._dp,t=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(e=e.rawTime(!0))>=t&&e<this.endTime(!0)-Ie))}},{key:"eventCallback",value:function(e,t,r){var n=this.vars;return 1<arguments.length?(t?(n[e]=t,r&&(n[e+"Params"]=r),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(r){function n(){var e=t.then;t.then=null,Ge(a)&&(a=a(t))&&(a.then||a===t)&&(t.then=e),r(a),t.then=e}var a=Ge(e)?e:E;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){$(this)}}]),e}(),ir=(vt(ar.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Ie,_prom:0,_ps:!1,_rts:1}),function(){a(t,ar);var e=s(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=1<arguments.length?arguments[1]:void 0;return h(this,t),(r=e.call(this,n)).labels={},r.smoothChildTiming=!!n.smoothChildTiming,r.autoRemoveChildren=!!n.autoRemoveChildren,r._sort=qe(n.sortChildren),le&&I(n.parent||le,o(r),a),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&B(o(r),n.scrollTrigger),r}return u(t,[{key:"to",value:function(e,t,r){return G(0,arguments,this),this}},{key:"from",value:function(e,t,r){return G(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return G(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,P(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new hr(e,t,V(this,r),1),this}},{key:"call",value:function(e,t,r){return I(this,hr.delayedCall(0,e,t),r)}},{key:"staggerTo",value:function(e,t,r,n,a,i,s){return r.duration=t,r.stagger=r.stagger||n,r.onComplete=i,r.onCompleteParams=s,r.parent=this,new hr(e,r,V(this,a)),this}},{key:"staggerFrom",value:function(e,t,r,n,a,i,s){return r.runBackwards=1,P(r).immediateRender=qe(r.immediateRender),this.staggerTo(e,t,r,n,a,i,s)}},{key:"staggerFromTo",value:function(e,t,r,n,a,i,s,o){return n.startAt=r,P(n).immediateRender=qe(n.immediateRender),this.staggerTo(e,t,n,a,i,s,o)}},{key:"render",value:function(e,t,r){var n,a,i,s,o,l,c,u,h,d,p=this._time,f=this._dirty?this.totalDuration():this._tDur,m=this._dur,g=e<=0?0:mt(e),v=this._zTime<0!=e<0&&(this._initted||!m);if((g=this!==le&&f<g&&0<=e?f:g)!==this._tTime||r||v){if(p!==this._time&&m&&(g+=this._time-p,e+=this._time-p),n=g,u=this._start,o=!(c=this._ts),v&&(m||(p=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(v=this._yoyo,s=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*s+e,t,r);if(n=mt(g%s),g===f?(i=this._repeat,n=m):((i=~~(g/s))&&i===g/s&&(n=m,i--),m<n&&(n=m)),h=C(this._tTime,s),v&&1&i&&(n=m-n,d=1),i!==(h=!p&&this._tTime&&h!==i?i:h)&&!this._lock){var b=v&&1&h;if(v=b===(v&&1&i),p=(b=i<h?!b:b)?0:m,this._lock=1,this.render(p||(d?0:mt(i*s)),t,!m)._lock=0,this._tTime=g,!t&&this.parent&&J(this,"onRepeat"),this.vars.repeatRefresh&&!d&&(this.invalidate()._lock=1),p&&p!==this._time||o!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,f=this._tDur,v&&(this._lock=2,this.render(p=b?m:-1e-4,!0),this.vars.repeatRefresh&&!d&&this.invalidate()),this._lock=0,!this._ts&&!o)return this;re(this,d)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,r){var n;if(t<r)for(n=e._first;n&&n._start<=r;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=r;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,mt(p),mt(n)))&&(g-=n-(n=l._start)),this._tTime=g,this._time=n,this._act=!c,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,p=0),!p&&n&&!t&&(J(this,"onStart"),this._tTime!==g))return this;if(p<=n&&0<=e)for(y=this._first;y;){if(a=y._next,(y._act||n>=y._start)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,r);if(y.render(0<y._ts?(n-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(n-y._start)*y._ts,t,r),n!==this._time||!this._ts&&!o){l=0,a&&(g+=this._zTime=-Ie);break}}y=a}else for(var y=this._last,x=e<0?e:n;y;){if(a=y._prev,(y._act||x<=y._end)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,r);if(y.render(0<y._ts?(x-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(x-y._start)*y._ts,t,r),n!==this._time||!this._ts&&!o){l=0,a&&(g+=this._zTime=x?-Ie:Ie);break}}y=a}if(l&&!t&&(this.pause(),l.render(p<=n?0:-Ie)._zTime=p<=n?1:-1,this._ts))return this._start=u,St(this),this.render(e,t,r);this._onUpdate&&!t&&J(this,"onUpdate",!0),!(g===f&&f>=this.totalDuration()||!g&&p)||u!==this._start&&Math.abs(c)===Math.abs(this._ts)||this._lock||(!e&&m||!(g===f&&0<this._ts||!g&&this._ts<0)||xt(this,1),t||e<0&&!p||!g&&!p&&f||(J(this,g===f&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||g<f&&0<this.timeScale()||this._prom()))}return this}},{key:"add",value:function(e,t){var r=this;if(He(t)||(t=V(this,t,e)),!(e instanceof ar)){if(Ze(e))return e.forEach((function(e){return r.add(e,t)})),this;if(Ve(e))return this.addLabel(e,t);if(!Ge(e))return this;e=hr.delayedCall(0,e)}return this!==e?I(this,e,t):this}},{key:"getChildren",value:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Le,a=[],i=this._first;i;)i._start>=n&&(i instanceof hr?t&&a.push(i):(r&&a.push(i),e&&a.push.apply(a,d(i.getChildren(!0,t,r))))),i=i._next;return a}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),r=t.length;r--;)if(t[r].vars.id===e)return t[r]}},{key:"remove",value:function(e){return Ve(e)?this.removeLabel(e):Ge(e)?this.killTweensOf(e):(yt(this,e),e===this._recent&&(this._recent=this._last),wt(this))}},{key:"totalTime",value:function(e,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=mt(jt.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),n(l(t.prototype),"totalTime",this).call(this,e,r),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=V(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,r){return(t=hr.delayedCall(0,t||w,r)).data="isPause",this._hasPause=1,I(this,t,V(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=V(this,e);t;)t._start===e&&"isPause"===t.data&&xt(t),t=t._next}},{key:"killTweensOf",value:function(e,t,r){for(var n=this.getTweensOf(e,r),a=n.length;a--;)rr!==n[a]&&n[a].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var r,n=[],a=Pt(e),i=this._first,s=He(t);i;)i instanceof hr?function(e,t){for(var r=t.length,n=0;e.indexOf(t[n])<0&&++n<r;);return n<r}(i._targets,a)&&(s?(!rr||i._initted&&i._ts)&&i.globalTime(0)<=t&&i.globalTime(i.totalDuration())>t:!t||i.isActive())&&n.push(i):(r=i.getTweensOf(a,t)).length&&n.push.apply(n,d(r)),i=i._next;return n}},{key:"tweenTo",value:function(e,t){t=t||{};var r,n=this,a=V(n,e),i=(e=t).startAt,s=e.onStart,o=e.onStartParams,l=(e=e.immediateRender,hr.to(n,vt({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:t.duration||Math.abs((a-(i&&"time"in i?i.time:n._time))/n.timeScale())||Ie,onStart:function(){var e;n.pause(),r||(e=t.duration||Math.abs((a-(i&&"time"in i?i.time:n._time))/n.timeScale()),l._dur!==e&&N(l,e,0,1).render(l._time,!0,!0),r=1),s&&s.apply(l,o||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,r){return this.tweenTo(t,vt({startAt:{time:V(this,e)}},r))}},{key:"recent",value:function(){return this._recent}},{key:"nextLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,V(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,V(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+Ie)}},{key:"shiftChildren",value:function(e,t){for(var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,a=this._first,i=this.labels;a;)a._start>=n&&(a._start+=e,a._end+=e),a=a._next;if(t)for(r in i)i[r]>=n&&(i[r]+=e);return wt(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return n(l(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),wt(this)}},{key:"totalDuration",value:function(e){var t,r,n,a=0,i=this,s=i._last,o=Le;if(arguments.length)return i.timeScale((i._repeat<0?i.duration():i.totalDuration())/(i.reversed()?-e:e));if(i._dirty){for(n=i.parent;s;)t=s._prev,s._dirty&&s.totalDuration(),(r=s._start)>o&&i._sort&&s._ts&&!i._lock?(i._lock=1,I(i,s,r-s._delay,1)._lock=0):o=r,r<0&&s._ts&&(a-=r,(!n&&!i._dp||n&&n.smoothChildTiming)&&(i._start+=r/i._ts,i._time-=r,i._tTime-=r),i.shiftChildren(-r,!1,-1/0),o=0),s._end>a&&s._ts&&(a=s._end),s=t;N(i,i===le&&i._time>a?i._time:a,1,1),i._dirty=0}return i._tDur}}],[{key:"updateRoot",value:function(e){if(le._ts&&(T(le,R(e,le)),pe=jt.frame),jt.frame>=ut){ut+=Ce.autoSleep||120;var t=le._first;if((!t||!t._ts)&&Ce.autoSleep&&jt._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||jt.sleep()}}}}]),t}()),sr=(vt(ir.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,a,i,s){var o,l,c,u,h,d=new yr(this._pt,e,t,0,1,Qt,null,a),p=0,f=0;for(d.b=r,d.e=n,r+="",(a=~(n+="").indexOf("random("))&&(n=Ot(n)),i&&(i(i=[r,n],e,t),r=i[0],n=i[1]),o=r.match(Je)||[];u=Je.exec(n);)c=u[0],u=n.substring(p,u.index),l?l=(l+1)%5:"rgba("===u.substr(-5)&&(l=1),c!==o[f++]&&(h=parseFloat(o[f-1])||0,d._pt={_next:d._pt,p:u||1===f?u:",",s:h,c:"="===c.charAt(1)?parseFloat(c.substr(2))*("-"===c.charAt(0)?-1:1):parseFloat(c)-h,m:l&&l<4?Math.round:0},p=Je.lastIndex);return d.c=p<n.length?n.substring(p,n.length):"",d.fp=s,($e.test(n)||a)&&(d.e=0),this._pt=d}),or=function(e,t,r,n,a,i,s,o,l){var c;if(Ge(n)&&(n=n(a||0,e,i)),a=e[t],i="get"!==r?r:Ge(a)?l?e[t.indexOf("set")||!Ge(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():a,r=Ge(a)?l?fr:pr:dr,Ve(n)&&"="===(n=~n.indexOf("random(")?Ot(n):n).charAt(1)&&(!(c=parseFloat(i)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(Et(i)||0))&&0!==c||(n=c)),i!==n)return isNaN(i*n)||""===n?(a||t in e||at(t,n),sr.call(this,e,t,i,n,r,o||Ce.stringFilter,l)):(c=new yr(this._pt,e,t,+i||0,n-(i||0),"boolean"==typeof a?vr:gr,0,r),l&&(c.fp=l),s&&c.modifier(s,this,e),this._pt=c)},lr=function(e,t,r,n,a,i){var s,o,l,c;if(lt[e]&&!1!==(s=new lt[e]).init(a,s.rawVars?t[e]:function(e,t,r,n,a){if(Ge(e)&&(e=Zt(e,a,t,r,n)),!We(e)||e.style&&e.nodeType||Ze(e)||Ke(e))return Ve(e)?Zt(e,a,t,r,n):e;var i,s={};for(i in e)s[i]=Zt(e[i],a,t,r,n);return s}(t[e],n,a,i,r),r,n,i)&&(r._pt=o=new yr(r._pt,a,e,0,1,s.render,s,0,s.priority),r!==fe))for(l=r._ptLookup[r._targets.indexOf(a)],c=s._props.length;c--;)l[s._props[c]]=o;return s},cr=dt+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",ur={},hr=(M(cr+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return ur[e]=1})),function(){a(t,ar);var e=s(t);function t(r,n,a,i){h(this,t),"number"==typeof n&&(a.duration=n,n=a,a=null);var s,l,c,u,d,p,f,m,g,b=(i=(s=e.call(this,i?n:P(n))).vars).duration,x=i.delay,w=i.immediateRender,S=i.stagger,M=i.overwrite,T=i.keyframes,_=i.defaults,E=i.scrollTrigger,D=i.yoyoEase,O=(i=n.parent||le,(Ze(r)||Ke(r)?He(r[0]):"length"in n)?[r]:Pt(r));if(s._targets=O.length?pt(O):y("GSAP target "+r+" not found. https://greensock.com",!Ce.nullTargetWarn)||[],s._ptLookup=[],s._overwrite=M,T||S||v(b)||v(x)){if(n=s.vars,(l=s.timeline=new ir({data:"nested",defaults:_||{}})).kill(),l.parent=l._dp=o(s),l._start=0,S||v(b)||v(x)){if(d=O.length,m=S&&W(S),We(S))for(p in S)~cr.indexOf(p)&&((g=g||{})[p]=S[p]);for(c=0;c<d;c++)(u=bt(n,ur)).stagger=0,D&&(u.yoyoEase=D),g&&k(u,g),f=O[c],u.duration=+Zt(b,o(s),c,f,O),u.delay=(+Zt(x,o(s),c,f,O)||0)-s._delay,!S&&1===d&&u.delay&&(s._delay=x=u.delay,s._start+=x,u.delay=0),l.to(f,u,m?m(c,f,O):0),l._ease=Nt.none;l.duration()?b=x=0:s.timeline=0}else if(T){P(vt(l.vars.defaults,{ease:"none"})),l._ease=Ht(T.ease||n.ease||"none");var C,R,L,U=0;if(Ze(T))T.forEach((function(e){return l.to(O,e,">")}));else{for(p in u={},T)"ease"!==p&&"easeEach"!==p&&function(e,t,r,n){var a,i,s=t.ease||n||"power1.inOut";if(Ze(t))i=r[e]||(r[e]=[]),t.forEach((function(e,r){return i.push({t:r/(t.length-1)*100,v:e,e:s})}));else for(a in t)i=r[a]||(r[a]=[]),"ease"!==a&&i.push({t:parseFloat(e),v:t[a],e:s})}(p,T[p],u,T.easeEach);for(p in u)for(C=u[p].sort((function(e,t){return e.t-t.t})),c=U=0;c<C.length;c++)(L={ease:(R=C[c]).e,duration:(R.t-(c?C[c-1].t:0))/100*b})[p]=R.v,l.to(O,L,U),U+=L.duration;l.duration()<b&&l.to({},{duration:b-l.duration()})}}b||s.duration(b=l.duration())}else s.timeline=0;return!0!==M||oe||(rr=o(s),le.killTweensOf(O),rr=0),I(i,o(s),a),n.reversed&&s.reverse(),n.paused&&s.paused(!0),(w||!b&&!T&&s._start===mt(i._time)&&qe(w)&&A(o(s))&&"nested"!==i.data)&&(s._tTime=-Ie,s.render(Math.max(0,-x))),E&&B(o(s),E),s}return u(t,[{key:"render",value:function(e,t,r){var n,a,i=this._time,s=this._tDur,o=this._dur,l=s-Ie<e&&0<=e?s:e<Ie?0:e;if(o){if(l!==this._tTime||!e||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(m=l,f=this.timeline,this._repeat){if(h=o+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*h+e,t,r);if(m=mt(l%h),l===s?(v=this._repeat,m=o):((v=~~(l/h))&&v===l/h&&(m=o,v--),o<m&&(m=o)),(p=this._yoyo&&1&v)&&(d=this._yEase,m=o-m),b=C(this._tTime,h),m===i&&!r&&this._initted)return this;v!==b&&(f&&this._yEase&&re(f,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=r=1,this.render(mt(h*v),!0).invalidate()._lock=0))}if(!this._initted){if(U(this,e<0?e:m,r,t))return this._tTime=0,this;if(o!==this._dur)return this.render(e,t,r)}if(this._tTime=l,this._time=m,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=a=(d||this._ease)(m/o),this._from&&(this.ratio=a=1-a),m&&!i&&!t&&(J(this,"onStart"),this._tTime!==l))return this;for(n=this._pt;n;)n.r(a,n.d),n=n._next;f&&f.render(e<0?e:!m&&p?-Ie:f._dur*f._ease(m/this._dur),t,r)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,r),J(this,"onUpdate")),this._repeat&&v!==b&&this.vars.onRepeat&&!t&&this.parent&&J(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&o||!(l===this._tDur&&0<this._ts||!l&&this._ts<0)||xt(this,1),t||e<0&&!i||!l&&!i||(J(this,l===s?"onComplete":"onReverseComplete",!0),!this._prom||l<s&&0<this.timeScale()||this._prom()))}}else{var c,u,h=this,d=e,p=t,f=r,m=h.ratio,g=d<0||!d&&(!h._start&&j(h)&&(h._initted||!F(h))||(h._ts<0||h._dp._ts<0)&&!F(h))?0:1,v=h._rDelay,b=0;if(v&&h._repeat&&(u=C(b=H(0,h._tDur,d),v),h._yoyo&&1&u&&(g=1-g),u!==C(h._tTime,v)&&(m=1-g,h.vars.repeatRefresh&&h._initted&&h.invalidate())),g!==m||f||h._zTime===Ie||!d&&h._zTime){if(h._initted||!U(h,d,f,p)){for(u=h._zTime,h._zTime=d||(p?Ie:0),p=p||d&&!u,h.ratio=g,h._from&&(g=1-g),h._time=0,h._tTime=b,c=h._pt;c;)c.r(g,c.d),c=c._next;h._startAt&&d<0&&h._startAt.render(d,!0,!0),h._onUpdate&&!p&&J(h,"onUpdate"),b&&h._repeat&&!p&&h.parent&&J(h,"onRepeat"),(d>=h._tDur||d<0)&&h.ratio===g&&(g&&xt(h,1),p||(J(h,g?"onComplete":"onReverseComplete",!0),h._prom&&h._prom()))}}else h._zTime||(h._zTime=d)}return this}},{key:"targets",value:function(){return this._targets}},{key:"invalidate",value:function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),n(l(t.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?$(this):this;if(this.timeline)return d=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,rr&&!0!==rr.vars.overwrite)._first||$(this),this.parent&&d!==this.timeline.totalDuration()&&N(this,this._dur*this.timeline._tDur/d,0,1),this;var r,n,a,i,s,o,l,c=this._targets,u=e?Pt(e):c,h=this._ptLookup,d=this._pt;if((!t||"all"===t)&&function(e,t){for(var r=e.length,n=r===t.length;n&&r--&&e[r]===t[r];);return r<0}(c,u))return"all"===t&&(this._pt=0),$(this);for(r=this._op=this._op||[],"all"!==t&&(Ve(t)&&(s={},M(t,(function(e){return s[e]=1})),t=s),t=function(e,t){var r,n,a,i,s=(e=e[0]?ft(e[0]).harness:0)&&e.aliases;if(!s)return t;for(n in r=k({},t),s)if(n in r)for(a=(i=s[n].split(",")).length;a--;)r[i[a]]=r[n];return r}(c,t)),l=c.length;l--;)if(~u.indexOf(c[l]))for(s in n=h[l],"all"===t?(r[l]=t,i=n,a={}):(a=r[l]=r[l]||{},i=t),i)(o=n&&n[s])&&("kill"in o.d&&!0!==o.d.kill(s)||yt(this,o,"_pt"),delete n[s]),"all"!==a&&(a[s]=1);return this._initted&&!this._pt&&d&&$(this),this}}],[{key:"to",value:function(e,r){return new t(e,r,arguments[2])}},{key:"from",value:function(e,t){return G(1,arguments)}},{key:"delayedCall",value:function(e,r,n,a){return new t(r,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:r,onReverseComplete:r,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:a})}},{key:"fromTo",value:function(e,t,r){return G(2,arguments)}},{key:"set",value:function(e,r){return r.duration=0,r.repeatDelay||(r.repeat=0),new t(e,r)}},{key:"killTweensOf",value:function(e,t,r){return le.killTweensOf(e,t,r)}}]),t}()),dr=(vt(hr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),M("staggerTo,staggerFrom,staggerFromTo",(function(e){hr[e]=function(){var t=new ir,r=kt.call(arguments,0);return r.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,r)}})),function(e,t,r){return e[t]=r}),pr=function(e,t,r){return e[t](r)},fr=function(e,t,r,n){return e[t](n.fp,r)},mr=function(e,t){return Ge(e[t])?pr:m(e[t])&&e.setAttribute?Xt:dr},gr=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},vr=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},br=function(e){for(var t,r,n,a,i=e._pt;i;){for(t=i._next,r=n;r&&r.pr>i.pr;)r=r._next;(i._prev=r?r._prev:a)?i._prev._next=i:n=i,(i._next=r)?r._prev=i:a=i,i=t}e._pt=n},yr=function(){function e(t,r,n,a,i,s,o,l,c){h(this,e),this.t=r,this.s=a,this.c=i,this.p=n,this.r=s||gr,this.d=o||this,this.set=l||dr,this.pr=c||0,(this._next=t)&&(t._prev=this)}return u(e,[{key:"modifier",value:function(e,t,r){this.mSet=this.mSet||this.set,this.set=er,this.m=e,this.mt=r,this.tween=t}}]),e}(),xr=(M(dt+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(e){return it[e]=1})),rt.TweenMax=rt.TweenLite=hr,rt.TimelineLite=rt.TimelineMax=ir,le=new ir({sortChildren:!1,defaults:Re,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ce.stringFilter=function(e){var t=e.join(" ");if(Bt.lastIndex=0,Bt.test(t))return t=Ut.test(t),e[1]=te(e[1],t),e[0]=te(e[0],t,It(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,r=Ge(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:w,render:Yt,add:or,kill:$t,modifier:Jt,rawVars:0}),a={targetTest:0,get:0,getSetter:mr,aliases:{},register:0};if(Ft(),e!==r){if(lt[t])return;vt(r,vt(bt(e,n),a)),k(r.prototype,k(n,bt(e,a))),lt[r.prop=t]=r,e.targetTest&&(ht.push(r),it[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}x(t,r),e.register&&e.register(Sr,r,yr)}))},timeline:function(e){return new ir(e)},getTweensOf:function(e,t){return le.getTweensOf(e,t)},getProperty:function(e,t,r,n){Ve(e)&&(e=Pt(e)[0]);var a=ft(e||{}).get,i=r?E:_;return"native"===r&&(r=""),e&&(t?i((lt[t]&&lt[t].get||a)(e,t,r,n)):function(t,r,n){return i((lt[t]&&lt[t].get||a)(e,t,r,n))})},quickSetter:function(e,t,r){var n,a;if(1<(e=Pt(e)).length)return n=e.map((function(e){return Sr.quickSetter(e,t,r)})),a=n.length,function(e){for(var t=a;t--;)n[t](e)};e=e[0]||{};var i=lt[t],s=ft(e),o=s.harness&&(s.harness.aliases||{})[t]||t,l=i?function(t){var n=new i;fe._pt=0,n.init(e,r?t+r:t,fe,0,[e]),n.render(1,n),fe._pt&&Yt(1,fe)}:s.set(e,o);return i?l:function(t){return l(e,o,r?t+r:t,s,1)}},isTweening:function(e){return 0<le.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Ht(e.ease,Re.ease)),D(Re,e||{})},config:function(e){return D(Ce,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,n=e.plugins,a=e.defaults;e=e.extendTimeline,(n||"").split(",").forEach((function(e){return e&&!lt[e]&&!rt[e]&&y(t+" effect requires "+e+" plugin.")})),ct[t]=function(e,t,n){return r(Pt(e),vt(t||{},a),n)},e&&(ir.prototype[t]=function(e,r,n){return this.add(ct[t](e,We(r)?r:(n=r)&&{},this),n)})},registerEase:function(e,t){Nt[e]=Ht(t)},parseEase:function(e,t){return arguments.length?Ht(e,t):Nt},getById:function(e){return le.getById(e)},exportRoot:function(){var e,t,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,a=new ir(r);for(a.smoothChildTiming=qe(r.smoothChildTiming),le.remove(a),a._dp=0,a._time=a._tTime=le._time,e=le._first;e;)t=e._next,!n&&!e._dur&&e instanceof hr&&e.vars.onComplete===e._targets[0]||I(a,e,e._start-e._delay),e=t;return I(le,a,0),a},utils:{wrap:function e(t,r,n){var a=r-t;return Ze(t)?X(t,e(0,t.length),r):_t(n,(function(e){return(a+(e-t)%a)%a+t}))},wrapYoyo:function e(t,r,n){var a=r-t,i=2*a;return Ze(t)?X(t,e(0,t.length-1),r):_t(n,(function(e){return t+(a<(e=(i+(e-t)%i)%i||0)?i-e:e)}))},distribute:W,random:Z,snap:K,normalize:function(e,t,r){return Q(e,t,0,1,r)},getUnit:Et,clamp:function(e,t,r){return _t(r,(function(r){return H(e,t,r)}))},splitColor:Lt,toArray:Pt,selector:function(e){return e=Pt(e)[0]||y("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Pt(t,r.querySelectorAll?r:r===e?y("Invalid scope")||he.createElement("div"):e)}},mapRange:Q,pipe:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(r){return e(parseFloat(r))+(t||Et(r))}},interpolate:function e(t,r,n,a){var i=isNaN(t+r)?0:function(e){return(1-e)*t+e*r};if(!i){var s,o,l,c,u,h=Ve(t),d={};if(!0===n&&(a=1)&&(n=null),h)t={p:t},r={p:r};else if(Ze(t)&&!Ze(r)){for(l=[],c=t.length,u=c-2,o=1;o<c;o++)l.push(e(t[o-1],t[o]));c--,i=function(e){e*=c;var t=Math.min(u,~~e);return l[t](e-t)},n=r}else a||(t=k(Ze(t)?[]:{},t));if(!l){for(s in r)or.call(d,t,s,"get",r[s]);i=function(e){return Yt(e,d),h?t.p:t}}}return _t(n,i)},shuffle:At},install:b,effects:ct,ticker:jt,updateRoot:ir.updateRoot,plugins:lt,globalTimeline:le,core:{PropTween:yr,globals:x,Tween:hr,Timeline:ir,Animation:ar,getCache:ft,_removeLinkedListItem:yt,suppressOverwrites:function(e){return oe=e}}}),wr=(M("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return xr[e]=hr[e]})),jt.add(ir.updateRoot),fe=xr.to({},{duration:0}),function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r}),Sr=xr.registerPlugin({name:"attr",init:function(e,t,r,n,a){var i,s;for(i in t)(s=this.add(e,"setAttribute",(e.getAttribute(i)||0)+"",t[i],n,a,0,0,i))&&(s.op=i),this._props.push(i)}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r])}},tr("roundProps",q),tr("modifiers"),tr("snap",K))||xr;hr.version=ir.version=Sr.version="3.9.1",de=1,g()&&Ft(),Nt.Power0,Nt.Power1,Nt.Power2,Nt.Power3,Nt.Power4,Nt.Linear,Nt.Quad,Nt.Cubic,Nt.Quart,Nt.Quint,Nt.Strong,Nt.Elastic,Nt.Back,Nt.SteppedEase,Nt.Bounce,Nt.Sine,Nt.Expo,Nt.Circ},4230:(e,t,r)=>{r.d(t,{N:()=>o,Z:()=>s});var n=r(8881),a=r(1794),i=r(6272);class s{constructor(e){this.mode="PerspectiveCamera",this.oCam=this.createOrthographic(),this.pCam=this.create(),this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"camera",map:{parse:e=>{e.childs.map((e=>{this.setTemp(e)}))}}})},this.clean=()=>{this.temp.clear()},this.backgroudDom=null,this.temp=new a.Z,this.pointerDown=()=>{var e;null!=(e=this.animaIns)&&e.kill()},this.runScene=e,this.runScene.cb.resize.add("camera-background",(()=>{var e,t;this.backgroudDom&&(({width:e,height:t}=this.runScene.renderEx.getDomSize()),this.backgroudDom.style.width=e+"px",this.backgroudDom.style.height=t+"px")})),this.runScene.cb.events.pointer.down.add("camera",this.pointerDown),this.runScene.cb.clean.add("camera",this.clean),this.runScene.cb.inited.add("camera",this.onInited)}setBackground(e){const t=this.runScene.assetsEx.engineDom;var r,n;this.backgroudDom||(this.backgroudDom=document.createElement("div"),({width:r,height:n}=this.runScene.renderEx.getDomSize()),this.backgroudDom.style.position="absolute",this.backgroudDom.style.width=r+"px",this.backgroudDom.style.height=n+"px",t.appendChild(this.backgroudDom)),e?(this.backgroudDom.style.display="block",this.backgroudDom.style.backgroundImage="url("+e+")",this.backgroudDom.style.backgroundRepeat="no-repeat",this.backgroudDom.style.backgroundSize="100% 100%"):this.backgroudDom.style.display="none"}create(){return new n.PerspectiveCamera}createOrthographic(){return new n.OrthographicCamera}setMode(e){if(e!==this.mode){this.runScene.helperEx.transContro.reset(),this.mode=e,this.runScene.assetsEx.reset(),this.reset(this.getCamera()),this.setSize();const t=this.runScene.assetsEx.get().controls;"OrthographicCamera"===e&&(t.enableRotate=!1,t.enablePan=!1)}}getCamera(){return"OrthographicCamera"===this.mode?this.oCam:this.pCam}reset(e){e.position.set(0,20,20);const t=this.runScene.assetsEx.get().controls;e.near=.1,e.far=1e3,e.fov=50,t.target.set(0,0,0),t.update(),e.updateProjectionMatrix()}get(){return this.runScene.assetsEx.get().camera}setSize(){var{width:e,height:t}=this.runScene.renderEx.getDomSize();const r=this.getCamera();r.aspect=e/t,r.updateProjectionMatrix()}addTemp(e){var{name:e,data:t}=e;this.temp.set(e,{name:e,data:t})}delTemp(e){this.temp.delete(e)}getLocal(){var{camera:e,controls:t}=this.runScene.assetsEx,{x:e,y:r,z:n}=e.position,{x:t,y:a,z:i}=t.target;return{x:e,y:r,z:n,tx:t,ty:a,tz:i}}setTemp(e,t){return(e=this.temp.get(e))?this.anima(e.data,t):Promise.resolve()}anima(e,t){return new Promise((r=>{const{time:n,onComplete:a,onUpdate:s}=t||{},{camera:o,controls:l}=this.runScene.assetsEx;this.animaIns&&(this.animaIns.kill(),this.animaIns=null),this.animaIns=(0,i.gY)(this.getLocal(),e,n||.5,(e=>{var{x:t,y:r,z:n,tx:a,ty:i,tz:c}=e;o.position.set(t,r,n),l.target.set(a,i,c),l.update(),null!=s&&s(e)}),(()=>{null!=a&&a(),r(0)}))}))}static toJSON(e){const t=e.assetsEx.camera;return{temp:e.cameraEx.temp.toJSON(),camera:t.toJSON()}}}const o=e=>null==e?void 0:e.isCamera},4330:(e,t,r)=>{r.d(t,{sG:()=>n,zX:()=>a});const n=["map","normalMap","aoMap"],a=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},3263:(e,t,r)=>{r.d(t,{F6:()=>n,YD:()=>c});var n={};r.r(n),r.d(n,{filter:()=>a,isDef:()=>l,isEmpty:()=>i,notEmpty:()=>s,random:()=>o});const a=e=>e.filter((e=>e)),i=e=>0===e.length,s=e=>0!==e.length,o=e=>{var t=Math.random()*e.length;return e[Math.floor(t)]},l=(e,t)=>{for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!0;return!1};r(1794),r(272);var c=r(7201)},1794:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(6001);class a extends Map{constructor(e){e?super((0,n.mapObj)(e,((e,t)=>[e,t]))):super()}toArray(e){let t=[];for(const r of this.entries())"key"==e?t.push(r[0]):t.push(r[1]);return t}map(e){return[...this.entries()].map((t=>{var[t,r]=t;return e(t,r)}))}toJSON(){const e={};return this.forEach(((t,r)=>{e[r]=t})),e}toString(){return JSON.stringify(this.map)}filter(e,t){let r=[];for(var[n,a]of this.entries())e(n,a)&&r.push("key"===t?n:a);return r}find(e){for(var[t,r]of this.entries())if(e(t,r))return r}static formJSON(e){return new a(e)}copy(e){e.map(((e,t)=>this.set(e,t)))}}},7201:(e,t,r)=>{r.r(t),r.d(t,{is:()=>i,isDef:()=>a,logObj:()=>u,objToStr:()=>c,replaceKVForObj:()=>o,replaceKeyForObj:()=>l,replaceValForObj:()=>s});var n=r(6001);const a=(e,t)=>{if(!i(e))return!0;var r=Object.keys(e);for(let o=0;o<r.length;o++){var n=r[o],s=e[n];if(n=t[n],i(s))return!i(n)||a(s,n);if(s!==n)return!0}return!1},i=e=>(null==e?void 0:e.constructor)===Object,s=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n];r[n]=t(n,i,a)})),r},o=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n],{k:n,v:i}=t(n,i,a);r[n]=i})),r},l=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n];r[t(n,i,a)]=i})),r},c=e=>{let t="";return(0,n.mapObj)(e,((e,r)=>{t=(t+=e+":")+(i(r)?c(r):r)})),t},u=e=>{console.log(c(e))}},272:(e,t,r)=>{r.d(t,{Z:()=>n});class n extends Set{constructor(e){super(),this.isSet=!0,null!=e&&e.map((e=>this.add(e)))}add(e){return Array.isArray(e)?e.map((e=>this.add(e))):super.add(e),this}remove(e){if(Array.isArray(e))e.map((e=>this.remove(e)));else{if(!super.has(e))return;super.delete(e)}return this}toArray(){return[...this]}map(e,t=!1){const r=[];return this.forEach((n=>{if(n=e(n),!t)return r.push(n);n&&r.push(n)})),r}find(e){for(const t of this)if(e(t))return t}filter(e){const t=[];for(const r of this)e(r)&&t.push(r);return t}toJSON(){return this.toArray()}}},5247:(e,t,r)=>{r.d(t,{Z:()=>n});const n=t=r(8881)},7625:(e,t,r)=>{r.d(t,{Z:()=>n});class n{constructor(e){this.runScene=e}}},7585:(e,t,r)=>{r.d(t,{Z:()=>u});var n=r(5247),a=r(3736),i=r(1398),s=r(3729),o=r(4457);t=r(7625);const l={far:1e5,near:.5,mapSizeX:512,scaleX:1,targetPosition:{x:0,y:-10,z:0}},c={position:{type:"v3",val:{x:0,y:10,z:0},shortKey:"p"},intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class u extends t.Z{static toJSON(e){const{intensity:t,name:r,type:n,position:a,visible:i,color:o,castShadow:l,shadow:c,rotation:u,target:h}=e;var{mapSize:d,camera:p}=c,{scale:p,near:f,far:m}=p;return{type:n,intensity:t,name:r,visible:i,color:o.getHexString(),castShadow:l,shadow:{mapSize:d.x,camera:{near:f,far:m,scale:p.x}},id:(0,s.Ki)(e),position:{x:a.x,y:a.y,z:a.z},rotation:{x:u.x,y:u.y,z:u.z},targetPosition:{x:h.position.x,y:h.position.y,z:h.position.z}}}parseJSON(e,t){t=this.runScene.lightEx.get("DirectionalLight",t);var[r]=t;return u.setConfig(r,e),(0,a.M)(r,"id",e.id),t}get(e){return this.runScene.lightEx.get("DirectionalLight",e)}static setConfig(e,t){const{intensity:r,position:a,rotation:i,targetPosition:s,name:o,visible:l,color:c,castShadow:u,shadow:h}=t;var{mapSize:t,camera:d}=h,{scale:d,near:p,far:f}=d;e.intensity=r,e.name=o,e.visible=l,e.castShadow=u,e.color=new n.Z.Color(c.includes(c)?c:"#"+c),a&&e.position.set(a.x,a.y,a.z),i&&e.rotation.set(i.x,i.y,i.z),s&&e.target.position.set(s.x,s.y,s.z),e.add(e.target),e.shadow.mapSize.x=t,e.shadow.mapSize.y=t,e.shadow.camera.scale.x=d,e.shadow.camera.scale.y=d,e.shadow.camera.scale.z=d,e.shadow.camera.near=p,e.shadow.camera.far=f,e.shadow.camera.updateProjectionMatrix(),null!=(t=e.cameraHelper)&&t.update()}}u.snapshot={create:e=>{const t=i.LV.getDiff(c,e);var r=e.shadow,{mapSize:r,camera:n}=r,{scale:n,near:a,far:s}=n,{x:e,y:u,z:h}=e.target.position;return(0,o.isDef)(r.x,l.mapSizeX)&&(t.m=r.x),(0,o.isDef)({x:e,y:u,z:h},l.targetPosition)&&(t.tp={x:e,y:u,z:h}),(0,o.isDef)(n.x,l.scaleX)&&(t.s=n.x),(0,o.isDef)(a,l.near)&&(t.n=a),(0,o.isDef)(s,l.far)&&(t.f=s),t},set:e=>{const{map:t,light:r,runScene:n,data:a}=e,{m:s,tp:o,s:u,n:h,f:d}=(i.LV.set({def:c,data:a,runScene:n,map:t,target:r}),a);t.data.completedCbs.push((()=>{var{far:e,near:t,mapSizeX:n,scaleX:a,targetPosition:i}=l,{x:i,y:c,z:p}=o||i,i=(r.target.position.set(i,c,p),s||n),c=(r.shadow.mapSize.x=i,r.shadow.mapSize.y=i,u||a);r.shadow.camera.scale.x=c,r.shadow.camera.scale.y=c,r.shadow.camera.scale.z=c,r.shadow.camera.near=h||t,r.shadow.camera.far=d||e,r.shadow.camera.updateProjectionMatrix(),null!=(p=r.cameraHelper)&&p.update()}))}}},1269:(e,t,r)=>{r.d(t,{ZP:()=>k,RQ:()=>D});var n=r(6001),a=r(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(n);function n(e,t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var i=new a.BufferGeometry,s=(i.setAttribute("position",new a.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),new a.LineBasicMaterial({fog:!1}));return((i=r.call(this,i,s)).light=e,i.color=t,i.type="RectAreaLightHelper",s=new a.BufferGeometry).setAttribute("position",new a.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),i.add(new a.Mesh(s,new a.MeshBasicMaterial({side:a.BackSide,fog:!1}))),i}return t=n,(e=[{key:"updateMatrixWorld",value:function(){var e,t;this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color?(this.material.color.set(this.color),this.children[0].material.color.set(this.color)):(this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),e=this.material.color,1<(t=Math.max(e.r,e.g,e.b))&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)),this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(a.Line),u=r(5247),h=r(3736),d=r(1398),p=r(3729);t=r(7625);const f={intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class m extends t.Z{get(){}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i}=e;return{type:t,intensity:r,name:n,visible:a,id:(0,p.Ki)(e),color:i.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("AmbientLight");const[r]=t;var{type:e,intensity:n,name:a,visible:i,color:s,id:o}=e;return r.intensity=n,r.type=e,r.name=a,r.visible=i,r.color=new u.Z.Color("#"+s),(0,h.M)(r,"id",o),t}}m.snapshot={create:e=>d.LV.getDiff(f,e),set:e=>{var{map:e,light:t,runScene:r,data:n}=e;d.LV.set({def:f,data:n,runScene:r,map:e,target:t})}};var g=r(7585);class v extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i,groundColor:s,position:o}=e;return{name:n,id:(0,p.Ki)(e),type:t,intensity:r,visible:a,position:{x:o.x,y:o.y,z:o.z},groundColor:s.getHexString(),color:i.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("HemisphereLight");const[r]=t;var{type:e,intensity:n,name:a,visible:i,color:s,groundColor:o,id:l,position:c}=e;return r.type=e,r.intensity=n,r.name=a,r.visible=i,r.color=new u.Z.Color("#"+s),r.groundColor=new u.Z.Color("#"+o),r.position.set(c.x,c.y,c.z),(0,h.M)(r,"id",l),t}}class b extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,intensity:n,distance:a,decay:i,renderOrder:s,color:o,visible:l,castShadow:c,shadow:u,position:h}=e;var{mapSize:d,camera:f,bias:m,radius:g}=u,{scale:f,near:v,far:b}=f;return{name:t,type:r,intensity:n,visible:l,color:o.getHexString(),castShadow:c,id:(0,p.Ki)(e),distance:a,decay:i,renderOrder:s,shadow:{mapSize:d.x,camera:{near:v,far:b,scale:f.x},radius:g,bias:m},position:{x:h.x,y:h.y,z:h.z}}}parseJSON(e){var t=this.runScene.lightEx.get("PointLight");const[r]=t;var{name:e,type:n,intensity:a,distance:i,decay:s,renderOrder:o,color:l,visible:c,castShadow:d,shadow:p,position:f,id:m}=e,{mapSize:p,camera:g,bias:v,radius:b}=p,{scale:g,near:y,far:x}=g;return r.intensity=a,r.type=n,r.name=e,r.visible=c,r.castShadow=d,r.distance=i,r.renderOrder=o,r.color=new u.Z.Color("#"+l),r.position.set(f.x,f.y,f.z),r.shadow.mapSize.x=p,r.shadow.mapSize.y=p,r.shadow.bias=v,r.decay=s,r.shadow.radius=b,r.shadow.camera.scale.x=g,r.shadow.camera.scale.y=g,r.shadow.camera.scale.z=g,r.shadow.camera.near=y,(0,h.M)(r,"id",m),r.shadow.camera.far=x,r.shadow.camera.updateProjectionMatrix(),t}}class y{constructor(e){this.runScene=e}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i,position:s}=e;return{name:n,type:t,intensity:r,id:(0,p.Ki)(e),visible:a,position:{x:s.x,y:s.y,z:s.z},color:i.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("RectAreaLight");const[r]=t;var{type:e,intensity:n,name:a,visible:i,color:s,position:o,id:l}=e;return r.type=e,(0,h.M)(r,"id",l),r.intensity=n,r.name=a,r.visible=i,r.color=new u.Z.Color("#"+s),r.position.set(o.x,o.y,o.z),t}}class x{constructor(e){this.runScene=e}static toJSON(e){const{name:t,type:r,color:n,distance:a,decay:i,intensity:s,angle:o,penumbra:l,visible:c,castShadow:u,shadow:h,renderOrder:d,position:f,target:m}=e;var{bias:g,camera:v,normalBias:b,mapSize:y,radius:x}=h,v=v.near;return{type:r,intensity:s,name:t,visible:c,distance:a,angle:o,id:(0,p.Ki)(e),decay:i,penumbra:l,renderOrder:d,color:n.getHexString(),castShadow:u,shadow:{bias:g,normalBias:b,mapSize:y.x,camera:{near:v},radius:x},position:{x:f.x,y:f.y,z:f.z},targetPosition:{x:m.position.x,y:m.position.y,z:m.position.z}}}parseJSON(e){var t=this.runScene.lightEx.get("SpotLight");const[r]=t;var{name:e,type:n,color:a,distance:i,decay:s,intensity:o,angle:l,penumbra:c,visible:d,castShadow:p,shadow:f,renderOrder:m,id:g,position:v,targetPosition:b}=e,{bias:f,camera:y,normalBias:x,mapSize:w,radius:S}=f,y=y.near;return r.intensity=o,r.type=n,r.name=e,r.visible=d,r.distance=i,r.decay=s,r.angle=l,r.penumbra=c,r.renderOrder=m,r.castShadow=p,r.color=new u.Z.Color("#"+a),r.position.set(v.x,v.y,v.z),r.shadow.mapSize.x=w,r.shadow.mapSize.y=w,r.shadow.camera.near=y,r.target.position.set(b.x,b.y,b.z),r.shadow.bias=f,r.shadow.normalBias=x,r.shadow.radius=S,(0,h.M)(r,"id",g),r.shadow.camera.updateProjectionMatrix(),t}}var w=r(8715),S=r(3735),M=r(2510),T=r(7169),_=r(4457);const E={DirectionalLight:g.Z,PointLight:b,SpotLight:x,RectAreaLight:y,HemisphereLight:v,AmbientLight:m};class k{constructor(e){this.shadowList=["DirectionalLight","PointLight","SpotLight"],this.helperList=["DirectionalLight","PointLight","SpotLight","RectAreaLight","HemisphereLight"],this.lightDom=void 0,this.helperUpdateList=["DirectionalLight","PointLight","SpotLight","HemisphereLight"],this.snapshot={create:e=>{const t=this.runScene.assetsEx.scene.children.filter((e=>this.isLight(e)&&!(0,w.isHelper)(e))),r={};t.map((e=>{var t=e.type,n=(0,p.Ki)(e),a=null==(a=null==(t=E[t].snapshot)?void 0:t.create)?void 0:a.call(t,e);a&&n&&(r[n]=a)})),e.data.set("light",r)},set:e=>{var t=e.snapshot.data.get("light");t&&(0,n.mapObj)(t,((t,r)=>{var n,a=((t=this.runScene.modelEx.getById(t))||{}).type;a&&null!=(n=null==(a=E[a].snapshot)?void 0:a.set)&&n.call(a,{data:r,runScene:this.runScene,light:t,map:e})}))}},this.runScene=e,this.lightExMap={DirectionalLight:new g.Z(e),PointLight:new b(e),SpotLight:new x(e),RectAreaLight:new y(e),HemisphereLight:new v(e),AmbientLight:new m(e)},e.cb.snapshot.create.add("light",this.snapshot.create),e.cb.snapshot.set.add("light",this.snapshot.set)}getLightsByScene(e=this.runScene.sceneEx.get()){return e.children.filter((e=>e.isLight))}add(e,t){e=e.map((e=>this.runScene.modelEx.add(e,void 0,Object.assign(Object.assign({},t),{select:!!D(e)&&t.select,addUndo:!1})))),t.addUndo&&this.runScene.undoEx.addUndo(e)}get(e,t){t=(0,_.mergeObject)({id:(0,n.getId)()},t).id;let r=new u.Z[e],a=[r];return r.position.y=10,r.name=e,r.userData.id=t,this.shadowList.includes(e)&&(r.castShadow=!0),this.setLight(r),a.push(...this.setLightHelper(r)),null!=(t=null==r?void 0:r.lightHelper)&&t.update(),a}setNull(e){e.userData.light&&this.setNull(e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!1):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!1),e.helper&&(e.helper.visible=!0)))}setSelect(e){e.userData.light&&this.setSelect(e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!0):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!0),e.helper&&(e.helper.visible=!0)))}update(e){var t;e.userData.isLightTarget&&e.userData.light&&(e=e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type||"SpotLight"===e.type?(null!=(t=e.helper)&&t.update(),null!=(t=e.cameraHelper)&&t.update()):null!=(e=null==(t=e.helper)?void 0:t.update)&&e.call(t))}remove(e,t=!0){let r;return this.runScene.helperEx.unfocus(),r="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new T.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)):[e,e.helper].map((t=>{if(t)return new T.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)),t&&r&&this.runScene.undoEx.addUndo(r),r}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const r=(0,p.Ki)(t);let n,a=[];switch(e){case"RectAreaLight":n=new c(t,16773120);break;case"DirectionalLight":if(n=new u.Z.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new u.Z.Object3D;(t.target=e).name="helperModel",e.position.y=-10,t.shadow.autoUpdate=!0,e.userData.isLightTarget=!0,(e.userData.light=t).add(e)}t.shadow.camera.layers.set(1),t.shadow.camera.far=1e5,t.shadowCameraLeft=-5,t.shadowCameraRight=5,t.shadowCameraTop=5,t.shadowCameraBottom=-5,t.shadow.camera.updateProjectionMatrix();const e=new u.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(e,!0,(e=>{e.userData.id=r,e.userData.unClick=!0})),e.userData.id=r,e.userData.unClick=!0,e.visible=!1,t.cameraHelper=e,a.push(e);break;case"PointLight":n=new u.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new u.Z.SpotLightHelper(t);let i=new u.Z.Object3D;(t.target=i).name="helperModel",i.userData.isLightTarget=!0,i.userData.light=t,i.position.y=-10,t.shadow.autoUpdate=!0,t.add(i);const s=new u.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(s,!0,(e=>{e.userData.id=r})),s.userData.id=r,s.visible=!1,t.cameraHelper=s,a.push(s);break;case"HemisphereLight":n=new u.Z.HemisphereLightHelper(t,1,16773135)}return n.name="helperModel",this.runScene.helperEx.setHelper(n,!0,(e=>{e.userData.id=r})),n.userData.id=r,(n.light=t).helper=n,this.update(t),a.push(n),a}setLightHelper(e){return"editor"===this.runScene.optionsEx.options.mode&&this.helperList.includes(e.type)?this.getLightHelper(e.type,e):[]}isUpdateHelper(e){return this.helperUpdateList.includes(e)}initLight(e){e.forEach((e=>this.setLightHelper(e)))}setNormal(e,t=0){var{model:e,info:r,val:n,cb:a}=e;return new M.Z({target:e,runScene:this.runScene,info:r,oldVal:e[r],newVal:n,cb:a}).execute()}setMultip(e,t,r=!0,n=!0){if(e instanceof Array)return a=e.map((e=>{var{model:e,typeList:n,newVal:a}=e;const i=new S.Z({target:e,typeList:n,newVal:a,cb:t});return r?i.execute():i})),n&&this.runScene.undoEx.addUndo(a),a;{var{model:a,typeList:e,newVal:i}=e;const s=new S.Z({target:a,typeList:e,newVal:i,cb:t});return n&&this.runScene.undoEx.addUndo(s),r?s.execute():s}}isLight(e){return null==(e=null==e?void 0:e.userData)?void 0:e.isLight}setLight(e){e.userData.isLight=!0}isHelperTarget(e){return e.userData.isLightTarget}clone(e){return this.get(e.type)}static toJSON(e){return e.filter((e=>!(0,w.isHelper)(e))).map((e=>{var t=e.type;return E[t].toJSON(e)}))}}const D=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isLight},2353:(e,t,r)=>{r.d(t,{B:()=>Le,Z:()=>Re});var n=r(8881),a=(t=r(3300),r.n(t));function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}r(6001);var s=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!==("undefined"==typeof WebAssembly?"undefined":i(WebAssembly)))return{supported:!1};var r,n=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",a=WebAssembly.instantiate(s(n),{}).then((function(e){(r=e.instance).exports.__wasm_call_ctors()}));function s(e){for(var r=new Uint8Array(e.length),n=0;n<e.length;++n){var a=e.charCodeAt(n);r[n]=96<a?a-97:64<a?a-39:a+4}var i=0;for(n=0;n<e.length;++n)r[i++]=r[n]<60?t[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,i)}function o(e,t,n,a,i,s){var o=r.exports.sbrk,l=n+3&-4,c=o(l*a),u=o(i.length),h=new Uint8Array(r.exports.memory.buffer);if(0==(h.set(i,u),e=e(c,n,a,u,i.length))&&s&&s(c,l,a),t.set(h.subarray(c,c+n*a)),o(c-o(0)),0!=e)throw new Error("Malformed buffer data: "+e)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},c={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],h=0;return{ready:a,supported:!0,useWorkers:function(e){!function(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(s(n))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+o.toString()+function(e){a.then((function(){var t=e.data;try{var n=new Uint8Array(t.count*t.size);o(r.exports[t.mode],n,t.count,t.size,t.source,r.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:n},[n.buffer])}catch(n){self.postMessage({id:t.id,count:t.count,action:"reject",value:n})}}))}.toString(),i=(t=new Blob([t],{type:"text/javascript"}),URL.createObjectURL(t)),l=0;l<e;++l)u[l]=function(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){e=e.data,t.pending-=e.count,t.requests[e.id][e.action](e.value),delete t.requests[e.id]},t}(i);URL.revokeObjectURL(i)}(e)},decodeVertexBuffer:function(e,t,n,a,i){o(r.exports.meshopt_decodeVertexBuffer,e,t,n,a,r.exports[l[i]])},decodeIndexBuffer:function(e,t,n,a){o(r.exports.meshopt_decodeIndexBuffer,e,t,n,a)},decodeIndexSequence:function(e,t,n,a){o(r.exports.meshopt_decodeIndexSequence,e,t,n,a)},decodeGltfBuffer:function(e,t,n,a,i,s){o(r.exports[c[i]],e,t,n,a,r.exports[l[s]])},decodeGltfBufferAsync:function(e,t,n,i,s){if(0<u.length){for(var d=e,p=t,f=n,m=c[i],g=l[s],v=u[0],b=1;b<u.length;++b)u[b].pending<v.pending&&(v=u[b]);return new Promise((function(e,t){var r=new Uint8Array(f),n=h++;v.pending+=d,v.requests[n]={resolve:e,reject:t},v.object.postMessage({id:n,count:d,size:p,source:r,mode:m,filter:g},[r.buffer])}))}return a.then((function(){var a=new Uint8Array(e*t);return o(r.exports[c[i]],a,e,t,n,r.exports[l[s]]),a}))}}}();function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=new WeakMap,d=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=c(a);function a(e){if(this instanceof a)return(e=r.call(this,e)).decoderPath="",e.decoderConfig={},e.decoderBinary=null,e.decoderPending=null,e.workerLimit=4,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},e.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},e;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,r,a){var i=this,s=new n.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(e){i.decodeDracoFile(e,t).catch(a)}),r,a)}},{key:"decodeDracoFile",value:function(e,t,r,n){return n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r},this.decodeGeometry(e,n).then(t)}},{key:"decodeGeometry",value:function(e,t){var r,n=this,a=JSON.stringify(t);if(h.has(e)){if((s=h.get(e)).key===a)return s.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var i=this.workerNextTaskID++,s=e.byteLength;return s=this._getWorker(i,s).then((function(n){return r=n,new Promise((function(n,a){r._callbacks[i]={resolve:n,reject:a},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))})).then((function(e){return n._createGeometry(e.geometry)})),s.catch((function(){return!0})).then((function(){r&&i&&n._releaseTask(r,i)})),h.set(e,{key:a,promise:s}),s}},{key:"_createGeometry",value:function(e){var t=new n.BufferGeometry;e.index&&t.setIndex(new n.BufferAttribute(e.index.array,1));for(var r=0;r<e.attributes.length;r++){var a=(s=e.attributes[r]).name,i=s.array,s=s.itemSize;t.setAttribute(a,new n.BufferAttribute(i,s))}return t}},{key:"_loadLibrary",value:function(e,t){var r=new n.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((function(t,n){r.load(e,t,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":o(WebAssembly))||"js"===this.decoderConfig.type,r=[];return t?r.push(this._loadLibrary("draco_decoder.js","text")):(r.push(this._loadLibrary("draco_wasm_wrapper.js","text")),r.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(r).then((function(r){var n=r[0];t||(e.decoderConfig.wasmBinary=r[1]),r=function(){var e,t;onmessage=function(r){var n=r.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var a=n.buffer,i=n.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,r=new e.DecoderBuffer;r.Init(new Int8Array(a),a.byteLength);try{var s=function(e,t,r,n){var a,i=n.attributeIDs,s=n.attributeTypes,o=t.GetEncodedGeometryType(r);if(o===e.TRIANGULAR_MESH)a=new e.Mesh,v=t.DecodeBufferToMesh(r,a);else{if(o!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,v=t.DecodeBufferToPointCloud(r,a)}if(!v.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());var l,c,u,h,d,p,f,m,g,v,b,y,x,w={index:null,attributes:[]};for(l in i){var S=self[s[l]],M=void 0,T=void 0;if(n.useUniqueIDs)T=i[l],M=t.GetAttributeByUniqueId(a,T);else{if(-1===(T=t.GetAttributeId(a,e[i[l]])))continue;M=t.GetAttribute(a,T)}w.attributes.push((T=e,c=t,u=a,h=l,d=M.num_components(),f=(p=u.num_points()*d)*S.BYTES_PER_ELEMENT,m=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(T,S),g=T._malloc(f),c.GetAttributeDataArrayForAllPoints(u,M,m,f,g),c=new S(T.HEAPF32.buffer,g,p).slice(),T._free(g),{name:h,array:c,itemSize:d}))}return o===e.TRIANGULAR_MESH&&(w.index=(r=e,v=t,y=4*(b=3*(o=a).num_faces()),x=r._malloc(y),v.GetTrianglesUInt32Array(o,y,x),v=new Uint32Array(r.HEAPF32.buffer,x,b).slice(),r._free(x),{array:v,itemSize:1})),e.destroy(a),w}(e,t,r,i),o=s.attributes.map((function(e){return e.array.buffer}));s.index&&o.push(s.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:s},o)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{e.destroy(r),e.destroy(t)}}))}}}.toString(),n=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n"),e.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var r=this;return this._initDecoder().then((function(){r.workerPool.length<r.workerLimit?((n=new Worker(r.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},r.workerPool.push(n)):r.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n,a=r.workerPool[r.workerPool.length-1];return a._taskCosts[e]=t,a._taskLoad+=t,a}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Loader),p=r(4091),f={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};var m=new(function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,r,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var a=this,i=!1,s=0,o=0,l=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=r,this.onError=n,this.itemStart=function(e){o++,!1===i&&void 0!==a.onStart&&a.onStart(e,s,o),i=!0},this.itemEnd=function(e){s++,void 0!==a.onProgress&&a.onProgress(e,s,o),s===o&&(i=!1,void 0!==a.onLoad&&a.onLoad())},this.itemError=function(e){void 0!==a.onError&&a.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){return-1!==(e=c.indexOf(e))&&c.splice(e,2),this},this.getHandler=function(e){for(var t=0,r=c.length;t<r;t+=2){var n=c[t],a=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return a}return null}})));var g=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:m,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,r;return t=e,(r=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.load(e,n,t,a)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var w=function(){var e=n,t=g;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=x(e);if(r=t?(r=x(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===v(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),e.options={premultiplyAlpha:"none"},e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,r,n,a){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,s=f.get(e);if(void 0!==s)return i.manager.itemStart(e),setTimeout((function(){t&&t(s),i.manager.itemEnd(e)}),0),s;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return Promise.all([new Promise((function(t){var r=(n=i.options).textureQuality,n=n.reverseTexture,s=a.notCompress,o=a.size,l=0===e.size?new ImageData(1,1):e;t(o&&1!==r?(o=(t=a.size).w,t=t.h,s=s?1:r,createImageBitmap(l,Object.assign(i.options,{imageOrientation:n?"none":"flipY",resizeHeight:t*s,resizeWidth:o*s}))):createImageBitmap(l,Object.assign(i.options,{imageOrientation:n?"none":"flipY"})))})),Promise.resolve(e)])})).then((function(r){r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),2!==i.length);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw a}}return i}}(e)||function(e,t){if(e){if("string"==typeof e)return b(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,2):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r);var n=r[0];r=r[1],f.add(e,n),t&&t(n,r),i.manager.itemEnd(e)})).catch((function(t){console.log(t,"e"),n&&n(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),S=r(4457),M=r(6422);function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw a}}return i}}(e,t)||D(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(){return(E="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=B(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function k(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=D(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw a}}}}function D(e,t){if(e){if("string"==typeof e)return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?P(e,t):void 0}}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t,r){return t&&O(e.prototype,t),r&&O(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function R(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&L(e,t)}function L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=B(e);if(r=t?(r=B(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===_(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var U=function(){R(t,n.Loader);var e=I(t);function t(r){return A(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new G(e)})),r.register((function(e){return new Q(e)})),r.register((function(e){return new Y(e)})),r.register((function(e){return new W(e)})),r.register((function(e){return new q(e)})),r.register((function(e){return new K(e)})),r.register((function(e){return new Z(e)})),r.register((function(e){return new V(e)})),r.register((function(e){return new X(e)})),r.register((function(e){return new H(e)})),r.register((function(e){return new N(e)})),r.register((function(e){return new J(e)})),r.register((function(e){return new $(e)})),r}return C(t,[{key:"load",value:function(e,t,r,a){function i(t){a?a(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)}var s=this,o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:n.LoaderUtils.extractUrlBase(e),l=(this.manager.itemStart(e),new n.FileLoader(this.manager));l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(r){try{s.parse(r,o,(function(r){t(r),s.manager.itemEnd(e)}),i)}catch(r){i(r)}}),r,i)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n,a){var i,s={},o={},l=new TextDecoder;if("string"==typeof e)i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===ee){try{s[F.KHR_BINARY_GLTF]=new te(e)}catch(e){return void(n&&n(e))}i=JSON.parse(s[F.KHR_BINARY_GLTF].content)}else i=JSON.parse(l.decode(e));else i=e;if(void 0===i.asset||i.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else if(a.valid(i)){var c=new we(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder,ex:a});c.fileLoader.setRequestHeader(this.requestHeader);for(var u=0;u<this.pluginCallbacks.length;u++){var h=this.pluginCallbacks[u](c);s[(o[h.name]=h).name]=!0}if(i.extensionsUsed)for(var d=0;d<i.extensionsUsed.length;++d){var p=i.extensionsUsed[d],f=i.extensionsRequired||[];switch(p){case F.KHR_MATERIALS_UNLIT:s[p]=new z;break;case F.KHR_DRACO_MESH_COMPRESSION:s[p]=new re(i,this.dracoLoader);break;case F.KHR_TEXTURE_TRANSFORM:s[p]=new ne;break;case F.KHR_MESH_QUANTIZATION:s[p]=new ae;break;default:0<=f.indexOf(p)&&void 0===o[p]&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}c.setExtensions(s),c.setPlugins(o),c.parse(r,n)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,t,n,a)}))}}]),t}();function j(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var F={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},N=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return C(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,n=t.length;r<n;r++){var a=t[r];a.extensions&&a.extensions[this.name]&&void 0!==a.extensions[this.name].light&&e._addNodeRef(this.cache,a.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,r="light:"+e,a=t.cache.get(r);if(a)return a;var i,s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l=new n.Color(16777215),c=(void 0!==o.color&&l.fromArray(o.color),void 0!==o.range?o.range:0);switch(o.type){case"directional":(i=new n.DirectionalLight(l)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new n.PointLight(l)).distance=c;break;case"spot":(i=new n.SpotLight(l)).distance=c,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,i.angle=o.spot.outerConeAngle,i.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return i.position.set(0,0,0),i.decay=2,ve(i,o),void 0!==o.intensity&&(i.intensity=o.intensity),i.name=t.createUniqueName(o.name||"light_"+e),a=Promise.resolve(i),t.cache.add(r,a),a}},{key:"getDependency",value:function(e,t){if("light"===e)return this._loadLight(t)}},{key:"createNodeAttachment",value:function(e){var t=this,r=this.parser,n=((e=r.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}]),e}(),z=function(){function e(){A(this,e),this.name=F.KHR_MATERIALS_UNLIT}return C(e,[{key:"getMaterialType",value:function(){return n.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,r){var a,i=[];return e.color=new n.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(a=t.baseColorFactor,e.color.fromArray(a),e.opacity=a[3]),void 0!==t.baseColorTexture&&i.push(r.assignTexture(e,"map",t.baseColorTexture,n.sRGBEncoding))),Promise.all(i)}}]),e}(),V=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_EMISSIVE_STRENGTH}return C(e,[{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(void 0!==(e=e.extensions[this.name].emissiveStrength)&&(t.emissiveIntensity=e),Promise.resolve()):Promise.resolve()}}]),e}(),G=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_CLEARCOAT}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&a.push(r.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&a.push(r.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(a.push(r.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(r=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new n.Vector2(r,r))),Promise.all(a)}}]),e}(),H=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_IRIDESCENCE}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).iridescenceFactor&&(t.iridescence=e.iridescenceFactor),void 0!==e.iridescenceTexture&&n.push(r.assignTexture(t,"iridescenceMap",e.iridescenceTexture)),void 0!==e.iridescenceIor&&(t.iridescenceIOR=e.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==e.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=e.iridescenceThicknessMinimum),void 0!==e.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=e.iridescenceThicknessMaximum),void 0!==e.iridescenceThicknessTexture&&n.push(r.assignTexture(t,"iridescenceThicknessMap",e.iridescenceThicknessTexture)),Promise.all(n)}}]),e}(),W=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_SHEEN}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[];return void 0!==(t.sheenColor=new n.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,e=e.extensions[this.name]).sheenColorFactor&&t.sheenColor.fromArray(e.sheenColorFactor),void 0!==e.sheenRoughnessFactor&&(t.sheenRoughness=e.sheenRoughnessFactor),void 0!==e.sheenColorTexture&&a.push(r.assignTexture(t,"sheenColorMap",e.sheenColorTexture,n.sRGBEncoding)),void 0!==e.sheenRoughnessTexture&&a.push(r.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(a)}}]),e}(),q=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_TRANSMISSION}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(n)}}]),e}(),K=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_VOLUME}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){if(!(e=(a=this.parser).json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var r=[],a=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&r.push(a.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||1/0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new n.Color(a[0],a[1],a[2]),Promise.all(r)}}]),e}(),Z=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_IOR}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(e=e.extensions[this.name],t.ior=void 0!==e.ior?e.ior:1.5,Promise.resolve()):Promise.resolve()}}]),e}(),X=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_SPECULAR}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[],i=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&a.push(r.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new n.Color(i[0],i[1],i[2]),void 0!==e.specularColorTexture&&a.push(r.assignTexture(t,"specularColorMap",e.specularColorTexture,n.sRGBEncoding)),Promise.all(a)}}]),e}(),Q=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_TEXTURE_BASISU}return C(e,[{key:"loadTexture",value:function(e){var t=this.parser,r=t.json;if(!(n=r.textures[e]).extensions||!n.extensions[this.name])return null;var n=n.extensions[this.name],a=t.options.ktx2Loader;if(a)return t.loadTextureImage(e,n.source,a);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}}]),e}(),Y=function(){function e(t){A(this,e),this.parser=t,this.name=F.EXT_TEXTURE_WEBP,this.isSupported=null}return C(e,[{key:"loadTexture",value:function(e){var t=this.name,r=this.parser,n=r.json;if(!(i=n.textures[e]).extensions||!i.extensions[t])return null;var a=i.extensions[t],i=n.images[a.source],s=r.textureLoader;return i.uri&&null!==(i=r.options.manager.getHandler(i.uri))&&(s=i),this.detectSupport().then((function(i){if(i)return r.loadTextureImage(e,a.source,s);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),J=function(){function e(t){A(this,e),this.name=F.EXT_MESHOPT_COMPRESSION,this.parser=t}return C(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var r=e.extensions[this.name],n=(e=this.parser.getDependency("buffer",r.buffer),this.parser.options.meshoptDecoder);if(n&&n.supported)return e.then((function(e){var t=r.byteOffset||0,a=r.byteLength||0,i=r.count,s=r.byteStride,o=new Uint8Array(e,t,a);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(i,s,o,r.mode,r.filter).then((function(e){return e.buffer})):n.ready.then((function(){var e=new ArrayBuffer(i*s);return n.decodeGltfBuffer(new Uint8Array(e),i,s,o,r.mode,r.filter),e}))}));if(t.extensionsRequired&&0<=t.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return null}}]),e}(),$=function(){function e(t){A(this,e),this.name=F.EXT_MESH_GPU_INSTANCING,this.parser=t}return C(e,[{key:"createNodeMesh",value:function(e){var t=this,r=this.parser.json,a=r.nodes[e];if(!a.extensions||!a.extensions[this.name]||void 0===a.mesh)return null;var i,s=k(r.meshes[a.mesh].primitives);try{for(s.s();!(i=s.n()).done;){var o=i.value;if(o.mode!==le.TRIANGLES&&o.mode!==le.TRIANGLE_STRIP&&o.mode!==le.TRIANGLE_FAN&&void 0!==o.mode)return null}}catch(e){s.e(e)}finally{s.f()}var l,c=a.extensions[this.name].attributes,u=[],h={};for(l in c)!function(e){u.push(t.parser.getDependency("accessor",c[e]).then((function(t){return h[e]=t,h[e]})))}(l);return u.length<1?null:(u.push(this.parser.createNodeMesh(e)),Promise.all(u).then((function(e){var r,a=e.pop(),i=a.isGroup?a.children:[a],s=e[0].count,o=[],l=k(i);try{for(l.s();!(r=l.n()).done;){for(var c,u=r.value,d=new n.Matrix4,p=new n.Vector3,f=new n.Quaternion,m=new n.Vector3(1,1,1),g=new n.InstancedMesh(u.geometry,u.material,s),v=0;v<s;v++)h.TRANSLATION&&p.fromBufferAttribute(h.TRANSLATION,v),h.ROTATION&&f.fromBufferAttribute(h.ROTATION,v),h.SCALE&&m.fromBufferAttribute(h.SCALE,v),g.setMatrixAt(v,d.compose(p,f,m));for(c in h)"TRANSLATION"!==c&&"ROTATION"!==c&&"SCALE"!==c&&u.geometry.setAttribute(c,h[c]);n.Object3D.prototype.copy.call(g,u),g.frustumCulled=!1,t.parser.assignFinalMaterial(g),o.push(g)}}catch(e){l.e(e)}finally{l.f()}return a.isGroup?(a.clear(),a.add.apply(a,o),a):o[0]})))}}]),e}(),ee="glTF",te=C((function e(t){A(this,e),this.name=F.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==ee)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var a=this.header.length-12,i=new DataView(t,12),s=0;s<a;){var o,l=i.getUint32(s,!0),c=(s+=4,i.getUint32(s,!0));s+=4,1313821514===c?(o=new Uint8Array(t,12+s,l),this.content=n.decode(o)):5130562===c&&(this.body=t.slice(o=12+s,o+l)),s+=l}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),re=function(){function e(t,r){if(A(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=F.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return C(e,[{key:"decodePrimitive",value:function(e,t){var r,n,a=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,l={},c={},u={};for(r in o){var h=pe[r]||r.toLowerCase();l[h]=o[r]}for(n in e.attributes){var d,p,f=pe[n]||n.toLowerCase();void 0!==o[n]&&(d=a.accessors[e.attributes[n]],p=ce[d.componentType],u[f]=p.name,c[f]=!0===d.normalized)}return t.getDependency("bufferView",s).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r];void 0!==(r=c[r])&&(n.normalized=r)}t(e)}),l,u)}))}))}}]),e}(),ne=function(){function e(){A(this,e),this.name=F.KHR_TEXTURE_TRANSFORM}return C(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}]),e}(),ae=C((function e(){A(this,e),this.name=F.KHR_MESH_QUANTIZATION})),ie=function(){R(t,n.Interpolant);var e=I(t);function t(r,n,a,i){return A(this,t),e.call(this,r,n,a,i)}return C(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,a=e*n*3+n,i=0;i!==n;i++)t[i]=r[a+i];return t}},{key:"interpolate_",value:function(e,t,r,n){for(var a=this.resultBuffer,i=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,c=n-t,u=e*l,h=u-l,d=-2*(t=(r=(n=(r-t)/c)*n)*n)+3*r,p=t-r,f=1-d,m=p-r+n,g=0;g!==s;g++){var v=i[h+g+s],b=i[h+g+o]*c,y=i[u+g+s],x=i[u+g]*c;a[g]=f*v+m*b+d*y+p*x}return a}}]),t}(),se=new n.Quaternion,oe=function(){R(t,ie);var e=I(t);function t(){return A(this,t),e.apply(this,arguments)}return C(t,[{key:"interpolate_",value:function(e,r,n,a){return e=E(B(t.prototype),"interpolate_",this).call(this,e,r,n,a),se.fromArray(e).normalize().toArray(e),e}}]),t}(),le={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ce={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:n.NearestFilter,9729:n.LinearFilter,9984:n.NearestMipmapNearestFilter,9985:n.LinearMipmapNearestFilter,9986:n.NearestMipmapLinearFilter,9987:n.LinearMipmapLinearFilter},he={33071:n.ClampToEdgeWrapping,33648:n.MirroredRepeatWrapping,10497:n.RepeatWrapping},de={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},pe={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},fe={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},me={CUBICSPLINE:void 0,LINEAR:n.InterpolateLinear,STEP:n.InterpolateDiscrete};function ge(e,t,r){for(var n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function ve(e,t){void 0!==t.extras&&("object"===_(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function be(e){for(var t="",r=Object.keys(e).sort(),n=0,a=r.length;n<a;n++)t+=r[n]+":"+e[r[n]]+";";return t}function ye(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var xe=new n.Matrix4,we=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=(A(this,e),this.json=t,this.extensions={},this.plugins={},this.options=r,this.cache=new j,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},t=!(this.nodeNamesUsed={}),r=!1,-1);"undefined"!=typeof navigator&&(t=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),a=(r=-1<navigator.userAgent.indexOf("Firefox"))?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||t||r&&a<98?this.textureLoader=new n.TextureLoader(this.options.manager):this.textureLoader=new w(this.options.manager),this.options.ex.setTextureLoader(this.textureLoader),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new n.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.rgbeLoader=new M.x(this.options.manager),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return C(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var r=this,n=this.json,a=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){var i={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};ge(a,i,n),ve(i,n),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(i)}))).then((function(){e(i)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],n=0,a=t.length;n<a;n++)for(var i=t[n].joints,s=0,o=i.length;s<o;s++)e[i[s]].isBone=!0;for(var l=0,c=e.length;l<c;l++){var u=e[l];void 0!==u.mesh&&(this._addNodeRef(this.meshCache,u.mesh),void 0!==u.skin&&(r[u.mesh].isSkinnedMesh=!0)),void 0!==u.camera&&this._addNodeRef(this.cameraCache,u.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,r){var n=this;if(e.refs[t]<=1)return r;var a=r.clone();return function e(t,r){var a,i=n.associations.get(t),s=(null!=i&&n.associations.set(r,i),k(t.children.entries()));try{for(s.s();!(a=s.n()).done;){var o=T(a.value,2),l=o[0];e(o[1],r.children[l])}}catch(e){s.e(e)}finally{s.f()}}(r,a),a.name+="_instance_"+e.uses[t]++,a}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var n=e(t[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),r=(t.unshift(this),[]),n=0;n<t.length;n++){var a=e(t[n]);a&&r.push(a)}return r}},{key:"getDependency",value:function(e,t){var r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":n=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":n=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})))break;throw new Error("Unknown type: "+e)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(e){var t,r,n=this.cache.get(e);return n||(r=(t=this).json[e+("mesh"===e?"es":"s")]||[],n=Promise.all(r.map((function(r,n){return t.getDependency(e,n)}))),this.cache.add(e,n)),n}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[F.KHR_BINARY_GLTF].body);var a=this.options;return new Promise((function(e,i){r.load(n.LoaderUtils.resolveURL(t.uri,a.path),e,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+r)}))}},{key:"loadAccessor",value:function(e){var t,r=this,a=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse)return e=de[i.type],s=ce[i.componentType],t=!0===i.normalized,s=new s(i.count*e),Promise.resolve(new n.BufferAttribute(s,e,t));var s=[];return void 0!==i.bufferView?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),void 0!==i.sparse&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then((function(e){var t,s=e[0],o=de[i.type],l=ce[i.componentType],c=l.BYTES_PER_ELEMENT,u=i.byteOffset||0,h=void 0!==i.bufferView?a.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized,p=h&&h!==c*o?(f=Math.floor(u/h),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+f+":"+i.count,(g=r.cache.get(m))||(t=new l(s,f*h,i.count*h/c),g=new n.InterleavedBuffer(t,h/c),r.cache.add(m,g)),new n.InterleavedBufferAttribute(g,o,u%h/c,d)):(t=null===s?new l(i.count*o):new l(s,u,i.count*o),new n.BufferAttribute(t,o,d));if(void 0!==i.sparse){var f=ce[i.sparse.indices.componentType],m=i.sparse.indices.byteOffset||0,g=i.sparse.values.byteOffset||0,v=new f(e[1],m,i.sparse.count*de.SCALAR),b=new l(e[2],g,i.sparse.count*o);null!==s&&(p=new n.BufferAttribute(p.array.slice(),p.itemSize,p.normalized));for(var y=0,x=v.length;y<x;y++){var w=v[y];if(p.setX(w,b[y*o]),2<=o&&p.setY(w,b[y*o+1]),3<=o&&p.setZ(w,b[y*o+2]),4<=o&&p.setW(w,b[y*o+3]),5<=o)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}},{key:"loadTexture",value:function(e){var t=this.json,r=this.options,n=t.textures[e].source,a=(t=t.images[n],this.textureLoader);return t.uri&&null!==(r=r.manager.getHandler(t.uri))&&(a=r),this.loadTextureImage(e,n,a)}},{key:"loadTextureImage",value:function(e,t,r){var a=this,i=this.json,s=i.textures[e],o=i.images[t],l=(o.uri||o.bufferView)+":"+s.sampler;return this.textureCache[l]?this.textureCache[l]:(t=this.loadImageSource(t,r,e).then((function(t){t.flipY=!1,t.name=s.name||o.name||"";var r=(i.samplers||{})[s.sampler]||{};return t.magFilter=ue[r.magFilter]||n.LinearFilter,t.minFilter=ue[r.minFilter]||n.LinearMipmapLinearFilter,t.wrapS=he[r.wrapS]||n.RepeatWrapping,t.wrapT=he[r.wrapT]||n.RepeatWrapping,a.associations.set(t,{textures:e}),a.options.ex.loadTexture({texture:t,textureDef:s}),t})).catch((function(){return null})),this.textureCache[l]=t)}},{key:"loadImageSource",value:function(e,t,r){var a=this,i=this.json,s=this.options,o=i.textures[r];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()}));var l=i.images[e],c=self.URL||self.webkitURL,u=l.uri||"";if(void 0!==l.bufferView)u=a.getDependency("bufferView",l.bufferView).then((function(e){var t=new Blob([e],{type:l.mimeType});return{sourceURI:u=c.createObjectURL(t),blob:t,bufferView:e}}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return r=Promise.resolve(u).then((function(e){var r=e.sourceURI,i=e.blob;return e.bufferView,new Promise((function(e,l){var c,u;o.isHdr?((c=new FileReader).readAsDataURL(i),c.addEventListener("load",(function(t){t=t.target.result,a.rgbeLoader.loadAsync(t).then((function(t){t.userData.blob=i,e({texture:t,blob:i})}))}))):!0===t.isImageBitmapLoader?(c=function(t,r){(t=new n.Texture(t)).needsUpdate=!0,e({texture:t,blob:r})},t.load(n.LoaderUtils.resolveURL(r,s.path),c,void 0,l,o)):(u=s.ex.loadConfig.reverseTexture,(0,S.urlToCanvas)(r).then((function(t){var r=t.ctx,a=t.canvas,s=(t=t.img,new n.Texture(a));u?e(s):(r.clearRect(0,0,a.width,a.height),r.translate(0,a.height),r.scale(1,-1),r.drawImage(t,0,0,a.width,a.height),e({texture:s,blob:i}))})).catch(l))}))})).then((function(e){var t=e.texture;return e=e.blob,t.userData.url=u,t.userData.blob=e,t.userData.mimeType=l.mimeType||(0<(e=l.uri||"").search(/\.jpe?g($|\?)/i)||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":0<e.search(/\.webp($|\?)/i)||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(e){throw console.log(e,"error"),console.error("THREE.GLTFLoader: Couldn't loadImageSource texture",u),e})),this.sourceCache[e]=r}},{key:"assignTexture",value:function(e,t,r,n){var a=this;return this.getDependency("texture",r.index).then((function(i){return i?(void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),a.extensions[F.KHR_TEXTURE_TRANSFORM]&&(s=void 0!==r.extensions?r.extensions[F.KHR_TEXTURE_TRANSFORM]:void 0)&&(o=a.associations.get(i),i=a.extensions[F.KHR_TEXTURE_TRANSFORM].extendTexture(i,s),a.associations.set(i,o)),void 0!==n&&(i.encoding=n),e[t]=i):null;var s,o}))}},{key:"assignFinalMaterial",value:function(e){var t,r,a=e.geometry,i=e.material,s=void 0===a.attributes.tangent,o=void 0!==a.attributes.color,l=void 0===a.attributes.normal;e.isPoints?(t="PointsMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new n.PointsMaterial,n.Material.prototype.copy.call(r,i),r.color.copy(i.color),r.map=i.map,r.sizeAttenuation=!1,this.cache.add(t,r)),i=r):e.isLine&&(t="LineBasicMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new n.LineBasicMaterial,n.Material.prototype.copy.call(r,i),r.color.copy(i.color),this.cache.add(t,r)),i=r),(s||o||l)&&(t="ClonedMaterial:"+i.uuid+":",s&&(t+="derivative-tangents:"),o&&(t+="vertex-colors:"),l&&(t+="flat-shading:"),(r=this.cache.get(t))||(r=i.clone(),o&&(r.vertexColors=!0),l&&(r.flatShading=!0),s&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(t,r),this.associations.set(r,this.associations.get(i)))),i.aoMap&&void 0===a.attributes.uv2&&void 0!==a.attributes.uv&&a.setAttribute("uv2",a.attributes.uv),this.options.ex.loadMaterial({material:i,materialDef:i.userData,model:e}),e.material=i}},{key:"getMaterialType",value:function(){return n.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,r,a=this,i=this.json,s=this.extensions,o=i.materials[e],l={},c=(i=[],(o.extensions||{})[F.KHR_MATERIALS_UNLIT]?(r=s[F.KHR_MATERIALS_UNLIT],t=r.getMaterialType(),i.push(r.extendParams(l,o,a))):(r=o.pbrMetallicRoughness||{},l.color=new n.Color(1,1,1),l.opacity=1,Array.isArray(r.baseColorFactor)&&(c=r.baseColorFactor,l.color.fromArray(c),l.opacity=c[3]),void 0!==r.baseColorTexture&&i.push(a.assignTexture(l,"map",r.baseColorTexture,n.sRGBEncoding)),l.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,l.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(i.push(a.assignTexture(l,"metalnessMap",r.metallicRoughnessTexture)),i.push(a.assignTexture(l,"roughnessMap",r.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),i.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,l)}))))),!0===o.doubleSided&&(l.side=n.DoubleSide),o.alphaMode||"OPAQUE");return"BLEND"===c?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,"MASK"===c&&(l.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==n.MeshBasicMaterial&&(i.push(a.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new n.Vector2(1,1),void 0!==o.normalTexture.scale&&(r=o.normalTexture.scale,l.normalScale.set(r,r))),void 0!==o.occlusionTexture&&t!==n.MeshBasicMaterial&&(i.push(a.assignTexture(l,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(l.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==n.MeshBasicMaterial&&(l.emissive=(new n.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==n.MeshBasicMaterial&&i.push(a.assignTexture(l,"emissiveMap",o.emissiveTexture,n.sRGBEncoding)),Promise.all(i).then((function(){var r=new t(l);return o.name&&(r.name=o.name),ve(r,o),a.associations.set(r,{materials:e}),o.extensions&&ge(s,r,o),r}))}},{key:"createUniqueName",value:function(e){for(var t=n.PropertyBinding.sanitizeNodeName(e||""),r=t,a=1;this.nodeNamesUsed[r];++a)r=t+"_"+a;return this.nodeNamesUsed[r]=!0,r}},{key:"loadGeometries",value:function(e){for(var t=this,r=this.extensions,a=this.primitiveCache,i=[],s=0,o=e.length;s<o;s++){var l=e[s],c=(u=void 0,u=(u=(c=l).extensions&&c.extensions[F.KHR_DRACO_MESH_COMPRESSION])?"draco:"+u.bufferView+":"+u.indices+":"+be(u.attributes):c.indices+":"+be(c.attributes)+":"+c.mode),u=a[c];u?i.push(u.promise):(u=void 0,u=l.extensions&&l.extensions[F.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[F.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return Se(r,e,t)}))}(l):Se(new n.BufferGeometry,l,t),a[c]={primitive:l,promise:u},i.push(u))}return Promise.all(i)}},{key:"loadMesh",value:function(e){for(var t=this,r=this.json,a=this.extensions,i=r.meshes[e],s=i.primitives,o=[],l=0,c=s.length;l<c;l++){var u=void 0===s[l].material?(void 0===(u=this.cache).DefaultMaterial&&(u.DefaultMaterial=new n.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:n.FrontSide})),u.DefaultMaterial):this.getDependency("material",s[l].material);o.push(u)}return o.push(t.loadGeometries(s)),Promise.all(o).then((function(r){for(var o=r.slice(0,r.length-1),l=r[r.length-1],c=[],u=0,h=l.length;u<h;u++){var d=l[u],f=s[u],m=void 0,g=o[u];if(f.mode===le.TRIANGLES||f.mode===le.TRIANGLE_STRIP||f.mode===le.TRIANGLE_FAN||void 0===f.mode)!0!==(m=new(!0===i.isSkinnedMesh?n.SkinnedMesh:n.Mesh)(d,g)).isSkinnedMesh||m.geometry.attributes.skinWeight.normalized||m.normalizeSkinWeights(),f.mode===le.TRIANGLE_STRIP?m.geometry=(0,p.Vs)(m.geometry,n.TriangleStripDrawMode):f.mode===le.TRIANGLE_FAN&&(m.geometry=(0,p.Vs)(m.geometry,n.TriangleFanDrawMode));else if(f.mode===le.LINES)m=new n.LineSegments(d,g);else if(f.mode===le.LINE_STRIP)m=new n.Line(d,g);else if(f.mode===le.LINE_LOOP)m=new n.LineLoop(d,g);else{if(f.mode!==le.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);m=new n.Points(d,g)}if(0<Object.keys(m.geometry.morphAttributes).length){M=S=w=x=y=v=void 0;var v=m,b=i;if(v.updateMorphTargets(),void 0!==b.weights)for(var y=0,x=b.weights.length;y<x;y++)v.morphTargetInfluences[y]=b.weights[y];if(b.extras&&Array.isArray(b.extras.targetNames)){var w=b.extras.targetNames;if(v.morphTargetInfluences.length===w.length){v.morphTargetDictionary={};for(var S=0,M=w.length;S<M;S++)v.morphTargetDictionary[w[S]]=S}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}m.name=t.createUniqueName(i.name||"mesh_"+e),ve(m,i),f.extensions&&ge(a,m,f),t.assignFinalMaterial(m),c.push(m)}for(var T=0,_=c.length;T<_;T++)t.associations.set(c[T],{meshes:e,primitives:T});if(1===c.length)return c[0];var E=new n.Group;t.associations.set(E,{meshes:e});for(var k=0,D=c.length;k<D;k++)E.add(c[k]);return E}))}},{key:"loadCamera",value:function(e){var t,r=(e=this.json.cameras[e])[e.type];if(r)return"perspective"===e.type?t=new n.PerspectiveCamera(n.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===e.type&&(t=new n.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),ve(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){for(var t=this.json.skins[e],r=[],a=0,i=t.joints.length;a<i;a++)r.push(this.getDependency("node",t.joints[a]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(e){for(var r=e.pop(),a=e,i=[],s=[],o=0,l=a.length;o<l;o++){var c=a[o];c?(i.push(c),c=new n.Matrix4,null!==r&&c.fromArray(r.array,16*o),s.push(c)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new n.Skeleton(i,s)}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],r=[],a=[],i=[],s=[],o=[],l=0,c=t.channels.length;l<c;l++){var u=t.channels[l],h=t.samplers[u.sampler],d=(u=u.target).node,p=void 0!==t.parameters?t.parameters[h.input]:h.input,f=void 0!==t.parameters?t.parameters[h.output]:h.output;r.push(this.getDependency("node",d)),a.push(this.getDependency("accessor",p)),i.push(this.getDependency("accessor",f)),s.push(h),o.push(u)}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(i),Promise.all(s),Promise.all(o)]).then((function(r){for(var a=r[0],i=r[1],s=r[2],o=r[3],l=r[4],c=[],u=0,h=a.length;u<h;u++)!function(e){var t=a[e],r=i[e],u=s[e],h=o[e],d=l[e];if(void 0!==t){t.updateMatrix();var p=void 0;switch(fe[d.path]){case fe.weights:p=n.NumberKeyframeTrack;break;case fe.rotation:p=n.QuaternionKeyframeTrack;break;default:p=n.VectorKeyframeTrack}e=t.name||t.uuid;var f=void 0!==h.interpolation?me[h.interpolation]:n.InterpolateLinear,m=[],g=(fe[d.path]===fe.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),u.array);if(u.normalized){for(var v=ye(g.constructor),b=new Float32Array(g.length),y=0,x=g.length;y<x;y++)b[y]=g[y]*v;g=b}for(var w=0,S=m.length;w<S;w++){var M=new p(m[w]+"."+fe[d.path],r.array,g,f);"CUBICSPLINE"===h.interpolation&&(M.createInterpolant=function(e){return new(this instanceof n.QuaternionKeyframeTrack?oe:ie)(this.times,this.values,this.getValueSize()/3,e)},M.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(M)}}}(u);return r=t.name||"animation_"+e,new n.AnimationClip(r,void 0,c)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,r=this,n=t.nodes[e];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(e){return e=r._getNodeRef(r.meshCache,n.mesh,e),void 0!==n.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,r=n.weights.length;t<r;t++)e.morphTargetInfluences[t]=n.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t=this.json,r=this.extensions,a=this,i=t.nodes[e],s=i.name?a.createUniqueName(i.name):"";return function(){for(var t=[],r=a._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})),n=(r&&t.push(r),void 0!==i.camera&&t.push(a.getDependency("camera",i.camera).then((function(e){return a._getNodeRef(a.cameraCache,i.camera,e)}))),a._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),[]),s=i.children||[],o=0,l=s.length;o<l;o++)n.push(a.getDependency("node",s[o]));return r=void 0===i.skin?Promise.resolve(null):a.getDependency("skin",i.skin),Promise.all([Promise.all(t),Promise.all(n),r])}().then((function(t){var o=t[0],l=t[1],c=t[2],u=!0===i.isBone?new n.Bone:1<o.length?new n.Group:1===o.length?o[0]:new n.Object3D;if(u!==o[0])for(var h=0,d=o.length;h<d;h++)u.add(o[h]);i.name&&(u.userData.name=i.name,u.name=s),ve(u,i),i.extensions&&ge(r,u,i),void 0!==i.matrix?((t=new n.Matrix4).fromArray(i.matrix),u.applyMatrix4(t)):(void 0!==i.translation&&u.position.fromArray(i.translation),void 0!==i.rotation&&u.quaternion.fromArray(i.rotation),void 0!==i.scale&&u.scale.fromArray(i.scale)),a.associations.has(u)||a.associations.set(u,{}),a.associations.get(u).nodes=e,null!==c&&u.traverse((function(e){e.isSkinnedMesh&&e.bind(c,xe)}));for(var p=0,f=l.length;p<f;p++)u.add(l[p]);return a.options.ex.loadNode({node:u,nodeDef:i})||u}))}},{key:"loadScene",value:function(e){for(var t=this.extensions,r=(e=this.json.scenes[e],this),a=new n.Group,i=(e.name&&(a.name=r.createUniqueName(e.name)),ve(a,e),e.extensions&&ge(t,a,e),e.nodes||[]),s=[],o=0,l=i.length;o<l;o++)s.push(r.getDependency("node",i[o]));return Promise.all(s).then((function(e){for(var t=0,i=e.length;t<i;t++)a.add(e[t]);return r.options.ex.loadScene(a),r.associations=function(e){var t,a=new Map,i=k(r.associations);try{for(i.s();!(t=i.n()).done;){var s=T(t.value,2),o=s[0],l=s[1];(o instanceof n.Material||o instanceof n.Texture)&&a.set(o,l)}}catch(e){i.e(e)}finally{i.f()}return e.traverse((function(e){var t=r.associations.get(e);null!=t&&a.set(e,t)})),a}(a),a}))}}]),e}();function Se(e,t,r){var a,i=t.attributes,s=[];for(a in i){var o=pe[a]||a.toLowerCase();o in e.attributes||s.push(function(t,n){return r.getDependency("accessor",t).then((function(t){e.setAttribute(n,t)}))}(i[a],o))}void 0===t.indices||e.index||(l=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),s.push(l)),ve(e,t);var l=e,c=t,u=r,h=c.attributes,d=new n.Box3;if(void 0!==h.POSITION){var p=(h=u.json.accessors[h.POSITION]).min,f=h.max;if(void 0===p||void 0===f)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{d.set(new n.Vector3(p[0],p[1],p[2]),new n.Vector3(f[0],f[1],f[2])),h.normalized&&(p=ye(ce[h.componentType]),d.min.multiplyScalar(p),d.max.multiplyScalar(p));var m=c.targets;if(void 0!==m){for(var g=new n.Vector3,v=new n.Vector3,b=0,y=m.length;b<y;b++){var x,w,S=m[b];void 0!==S.POSITION&&(w=(S=u.json.accessors[S.POSITION]).min,x=S.max,void 0!==w&&void 0!==x?(v.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),v.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),v.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),S.normalized&&(w=ye(ce[S.componentType]),v.multiplyScalar(w)),g.max(v)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}d.expandByVector(g)}l.boundingBox=d,f=new n.Sphere,d.getCenter(f.center),f.radius=d.min.distanceTo(d.max)/2,l.boundingSphere=f}}return Promise.all(s).then((function(){if(void 0===t.targets)return e;for(var n=e,a=t.targets,i=r,s=!1,o=!1,l=!1,c=0,u=a.length;c<u;c++){var h=a[c];if(void 0!==h.POSITION&&(s=!0),void 0!==h.NORMAL&&(o=!0),void 0!==h.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(n);for(var d=[],p=[],f=[],m=0,g=a.length;m<g;m++){var v,b=a[m];s&&(v=void 0!==b.POSITION?i.getDependency("accessor",b.POSITION):n.attributes.position,d.push(v)),o&&(v=void 0!==b.NORMAL?i.getDependency("accessor",b.NORMAL):n.attributes.normal,p.push(v)),l&&(b=void 0!==b.COLOR_0?i.getDependency("accessor",b.COLOR_0):n.attributes.color,f.push(b))}return Promise.all([Promise.all(d),Promise.all(p),Promise.all(f)]).then((function(e){var t=e[0],r=e[1];return e=e[2],s&&(n.morphAttributes.position=t),o&&(n.morphAttributes.normal=r),l&&(n.morphAttributes.color=e),n.morphTargetsRelative=!0,n}))}))}var Me=r(1794),Te=r(6272);class _e{constructor(e,t){this.runScene=e,this.helper=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof w&&e.setOptions({reverseTexture:this.helper.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})}}class Ee{constructor(e,t){this.pending=[],this.models=[],this.module=new Me.Z,this.runScene=e,this.loadConfig=t,this.options=new _e(e,this),this.callback("mountModule",null)}beforeLoader(e){this.callback("getJSON",e),this.json=e;var t=this.processBase64(e);return"editor"===this.runScene.optionsEx.options.mode?(this.callback("beforeParse",e),!0):(t&&this.callback("beforeParse",e),t)}loadTexture(e){this.callback("loadTexture",e)}processBase64(e){if(null==(t=e.asset)||!t.ex)return!0;var t=e.asset.ex.base64;return!t||!!(e=(0,Te.Ne)(t))&&(t=Number(e),!isNaN(t)&&(new Date).getTime()<t)}callback(e,t){var r,n;return this.loadConfig.triggerCb&&null!=(r=null==(n=this.runScene.cb.loaderer.gltf[e])?void 0:n.cb)&&r.call(n,t),null!=(n=null==(r=this.loadConfig.callBack)?void 0:r[e])&&n.call(r,t),this.runScene.exporter.gltf.module.loadCallback({type:e,json:this.json,data:t,config:this.loadConfig,core:this})}loadMaterial(e){this.callback("loadMaterial",e)}loadNode(e){if(1===(e=this.callback("loadNode",e)).length)return e[0]}}class ke{constructor(e,t){this.options=e,this.runScene=t}static getGltfLoader(e){let t=this._gltf;if(!t){t=this._gltf=new U;const r=new d;r.setDecoderPath(e),this._gltf.setMeshoptDecoder(s),this._gltf.setDRACOLoader(r)}return t}parse(e){var{arrayBuffer:e,onDone:t,onError:r}=e;ke.getGltfLoader(this.runScene.optionsEx.options.decodePath).parse(e,"",t,r,this)}valid(e){return this.options.core.beforeLoader(e)}loadTexture(e){return this.options.core.loadTexture(e)}loadMaterial(e){return this.options.core.loadMaterial(e)}loadNode(e){return this.options.core.loadNode(e)}setTextureLoader(e){this.options.core.options.setTextureLoader(e)}loadScene(e){this.scene=e,this.options.models.push(e)}onBuildNodeHierarchy(e){const{nodeId:t,parentObject:r,node:n,idMap:a,children:i}=e;a&&a.set(t,n);try{if(void 0!==i&&(null==i?void 0:i.length)===r.children.length){let e=!0;i.forEach((t=>{a.get(t)||(e=!1)})),e&&(r.children=[...a.entries()].sort(((e,t)=>e[0]-t[0])).map((e=>{var[,e]=e;return e})),a.clear())}}catch(e){console.log(e,"e")}}}class De{constructor(e){this.dracoPath="./draco/",this._gltf=new U,this.runScene=e}init(){const e=new d;e.setDecoderPath(this.runScene.optionsEx.options.decodePath),this._gltf.setMeshoptDecoder(s),this._gltf.setDRACOLoader(e)}load(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var r=yield a().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var r,{total:e,loaded:n}=e;let a=n/e;1<(a=a<0?0:a)&&(a=1);var n=Number(a.toFixed(2));e=Math.floor(100*n),null!=(r=null==(n=null==t?void 0:t.callBack)?void 0:n.progress)&&r.call(n,e),this.runScene.optionsEx.log("下载场景进度:"+e,"detail"),null!=t&&t.triggerCb&&this.runScene.cb.loaderer.gltf.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.runScene.optionsEx.log("下载场景失败:",e)}));return r?this.parse(r,t):Promise.resolve()}))}parse(e,t){const r=(0,S.deepMergeObject)({cleanJSON:!0,triggerCb:!1,reverseTexture:!1,callBack:{mountModule:void 0,getJSON:void 0,beforeParse:void 0,afterParse:void 0,lazyLoadedTexture:void 0,loaded:void 0,loadMaterial:void 0,loadNode:void 0,modelLoaded:void 0,progress:void 0,getArrayBuffer:void 0,complete:void 0,loadedGltf:void 0,loadTexture:void 0},module:{light:!0,model:!0,camera:!0,controls:!0,tags:!0,objects:!0,timeline:!0,sceneConfig:!0}},t||{}),n=new Ee(this.runScene,r);return n.callback("getArrayBuffer",e),new Promise((t=>{new ke({rootModel:this.runScene.assetsEx.get().scene,models:[],core:n,runScene:this.runScene,loadConfig:r},this.runScene).parse({arrayBuffer:e,onDone:e=>{n.callback("loadedGltf",e);try{this.afterParse(e.parser.options.ex.options,e,r)}catch(e){this.runScene.cb.error.cb({tip:"加载glb出错",msg:e}),console.log(e,"e")}t(n.models)},onError:e=>{console.log(e,"_a")}})}))}afterParse(e,t,r){var n;const a=e.core;a.callback("afterParse",{options:e,json:t,loadConfig:r});var{cleanJSON:r,callBack:i}=r;if(!t.asset.ex){const{models:r,core:n}=e,a=this.runScene.sceneEx.cleanUnlessLevel(r[0]);n.models.push(a),0<t.animations.length&&(a.animations=[...t.animations])}this.runScene.optionsEx.log(t,"detail"),Promise.all(a.pending).then((()=>{a.callback("complete",{models:e.models,json:t})})),null!=(n=null==i?void 0:i.getJSON)&&n.call(i,t),r&&this.disposeJSON(t)}disposeJSON(e){}}var Pe=r(3736),Ae=r(110);class Oe{constructor(e){this._objectLoader=new n.ObjectLoader,this.runScene=e,this._parser=new Ce(e)}parse(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var t=yield this._objectLoader.parseAsync(JSON.parse(e));return this._parser.afterParse(this.runScene.sceneEx.cleanUnlessLevel(t))}))}}class Ce{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,Pe.M)(t,"type",Ae.Z.tools.type),this.runScene.uniqueEx.material.add(e.material)}afterParse(e){return e instanceof Array?e.map((e=>{e.traverse((e=>{this.parseModel(e)}))})):e.traverse((e=>{this.parseModel(e)})),e}}class Re{constructor(e){this.imgBitMap=new n.ImageBitmapLoader,this.object=new n.ObjectLoader,this.runScene=e,this.gltf=new De(e),this.json=new Oe(e)}init(){this.gltf.init()}}const Le=new class{constructor(){this.load=new n.AnimationLoader}parse(e){return this.load.parse(e)}}},7880:(e,t,r)=>{r.d(t,{Ws:()=>Q,ZP:()=>Y,ee:()=>J});var n,a,i,s=r(4707),o=r(8881),l=r(932),c=r(6651),u=r(3735),h=r(3736);class d{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}(n=d).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],d.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"],d.tools={type:"FakeInterior",getTextures:e=>{const t=[];return e.uniforms.ceilingTex.value&&t.push({type:"ceilingTex",texture:e.uniforms.ceilingTex.value}),e.uniforms.floorTex.value&&t.push({type:"floorTex",texture:e.uniforms.floorTex.value}),e.uniforms.sideWallTex.value&&t.push({type:"sideWallTex",texture:e.uniforms.sideWallTex.value}),e.uniforms.backWallTex.value&&t.push({type:"backWallTex",texture:e.uniforms.backWallTex.value}),t},create:(e,t)=>{var r=new o.ShaderMaterial({uniforms:(0,c.d9)(p.uniforms),vertexShader:p.vertexShader,fragmentShader:p.fragmentShader});return n.tools.bind(r),r},parseData:e=>{const{texture:t,normal:r,material:a}=e,{data:i,load:s}=t,l=new o.ShaderMaterial({uniforms:(0,c.d9)(p.uniforms),vertexShader:p.vertexShader,fragmentShader:p.fragmentShader}),u=[];return s&&u.push(...i.map((e=>()=>{"ceilingTex"===e.type?l.uniforms.ceilingTex.value=e.texture||null:"floorTex"===e.type?l.uniforms.floorTex.value=e.texture||null:"sideWallTex"===e.type?l.uniforms.sideWallTex.value=e.texture||null:"backWallTex"===e.type&&(l.uniforms.backWallTex.value=e.texture||null)}))),Object.keys(r.uniforms).filter((e=>!d.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];l.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new o.Vector4(t.x,t.y,t.z,t.w):t})),l.name=r.name,l.userData.id=a.userData.id,n.tools.bind(l),{material:l,setTextureFns:u}},toNormal:e=>{const t=(0,l.createDefMaterial)(),r=(t.userData=Object.assign({},t.userData),{}),a=e.uniforms,i=p.uniforms;return Object.keys(a).filter((e=>!d.TextureNames.includes(e))).map((e=>{var t,n,s,l,c,u,h=a[e].value,d=i[e].value;h instanceof o.Vector4?(({x:t,y:n,z:s}=h),({x:l,y:c,z:u}=d),t===l&&n===c&&s===u||(r[e]=h)):h!==d&&(r[e]=h)})),{material:t,normal:{type:n.tools.type,uniforms:r,name:e.name},textures:n.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=n.tools.create(t);return Object.keys(r).filter((e=>!d.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",n.tools.type)},validType:e=>"FakeInterior"===e.userData.type};const p={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new o.Vector4(1,1,1,1)},sideWallTex:{value:null},backWallTex:{value:null},floorTex:{value:null},ceilingTex:{value:null},sideWallTexTiling:{value:.097},backWallTexTiling:{value:.097},floorTexTiling:{value:.15},ceilingTexTiling:{value:.15},roomTile:{value:.3},roomsXYZPropsW:{value:new o.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new o.Vector4(4.7,2,-11,-3)},depthTest:{value:!0},depthWrite:{value:!0}},vertexShader:"\n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vUv = uv;\n vPos = position;\n vModelMatrix = modelMatrix;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform float roomIntensity;\n uniform vec4 roomColorTint;\n \n uniform sampler2D sideWallTex;\n uniform sampler2D backWallTex;\n uniform sampler2D floorTex;\n uniform sampler2D ceilingTex;\n \n uniform float sideWallTexTiling;\n uniform float backWallTexTiling;\n uniform float floorTexTiling;\n uniform float ceilingTexTiling;\n \n uniform float roomTile;\n uniform vec4 roomsXYZPropsW;\n uniform vec4 positionOffsetRoomsXYZPropsW;\n \n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vec4 interpVertexPos = vec4(vPos.xyz, vPos.z);\n // 将相机世界空间坐标转换为对象空间坐标\n vec4 cameraObjectPos = inverse(vModelMatrix) * vec4(cameraPosition, 1.0);\n vec4 transCameraPos = vec4(cameraObjectPos.xyz, cameraObjectPos.z);\n \n vec4 temp1 = (interpVertexPos - positionOffsetRoomsXYZPropsW);\n vec4 temp2 = ((roomsXYZPropsW + vec4(-1E-05, -1E-05, -1E-05, -1E-05)) * roomTile);\n vec4 V2 = transCameraPos - positionOffsetRoomsXYZPropsW;\n vec4 V1 = temp1 - V2;\n vec4 middleman = ((floor(temp2 * temp1) + step(vec4(0, 0, 0, 0), V1)) / temp2 - V2) / V1;\n \n // Side Walls\n vec2 sideWallUv = (middleman.x * V1 + V2).zy * sideWallTexTiling;\n vec4 sideWallColor = texture2D(sideWallTex, sideWallUv);\n \n // Back Wall\n vec2 backWallUv = (middleman.z * V1 + V2).xy * backWallTexTiling;\n vec4 backWallColor = texture2D(backWallTex, backWallUv);\n \n // Floor Ceiling\n vec2 floorUv = ((middleman.y * V1) + V2).xz * floorTexTiling;\n vec2 ceilingUv = ((middleman.y * V1) + V2).xz * ceilingTexTiling;\n vec4 floorColor = texture2D(floorTex, floorUv);\n vec4 ceilingColor = texture2D(ceilingTex, ceilingUv);\n vec4 cfColor = mix(floorColor, ceilingColor, step(0.0, V1.y));\n \n // Mix\n float compareXZ = 0.0;\n float stepXZ = step(middleman.z, middleman.x);\n if(stepXZ <= 0.0)\n compareXZ = middleman.x;\n else\n compareXZ = middleman.z;\n \n vec4 wallColor = vec4(0);\n if(stepXZ <= 0.0)\n wallColor = sideWallColor;\n else\n wallColor = backWallColor;\n \n vec4 finalColor = vec4(0);\n if(middleman.y <= compareXZ)\n finalColor = cfColor;\n else\n finalColor = wallColor;\n \n // Tint Room\n vec4 tintColor = roomColorTint * finalColor * roomIntensity;\n \n gl_FragColor = tintColor;\n }\n "};class f{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:[...t],newVal:r}).execute())}}(a=f).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],f.TextureNames=["envMap","displacementMap"],f.tools={type:"Fresnel",getTextures:e=>{const t=[];return e.envMap&&t.push({type:"envMap",texture:e.envMap}),e.displacementMap&&t.push({type:"displacementMap",texture:e.displacementMap}),t},create:(e,t)=>{const r=new m(void 0,void 0,e);return r.insertFresnelShader(),a.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),r},parseData:(e,t)=>{const{texture:r,normal:n,material:i}=e,{data:s,load:o}=r,c=(0,l.mergeMaterial)(i,new m(void 0,void 0,t)),u=[];return o&&u.push(...s.map((e=>()=>{c[e.type]=e.texture}))),Object.keys(n.uniforms).filter((e=>!f.TextureNames.includes(e))).map((e=>{c[e]=n.uniforms[e]})),c.insertFresnelShader(),c.name=n.name,c.userData.id=i.userData.id,a.tools.bind(c),{material:c,setTextureFns:u}},toNormal:e=>{const t=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=g.uniforms;return Object.keys(n).filter((e=>!f.TextureNames.includes(e))).map((t=>{var a=e[t],i=n[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===t?a.value!==i&&(r[t]=a):a!==i&&(r[t]=a)})),{material:t,normal:{type:a.tools.type,uniforms:r,name:e.name},textures:a.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=a.tools.create(t);return Object.keys(r).filter((e=>!f.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",a.tools.type)},validType:e=>"Fresnel"===e.userData.type};class m extends o.MeshPhysicalMaterial{constructor(e,t,r){if(e?super(e):(super(),this.emissive=new o.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=r,this.isSpecialMaterial=!0,t?(this.fresnelBias=new o.Uniform(t.fresnelBias),this.fresnelScale=new o.Uniform(t.fresnelScale),this.fresnelPower=new o.Uniform(t.fresnelPower)):(this.fresnelBias=new o.Uniform(g.uniforms.fresnelBias.value),this.fresnelScale=new o.Uniform(g.uniforms.fresnelScale.value),this.fresnelPower=new o.Uniform(g.uniforms.fresnelPower.value)),this.clock=new o.Clock,this.isSurge=new o.Uniform(!1),this.deltaTime=new o.Uniform(0),!this.cubeCamera){const e=new o.WebGLCubeRenderTarget(2048);e.texture.mapping=o.CubeRefractionMapping,this.cubeCamera=new o.CubeCamera(.1,1e5,e),this.runScene.assetsEx.scene.add(this.cubeCamera),this.runScene.cb.render.add("Fresnel",(()=>{this.update()}))}}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.isSurge=this.isSurge,e.uniforms.deltaTime=this.deltaTime,e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vWorldPosition;/g,g.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,g.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,g.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,g.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,g.fragmentShaderEmissive)}}update(){this.clock&&(this.deltaTime.value+=3*this.clock.getDelta()),this.cubeCamera&&(this.cubeCamera.position.copy(this.runScene.assetsEx.camera.position),this.cubeCamera.update(this.runScene.assetsEx.renderer,this.runScene.assetsEx.scene))}}const g={uniforms:{depthTest:new o.Uniform(!0),depthWrite:new o.Uniform(!0),isSurge:new o.Uniform(!1),deltaTime:new o.Uniform(0),fresnelBias:new o.Uniform(0),fresnelScale:new o.Uniform(1),fresnelPower:new o.Uniform(3)},vertexParas:"\n uniform bool isSurge;\n uniform float deltaTime;\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader1:"\n vec3 transformed = vec3(position);\n if(isSurge) {\n // 0.15作为系数控制气泡表面波纹的稀疏程度,数值越大越密\n float wobbleValue = 0.15 * transformed.y + deltaTime;\n // 三角函数的系数控制气泡表面波纹的波动幅度,数值越大波幅越大\n vec3 wobblePos = vec3(0.75 * cos(wobbleValue) + 0.25 * sin(wobbleValue));\n transformed += wobblePos;\n }\n ",vertexShader2:"\n vWorldPosition = worldPosition.xyz;\n vWorldNormal = normalize(vec3(modelMatrix * vec4(normal, 0.0)));\n ",fragmentParas:"\n #include <transmission_pars_fragment>\n varying vec3 vWorldNormal;\n uniform float fresnelBias;\n uniform float fresnelScale;\n uniform float fresnelPower;\n ",fragmentShaderEmissive:"\n vec3 viewDir = normalize(cameraPosition - vWorldPosition);\n float fresnelNdot = dot(viewDir, vWorldNormal);\n float fresnelValue = fresnelBias + fresnelScale * pow(1.0 - fresnelNdot, fresnelPower);\n // fresnelValue = [0, 1], 0=center,1=edge\n \n vec3 totalEmissiveRadiance = emissive * fresnelValue;\n "};class v{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;this.runScene.undoEx.addUndo(new u.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(i=v).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],v.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"],v.tools={type:"Matcap",getTextures:e=>{const t=[];return v.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new o.MeshMatcapMaterial;return i.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="Matcap-"+t.name),r},parseData:e=>{const{normal:t,texture:r,material:n}=e,{data:a,load:s}=r,c=(0,l.mergeMaterial)(n,new o.MeshMatcapMaterial),u=(delete c.emissive,[]);return s&&u.push(...a.map((e=>()=>{c[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!v.IgnoredAttributes.includes(e))).map((e=>{c[e]="normalScale"===e?new o.Vector2(t.uniforms[e].x,t.uniforms[e].y):t.uniforms[e]})),c.name=t.name,c.userData.id=n.userData.id,i.tools.bind(c),{material:c,setTextureFns:u}},toNormal:e=>{var t=i.tools.getTextures(e);const r=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),n=(r.userData=Object.assign({},r.userData),r.name=e.name,{}),a=new o.MeshMatcapMaterial;return Object.keys(e).filter((e=>!v.TextureNames.includes(e))).filter((e=>!v.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],i=a[t];"bumpScale"===t||"displacementScale"===t||"displacementBias"===t||"depthTest"===t||"depthWrite"===t||"transparent"===t||"opacity"===t?r!==i&&(n[t]=r):"normalScale"!==t||r.x===i.x&&r.y===i.y||(n[t]=r)})),{material:r,normal:{type:i.tools.type,uniforms:n,name:e.name},textures:t}},clone:(e,t)=>e,copy:(e,t)=>{const r=i.tools.create(t);return Object.keys(r).filter((e=>!v.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",i.tools.type)},validType:e=>"Matcap"===e.userData.type};const b="\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec2 mod289(vec2 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec3 permute(vec3 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\n\nfloat noise2D(vec2 v) {\n const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0\n 0.366025403784439, // 0.5*(sqrt(3.0)-1.0)\n -0.577350269189626, // -1.0 + 2.0 * C.x\n 0.024390243902439); // 1.0 / 41.0\n// First corner\nvec2 i = floor(v + dot(v, C.yy) );\nvec2 x0 = v - i + dot(i, C.xx);\n\n// Other corners\nvec2 i1;\n//i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0\n//i1.y = 1.0 - i1.x;\ni1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n// x0 = x0 - 0.0 + 0.0 * C.xx ;\n// x1 = x0 - i1 + 1.0 * C.xx ;\n// x2 = x0 - 1.0 + 2.0 * C.xx ;\nvec4 x12 = x0.xyxy + C.xxzz;\nx12.xy -= i1;\n\n// Permutations\ni = mod289(i); // Avoid truncation effects in permutation\nvec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 )) + i.x + vec3(0.0, i1.x, 1.0 ));\n\nvec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\nm = m*m ;\nm = m*m ;\n\n// Gradients: 41 points uniformly over a line, mapped onto a diamond.\n// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)\n\nvec3 x = 2.0 * fract(p * C.www) - 1.0;\nvec3 h = abs(x) - 0.5;\nvec3 ox = floor(x + 0.5);\nvec3 a0 = x - ox;\n\n// Normalise gradients implicitly by scaling m\n// Approximation of: m *= inversesqrt( a0*a0 + h*h );\nm *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );\n\n// Compute final noise value at P\nvec3 g;\ng.x = a0.x * x0.x + h.x * x0.y;\ng.yz = a0.yz * x12.xz + h.yz * x12.yw;\nreturn 130.0 * dot(m, g);\n}\n ",y="\n vec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n }\n \n vec4 taylorInvSqrt(vec4 r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n }\n \n float noise3D(vec3 v) {\n const vec2 C = vec2(1.0/6.0, 1.0/3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n \n // First corner\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n \n // Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n \n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;\n // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy;\n // -1.0+3.0*C.x = -0.5 = -D.y\n \n // Permutations\n i = mod289(i);\n vec4 p = permute(permute(permute(i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n \n // Gradients: 7x7 points over a square, mapped onto an octahedron.\n // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n \n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)\n \n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n \n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n \n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n \n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n \n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww;\n \n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n \n //Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n \n // Mix final noise value\n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) );\n }\n ",x={defines:{USE_UV:!0,USE_MAP:!0},uniforms:{mapArray:{value:[null,null,null,null,null,null]},maskArray:{value:[null,null,null,null,null]},mapUvTransArray:{value:[new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3]},maskUvTransArray:{value:[new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3]},diffuse:{value:new o.Color(16777215)},uvTransform:{value:new o.Matrix3},shadowShade:{value:.6}},vertex:"\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n // vUv = (uvTransform * vec3(uv, 1.0)).xy;\n}\n ",fragment:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n#define MAX_TEX 6\nuniform mat3 mapUvTransArray[MAX_TEX];\nuniform mat3 maskUvTransArray[MAX_TEX - 1];\nuniform sampler2D mapArray[MAX_TEX];\nuniform sampler2D maskArray[MAX_TEX - 1];\nuniform float shadowShade;\n\n// Insert Noise2D\nfloat sum(vec3 v) {return v.x + v.y + v.z;}\nvec3 textureNoTile(sampler2D tex, vec2 tUv, float offsetScale) {\n // cheap (cache friendly) lookup\n float k = noise2D(0.25 * tUv);\n\n float l = k * 8.0;\n float f = fract(l);\n float ia = floor(l);\n float ib = ia + 1.0;\n\n // can replace with any other hash\n vec2 offa = sin(vec2(3.0, 7.0) * ia);\n vec2 offb = sin(vec2(3.0, 7.0) * ib);\n\n vec2 duvdx = dFdx(tUv);\n vec2 duvdy = dFdy(tUv);\n vec3 cola = textureGrad(tex, tUv + offsetScale * offa, duvdx, duvdy).xyz;\n vec3 colb = textureGrad(tex, tUv + offsetScale * offb, duvdx, duvdy).xyz;\n\n return mix(cola, colb, smoothstep(0.2, 0.8, f - 0.1 * sum(cola-colb)));\n}\nvec4 texSampler(sampler2D tex, vec2 tUv, float offsetScale) {\n return vec4(textureNoTile(tex, tUv, offsetScale), 1.0);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n \n // Custom UV Start\n #if MAX_TEX > 0\n vec2 vCustomMapUv[MAX_TEX];\n for (int i = 0; i < MAX_TEX; i++) {\n vCustomMapUv[i] = (mapUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n #if MAX_TEX > 1\n vec2 vCustomMaskUv[MAX_TEX - 1];\n for (int i = 0; i < MAX_TEX - 1; i++) {\n vCustomMaskUv[i] = (maskUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n // Custom UV End\n \n // Custom Texture Start\n float offsetScale = 1.2;\n vec4 maskColor = vec4(1.0);\n vec4 textureColor = vec4(1.0);\n #if MAX_TEX > 0\n textureColor = texSampler(mapArray[0], vCustomMapUv[0], offsetScale);\n #endif\n #if MAX_TEX > 1\n maskColor = texture2D(maskArray[0], vCustomMaskUv[0]);\n textureColor = mix(textureColor, texSampler(mapArray[1], vCustomMapUv[1], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 2\n maskColor = texture2D(maskArray[1], vCustomMaskUv[1]);\n textureColor = mix(textureColor, texSampler(mapArray[2], vCustomMapUv[2], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 3\n maskColor = texture2D(maskArray[2], vCustomMaskUv[2]);\n textureColor = mix(textureColor, texSampler(mapArray[3], vCustomMapUv[3], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 4\n maskColor = texture2D(maskArray[3], vCustomMaskUv[3]);\n textureColor = mix(textureColor, texSampler(mapArray[4], vCustomMapUv[4], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 5\n maskColor = texture2D(maskArray[4], vCustomMaskUv[4]);\n textureColor = mix(textureColor, texSampler(mapArray[5], vCustomMapUv[5], offsetScale), maskColor.r);\n #endif\n diffuseColor *= textureColor;\n // Custom Texture End\n \n // ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n // reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n // vec3 outgoingLight = reflectedLight.indirectDiffuse;\n vec3 outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n \n // gl_FragColor = vec4(diffuse, opacity * (1.0 - getShadowMask()));\n gl_FragColor.rgb *= vec3(getShadowMask() * (1.0 - shadowShade) + shadowShade);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n "};var w,S=r(1398),M=r(3729);const T={diffuse:{type:"color",label:["uniforms","diffuse","value"],val:{r:1,g:1,b:1},shortKey:"df"},shadowShade:{type:"number",label:["uniforms","shadowShade","value"],val:.6,shortKey:"ss"},terrainMap0:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[0])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[0]=r},shortKey:"p0"},terrainMap1:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[1])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[1]=r},shortKey:"p1"},terrainMap2:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[2])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[2]=r},shortKey:"p2"},terrainMap3:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[3])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[3]=r},shortKey:"p3"},terrainMap4:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[4])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[4]=r},shortKey:"p4"},terrainMap5:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[5])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[5]=r},shortKey:"p5"},terrainMap6:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[6])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[6]=r},shortKey:"p6"},terrainMap7:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[7])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[7]=r},shortKey:"p7"},terrainMask0:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[0])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[0]=r},shortKey:"k0"},terrainMask1:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[1])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[1]=r},shortKey:"k1"},terrainMask2:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[2])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[2]=r},shortKey:"k2"},terrainMask3:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[3])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[3]=r},shortKey:"k3"},terrainMask4:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[4])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[4]=r},shortKey:"k4"},terrainMask5:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[5])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[5]=r},shortKey:"k5"},terrainMask6:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[6])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[6]=r},shortKey:"k6"}};class _{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}insertShader(e){e&&(e.onBeforeCompile=t=>{t.defines=x.defines,this.mergeUniforms(e.uniforms,t.uniforms),t.vertexShader=x.vertex,t.fragmentShader=x.fragment,t.fragmentShader=t.fragmentShader.replace(/\/\/ Insert Noise2D/g,b)})}mergeUniforms(e,t){if(e&&t)for(const r in e)t[r]=e[r]}onTexRepeatChange(e,t,r){e&&0<=t&&(r?(r=e.uniforms.mapArray.value[t],e.uniforms.mapUvTransArray.value[t].identity(),e.uniforms.mapUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)):(r=e.uniforms.maskArray.value[t],e.uniforms.maskUvTransArray.value[t].identity(),e.uniforms.maskUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)))}}(w=_).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],_.TextureNames=["terrainMap0","terrainMap1","terrainMap2","terrainMap3","terrainMap4","terrainMap5","terrainMap6","terrainMap7","terrainMask0","terrainMask1","terrainMask2","terrainMask3","terrainMask4","terrainMask5","terrainMask6"],_.tools={type:"MixTexture",getTextures:e=>{const t=[];return _.TextureNames.forEach((r=>{var n=parseInt(r.slice(-1));r.startsWith("terrainMap")?e.uniforms.mapArray.value[n]&&t.push({type:r,texture:e.uniforms.mapArray.value[n]}):r.startsWith("terrainMask")&&e.uniforms.maskArray.value[n]&&t.push({type:r,texture:e.uniforms.maskArray.value[n]})})),t},create:(e,t)=>{const r=new o.ShadowMaterial({color:0,opacity:1});return r.uniforms=o.UniformsUtils.clone(x.uniforms),e.materialEx.def.map.MixTexture.insertShader(r),w.tools.bind(r),r},parseData:(e,t)=>{const{texture:r,normal:n,material:a}=e,{data:i,load:s}=r,l=new o.ShadowMaterial({color:0,opacity:1}),c=(l.uniforms=o.UniformsUtils.clone(x.uniforms),t.materialEx.def.map.MixTexture.insertShader(l),[]);return s&&c.push(...i.map((e=>()=>{var r=parseInt(e.type.slice(-1));e.type.startsWith("terrainMap")?(l.uniforms.mapArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(l,r,!0)):e.type.startsWith("terrainMask")&&(l.uniforms.maskArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(l,r,!1))}))),Object.keys(n.uniforms).filter((e=>!_.TextureNames.includes(e))).map((e=>{var t=n.uniforms[e];"diffuse"===e?l.uniforms[e].value=new o.Color(parseInt(t,16)):"uvTransform"!==e&&(l.uniforms[e].value=t)})),l.name=n.name,l.userData.id=a.userData.id,w.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{const t=(0,l.createDefMaterial)(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:w.tools.type,uniforms:{},name:e.name},textures:w.tools.getTextures(e)}),{}),n=e.uniforms,a=x.uniforms;return Object.keys(n).filter((e=>"mapArray"!==e&&"maskArray"!==e&&"mapUvTransArray"!==e&&"maskUvTransArray"!==e)).map((e=>{const t=n[e].value,i=a[e].value;"diffuse"===e?t.getHexString()!==i.getHexString()&&(r[e]=t.getHexString()):"uvTransform"!==e&&t!==i&&(r[e]=t)})),{material:t,normal:{type:w.tools.type,uniforms:r,name:e.name},textures:w.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=w.tools.create(t);return Object.keys(r).filter((e=>!_.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",w.tools.type)},validType:e=>"MixTexture"===e.userData.type,snapshot:{getDiff:e=>S.LV.getDiff(T,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;S.LV.set({def:T,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,l.updateMaterial)(r)}))}}};var E,k=r(110);class D{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:[...t],newVal:r}).execute())}}(E=D).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],D.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"],D.tools={type:"Physical",getTextures:e=>{const t=[];return D.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new o.MeshPhysicalMaterial;return E.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="MeshPhysicalMaterial-"+t.name),r},parseData:e=>{const{normal:t,texture:r,material:n}=e,{data:a,load:i}=r,s=(0,l.mergeMaterial)(n,new o.MeshPhysicalMaterial),c=[];return i&&c.push(...a.map((e=>()=>{s[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!D.IgnoredAttributes.includes(e))).map((e=>{var r=t.uniforms[e];s[e]="attenuationColor"===e||"sheenColor"===e||"specularColor"===e?new o.Color(r):"clearcoatNormalScale"===e?new o.Vector2(r.x,r.y):r})),s.name=t.name,s.userData.id=n.userData.id,E.tools.bind(s),{material:s,setTextureFns:c}},toNormal:e=>{const t=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=new o.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!D.TextureNames.includes(e))).filter((e=>!D.IgnoredAttributes.includes(e))).filter((e=>void 0===t[e])).map((t=>{const a=e[t],i=n[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?a.getHexString()!==i.getHexString()&&(r[t]=a.getHexString()):"clearcoatNormalScale"===t?a.x===i.x&&a.y===i.y||(r[t]=a):a!==i&&(r[t]=a)})),{material:t,normal:{type:E.tools.type,uniforms:r,name:e.name},textures:E.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=E.tools.create(t);return Object.keys(r).filter((e=>!D.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",E.tools.type)},validType:e=>"MeshPhysicalMaterial"===e.type};var P=r(6001),A=r(5180);const O={uniforms:{tDiffuse:new o.Uniform(null),h:new o.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"},C={uniforms:{tDiffuse:new o.Uniform(null),v:new o.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"};var R,L;new o.Uniform(null),new o.Uniform(null),new o.Uniform(0),new o.Uniform(0),new o.Uniform(0),new o.Uniform(new o.Vector2),new o.Uniform(.1),new o.Uniform(1e3);class I{constructor(e){this.materials={},this.render=()=>{(0,P.mapObj)(this.materials,((e,t)=>{const{model:r,material:n}=t;n.update(r)}))},this.runScene=e,this.init(),this.runScene.cb.material.dispose.add("Reflector",this.dispose.bind(this))}init(){this.runScene.cb.render.add("Reflector-render",this.render),this.runScene.cb.model.add.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,this.materials[t.userData.id]||(this.materials[t.userData.id]={model:e,material:t}))})),this.runScene.cb.model.remove.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,delete this.materials[t.userData.id])}))}bindData(e){const t=e.material;var r=(0,P.getId)();t.userData.id=r,this.materials[r]=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}(R=I).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],I.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"],I.tools={type:"Reflector",getTextures:e=>(0,l.getTexturesByMaterial)(e),create:(e,t)=>{const r=new B(void 0,void 0,e);return r.insertReflectorShader(),R.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),e.materialEx.def.map.Reflector.bindData({model:t,material:r}),r},parseData:(e,t)=>{const{texture:r,normal:n,models:a,material:i}=e,{data:s,load:c}=r,u=(0,l.mergeMaterial)(i,new B(void 0,void 0,t)),h=[];return c&&h.push(...s.map((e=>()=>{u[e.type]=e.texture}))),Object.keys(n.uniforms).filter((e=>!I.TextureNames.includes(e))).map((e=>{u[e]="normalScale"===e?new o.Vector2(n.uniforms[e].x,n.uniforms[e].y):n.uniforms[e]})),u.setRTSize(u.resolution),u.setBlurPass(u.blurSize),u.insertReflectorShader(),t.materialEx.def.map.Reflector.bindData({model:a[0],material:u}),u.name=n.name,u.userData.id=i.userData.id,R.tools.bind(u),{material:u,setTextureFns:h}},toNormal:e=>{const t=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=U.uniforms;return Object.keys(n).filter((e=>!I.TextureNames.includes(e))).map((t=>{var a=e[t],i=n[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?a.value!==i&&(r[t]=a):a!==i&&(r[t]=a)})),t.normalScale&&(r.normalScale=t.normalScale),{material:t,normal:{type:R.tools.type,uniforms:r,name:e.name},textures:R.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=R.tools.create(t);return Object.keys(r).filter((e=>!I.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",R.tools.type)},validType:e=>"Reflector"===e.userData.type};class B extends o.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=U.uniforms.opacity.value,this.transparent=U.uniforms.transparent.value,this.roughness=U.uniforms.roughness.value,this.metalness=U.uniforms.metalness.value),this.runScene=r,this.isSpecialMaterial=!0,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new o.Uniform(t.mirror),this.mixBlur=new o.Uniform(t.mixBlur),this.mixStrength=new o.Uniform(t.mixStrength),this.mixContrast=new o.Uniform(t.mixContrast)):(this.resolution=U.uniforms.resolution.value,this.blurSize=U.uniforms.blurSize.value,this.mirror=new o.Uniform(U.uniforms.mirror.value),this.mixBlur=new o.Uniform(U.uniforms.mixBlur.value),this.mixStrength=new o.Uniform(U.uniforms.mixStrength.value),this.mixContrast=new o.Uniform(U.uniforms.mixContrast.value)),this.textureMatrix=new o.Uniform(new o.Matrix4),this.reflectorWorldPosition=new o.Vector3,this.cameraWorldPosition=new o.Vector3,this.rotationMatrix=new o.Matrix4,this.normal=new o.Vector3,this.view=new o.Vector3,this.lookAtPosition=new o.Vector3,this.target=new o.Vector3,this.tempQuaternion=new o.Vector4,this.virtualCamera=new o.PerspectiveCamera,this.reflectorPlane=new o.Plane,this.clipPlane=new o.Vector4,e={minFilter:o.LinearFilter,magFilter:o.LinearFilter,type:o.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new o.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new o.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new o.Uniform(this.glRT1.texture),this.tDiffuseBlur=new o.Uniform(this.glRT2.texture),this.hBlurPass=new A.T(O),this.hBlurPass.uniforms.h.value=1/this.blurSize,this.hBlurPass.clear=!1,this.hBlurPass.renderToScreen=!1,this.hBlurPass.enabled=0<this.blurSize,this.hBlurPass.material.depthWrite=!1,this.vBlurPass=new A.T(C),this.vBlurPass.uniforms.v.value=1/this.blurSize,this.vBlurPass.clear=!1,this.vBlurPass.renderToScreen=!1,this.vBlurPass.enabled=0<this.blurSize,this.vBlurPass.material.depthWrite=!1}insertReflectorShader(){this.onBeforeCompile=e=>{var t;null!=(t=e.defines)&&t.USE_UV||(e.defines.USE_UV=""),null!=(t=e.defines)&&t.USE_BLUR||(e.defines.USE_BLUR=""),e.uniforms.tDiffuse=this.tDiffuse,e.uniforms.tDiffuseBlur=this.tDiffuseBlur,e.uniforms.textureMatrix=this.textureMatrix,e.uniforms.mirror=this.mirror,e.uniforms.mixBlur=this.mixBlur,e.uniforms.mixStrength=this.mixStrength,e.uniforms.mixContrast=this.mixContrast,e.vertexShader=U.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",U.vertexShader),e.fragmentShader=U.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",U.fragmentShader)}}setRTSize(e){this.glRT1.setSize(e,e),this.glRT2.setSize(e,e),this.hBlurPass.setSize(e,e),this.vBlurPass.setSize(e,e)}setBlurPass(e){this.hBlurPass.enabled=0<e,this.hBlurPass.enabled&&(this.hBlurPass.uniforms.h.value=1/e),this.vBlurPass.enabled=0<e,this.vBlurPass.enabled&&(this.vBlurPass.uniforms.v.value=1/e)}copy(e){return super.copy(e),this.resolution=e.resolution,this.blurSize=e.blurSize,this.mirror.value=e.mirror.value,this.mixBlur.value=e.mixBlur.value,this.mixStrength.value=e.mixStrength.value,this.mixContrast.value=e.mixContrast.value,this}swapBuffers(){var e=this.glRT1;this.glRT1=this.glRT2,this.glRT2=e}beforeRender(e){if(this.reflectorWorldPosition.setFromMatrixPosition(e.matrixWorld),this.cameraWorldPosition.setFromMatrixPosition(this.runScene.assetsEx.get().camera.matrixWorld),this.rotationMatrix.extractRotation(e.matrixWorld),this.normal.set(0,0,1),this.normal.applyMatrix4(this.rotationMatrix),this.reflectorWorldPosition.addScaledVector(this.normal,0),this.view.subVectors(this.reflectorWorldPosition,this.cameraWorldPosition),!(0<this.view.dot(this.normal))){this.view.reflect(this.normal).negate(),this.view.add(this.reflectorWorldPosition),this.rotationMatrix.extractRotation(this.runScene.assetsEx.get().camera.matrixWorld),this.lookAtPosition.set(0,0,-1),this.lookAtPosition.applyMatrix4(this.rotationMatrix),this.lookAtPosition.add(this.cameraWorldPosition),this.target.subVectors(this.reflectorWorldPosition,this.lookAtPosition),this.target.reflect(this.normal).negate(),this.target.add(this.reflectorWorldPosition),this.virtualCamera.position.copy(this.view),this.virtualCamera.up.set(0,1,0),this.virtualCamera.up.applyMatrix4(this.rotationMatrix),this.virtualCamera.up.reflect(this.normal),this.virtualCamera.lookAt(this.target),this.virtualCamera.far=this.runScene.assetsEx.get().camera.far,this.virtualCamera.updateMatrixWorld(),this.virtualCamera.projectionMatrix.copy(this.runScene.assetsEx.get().camera.projectionMatrix),this.textureMatrix.value.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.value.multiply(this.virtualCamera.projectionMatrix),this.textureMatrix.value.multiply(this.virtualCamera.matrixWorldInverse),this.textureMatrix.value.multiply(e.matrixWorld),this.reflectorPlane.setFromNormalAndCoplanarPoint(this.normal,this.reflectorWorldPosition),this.reflectorPlane.applyMatrix4(this.virtualCamera.matrixWorldInverse),this.clipPlane.set(this.reflectorPlane.normal.x,this.reflectorPlane.normal.y,this.reflectorPlane.normal.z,this.reflectorPlane.constant);const t=this.virtualCamera.projectionMatrix;this.tempQuaternion.x=(Math.sign(this.clipPlane.x)+t.elements[8])/t.elements[0],this.tempQuaternion.y=(Math.sign(this.clipPlane.y)+t.elements[9])/t.elements[5],this.tempQuaternion.z=-1,this.tempQuaternion.w=(1+t.elements[10])/t.elements[14],this.clipPlane.multiplyScalar(2/this.clipPlane.dot(this.tempQuaternion)),t.elements[2]=this.clipPlane.x,t.elements[6]=this.clipPlane.y,t.elements[10]=this.clipPlane.z+1,t.elements[14]=this.clipPlane.w}}update(e){e&&e.visible&&(this.beforeRender(e),e.visible=!1,this.runScene.assetsEx.get().renderer.setRenderTarget(this.glRT1),this.runScene.assetsEx.get().renderer.clear(),this.runScene.assetsEx.get().renderer.render(this.runScene.assetsEx.get().scene,this.virtualCamera),this.hBlurPass&&this.hBlurPass.enabled&&(this.hBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),this.vBlurPass&&this.vBlurPass.enabled&&(this.vBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),e.visible=!0,this.runScene.assetsEx.get().renderer.setRenderTarget(null))}}const U={uniforms:{opacity:new o.Uniform(1),transparent:new o.Uniform(!1),roughness:new o.Uniform(1),metalness:new o.Uniform(.6),resolution:new o.Uniform(1024),blurSize:new o.Uniform(1024),mirror:new o.Uniform(0),mixBlur:new o.Uniform(10),mixStrength:new o.Uniform(2),mixContrast:new o.Uniform(1),depthTest:new o.Uniform(!0),depthWrite:new o.Uniform(!0)},vertexParas:"\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n ",vertexShader:"\n #include <project_vertex>\n my_vUv = textureMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n ",fragmentParas:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float mirror;\n uniform float mixBlur;\n uniform float mixStrength;\n uniform float mixContrast;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n ",fragmentShader:"\n #include <emissivemap_fragment>\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n \n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n \n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n \n float blurFactor = 0.0;\n float depthFactor = 0.0001;\n \n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n #endif\n \n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n \n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n \n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n "},j="\n#define STANDARD\n\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n\n// Insert Noise3D\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nuniform float uTime;\nuniform float uWindForce;\nuniform float uWindSpeed;\nuniform float uWindWaveScale;\nvarying vec3 vWorldPos;\nvarying vec3 vWorldNor;\n\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n\n vec4 mvPosition = vec4(transformed, 1.0);\n #ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n #endif\n mvPosition = modelViewMatrix * mvPosition;\n\n // Wind Vertex Start\n vWorldNor = normalize((modelMatrix * vec4(transformedNormal, 1.0)).xyz);\n vWorldPos = (modelMatrix * vec4(transformed, 1.0)).xyz;\n float tSpeed = uTime * uWindSpeed * 5.0;\n float wNoise = noise3D((vWorldPos + vec3(tSpeed)) * uWindWaveScale);\n float pOffset = wNoise * uWindForce * 30.0;\n transformed.xyz += vec3(pOffset);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(transformed, 1.0);\n // Wind Vertex End\n\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n #ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n #endif\n}\n ",F="\n#define STANDARD\n#ifdef PHYSICAL\n#define IOR\n#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n#ifdef USE_SPECULARINTENSITYMAP\n uniform sampler2D specularIntensityMap;\n#endif\n#ifdef USE_SPECULARCOLORMAP\n uniform sampler2D specularColorMap;\n#endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n#ifdef USE_SHEENCOLORMAP\n uniform sampler2D sheenColorMap;\n#endif\n#ifdef USE_SHEENROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n#endif\n#endif\n\nuniform vec3 uColorGradient;\nuniform float uColorLevel;\nuniform float uColorFade;\nuniform float uLeavesCore;\nuniform vec3 uLeavesSize;\nuniform vec3 uLeavesPos;\n//uniform float uDirectLightOffset;\n//uniform float uDirectLightInt;\n//uniform float uIndirectLightInt;\nvarying vec3 vViewPosition;\nvarying vec3 vWorldPos;\nvarying vec3 vWorldNor;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n//#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n//#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n\n #ifdef USE_MAP\n // Gradient Colors Start\n float normalizeY = vWorldPos.y / uLeavesSize.y;\n float secColorMask = saturate((normalizeY + uColorLevel) * uColorFade * 30.0);\n vec3 diffuseColor2 = uColorGradient * texture2D(map, vUv).rgb;\n vec3 mixColor = mix(diffuseColor.rgb, diffuseColor2, secColorMask);\n diffuseColor.rgb = mixColor;\n // Gradient Colors End\n #endif\n\n // Custom Normal Start\n vec3 leafCore = vec3(uLeavesPos.x, uLeavesPos.y + uLeavesCore * uLeavesSize.y, uLeavesPos.z);\n normal = normalize(vWorldPos - leafCore);\n // Custom Normal End\n\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n\n // 直射光:DirectLight = IncidentLight\n // float dotNL = saturate(dot(geometry.normal, directLight.direction));\n // vec3 irradiance = dotNL * directLight.color;\n // reflectedLight.directDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n // 间接光:IndirectLight = ReflectedLight\n // vec3 irradiance = getAmbientLightIrradiance(ambientLightColor);\n // irradiance += getLightProbeIrradiance(lightProbe, geometry.normal);\n // irradiance += getHemisphereLightIrradiance(hemisphereLights[i], geometry.normal);\n // reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n\n // Custom Lighting Start\n // float dotNL = dot(geometry.normal, directLight.direction);\n // vec3 customIrradiance = clamp((dotNL + uDirectLightOffset), 0.01, 1.0) * vec3(1.0, 0.87, 0.67);\n // vec3 customDirectLight = customIrradiance * diffuseColor.rgb * uDirectLightInt;\n // vec3 customIndirectLight = (irradiance + vWorldNor * 0.001) * diffuseColor.rgb * uIndirectLightInt;\n // vec3 totalDiffuse = customDirectLight + customIndirectLight;\n // Custom Lighting End\n\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3(material.sheenColor);\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate(dot(geometry.clearcoatNormal, geometry.viewDir));\n vec3 Fcc = F_Schlick(material.clearcoatF0, material.clearcoatF90, dotNVcc);\n outgoingLight = outgoingLight * (1.0 - material.clearcoat * Fcc) + clearcoatSpecular * material.clearcoat;\n #endif\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}\n ",N={emissive:s.Gf.emissive,alphaTest:{type:"number",val:0,shortKey:"at"},colorGradient:{type:"color",label:["uniforms","colorGradient","value"],val:{r:0,g:1,b:0},shortKey:"cg"}};class z{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;this.runScene.undoEx.addUndo(new u.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(L=z).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],z.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"],z.tools={type:"TreeLeaf",getTextures:e=>{const t=[];return z.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new G(e);return L.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name,r.setSize(t),r.setWorldPos(t)),r},parseData:(e,t)=>{const{normal:r,texture:n,material:a,models:i}=e,{data:s,load:c}=n,u=(0,l.mergeMaterial)(a,new G(t)),h=(u.setSize(i[0]),u.setWorldPos(i[0]),[]);return c&&h.push(...s.map((e=>()=>{u[e.type]=e.texture}))),Object.keys(r.uniforms).filter((e=>!z.IgnoredAttributes.includes(e))).map((e=>{var t=r.uniforms[e];"color"!==e&&"emissive"!==e&&("normalScale"===e?u[e]=new o.Vector2(t.x,t.y):"windForce"===e||"windSpeed"===e||"windWaveScale"===e||"colorLevel"===e||"colorFade"===e||"leavesCore"===e?u.uniforms[e]=new o.Uniform(t):"colorGradient"===e?u.uniforms[e]=new o.Uniform(new o.Color(parseInt(t,16))):u[e]=r.uniforms[e])})),u.name=r.name,u.userData.id=a.userData.id,L.tools.bind(u),{material:u,setTextureFns:h}},toNormal:(e,t)=>{var r=L.tools.getTextures(e);const n=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),a=(n.name=e.name,{}),i=new G(t);return Object.keys(e).filter((e=>!z.TextureNames.includes(e))).filter((e=>!z.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],n=i[t];"color"!==t&&"emissive"!==t&&("normalScale"===t?r.x===n.x&&r.y===n.y||(a[t]=r):"uniforms"===t?Object.keys(r).map((t=>{const r=e.uniforms[t].value,n=i.uniforms[t].value;"windForce"===t||"windSpeed"===t||"windWaveScale"===t||"colorLevel"===t||"colorFade"===t||"leavesCore"===t?r!==n&&(a[t]=r):"colorGradient"===t&&r.getHexString()!==n.getHexString()&&(a[t]=r.getHexString())})):r!==n&&(a[t]=r))})),{material:n,normal:{type:L.tools.type,uniforms:a,name:e.name},textures:r}},clone:(e,t)=>e,copy:(e,t)=>{const r=L.tools.create(t);return Object.keys(r).filter((e=>!z.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",L.tools.type)},validType:e=>"TreeLeaf"===e.userData.type,snapshot:{getDiff:e=>S.LV.getDiff(N,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;S.LV.set({def:N,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,l.updateMaterial)(r)}))}}};const V=new o.Clock;class G extends o.MeshStandardMaterial{constructor(e){super(),this.isSpecialMaterial=!0,this.uniforms={time:new o.Uniform(0),windForce:new o.Uniform(.3),windSpeed:new o.Uniform(.5),windWaveScale:new o.Uniform(.25),colorGradient:new o.Uniform(new o.Color(65280)),colorLevel:new o.Uniform(-.5),colorFade:new o.Uniform(-.25),leavesCore:new o.Uniform(.3),leavesSize:new o.Uniform(new o.Vector3),leavesPos:new o.Uniform(new o.Vector3)},this.insertShader(),e&&e.cb.render.add("TreeLeaf",(()=>{this.update()}))}insertShader(){this.onBeforeCompile=e=>{e.uniforms.uTime=this.uniforms.time,e.uniforms.uWindForce=this.uniforms.windForce,e.uniforms.uWindSpeed=this.uniforms.windSpeed,e.uniforms.uWindWaveScale=this.uniforms.windWaveScale,e.uniforms.uColorGradient=this.uniforms.colorGradient,e.uniforms.uColorLevel=this.uniforms.colorLevel,e.uniforms.uColorFade=this.uniforms.colorFade,e.uniforms.uLeavesCore=this.uniforms.leavesCore,e.uniforms.uLeavesSize=this.uniforms.leavesSize,e.uniforms.uLeavesPos=this.uniforms.leavesPos,e.vertexShader=j,e.fragmentShader=F,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,y)}}update(){this.uniforms.time.value=V.getElapsedTime()}setSize(e){var t=new o.Vector3;e.getWorldScale(t),t=new o.Vector3,(new o.Box3).setFromObject(e).getSize(t),this.uniforms.leavesSize.value=t}setWorldPos(e){var t=new o.Vector3;e.getWorldPosition(t),this.uniforms.leavesPos.value=t}}var H,W,q=r(3263);const K={color:s.Gf.color,opacity:s.Gf.opacity};class Z{constructor(e){this.runScene=e}}(H=Z).tools={type:"LineBasicMaterial",bind(e){(0,h.M)(e,"type","LineBasicMaterial")},create:()=>{var e=new o.LineBasicMaterial;return H.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:a}=e,{data:i,load:s}=t,o=[];return s&&o.push(...q.F6.filter(i.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.uniqueEx.texture.addMaterial(r,{material:a,type:t})}})))),n.runScene.materialEx.parseNromals(r,a),H.tools.bind(a),{material:a,setTextureFns:o}},toNormal:e=>({material:e.clone(),normal:{type:H.tools.type},textures:[]}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:()=>[],snapshot:{getDiff:e=>S.LV.getDiff(K,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;S.LV.set({def:K,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,l.updateMaterial)(r)}))}},validType:e=>e.type===H.tools.type};class X{constructor(e){this.runScene=e}}(W=X).tools={type:"MyPointsMaterial",bind(e){(0,h.M)(e,"type","MyPointsMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:(e,t)=>(t=t.modelEx.def.vertices.rain.createMaterial(e),W.tools.bind(t),t),parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:a,load:i}=e,s=[];var{name:e,size:n}=n;const o=X.tools.create({size:n},t);return(0,M.x)(o,(0,M.Ki)(r)),e&&(o.name=e),i&&s.push(...a.map((e=>{const{type:t,texture:r}=e;return()=>{o[t]=r,(0,l.updateMaterial)(o)}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,l.createDefMaterial)();var r={type:X.tools.type,name:e.name,size:e.size};return t.map=e.map,t.userData=Object.assign({},t.userData),{normal:r,textures:X.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=X.tools.type,t}};const Q={SpriteMaterial:k.Z,FakeInterior:d,Fresnel:f,Matcap:v,MixTexture:_,Physical:D,Reflector:I,TreeLeaf:z,BasicMaterial:s.ZP,LineBasicMaterial:Z,MyPointsMaterial:X};class Y{constructor(e){this.runScene=e,this.map={SpriteMaterial:new k.Z(e),FakeInterior:new d(e),Fresnel:new f(e),Matcap:new v(e),MixTexture:new _(e),Physical:new D(e),Reflector:new I(e),TreeLeaf:new z(e),BasicMaterial:new s.ZP(e)}}static create(e,t){return Q[e].tools.create(t)}static copy(e,t,r){return Q[e].tools.copy(t,r)}static clone(e,t){return Q[e].tools.clone(t)}static toNromal(e,t,r){return Q[e].tools.toNormal(t,r)}static parseData(e,t,r){var n=t.material;let a=e;return Q.LineBasicMaterial.tools.validType(n)&&(a=Q.LineBasicMaterial.tools.type),Q[a].tools.parseData(t,r)}static bind(e){e.material&&("MeshStandardMaterial"===e.material.type?s.ZP.tools.bind(e):"SpriteMaterial"===e.material.type&&k.Z.tools.bind(e))}static getTextures(e){var t=J(e);if(t)return Q[t].tools.getTextures(e);throw TypeError("该材质没有类型")}static parseNode(e){e.material&&(e=e.material,(0,l.isBaseMaterial)(e)&&s.ZP.tools.bind(e),e.isSpriteMaterial&&k.Z.tools.bind(e))}static validType(e,t){return!Q[e].tools.validType||Q[e].tools.validType(t)}}Y.snapshot={getDiff:e=>{var t=J(e);if(Q[t])return Q[t].tools.snapshot.getDiff(e);throw TypeError("该材质没有类型")},set:e=>{var t=e.material;if(t=J(t),Q[t])return Q[t].tools.snapshot.set(e);throw TypeError("该材质没有类型")}};const J=e=>{var t=e.userData.type;if(t)return Y.validType(t,e)?t:void 0}},932:(e,t,r)=>{r.r(t),r.d(t,{SpecialMaterial:()=>L,createDefMaterial:()=>w,defAllMaterialMap:()=>y,defBaseMaterialMap:()=>b,default:()=>x,disposeMaterial:()=>M,getBaseTextures:()=>E,getMaterialType:()=>I,getTextures:()=>_,getTexturesByMaterial:()=>T,initMaterial:()=>D,isBaseMaterial:()=>R,isColor:()=>P,isMaterial:()=>O,materialIgnore:()=>B,mergeMaterial:()=>S,setDefMaterialForSameGeo:()=>C,setMaterialTexture:()=>k,updateMaterial:()=>A});var n=r(6001),a=r(8881),i=r(4330),s=r(1794),o=r(3736),l=r(3625),c=r(8024),u=r(2510),h=r(3729),d=r(6272),p=r(4707);class f{constructor(e){this.data=this.getData(),this.pending=[],this.clonedTextures=[],this.mount=e=>{e.core.module.set("material",this)},this.complete=()=>{this.reset()},this.load=e=>{e=e.data;var{materialDef:e,material:t,model:r}=e;D(t),this.data.materialIns[e.id]||(this.data.materialIns[e.id]={material:t,models:[]}),this.data.materialIns[e.id].models.push(r)},this.done=e=>{const{json:t,core:r}=e;var{materialMap:e,textureMap:n}=(null==(e=t.asset)?void 0:e.ex)||{};this.processTextureMap(n||{}),this.processMaterialMap(e||{},t),this.processClonedTextures(),this.pending.push(this.loadTextures(r)),r.pending.push(Promise.all(this.pending))},this.parser=null,this.loadTexture=e=>{e=e.data;const{textureDef:t,texture:r}=e;var{md5:e,format:n,size:a,uvScript:i,unDelAble:s,unDelAbleRef:c,id:u,cloneSourceId:h,minFilter:d,isHdr:p}=t;r.userData.md5=e,r.userData.isHdr=p,n&&(r.format=n,r.userData.format=n),i&&(r.userData.uvScript=i),h&&((0,l.setTextureCloneId)(r,h),this.clonedTextures.push(r)),"nearest"===d&&((0,l.setTextureMinFilter)(r,"nearest"),(0,o.M)(r,"minFilter",d)),s&&l.unDelAbleTexture.set(r,s,c),r.userData.id=u,r.userData.size=a,this.data.textureIns[t.id]=this.runScene.textureEx.getSameTexture(e,r)||r},this.processTextureMap=(()=>{const e=e=>{const{target:t,data:r}=e;var n;r&&(({x:e,y:n}="object"==typeof r?r:{x:r,y:r}),t.x=e,t.y=n)};return t=>{(0,n.mapObj)(t,((t,r)=>{var{format:r,center:n,rotation:a,offset:i,repeat:s}=r;const o=this.data.textureIns[t];o&&(o.format=r,e({target:o.repeat,data:s}),e({target:o.center,data:n}),e({target:o.offset,data:i}),a&&(o.rotation=a),this.runScene.textureEx.initTextureAndAddtoAll(o))}))}})(),this.processMaterialMap=(()=>{const e=e=>{const{textures:t,normal:r,models:a,material:i}=e;e=(0,n.mapObj)(t,((e,t)=>({type:e,texture:this.data.textureIns[t]})));const{material:s,setTextureFns:o}=this.runScene.materialEx.parseData(r.type,{normal:r,texture:{data:e,load:this.runScene.optionsEx.options.texture.load},core:this,models:a,material:i});s&&(0<o.length&&this.lazyLoadFns.push(...o),a.map((e=>e.material=s)))};return(t,r)=>{(0,n.mapObj)(t,((t,a)=>{if(t=this.data.materialIns[t]){const{material:i,models:s}=t;if(i){const{normal:o,textures:l}=a;o.type||(o.type=p.ZP.tools.type),"scene"===(null==(a=null==(t=r.asset)?void 0:t.ex)?void 0:a.type)&&r.asset.ex.sceneEx.materialId===i.userData.id&&(0,n.mapObj)(l,((e,t)=>{t=this.data.textureIns[t],k({material:i,type:e,texture:t})})),e({textures:l,models:s,material:i,normal:o}),i.needsUpdate=!0}}}))}})(),this.lazyLoadFns=[],this.loadTextures=(()=>{const e=e=>{e.callback("lazyLoadedTexture",""),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(r,n,a)=>{const i=this.lazyLoadFns[r];if(!i)return n(0),e(a);i(),setTimeout((()=>t(++r,n,a)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return e=>new Promise((r=>{this.runScene.optionsEx.options.texture.lazyLoad.open?t(0,r,e):(this.lazyLoadFns.map((e=>e())),r(0))}))})(),this.afterParse=e=>{const{data:t,core:r,json:n}=e;if("material"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){e=t.options.models;const[n]=e,a=[];n.material?(this.runScene.materialEx.add(n.material),a.push(n.material)):n.children.map((e=>{e.material&&(a.push(e.material),this.runScene.materialEx.add(e.material))})),r.models.push(...a)}},this.runScene=e}getData(){return{materialMap:{},textureMap:{},materialIns:{},textureIns:{}}}getMap(){return new s.Z({loadedGltf:this.done,loadMaterial:this.load,loadTexture:this.loadTexture,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}processInput(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.parser=t}))}processClonedTextures(){this.clonedTextures.map((e=>{var t=(0,l.getCloneIdFromTexture)(e);(t=this.data.textureIns[t])?(e.image=t.image,e.needsUpdate=!0,e.userData.blob=t.userData.blob,e.userData.md5=t.userData.md5,e.userData.url=t.userData.url,(0,l.bindTextureBaseData)(e)):(this.runScene.textureEx.delete(e),(0,o.bv)(e,"cloneSourceId"),(0,l.disposeTexture)(e))}))}reset(){this.clonedTextures=[],this.data=this.getData(),this.pending=[]}}var m=r(7880);t=r(110);class g{constructor(e){this.resetItem=e=>{"material"===e.type&&e.datas.map((t=>{const r=t.data.get("material")||{};e.targets.map((e=>{var t=(0,m.ee)(e);t&&m.Ws[t].tools.snapshot&&(t=(0,h.Ki)(e))&&(r[t]=this.getItem(e))}))}))},this.getDiff=()=>{let e={};return this.runScene.uniqueEx.material.getAll("values").map((t=>{t=t.material;var r=(0,m.ee)(t);r&&m.Ws[r].tools.snapshot&&(r=(0,h.Ki)(t))&&(e[r]=this.getItem(t))})),e},this.create=e=>{e.data.set("material",this.getDiff())},this.set=e=>{var t=e.snapshot.data.get("material");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.material.get(t))&&m.ZP.snapshot.set({material:t,data:r,runScene:this.runScene,map:e})}))},this.runScene=e,this.runScene.cb.snapshot.create.add("material",this.create),this.runScene.cb.snapshot.set.add("material",this.set),this.runScene.cb.snapshot.resetItem.add("material",this.resetItem)}getItem(e){return m.ZP.snapshot.getDiff(e)}}var v=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const b={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1,fog:!0},y=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest","fog"];class x{constructor(e){this.clean=()=>{this.dispose()},this.defMaterial=w(),this.addCb=e=>{this.runScene.cb.material.add.cb(e)},this.runScene=e,this.def=new m.ZP(e),this.snaphot=new g(e),this.runScene.cb.unique.material.add.add("engine-material-add",(e=>{this.addCb(e)})),this.runScene.cb.clean.add("EngineMaterial",this.clean),this.import=new f(e)}init(){var e={name:"material",loadCallBacks:this.import.getMap(),exportCallBacks:new s.Z};this.runScene.exporter.gltf.module.bind(e)}parse(e){m.Ws.LineBasicMaterial.tools.validType(e)&&m.Ws.LineBasicMaterial.tools.bind(e),this.setEnvStrength(e,this.runScene.sceneEx.envStrength)}add(e,t,r){B.is(e)||this.runScene.uniqueEx.material.add(e,t,r)}setEnvStrength(e,t,r=!1){void 0===e.envMapIntensity||e.envMapIntensity===t||!r&&e.envMapIntensity!==this.runScene.sceneEx.envStrength||(e.envMapIntensity=t,A(e))}create(e="BasicMaterial"){return e=m.ZP.create(e,this.runScene),this.add(e),e}toArray(){return(0,n.mapObj)(this.runScene.uniqueEx.material.map,((e,t)=>t.material))}copy(e){var t=I(e);if(t){const r=m.ZP.copy(t,e,this.runScene);return r.userData.id=(0,n.getId)(),r}}clone(e){var t=I(e);if(t){const r=m.ZP.clone(t,e);return r.userData.id=(0,n.getId)(),r}}setNormals(e,t=!0){const{info:r,newVal:n,materials:a,oldval:i,cb:s}=e;let o=n;return o.isVector2&&(o=o.clone()),e=a.map((e=>new c.Z({info:r,target:e,newVal:o,oldVal:i||e[r],runScene:this.runScene,cb:s}).execute())),t&&this.runScene.undoEx.addUndo(e),e}setNormal(e,t=!0){return e=new c.Z(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTextures(e,t=!0){return v(this,void 0,void 0,(function*(){const{info:r,newVal:n,materials:a,oldVal:i}=e;n instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(n)),"envMap"===r&&(0,l.setTextureMapping)(e.newVal);var s=a.map((t=>new c.Z({info:r,target:t,newVal:e.newVal,oldVal:i||t[r],runScene:this.runScene}).execute()));return t&&this.runScene.undoEx.addUndo(s),a[0][r]}))}setTexture(e,t=!0){return v(this,void 0,void 0,(function*(){var{info:r,newVal:n,target:a}=e,n=(n instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(n)),"envMap"===r&&(0,l.setTextureMapping)(e.newVal),new c.Z(Object.assign(Object.assign({},e),{oldVal:a[r],runScene:this.runScene})).execute());return t&&this.runScene.undoEx.addUndo(n),e.newVal}))}resetMaterial(e,t,r){const{addUndo:n,includeChild:a}=r=(0,d.Gm)({addUndo:!0,includeChild:!1},r);if(e&&t){const r=new Set;((0,d.lG)(e,"array")?e:[e]).map((e=>{a?e.traverse((e=>{R(e.material)&&r.add(e)})):e.material&&r.add(e)}));const i=[];r.forEach((e=>{i.push(new u.Z({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:e.material}).execute())})),this.runScene.modelEx.select===e&&this.runScene.cb.setSelectMaterial.cb(t),n&&this.runScene.undoEx.addUndo(i)}}toNromal(e){var t=I(e);if(t){const r=m.ZP.toNromal(t,e,this.runScene);return r.material.userData=Object.assign(Object.assign({},r.material.userData),e.userData),r}}setSelect(e){this.select=e,this.runScene.cb.setSelectMaterial.cb(e)}parseData(e,t){return m.ZP.parseData(e,t,this.runScene)}dispose(){this.runScene.cb.material.dispose.cb("")}remove(e){const t=this.runScene.uniqueEx.material.getModels((0,h.Ki)(e));t&&(this.resetMaterial(t.toArray(),w()),this.runScene.cb.material.remove.cb(e))}getDefNromals(e){var t;return"BasicMaterial"!==(null==(t=e.userData)?void 0:t.type)?{}:(0,d.ad)(b,e)}parseNromals(e,t){(0,n.mapObj)(e,((e,r)=>{var n,a,i,s,o;void 0!==b[e]&&("object"==typeof r?(({x:i,y:s,z:o}=r),null!=(a=null==(n=t[e])?void 0:n.set)&&a.call(n,i,s,o)):t[e]=r)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&"BasicMaterial"===e.userData.type&&!e.userData.isTimeLineUsed&&p.ZP.isDefVal(e)}setByType(e,t){"SpriteMaterial"===e&&!t.isSprite||(e=this.create(e))&&(this.add(e),this.runScene.modelEx.setMaterial(t,e))}}const w=e=>{const t=new a.MeshStandardMaterial(e);return t.userData.id=(0,n.getId)(),p.ZP.tools.bind(t),t},S=(e,t)=>(y.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),M=e=>{e.dispose();const t=T(e);0!==t.length&&t.map((e=>{e=e.texture,(0,l.disposeTexture)(e)}))},T=e=>E(e),_=e=>m.ZP.getTextures(e)||E(e),E=e=>i.zX.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),k=e=>{const{material:t,type:r,texture:n}=e;"envMap"===r&&(0,l.setTextureMapping)(n),t[r]=n,t.needsUpdate=!0},D=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},P=e=>null==e?void 0:e.isColor,A=e=>{e.needsUpdate=!0},O=e=>null==e?void 0:e.isMaterial,C=e=>{},R=e=>(null==e?void 0:e.isMeshStandardMaterial)&&!e.isSpecialMaterial,L={Sprite:t.Z},I=e=>{var t;return(null==(t=null==e?void 0:e.userData)?void 0:t.type)||(null==e?void 0:e.type)},B={set(e,t){t?(0,o.M)(e,"ignore",!0):delete e.userData.ignore},is:e=>!0===(0,o.is)(e,"ignore")}},4707:(e,t,r)=>{r.d(t,{ZP:()=>v,Gf:()=>g});var n=r(8881),a=r(4330),i=r(3263),s=r(3736);const o="\n#define STANDARD\nuniform int uvCount;\n ",l="\nattribute vec2 uv2;\nvarying vec2 vUv2;\nuniform mat3 uv2Transform;\n ",c="\nvUv2 = (uv2Transform * vec3(uv2, 1)).xy;\n ",u="\nvarying vec2 vUv2;\n ",h="\n#ifdef USE_MAP\n vec4 sampledDiffuseColor = vec4(0.0);\n if(uvCount > 1) sampledDiffuseColor = texture2D(map, vUv2);\n else sampledDiffuseColor = texture2D(map, vUv);\n \n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif\n ",d="\n#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = vec4(0.0);\n if(uvCount > 1) emissiveColor = texture2D(emissiveMap, vUv2);\n else emissiveColor = texture2D(emissiveMap, vUv);\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n ";var p,f=r(1398),m=r(932);const g={color:{type:"color",val:{r:1,g:1,b:1},shortKey:"clr"},map:{type:"texture",val:null,shortKey:"map"},emissiveMap:{type:"texture",val:null,shortKey:"em"},roughnessMap:{type:"texture",val:null,shortKey:"rm"},emissive:{type:"color",val:{r:0,g:0,b:0},shortKey:"emi"},roughness:{type:"number",val:1,shortKey:"rgh"},metalness:{type:"number",val:0,shortKey:"meta"},metalnessMap:{type:"texture",val:null,shortKey:"mm"},lightMap:{type:"texture",val:null,shortKey:"lm"},lightMapIntensity:{type:"number",val:1,shortKey:"lmi"},envMap:{type:"texture",val:null,shortKey:"envm"},envMapIntensity:{type:"number",val:1,shortKey:"envI"},opacity:{type:"number",val:1,shortKey:"opc",before:({target:e,end:t})=>{t<1&&!e.transparent&&(e.transparent=!0,(0,m.updateMaterial)(e))}},depthTest:{type:"other",val:!0,shortKey:"dt"},depthWrite:{type:"other",val:!0,shortKey:"dw"},fog:{type:"other",val:!0,shortKey:"fo"},wireframe:{type:"other",val:!1,shortKey:"wf"},alphaMap:{type:"texture",val:null,shortKey:"alpm"}};class v{constructor(e){this.init(e)}init(e){e.cb.material.add.add("base-material",(e=>{(0,m.isBaseMaterial)(e)&&"MeshPhysicalMaterial"!==e.type&&(v.tools.bind(e),e.userData.uvCount||(e.userData.uvCount=new n.Uniform(1)),e.onBeforeCompile=t=>{t.uniforms.uvCount=e.userData.uvCount,t.vertexShader=t.vertexShader.replace(/#include <uv2_pars_vertex>/g,l),t.vertexShader=t.vertexShader.replace(/#include <uv2_vertex>/g,c),t.fragmentShader=t.fragmentShader.replace(/#define STANDARD/g,o),t.fragmentShader=t.fragmentShader.replace(/#include <uv2_pars_fragment>/g,u),t.fragmentShader=t.fragmentShader.replace(/#include <map_fragment>/g,h),t.fragmentShader=t.fragmentShader.replace(/#include <emissivemap_fragment>/g,d)})}))}static isDefVal(e){for(const t in this.defVal){const r=this.defVal[t],a=e[t];if(r instanceof n.Color){if(r.getHexString()!==a.getHexString())return!1}else if("object"==typeof r){if(a.x!==r.x)return!1}else if(a!==r)return!1}for(const t of a.zX)if(e[t])return!1;return!0}create(){return(0,m.createDefMaterial)()}}(p=v).tools={type:"BasicMaterial",bind(e){(0,s.M)(e,"type","BasicMaterial")},create:()=>{var e=new n.MeshStandardMaterial;return p.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:a}=e,{data:s,load:o}=t,l=[];return o&&l.push(...i.F6.filter(s.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.uniqueEx.texture.addMaterial(r,{material:a,type:t}),(0,m.setMaterialTexture)({material:a,type:t,texture:r})}})))),n.runScene.materialEx.parseNromals(r,a),{material:a,setTextureFns:l}},toNormal:e=>({material:e.clone(),normal:{type:v.tools.type},textures:(0,m.getBaseTextures)(e)}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,m.getBaseTextures)(e),snapshot:{getDiff:e=>f.LV.getDiff(g,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;f.LV.set({def:g,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,m.updateMaterial)(r)}))}},validType:e=>"MeshStandardMaterial"===e.type},v.defVal={color:new n.Color(16777215),emissive:new n.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new n.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1,fog:!0}},110:(e,t,r)=>{r.d(t,{Z:()=>h});var n,a=r(8881),i=r(8715),s=r(3736),o=r(1398),l=r(3729),c=r(932);const u={color:(t=r(4707)).Gf.color,map:t.Gf.map,opacity:t.Gf.opacity};class h{constructor(e){this.modelParse={toNormal:e=>{e=e.model;const t=(0,i.createDefModel)("Box");return t.userData.normal=Object.assign({type:"MySpriteMaterial"},e.userData),t.material=e.material,h.modelTools.merge(e,t),t},parse:e=>{var{model:e,normal:t}=e;const r=(0,i.createDefModel)("Sprite");var n=e.userData.layers;return(0,i.setLayers)(r,n),r.userData=Object.assign(Object.assign({},t),r.userData),h.modelTools.merge(e,r),r.material=e.material,r}},this.runScene=e;const t=h.modelTools.type,{parse:r,toNormal:n}=this.modelParse;e.cb.inited.add("MySpriteMaterial",(()=>{e.modelEx.importAndExport.addParses(t,{parse:r,toNormal:n})}))}}(n=h).tools={type:"SpriteMaterial",bind(e){(0,s.M)(e,"type","SpriteMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:()=>{var e=new a.SpriteMaterial;return n.tools.bind(e),e},parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:a,load:i}=e,s=[],o=(0,c.mergeMaterial)(r,h.tools.create(t));(0,l.x)(o,(0,l.Ki)(r));var{depthWrite:e,depthTest:t,name:r,fog:n}=n;return!1===n&&(o.fog=!1),void 0!==e&&(o.depthWrite=e),void 0!==t&&(o.depthTest=t),r&&(o.name=r),i&&s.push(...a.map((e=>{const{type:t,texture:r}=e;return()=>{o[t]=r}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,c.mergeMaterial)(e,(0,c.createDefMaterial)());var r=Object.assign({},t.userData);const n={type:h.tools.type,name:e.name};return e.fog||(n.fog=!1),e.depthWrite!==c.defBaseMaterialMap.depthWrite&&(n.depthWrite=e.depthWrite),e.depthTest!==c.defBaseMaterialMap.depthTest&&(n.depthTest=e.depthTest),t.userData=r,{normal:n,textures:h.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=h.tools.type,t},snapshot:{getDiff:e=>o.LV.getDiff(u,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;o.LV.set({def:u,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,c.updateMaterial)(r)}))}}},h.modelTools={merge(e,t){t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.renderOrder=e.renderOrder,t.castShadow=e.castShadow,t.receiveShadow=e.receiveShadow,t.name=e.name,t.name=e.name,(0,s.M)(e,"name",e.name),(0,i.setLayers)(t,1===e.layers.mask?0:1)},toNormal:e=>{const t=(0,i.createDefModel)("Box");return t.userData.normal=Object.assign({type:"MySpriteMaterial"},e.userData),t.material=e.material,h.modelTools.merge(e,t),t},parseData:(e,t)=>{const r=(0,i.createDefModel)("Sprite");var n=e.userData.layers;return(0,i.setLayers)(r,n),r.userData=Object.assign(Object.assign({},t),r.userData),h.modelTools.merge(e,r),r.material=e.material,r},type:"MySpriteMaterial"}},3801:(e,t,r)=>{r.d(t,{Ju:()=>i,t9:()=>a,zf:()=>s});var n=r(3736);const a={isDynamic:()=>{}},i={isDeleted(e,t=!1){var r;return!!e&&(!(null==(r=null==e?void 0:e.userData)||!r.isDeleted)||!!t&&i.isDeleted(e.parent,t))},setDeleted(e,t){e.userData&&(t?(0,n.M)(e,"isDeleted",!0):null!=(t=null==e?void 0:e.userData)&&delete t.isDeleted)}},s={setLock(e){(0,n.M)(e,"lock",!0)},reLock(e){delete e.userData.lock},isLock(e,t=!1){if(!e||"Scene"===e.type)return!1;var r=e.userData.lock;return t?!!r||s.isLock(e.parent,t):void 0!==r&&r}}},8715:(e,t,r)=>{r.r(t),r.d(t,{createDefModel:()=>N,createSpecialModel:()=>F,default:()=>j,delClonedModel:()=>ee,deletedModel:()=>U.Ju,disposeModel:()=>z,dynamicModel:()=>U.t9,getClonedIdModel:()=>J,getDeepModels:()=>Z,getIdMapByModel:()=>ce,getModelSize:()=>ae,hasSkeleton:()=>X,helperModel:()=>oe,instanceModel:()=>V,isDynamicModel:()=>Y,isGLowModel:()=>te,isGroup:()=>ne,isHelper:()=>q,isSprite:()=>re,lockModel:()=>U.zf,mergeModel:()=>G,normalModel:()=>se,selectableModel:()=>ie,setClonedModel:()=>$,setDynamicModel:()=>Q,setHelper:()=>W,setLayers:()=>K,tempModel:()=>ue,uselessGroup:()=>le,withAnima:()=>H});var n=r(6001),a=r(8881),i=r(4091),s=r(4230);const o=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector","VerticesRain"];var l=r(1794),c=r(272),u=r(5247),h=r(1269),d=r(7880),p=r(932),f=r(3736);class m extends r(4773).Z{constructor(e){super(e),this.type="添加模型",this.isUndoAdd=!0}_execute(e){return Promise.reject()}undo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}redo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}execute(){return this.redo(),this}}var g=r(3735),v=r(2510);class b extends r(4616).Z{constructor(e){super(),this.type="修改父元素",this.isUndoParent=!0,this.runScene=e.runScene,this.oldParent=e.oldParent,this.newParent=e.newParent,this.target=e.target}execute(){return this.redo(),this}_execute(e,t){e.attach(this.target),this.runScene.cb.model.setParent.cb({model:this.target,parent:e}),(null==(e=this.runScene.modelEx.select)?void 0:e.userData.id)===t.userData.id&&this.runScene.modelEx.selectNull()}undo(){this._execute(this.oldParent,this.newParent)}redo(){this._execute(this.newParent,this.oldParent)}}const y=b;var x=r(7169),w=r(4380),S=r(3729),M=r(8089),T=r(5857);class _{constructor(e){this.definfo={speed:1,size:10,length:2e3},this.map=new l.Z,this.modelParse={toNormal:e=>{const{model:t,runScene:r}=e,n=N("Box");e=(0,S.Ki)(t);var a=r.modelEx.def.vertices.rain.map.get(e);if(n.material=t.material,!e||!a)throw TypeError("缺少属性");var{length:e,size:a,speed:i}=a;return n.userData.normal={type:_.modelTools.type,length:e,size:a,speed:i,materialId:(0,S.Ki)(t.material)},n},parse:e=>{const{runScene:t,normal:r,model:n}=e,a=t.modelEx.def.create(_.modelTools.type,r);return a.material=n.material,a.material.userData.id=r.materialId,a}},this.update=()=>{const e=this.runScene.assetsEx.get().camera;this.map.map(((t,r)=>{const{model:n,length:a,speed:i,del:s}=r;if(!s){n.position.set(e.position.x,e.position.y,e.position.z);for(let e=0;e<a;e++)n.geometry.attributes.position.setY(e,n.geometry.attributes.position.getY(e)-i),0<=i?n.geometry.attributes.position.getY(e)<=-1e3&&n.geometry.attributes.position.setY(e,1e3):1e3<=n.geometry.attributes.position.getY(e)&&n.geometry.attributes.position.setY(e,-1e3),n.geometry.attributes.position.needsUpdate=!0}}))},this.tools={type:"VerticesRain",merge:function(e,t){},toNormal:function(e){const t=N("Box");var r=(0,S.Ki)(e),n=this.map.get(r);if(t.material.map=e.material.map,r&&n)return t.userData.normal=Object.assign({type:this.tools.type},n),t;throw TypeError("缺少属性")},parseData:function(e,t){}},(this.runScene=e).cb.render.add("verticesRain",this.update),e.cb.model.add.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,S.Ki)(e));t&&(t.del=!1)}})),e.cb.model.remove.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,S.Ki)(e));t&&(t.del=!0)}})),e.cb.clean.add("verticesRain",(()=>{this.map.clear()}));const{toNormal:t,parse:r}=this.modelParse;e.cb.inited.add("VerticesRain",(()=>{e.modelEx.importAndExport.addParses(_.modelTools.type,{toNormal:t,parse:r})}))}bindMaterial(e,t){(0,f.M)(e,"id",t||(0,n.getId)()),(0,f.M)(e,"type","MyPointsMaterial")}create(e){var t=(e=e||this.definfo).length;const r=new T.Sf.Points(this.createGeo(t),this.createMaterial(e));return r.name="雨雪",r.renderOrder=1,t=(0,n.getId)(),(0,f.M)(r,"id",t),this.bindMaterial(r.material),(0,f.M)(r,"type",this.tools.type),(0,f.M)(r,"normal",{type:this.tools.type}),this.map.set(t,{model:r,length:e.length,size:e.size,speed:e.speed,del:!1}),r}createGeo(e){let t=[];const r=new a.BufferGeometry;for(let r=0;r<e;r++){var n=2e3*Math.random()-1e3,i=2e3*Math.random()-1e3,s=2e3*Math.random()-1e3;t.push(n,i,s)}return r.setAttribute("position",new a.Float32BufferAttribute(t,3)),r}createMaterial(e){var{size:e,map:t}=e;return new T.Sf.PointsMaterial({blending:T.Sf.AdditiveBlending,depthTest:!1,transparent:!0,size:e,map:t})}setForModel(e){var{model:e,type:t,data:r}=e;(e=(0,S.Ki)(e))&&this.set(e,t,r)}set(e,t,r){const n=this.map.get(e);if(n){const{model:e,size:i}=n;switch(t){case"show":e.visible=r;break;case"length":e.geometry=this.createGeo(r),n[t]=r;break;case"size":var a=e.material;e.material=this.createMaterial({map:e.material.map,size:r}),this.bindMaterial(e.material,(0,S.Ki)(a)),n[t]=r;break;case"speed":n[t]=r;break;case"texture":a=e.material,e.material=this.createMaterial({map:r,size:i}),this.bindMaterial(e.material,(0,S.Ki)(a))}}}}_.modelTools={type:"VerticesRain",parseData:function(e,t,r){const n=r.modelEx.def.create(_.modelTools.type,t);return n.material=e.material,n.material.userData.id=t.materialId,n},toNormal:(e,t,r)=>{const n=N("Box");var a=(0,S.Ki)(e);if(t=t.modelEx.def.vertices.rain.map.get(a),n.material=e.material,!a||!t)throw TypeError("缺少属性");var{length:a,size:t,speed:i}=t;return n.userData.normal={type:_.modelTools.type,length:a,size:t,speed:i,materialId:(0,S.Ki)(e.material)},n}};class E{constructor(e){this.runScene=e,this.rain=new _(e)}}class k{constructor(e){this.runScene=e,this.vertices=new E(e)}create(e,t){let r;return"VerticesRain"===e?r=this.vertices.rain.create(t):o.includes(e)&&(r=(0,M.Py)(e,t)),d.ZP.parseNode(r),r}}var D=r(4457);class P{constructor(e){this.runScene=e}init(){this.bindEvent()}bindEvent(){}}var A=r(2353),O=r(110);class C{constructor(e){this.data=this.getData(),this.parses=new l.Z,this.nodeType={MySpriteMaterial:O.Z,VerticesRain:_},this.mount=e=>{e.core.module.set("model",this)},this.complete=()=>{this.data=this.getData()},this.loadNodeDef=e=>{let{node:t,nodeDef:r}=e;(0,n.mapObj)(this.runScene.modelEx.defNodeMap,((e,n)=>{var a=r[e];null!=a&&(t[e]=a)})),r.wireframe&&(t.material.wireframe=!0)},this.load=e=>{var{data:e,core:t}=e;return this.loadNodeDef(e),this.loadExtras(e,t),e.node},this.done=()=>{this.removeHelperModel()},this.afterParse=e=>{const{config:t,data:r,json:n,core:a}=e;if("model"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){if(null==(e=t.module)||!e.model)return[];let n=["glb_model"===(e=(e=r.options).models[0]).name&&(null==e?void 0:e.children[0])||e];var[e]=n;le.is(e)&&(n=[...e.children]),a.models.push(...n),this.mergeClone()}},this.toNromal=e=>{var t=e.type;const r=this.parses.get(t);if(r)return r.toNormal(e)},this.parse=e=>{var t=e.type;const r=this.parses.get(t);if(r)return r.parse(e)},this.runScene=e}getData(){return{map:new l.Z,clonedMap:{},instancedMap:{},helperModels:[]}}getMap(){return new l.Z({loadNode:this.load,loadedGltf:this.done,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}addParses(e,t){this.parses.set(e,t)}loadExtras(e,t){let{node:r,nodeDef:n}=e;if(n.extras){const{layers:o,normal:l,local:c,cloneId:u,id:h,animations:d,isDynamic:p}=n.extras;var a,i=Y(r,!0),s=("running"!==this.runScene.optionsEx.options.mode||i||null!=(s=this.runScene.optionsEx.options.renderConfig)&&s.matrixAutoUpdate||(r.matrixAutoUpdate=!1),d&&(r.animations=A.B.parse(d)),p&&(r.userData.isDynamic=!0),!u||i||(this.data.instancedMap[u]||(this.data.instancedMap[u]=new Set),this.data.instancedMap[u].add(r)),c&&([s,i,a]=c.split(","),r.position.set(s,i,a)),o&&(r.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:r,val:1})),n.extras.isHelper&&this.data.helperModels.push(r),l&&(e.node=this.parse({type:l.type,model:e.node,normal:l,runScene:this.runScene})),h&&this.data.map.set(h,e.node),null==(a=null==(i=null==(s=e.node)?void 0:s.material)?void 0:i.userData)?void 0:a.id);if(s){const r=t.module.get("material").data.materialIns[s];r&&r.models.push(e.node)}}}removeHelperModel(){this.data.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}mergeClone(){var e;this.runScene.optionsEx.options.instanceClone&&"running"===this.runScene.optionsEx.options.mode&&(this.runScene.assetsEx.scene.updateMatrixWorld(),e=this.data.instancedMap,(0,n.mapObj)(e,((e,t)=>{var r,n=this.runScene.uniqueEx.model.map[e];t.size<2||!n||!n.geometry||Y(n,!0)||(r=V(n,[...t]),this.runScene.modelEx.add(r,void 0,{isClone:!1,select:!1,addUndo:!1}),te(n)&&this.runScene.modelEx.setGlow(r,!0),this.runScene.modelEx.remove(n,!1),t.forEach((e=>this.runScene.modelEx.remove(e,!1))),t.clear(),delete this.data.instancedMap[e])}))),this.data.instancedMap={}}mergeGeometry(){}}var R=r(228),L=r(1398);const I={position:{type:"v3",val:{x:0,y:0,z:0},shortKey:"po"},rotation:{type:"v3",val:{x:0,y:0,z:0},shortKey:"ro"},scale:{type:"v3",val:{x:1,y:1,z:1},shortKey:"scl"},visible:{type:"other",val:!0,shortKey:"vi"},castShadow:{type:"other",val:!1,shortKey:"ca"},receiveShadow:{type:"other",val:!1,shortKey:"rec"},renderOrder:{type:"other",val:0,shortKey:"ren"}};class B{constructor(e){this.resetItem=e=>{"model"===e.type&&e.datas.map((t=>{const r=t.data.get("model")||{},n=new c.Z;if(e.targets.map((e=>{var t=(0,S.Ki)(e);t&&(e.material&&n.add(e.material),r[t]=this.getItem(e))})),0!==n.size){const t=new c.Z;n.map((e=>{const r=d.ZP.getTextures(e);0!==r.length&&t.add(r.map((e=>e.texture)))})),this.runScene.cb.snapshot.resetItem.cb({type:"texture",datas:e.datas,targets:t.toArray()}),this.runScene.cb.snapshot.resetItem.cb({type:"material",datas:e.datas,targets:n.toArray()})}}))},this.create=e=>{e.data.set("model",this.getDiff())},this.set=e=>{var t=e.snapshot.data.get("model");if(t){const r=e.data.completedCbs;this.runScene.pp.clearAllOutlineObj(),(0,n.mapObj)(t,((t,n)=>{const a=this.runScene.uniqueEx.model.get(t);a&&(L.LV.set({def:I,runScene:this.runScene,data:n,target:a,map:e}),t=n[I.visible.shortKey],a.visible=void 0===t,r.push((()=>{var e;this.runScene.modelEx.setGlow(a,!!n.isGLow),n.isOutline&&this.runScene.pp.addOutlineObj(a),this.runScene.cb.model.change.cb({model:a,type:"visible",val:a.visible}),n.materialId&&(e=this.runScene.uniqueEx.material.get(n.materialId))&&this.runScene.materialEx.resetMaterial(a,e,{addUndo:!1,includeChild:!1})})))}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("scene",this.create),this.runScene.cb.snapshot.set.add("scene",this.set),this.runScene.cb.snapshot.resetItem.add("scene",this.resetItem)}getItem(e){const t=L.LV.getDiff(I,e);return te(e)&&(t.isGLow=!0),(0,R.S)(e)&&(t.isOutline=!0),e.material&&(t.materialId=(0,S.Ki)(e.material)),t}getDiff(){const e={};return this.runScene.sceneEx.getClearModels().map((t=>{t.traverse((t=>{var r=(0,S.Ki)(t);r&&(e[r]=this.getItem(t))}))})),e}getData(){}}var U=r(3801);class j{constructor(e){this._selectModel=void 0,this.geometryMap=new l.Z,this.clonedMap=new l.Z,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.clean=()=>{this.reset()},this.add=(()=>{const e=(e,t)=>{t?(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.cb.model.clone.cb(e)):this.runScene.uniqueEx.model.add(e)};return(t,r,n)=>{var{addUndo:a,isClone:i,select:s,addToTree:o}=(0,D.mergeObject)({addUndo:!0,isClone:!1,select:!1,addToTree:!0},n);return t instanceof Array?t.map((e=>this.add(e,r,n))):(e(t,i),this.setGeometryMap(t),this.setCloneMap(t),o=new m({model:t,parent:r||this.runScene.sceneEx.get(),isClone:i,addTree:o,runScene:this.runScene}).execute(),!0===a&&this.runScene.undoEx.addUndo(o),s&&this.setSelectByModel(t,{isDomTreeActive:!1,isClone:i}),o)}})(),this.deepIsVisible=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&this.deepIsVisible(e.parent),this.runScene=e,this.clone=(e=>(t,r=!0)=>{if(e.lightEx.isLight(t))return e.lightEx.clone(t);var a,i,s=X(t),o=(e=>{const t={};return(0,D.getModelMap)(e,"id",(e=>{0<e.animations.length&&(t[(0,S.Ki)(e)]=e.animations)})),t})(t),l=(s=s?function(e){var t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(var a=0;a<t.children.length;a++)e(t.children[a],r.children[a],n)}(e,n,(function(e,n){t.set(n,e),r.set(e,n)})),n.traverse((function(e){var n,a;e.isSkinnedMesh&&(a=(n=t.get(e)).skeleton.bones,e.skeleton=n.skeleton.clone(),e.bindMatrix.copy(n.bindMatrix),e.skeleton.bones=a.map((function(e){return r.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),n}(t):t.clone(),l=t,(0,f.M)(s,"cloneId",J(l)||l.userData.id),(0,f.is)(t,"isDynamic")&&Q(s,!0),(0,D.getModelMap)(s,"id"));c=s,(i=null==t?void 0:t.material)&&(a=d.ZP.clone((0,d.ee)(i),i))&&a.uuid!==i.uuid&&(e.materialEx.resetMaterial(c,a,{addUndo:!0}),e.materialEx.add(a,t,i));{var c={newModel:s,newModelMap:l,animaMap:o};const{animaMap:t,newModelMap:r}=c;(0,n.mapObj)(t,((t,a)=>{const i=r[t],s={};i&&(i.animations=[...a.map((e=>{const t=e.clone();return t.tracks.map((e=>{var[t]=e.name.split(".");s[t]||(s[t]=[]),s[t].push(e)})),t}))],(0,n.mapObj)(s,((t,r)=>{var a=i.getObjectByName(t);if(a){(0,f.M)(a,"id",(0,n.getId)());const i=e.uniqueEx.model.parseName(a);r.map((e=>{e.name=i+e.name.slice(t.length)}))}})))}))}return r&&e.uniqueEx.model.add(s,{hasReset:!0}),s})(e),this.runScene.cb.clean.add("EngineModel",this.clean),this.export=new P(e),this.importAndExport=new C(e),this.snapsot=new B(e),this.def=new k(e),this.runScene.cb.loaderer.gltf.getArrayBuffer.add("EngineModel",(()=>{this.selectNull()}))}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}init(){var e={name:"node",loadCallBacks:this.importAndExport.getMap(),exportCallBacks:new l.Z};this.runScene.exporter.gltf.module.bind(e)}setGeometryMap(e){if((0,D.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t;e.geometry&&(t=e.geometry.uuid,this.geometryMap.get(t)||this.geometryMap.set(t,new Set),this.geometryMap.get(t).add((0,S.Ki)(e))),this.setGeometryMap(e.children)}isSameGeo(e,t){var{normal:e,position:r,uv:n}=e.attributes,{normal:t,position:a,uv:i}=t.attributes;return e.array.length===t.array.length&&r.array.length===a.array.length&&n.array.length===i.array.length&&(e=(0,D.sameArr)([...e.array],[...t.array],20),t=(0,D.sameArr)([...r.array],[...a.array],20),r=(0,D.sameArr)([...n.array],[...i.array],20),e&&t&&r)}getClonedIdFromModel(e){if(e.geometry){for(const e of this.clonedMap){const[r,n]=e;if(0!==n.size){var t=n.values()[0];if(!t)return;const e=this.runScene.uniqueEx.model.get(t);if(!e||!e.geometry)return;if(this.isSameGeo(e.geometry,e.geometry))return r}}this.clonedMap.map(((e,t)=>{t.size}))}}setCloneMap(e){if((0,D.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=J(e);(t||this.getClonedIdFromModel(e))&&(this.clonedMap.get(t)||this.clonedMap.set(t,new c.Z),this.clonedMap.get(t).add((0,S.Ki)(e)),this.setCloneMap(e.children))}removeCloneMap(e){this.clonedMap.get((0,S.Ki)(e))}replaceClonedGroup(e,t){t=J(t)||(0,S.Ki)(t);const r=this.clonedMap.get(t);r&&0!==r.size&&(e.userData.id=t,r.map((t=>{if(t=this.runScene.modelEx.getById(t)){var{position:r,rotation:n,scale:a,name:i,parent:s}=t;this.remove(t,!1);const o=this.runScene.modelEx.clone(e);o.userData.id=(0,S.Ki)(t),o.position.copy(r),o.rotation.copy(n),o.scale.copy(a),o.name=i,this.add(o,s,{addUndo:!1,isClone:!0,select:!1})}})))}replaceGeometry(e,t){t=t.uuid;const r=this.geometryMap.get(t);r&&0!==r.size&&(r.forEach((t=>{const r=this.runScene.uniqueEx.model.get(t);r&&(r.geometry=e,r.updateMatrix())})),this.geometryMap.delete(t),this.geometryMap.set(e.uuid,r))}setSelectByModel(e,t){this.runScene.optionsEx.log([e,"选中的模型",(0,S.Ki)(e)],"detail");var{isDomTreeActive:t,isClone:r}=t||{};if(this.runScene.events.key.ctrl&&!r)this.runScene.multipSelector.add(e);else{if(this.runScene.multipSelector.isEmpty()||this.runScene.multipSelector.setEmpty(),this._selectModel){if(this._selectModel===e)return void(this.runScene.helperEx.focusModelId||this.runScene.helperEx.focus(e));this.runScene.lightEx.setNull(this._selectModel),this.runScene.cb.model.unFocus.cb(this._selectModel)}e&&(this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.cb.model.setSelect.cb(e),(this._selectModel=e).isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)))}}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){let r=[];Array.isArray(e)?r.push(...e):r.push(e),e=r.map((e=>new x.Z({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute())),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t){var{x:e,y:r,z:n}=e;return e===(t=t?1:0)&&r===t&&n===t}isNavieV2(e,t=0){var{x:e,y:r}=e;return e===t&&r===t}isUnless(e){return!e.material&&this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&0===e.children.length&&!H(e)}isUnlessLevel(e){return this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&1===e.children.length&&!H(e)}create(){var e=(0,D.getModelByType)("Box");return d.ZP.parseNode(e),e}getById(e){return Array.isArray(e)?e.map((e=>this.runScene.uniqueEx.model.get(e))):this.runScene.uniqueEx.model.get(e)}getLevel(e,t=0){return e.parent&&"Scene"!==e.parent.type?this.getLevel(e.parent,++t):t}selectNull(){var e=this._selectModel;e&&(this.runScene.cb.model.unFocus.cb(e),this.runScene.materialEx.setSelect(null),this.runScene.lightEx.setNull(e)),this._selectModel=void 0,this.runScene.cb.model.setSelect.cb(null),this.runScene.helperEx.unfocus()}cloneV3(e){return e.clone()}setParent(e,t,r=!0){if(t=new y({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!r)return t;this.runScene.undoEx.addUndo(t)}_setV3(e){const{model:t,info:r,newV3:n}=e;if(Array.isArray(t))return t.map((e=>{e[r].set(n.x,n.y,n.z),e.updateMatrix()}));t[r].set(n.x,n.y,n.z),t.updateMatrix()}update(e){if(Array.isArray(e))return e.map((e=>e.updateMatrix()));e.updateMatrix()}setV3(e,t=!0,r=!0){let{model:n,info:i,newV3:s,oldV3:o}=e;var l,c;if(s.isVector3||s.isEuler||(({x:u,y:l,z:c}=s),s=new a.Vector3(u,l,c)),(0,D.isRunning)(this.runScene))return this._setV3(e);var u=n instanceof Array?n.map((e=>new w.Z({target:e,info:i,runScene:this.runScene,oldV3:o||e[i].clone(),newV3:s}).execute(r))):new w.Z({target:n,info:i,oldV3:o||n[i].clone(),newV3:s,runScene:this.runScene}).execute(r);t&&this.runScene.undoEx.addUndo(u)}setNormal(e,t=!0){const{model:r,oldVal:n,info:a,val:i,executeCb:s}=e;return e=r instanceof Array?r.map((e=>new v.Z({target:e,info:a,runScene:this.runScene,oldVal:n||r[a],newVal:i,executeCb:s}).execute())):new v.Z({target:r,info:a,runScene:this.runScene,oldVal:n||r[a],newVal:i,executeCb:s}).execute(),t&&this.runScene.undoEx.addUndo(e),e}setMaterial(e,t,r=!0){var n=new v.Z({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t}).execute();this.select===e&&this.runScene.cb.setSelectMaterial.cb(t),e.material.needsUpdate=!0,r&&this.runScene.undoEx.addUndo(n)}addDef(e){this.add(this.def.create(e),void 0,{select:!0})}isModel(e){return!(e.isLight||e.isCamera)}getSphere(){var e=new a.MeshBasicMaterial,t=new a.SphereGeometry(.7,150,150);return new a.Mesh(t,e)}getIndexByModel(e){var t;return e.parent?null==(t=e.parent)?void 0:t.children.findIndex((t=>t===e)):-1}getBeTweenChildByTwoModel(e,t){if(e.parent.uuid===t.parent.uuid){var r=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==r&&-1!==t){const n=Math.max(r,t),a=r===n?t:r;return e.parent.children.map(((e,t)=>t>a&&t<n&&e)).filter((e=>e))}}}setMultip(e){var{model:e,typeList:t,newVal:r}=e;this.runScene.undoEx.addUndo(new g.Z({target:e,typeList:t,newVal:r}).execute())}createGroup(e,t,r){const n=t||new a.Group,i=[];i.push(new m({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new y({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.push(new y({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()),r&&this.runScene.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.cb.model.setMainStatue.cb({status:!0,model:n}),this.runScene.undoEx.addUndo(i),this.setSelectByModel(n)}cleanGroup(e,t=!0){if(e instanceof Array){const t=(0,n.multiArrToArr)(e.map((e=>(this.runScene.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.cb.model.unFocus.cb(e),0!==e.children.length){const r=[],n=e.children.map((e=>{if(e.parent.parent)return new y({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return r.push(...n.map((e=>e.execute()))),r.push(new x.Z({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(r),r}}hideOther(e){const t=e.uuid,r=0<e.children.length,n=this.runScene.sceneEx.getClearModels(),a=[];n.map((n=>{n.traverse((n=>{r?!1===(0,D.deepFindParentByUuid)(n,t)&&n.uuid!==e.uuid&&a.push(n):n.uuid!==e.uuid&&a.push(n)}))}));var i=a.map((e=>new v.Z({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(i),(0,D.setParentVisible)(e,!0)}showAll(){const e=this.runScene.sceneEx.getClearModels(),t=[];e.map((e=>{e.traverse((e=>{"materialHelper"!==e.name&&!1===e.visible&&t.push(e)}))}));var r=t.map((e=>new v.Z({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(r)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,r=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{r.push(new x.Z({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(r)}_getModel(e){var t=this.runScene.uniqueEx.model.nameMap[e];if(t)return this.runScene.uniqueEx.model.get(t)||this.runScene.assetsEx.scene.getObjectByName(e)}getModel(e,t="array"){if(!(e instanceof Array))return this._getModel(e);if("array"===t)return e.map((e=>this._getModel(e)));if("map"===t){const t={};return e.map((e=>{t[e]=this.getModel(e)})),t}}getWorldLocal(e){this.runScene.assetsEx.scene.updateMatrixWorld(!0);var t=new a.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,r=!1){let n=new a.Raycaster,i=new a.Vector2,s=(i.x=e.offsetX/this.runScene.assetsEx.engineDom.clientWidth*2-1,i.y=-e.offsetY/this.runScene.assetsEx.engineDom.clientHeight*2+1,n.setFromCamera(i,this.runScene.assetsEx.camera),n.intersectObjects(t,!0)),o={intersects:null,obj:null};if(0===s.length)return o;if(r){if(0===(e=s.filter((e=>(0,D.isVisible)(e.object)))).length)return o;o={intersects:e,obj:e[0].object}}else o={intersects:s,obj:s[0].object};return o}getCamLocal(){var{x:e,y:t,z:r}=this.runScene.assetsEx.camera.position,{x:n,y:a,z:i}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:r,tx:n,ty:a,tz:i}}camAnima(e,t,r=1,n,a){return(0,D.anima)(e,t,r,(e=>{a&&a(e),this.runScene.assetsEx.camera.position.set(e.cx,e.cy,e.cz),this.runScene.assetsEx.controls.target.set(e.tx,e.ty,e.tz),this.runScene.assetsEx.camera.lookAt(this.runScene.assetsEx.controls.target)}),(e=>{n&&n()}))}setGlow(e,t=!0){t=t?1:0,0==(e.userData.layers=t)?e.layers.set(0):e.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:e,val:t})}setOutline(e,t=!0){e.userData.outline=t,this.runScene.pp.addOutlineObj(e,t),this.runScene.cb.model.setOutline.cb({model:e,val:t})}beforeLoad(e){return e instanceof Array?e.map((e=>this.beforeLoad(e))):e}focus(e){const{scene:t,camera:r,renderer:n,controls:i}=this.runScene.assetsEx.get(),s=new a.Vector3,o=new a.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){const e=this.runScene.helperEx.boxHelper;if(e.update(),!e||!e.object)return;var l=n.domElement.getBoundingClientRect();let t=l.width/l.height;const i=new a.Vector3;l=e.geometry.attributes.position.array,i.set(Math.abs(l[0]-l[3]),Math.abs(l[1]-l[7]),Math.abs(l[2]-l[14])),o.x=.5*(l[0]+l[3]),o.y=.5*(l[1]+l[7]),o.z=.5*(l[2]+l[14]);let c=new a.Vector3;c.subVectors(r.position,o),c.projectOnPlane(new a.Vector3(0,1,0)),c.normalize(),1<t&&(t=1/t),l=2*Math.tan(.5*r.fov*Math.PI/180),l=i.length()/t/l,s.addVectors(o,c.multiplyScalar(l))}else{t.updateMatrixWorld(!0),l=new a.Vector3,e.getWorldPosition(l),o.set(l.x,l.y,l.z);let n=new a.Vector3;n.subVectors(r.position,o),n.projectOnPlane(new a.Vector3(0,1,0)),n.normalize(),s.addVectors(o,n.multiplyScalar(3))}(0,D.anima)({positionX:r.position.x,positionY:r.position.y,positionZ:r.position.z,targetX:i.target.x,targetY:i.target.y,targetZ:i.target.z},{positionX:s.x,positionY:s.y,positionZ:s.z,targetX:o.x,targetY:o.y,targetZ:o.z},.5,(e=>{r.position.set(e.positionX,e.positionY,e.positionZ),r.lookAt(e.targetX,e.targetY,e.targetZ),i.target.set(e.targetX,e.targetY,e.targetZ),i.update()}))}instance(e){this.runScene.assetsEx.scene.updateMatrixWorld();const t={},r=Array.isArray(e)?e:[e],a=[];r.map((e=>{e.traverse((e=>{var r;e.geometry&&!Y(e)&&(r=J(e))&&(a.push(e),t[r]||(t[r]=new Set),t[r].add(e))}))})),(0,n.mapObj)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||(t=V(e,[...t]),this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),te(e)&&this.setGlow(t,!0),this.runScene.modelEx.remove(e,!1))})),a.map((e=>{this.runScene.modelEx.remove(e,!1)}))}reset(){const e=this.runScene.sceneEx.getClearModels();let t=[];e.map((e=>e.traverse((e=>t.push(e))))),t.map((e=>{z(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),this.runScene.modelEx.selectNull(),this.geometryMap.clear()}getHoverFromModels(e,t,r){const{getOriginData:n,ignoreMove:i}=(0,D.mergeObject)({ignoreMove:!1,getOriginData:!1},r);this.runScene.cb.events.pointer.move.add("get-hover-from-models",(r=>{if(i||!this.runScene.events.mouse.isMove){const i=new a.Raycaster,u=new a.Vector2,{engineDom:h,camera:d}=this.runScene.assetsEx.get();var{top:s,left:o,width:l,height:c}=h.getBoundingClientRect(),o=r.pageX-o;r=r.pageY-s,u.x=o/l*2-1,u.y=-r/c*2+1,i.setFromCamera(u,d);const p=i.intersectObjects(e||[],!0);null!=t&&t(0===p.length?null:n?p:p.map((e=>e.object)))}}))}}const F=e=>{},N=e=>{if(o.includes(e))return e=(0,D.getModelByType)(e),d.ZP.parseNode(e),e;throw TypeError("")},z=(e,t)=>{t=(t||{}).remove;const{geometry:r,material:n}=e;r&&(null!=r&&r.dispose(),delete e.geometry),n&&((0,p.disposeMaterial)(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},V=(e,t)=>{var{material:r,geometry:n}=e;const a=new u.Z.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{e.updateMatrix(),a.setMatrixAt(t,e.matrixWorld)})),a.name=e.name,a},G=(e,t)=>{const r=[];if(t.map((e=>{e=e.geometry,r.push(e)})),t=i.qf(r))return new u.Z.Mesh(t,e)},H=e=>0!==e.animations.length,W=e=>{e&&e.userData&&(e.userData.isHelper=!0)},q=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,K=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,f.M)(e,"layers",t))},Z=e=>{const t=[];e.traverse((e=>{t.push(e)}))},X=e=>{let t=!1;if(e)return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},Q=(e,t)=>{t?(0,f.M)(e,"isDynamic",!0):delete e.userData.isDynamic},Y=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&Y(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,J=e=>e.userData.cloneId,$=(e,t)=>{(0,f.M)(e,"cloneId",t)},ee=e=>{delete e.userData.cloneId},te=e=>1===e.userData.layers,re=e=>e.isSprite,ne=e=>{},ae=e=>{var t=new a.Vector3;return(new a.Box3).setFromObject(e).getSize(t),t},ie={open(e){delete e.userData.unSelectable},close(e){e.userData.unSelectable=!0},is:e=>void 0===e.userData.unSelectable},se={set(e,t){t?delete e.userData.unNormal:e.userData.unNormal=!0},is:e=>!(0,h.RQ)(e)&&!(0,s.N)(e)&&void 0===e.userData.unNormal,hasUnNormal:e=>void 0!==(null==(e=null==e?void 0:e.userData)?void 0:e.unNormal)},oe={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,set(e,t=!0){t?e.userData.isHelper=!0:delete e.userData.isHelper}},le={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.uselessGroup,set(e,t){t?e.userData.uselessGroup=!0:delete e.userData.uselessGroup}},ce=(e,t)=>{let r=[];Array.isArray(e)?r.push(...e):r.push(e);const n={};return r.map((e=>e.traverse((e=>{null!=t&&t(e),n[(0,S.Ki)(e)]=e})))),n},ue={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.isTemp),set(e,t){t?e.userData.isTemp=t:delete e.userData.isTemp}}},228:(e,t,r)=>{r.d(t,{Q:()=>d,S:()=>p});var n=r(5857),a=r(8881),i=r(4819),s=r(6608);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=c(n);function n(e,t,o,l){var c;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(c=r.call(this)).renderScene=t,c.renderCamera=o,c.selectedObjects=void 0!==l?l:[],c.visibleEdgeColor=new a.Color(1,1,1),c.hiddenEdgeColor=new a.Color(.1,.04,.02),c.edgeGlow=0,c.usePatternTexture=!1,c.edgeThickness=1,c.edgeStrength=3,c.downSampleRatio=2,c.pulsePeriod=0,c._visibilityCache=new Map,c.resolution=void 0!==e?new a.Vector2(e.x,e.y):new a.Vector2(256,256),t=Math.round(c.resolution.x/c.downSampleRatio),o=Math.round(c.resolution.y/c.downSampleRatio),c.renderTargetMaskBuffer=new a.WebGLRenderTarget(c.resolution.x,c.resolution.y),c.renderTargetMaskBuffer.texture.name="OutlinePass.mask",c.renderTargetMaskBuffer.texture.generateMipmaps=!1,c.depthMaterial=new a.MeshDepthMaterial,c.depthMaterial.side=a.DoubleSide,c.depthMaterial.depthPacking=a.RGBADepthPacking,c.depthMaterial.blending=a.NoBlending,c.prepareMaskMaterial=c.getPrepareMaskMaterial(),c.prepareMaskMaterial.side=a.DoubleSide,c.prepareMaskMaterial.fragmentShader=function(e,t){return t=t.isPerspectiveCamera?"perspective":"orthographic",e.replace(/DEPTH_TO_VIEW_Z/g,t+"DepthToViewZ")}(c.prepareMaskMaterial.fragmentShader,c.renderCamera),c.renderTargetDepthBuffer=new a.WebGLRenderTarget(c.resolution.x,c.resolution.y),c.renderTargetDepthBuffer.texture.name="OutlinePass.depth",c.renderTargetDepthBuffer.texture.generateMipmaps=!1,c.renderTargetMaskDownSampleBuffer=new a.WebGLRenderTarget(t,o),c.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",c.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,c.renderTargetBlurBuffer1=new a.WebGLRenderTarget(t,o),c.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",c.renderTargetBlurBuffer1.texture.generateMipmaps=!1,c.renderTargetBlurBuffer2=new a.WebGLRenderTarget(Math.round(t/2),Math.round(o/2)),c.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",c.renderTargetBlurBuffer2.texture.generateMipmaps=!1,c.edgeDetectionMaterial=c.getEdgeDetectionMaterial(),c.renderTargetEdgeBuffer1=new a.WebGLRenderTarget(t,o),c.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",c.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,c.renderTargetEdgeBuffer2=new a.WebGLRenderTarget(Math.round(t/2),Math.round(o/2)),c.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",c.renderTargetEdgeBuffer2.texture.generateMipmaps=!1,c.separableBlurMaterial1=c.getSeperableBlurMaterial(4),c.separableBlurMaterial1.uniforms.texSize.value.set(t,o),c.separableBlurMaterial1.uniforms.kernelRadius.value=1,c.separableBlurMaterial2=c.getSeperableBlurMaterial(4),c.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(t/2),Math.round(o/2)),c.separableBlurMaterial2.uniforms.kernelRadius.value=4,c.overlayMaterial=c.getOverlayMaterial(),l=s.C,c.copyUniforms=a.UniformsUtils.clone(l.uniforms),c.copyUniforms.opacity.value=1,c.materialCopy=new a.ShaderMaterial({uniforms:c.copyUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,blending:a.NoBlending,depthTest:!1,depthWrite:!1,transparent:!0}),c.enabled=!0,c.needsSwap=!1,c._oldClearColor=new a.Color,c.oldClearAlpha=1,c.fsQuad=new i.T(null),c.tempPulseColor1=new a.Color,c.tempPulseColor2=new a.Color,c.textureMatrix=new a.Matrix4,c}return t=n,(e=[{key:"dispose",value:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose(),this.depthMaterial.dispose(),this.prepareMaskMaterial.dispose(),this.edgeDetectionMaterial.dispose(),this.separableBlurMaterial1.dispose(),this.separableBlurMaterial2.dispose(),this.overlayMaterial.dispose(),this.materialCopy.dispose(),this.fsQuad.dispose()}},{key:"setSize",value:function(e,t){this.renderTargetMaskBuffer.setSize(e,t),this.renderTargetDepthBuffer.setSize(e,t),e=Math.round(e/this.downSampleRatio),t=Math.round(t/this.downSampleRatio),this.renderTargetMaskDownSampleBuffer.setSize(e,t),this.renderTargetBlurBuffer1.setSize(e,t),this.renderTargetEdgeBuffer1.setSize(e,t),this.separableBlurMaterial1.uniforms.texSize.value.set(e,t),e=Math.round(e/2),t=Math.round(t/2),this.renderTargetBlurBuffer2.setSize(e,t),this.renderTargetEdgeBuffer2.setSize(e,t),this.separableBlurMaterial2.uniforms.texSize.value.set(e,t)}},{key:"changeVisibilityOfSelectedObjects",value:function(e){var t=this._visibilityCache;function r(r){r.isMesh&&(!0===e?r.visible=t.get(r):(t.set(r,r.visible),r.visible=e))}for(var n=0;n<this.selectedObjects.length;n++)this.selectedObjects[n].traverse(r)}},{key:"changeVisibilityOfNonSelectedObjects",value:function(e){var t=this._visibilityCache,r=[];function n(e){e.isMesh&&r.push(e)}for(var a=0;a<this.selectedObjects.length;a++)this.selectedObjects[a].traverse(n);this.renderScene.traverse((function(n){if(n.isMesh||n.isSprite){for(var a,i=!1,s=0;s<r.length;s++)if(r[s].id===n.id){i=!0;break}!1===i&&(a=n.visible,!1!==e&&!0!==t.get(n)||(n.visible=e),t.set(n,a))}else(n.isPoints||n.isLine)&&(!0===e?n.visible=t.get(n):(t.set(n,n.visible),n.visible=e))}))}},{key:"updateTextureMatrix",value:function(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}},{key:"render",value:function(e,t,r,a,i){var s,o;0<this.selectedObjects.length&&(e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha(),s=e.autoClear,e.autoClear=!1,i&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1),o=this.renderScene.background,this.renderScene.background=null,this.renderScene.overrideMaterial=this.depthMaterial,e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.changeVisibilityOfSelectedObjects(!0),this._visibilityCache.clear(),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.renderTargetDepthBuffer.texture,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this.changeVisibilityOfNonSelectedObjects(!0),this._visibilityCache.clear(),this.renderScene.background=o,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),0<this.pulsePeriod&&(o=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2,this.tempPulseColor1.multiplyScalar(o),this.tempPulseColor2.multiplyScalar(o)),this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=n.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,i&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s),this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=r.texture,e.setRenderTarget(null),this.fsQuad.render(e))}},{key:"getPrepareMaskMaterial",value:function(){return new a.ShaderMaterial({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new a.Vector2(.5,.5)},textureMatrix:{value:null}},vertexShader:"#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t\tvPosition = mvPosition;\n\n\t\t\t\t\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t\t\t\t\t#ifdef USE_INSTANCING\n\n\t\t\t\t\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t\t\t\t\t#endif\n\t\t\t\t\t\n\t\t\t\t\tworldPosition = modelMatrix * worldPosition;\n\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\n\t\t\t\t}",fragmentShader:"#include <packing>\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tuniform sampler2D depthTexture;\n\t\t\t\tuniform vec2 cameraNearFar;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n\t\t\t\t\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n\t\t\t\t\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n\t\t\t\t\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\n\t\t\t\t}"})}},{key:"getEdgeDetectionMaterial",value:function(){return new a.ShaderMaterial({uniforms:{maskTexture:{value:null},texSize:{value:new a.Vector2(.5,.5)},visibleEdgeColor:{value:new a.Vector3(1,1,1)},hiddenEdgeColor:{value:new a.Vector3(1,1,1)}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n\t\t\t\t}"})}},{key:"getSeperableBlurMaterial",value:function(e){return new a.ShaderMaterial({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new a.Vector2(.5,.5)},direction:{value:new a.Vector2(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float kernelRadius;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat sigma = kernelRadius/2.0;\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, sigma);\n\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n\t\t\t\t\tvec2 uvOffset = delta;\n\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = kernelRadius * float(i) / float(MAX_RADIUS);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, sigma);\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\n\t\t\t\t\t\tweightSum += (2.0 * w);\n\t\t\t\t\t\tuvOffset += delta;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\n\t\t\t\t}"})}},{key:"getOverlayMaterial",value:function(){return new a.ShaderMaterial({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform sampler2D edgeTexture1;\n\t\t\t\tuniform sampler2D edgeTexture2;\n\t\t\t\tuniform sampler2D patternTexture;\n\t\t\t\tuniform float edgeStrength;\n\t\t\t\tuniform float edgeGlow;\n\t\t\t\tuniform bool usePatternTexture;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\n\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n\t\t\t\t\tif(usePatternTexture)\n\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n\t\t\t\t\tgl_FragColor = finalColor;\n\t\t\t\t}",blending:a.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(i.w);h.BlurDirectionX=new a.Vector2(1,0),h.BlurDirectionY=new a.Vector2(0,1);class d{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.outlinePass||(this.outlinePass=new h(this.mtuPP.rtSize,this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.outlinePass)}setOutlineData(e,t){this.outlinePass[e]="visibleEdgeColor"===e||"hiddenEdgeColor"===e?new n.Sf.Color(t):t}dispose(){this.outlinePass&&(this.outlinePass.dispose(),this.outlinePass=null)}addSelectedObject(e,t=!0){this.outlinePass&&e&&(this.outlinePass.selectedObjects||(this.outlinePass.selectedObjects=[]),t?this.isObjExist(e)||(e.userData.outline=!0,this.outlinePass.selectedObjects.push(e)):this.outlinePass.selectedObjects.map(((t,r)=>{t.uuid===e.uuid&&(e.userData.outline=!1,this.outlinePass.selectedObjects.splice(r,1))})))}clearAllOutlineObj(){this.outlinePass&&(this.outlinePass.selectedObjects=[])}isObjExist(e){if(!e||!this.outlinePass||!this.outlinePass.selectedObjects)return!1;let t=!1;return this.outlinePass.selectedObjects.forEach((r=>{e.uuid===r.uuid&&(t=!0)})),t}enablePass(e){this.outlinePass&&this.outlinePass.enabled!==e&&(this.outlinePass.enabled=e)}}const p=e=>e.userData.outline},7738:(e,t,r)=>{r.d(t,{Z:()=>a,s:()=>i});var n=r(8881);class a{constructor(e){this.setSize=(e,t)=>{var{width:r,height:n}=this.getDomSize();this.runScene.setSize(e||r,t||n),this.runScene.cb.renderEx.setSize.cb({width:r,height:n})},this.runScene=e,this.runScene.cb.resize.add("render-ex-resize",(()=>{this.setSize()}))}setBackground(e){this.runScene.assetsEx.engineDom.style.background=e}create(e){let t=new n.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance"});return t.domElement.style.position="absolute",t.setPixelRatio(window.devicePixelRatio),t.shadowMap.enabled=!0,t.shadowMap.type=n.PCFSoftShadowMap,t.physicallyCorrectLights=!0,t.localClippingEnabled=!0,e.appendChild(t.domElement),t}getDomSize(){var{width:e,height:t}=this.runScene.assetsEx.get().engineDom.getBoundingClientRect();return{width:e,height:t}}}const i=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()}},5857:(e,t,r)=>{r.d(t,{Gc:()=>ca,al:()=>et,ch:()=>h,Az:()=>Ye,Sf:()=>ua,cQ:()=>u,ZP:()=>ha}),t={};var n=(r.r(t),r.d(t,{FBXLoader:()=>Qt}),r(3300)),a=r.n(n),i=r(6001),s=r(8881);class o{constructor(e){this.runScene=e}}var l=r(2353),c=r(5247),u=r(4457),h=r(8715);class d extends o{constructor(e){super(e),this.map={},this.clock=new s.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},this.clean=()=>{this.reset()},e.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)})),e.cb.model.remove.add("anima-parse",(({model:e})=>{this.onModelDelete(e)})),this.runScene.cb.clean.add("EngineHelper",this.clean)}onModelDelete(e){e.traverse((e=>{(0,h.withAnima)(e)&&e.animations.map((t=>{t.id&&(this.close(e,t.name),delete this.map[t.id])}))}))}parses(e){e.traverse((e=>this.parse(e)))}findId(e,t){for(const r of e.animations)if(r.name===t)return r.id}parse(e,t){if(0!==e.animations.length||t){const a=e.animations.length?e.animations:l.B.parse(t),o=new s.AnimationMixer(e);for(const t of a){var r=(0,i.getId)(),n=(t.id=r,o.clipAction(t));const a={finished:()=>{},loop:()=>{}};o.addEventListener("finished",(()=>a.finished())),o.addEventListener("loop",(()=>a.loop())),this.map[r]={mixer:o,action:n,model:e,time:0,runState:"close",clip:t,eventMap:a}}a.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t,r){e=this.findId(e,t);const n=this.map[e];if(n&&!this.playings.has(n)){t=(0,u.mergeObject)({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},r);const{onProgress:a,onBeforeEnd:i,onLoop:s,onFinished:o,lastFrame:l,loop:h,reset:d}=t,{action:p,clip:f,eventMap:m}=(this.map[e].options=t,n);p.stop(),r=d?0:n.time,p.time=r,this.setPlayState(n,!0),d&&p.reset(),p.play();let g=!(n.runState="play");this.setUpdates(e,(()=>{var e=(0,u.getProgress)(p.time,f.duration,!0);99<=e&&!g&&(i(),g=!0),a(e)})),h?(p.loop=c.Z.LoopRepeat,m.loop=s):(l&&(p.clampWhenFinished=!0),p.loop=c.Z.LoopOnce,m.finished=()=>{this.setPlayState(n,!1),a(100),o()})}}pause(e,t){e=this.findId(e,t);const r=this.map[e];r&&this.playings.has(r)&&(this.updateTime(r),this.setPlayState(r,!1),r.options.onPause(),r.runState="pause")}resume(e,t){var r=this.findId(e,t);const n=this.map[r];n&&this.playings.has(n)&&(n.options.onResume(),this.play(e,t,null==(r=this.map[t])?void 0:r.options))}playAll(){this.pauseAll(),this.playings.clear(),Object.values(this.map).map((e=>{this.playings.add(e);const t=e.action;t.time=0,t.play()})),this.anima()}setValue(e){let t=this.clock.getDelta();Object.keys(this.map).map((r=>{const{mixer:n,action:a}=this.map[r];a.play(),a.time=e,n.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,i.mapObj)(this.updates,((e,r)=>r(t)))}anima(){let e=this.clock.getDelta();this.update(e),this.playings.forEach((t=>{t.mixer.update(e)})),this.tickIndex=window.requestAnimationFrame(this.anima.bind(this))}closeAnima(){window.cancelAnimationFrame(this.tickIndex)}resetItem(e){const{mixer:t,action:r}=e;r.reset(),r.stop(),t.time=0}pauseAll(){this.closeAnima(),this.playings.forEach((e=>this.resetItem(e))),this.playings.clear()}reset(){this.pauseAll(),this.map={},this.playings.clear(),this.closeAnima()}updateTime(e,t){e.time=t||e.action.time}setPlayState(e,t){t?(this.playings.add(e),1===this.playings.size&&this.anima()):(this.playings.delete(e),delete this.updates[e.clip.id],0===this.playings.size&&this.closeAnima())}getItem(e,t){return e=this.findId(e,t),this.map[e]}close(e,t,r){e=this.findId(e,t);const n=this.map[e];n&&this.playings.has(n)&&n.options&&((t=(0,u.mergeObject)({resetAction:!0},r).resetAction)&&n.action.reset(),this.setPlayState(n,!1),this.updateTime(n,0),n.options.onClose(),n.options=null,n.runState="pause")}setUpdates(e,t){this.updates[e]=t}fadeTo(e){var{lastModel:e,lastName:t,nextModel:r,nextName:n,duration:a}=e;e=this.findId(e,t);const i=this.map[e];i&&(t=this.findId(r,n),(e=this.map[t])&&i.action.crossFadeTo(e.action,a,!0))}resetTime(e,t){const r=this.getItem(e,t);r&&(r.action.time=0)}}var p=r(3693),f=r(699);class m{constructor(e){this.scene=null,this.camera=null,this.controls=null,this.renderer=null,this.engineDom=null,this.clean=()=>{var e=this.get().camera;this.runScene.cameraEx.reset(e)},this.disposeRender=e=>{e&&(e.render=()=>{},e.domElement.remove())},this.runScene=e,this.runScene.cb.clean.add("assets",this.clean)}initRender3(){const e=new p.lX;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.style.top=String(0),e.domElement.className="css3dRenderer",this.engineDom.appendChild(e.domElement),this.runScene.cb.resize.add("render-3",(({width:t,height:r})=>{e.setSize(t,r)})),e}initRender2(){const e=new f.M;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.classList.add("css2dRenderer"),e.domElement.style.top="0px",e.domElement.style.left="0px",this.engineDom.insertBefore(e.domElement,this.engineDom.childNodes[0]),this.runScene.cb.resize.add("render-2",(({width:t,height:r})=>{e.setSize(t,r)})),e}reset(){var e=this.get().camera;this.runScene.renderEx.setSize(),this.runScene.cameraEx.reset(e)}dispose(){this.disposeRender(this.render2),this.disposeRender(this.render3)}setRender2(e){e?this.render2=this.initRender2():this.render2&&(this.disposeRender(this.render2),this.render2=null)}setRender3(e){e?this.render3=this.initRender3():this.render3&&(this.disposeRender(this.render3),this.render3=null)}init(e){var t=this.runScene.sceneEx.create(),r=this.runScene.cameraEx.pCam,n=this.runScene.renderEx.create(e),a=this.runScene.controlsEx.create(r,e),{render2:i,render3:s}=this.runScene.optionsEx.options;return this.camera=r,this.scene=t,this.renderer=n,this.controls=a,this.engineDom=e,this.runScene.renderEx.setSize(),this.setRender2(i),this.setRender3(s),{scene:t,camera:r,render:n,controls:a,engineDom:e}}get(){var{scene:e,renderer:t,controls:r,engineDom:n}=this;return{scene:e,camera:this.runScene.cameraEx.getCamera(),renderer:t,controls:r,engineDom:n}}}class g{constructor(){this.cbs=[],this.cb=e=>this.cbs.map((t=>{var r;return null==(r=t.fn)?void 0:r.call(t,e)})),this.emit=this.cb}add(e,t){return this.cbs.push({fn:t,name:e})}on(e,t){return this.add(t||"custom_"+(0,i.getId)(),e)}get(e){var t=this.cbs.findIndex((t=>t.name===e));if(-1!==t)return{data:this.cbs[t],index:t}}reset(e,t){return!!(e=this.get(e))&&(e.data.fn=t,!0)}remove(e){this.reset(e,null)}delete(e){e=(this.get(e)||{}).index,this.cbs.splice(e,1)}}class v{constructor(){this.resize=new g,this.renderEx={setSize:new g},this.setSelectMaterial=new g,this.setScene=new g,this.reset=new g,this.render=new g,this.tick=new g,this.baseLog=new g,this.inited=new g,this.texture={add:new g,remove:new g,set:new g,setAnima:new g},this.model={multiSelect:{setEmpty:new g},change:new g,setSelect:new g,click:new g,add:new g,remove:new g,multipDrop:new g,focus:new g,unFocus:new g,changeName:new g,setOpen:new g,setMainStatue:new g,setVisible:new g,setParent:new g,setLayers:new g,setOutline:new g,clone:new g,dispose:new g},this.material={add:new g,remove:new g,dispose:new g,setName:new g},this.unique={material:{add:new g}},this.tranControls={changing:new g},this.undo={addUndos:new g,addRedus:new g,removeUndos:new g,undoByIndex:new g,reset:new g},this.scene={save:new g,saveNet:new g,setEnvStrength:new g},this.timeLine={setProgress:new g,playGroup:new g,setGroupMap:new g,reset:new g,closeGroup:new g},this.events={key:{down:new g,up:new g},mouse:{move:new g,down:new g,up:new g},pointer:{rightTrigger:new g,down:new g,up:new g,move:new g,trigger:new g},model:{addOptions:new g}},this.pp={glow:{setData:new g,setStatus:new g},outline:{setData:new g,setStatus:new g},ao:{setData:new g,setStatus:new g},vignette:{setData:new g,setStatus:new g}},this.load={getJSON:new g,progress:new g,complete:new g},this.exporter={gltf:{before:new g,complete:new g}},this.loaderer={gltf:{loadNode:new g,lazyLoadedTexture:new g,loaded:new g,modelLoaded:new g,progress:new g,getJSON:new g,getArrayBuffer:new g,complete:new g}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new g),e[t])}),this.tags={parseJSON:new g,clear:new g},this.snapshot={create:new g,set:new g,resetItem:new g,delete:new g},this.clean=new g,this.objects={sky:{setState:new g}},this.error=new g}}var b=r(4230);function y(e,t){this.orbit=t,this.object=e,this.target=new c.Z.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=.25;var r,n,a,i,s,o,l,u,h,d,p,f,m=this,g=0,v=0,b=0,y=0,x=1,w=new c.Z.Vector3,S=!1;this.getPolarAngle=function(){return v},this.getAzimuthalAngle=function(){return g},this.setPolarAngle=function(e){v=e,this.forceUpdate()},this.setAzimuthalAngle=function(e){g=e,this.forceUpdate()},this.rotateLeft=function(e){y-=e},this.rotateUp=function(e){b-=e},this.panLeft=(r=new c.Z.Vector3,function(e){var t=this.object.matrix.elements;r.set(t[0],t[1],t[2]),r.multiplyScalar(-e),w.add(r)}),this.panUp=(n=new c.Z.Vector3,function(e,r){t.screenSpacePanning?n.setFromMatrixColumn(r,1):(n.setFromMatrixColumn(r,0),n.crossVectors(m.object.up,n)),n.multiplyScalar(e),w.add(n)}),this.pan=function(e,t,r,n){var a;m.object instanceof c.Z.PerspectiveCamera?(a=m.object.position.clone().sub(m.target).length(),a*=Math.tan(m.object.fov/2*Math.PI/180),m.panLeft(2*e*a/n),m.panUp(2*t*a/n,m.object.matrix)):m.object instanceof c.Z.OrthographicCamera?(m.panLeft(e*(m.object.right-m.object.left)/r),m.panUp(t*(m.object.top-m.object.bottom)/n)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(e){m.object instanceof c.Z.PerspectiveCamera?x/=e:m.object instanceof c.Z.OrthographicCamera?(m.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*e)),m.object.updateProjectionMatrix(),S=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.dollyOut=function(e){m.object instanceof c.Z.PerspectiveCamera?x*=e:m.object instanceof c.Z.OrthographicCamera?(m.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/e)),m.object.updateProjectionMatrix(),S=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.forceUpdate=(a=new c.Z.Vector3,i=(new c.Z.Quaternion).setFromUnitVectors(e.up,new c.Z.Vector3(0,1,0)),s=i.clone().invert(),o=new c.Z.Vector3,l=new c.Z.Quaternion,function(){var e=this.object.position,t=(a.copy(e).sub(this.target),a.applyQuaternion(i),g=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,g)),v=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,v)),v=Math.max(1e-6,Math.min(Math.PI-1e-6,v)),a.length()*x);return t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(w),a.x=t*Math.sin(v)*Math.sin(g),a.y=t*Math.cos(v),a.z=t*Math.sin(v)*Math.cos(g),a.applyQuaternion(s),e.copy(this.target).add(a),this.object.lookAt(this.target),!0===this.enableDamping?(y*=1-this.dampingFactor,b*=1-this.dampingFactor):b=y=0,x=1,w.set(0,0,0),!(!(S||1e-6<o.distanceToSquared(this.object.position)||1e-6<8*(1-l.dot(this.object.quaternion)))||(o.copy(this.object.position),l.copy(this.object.quaternion),S=!1))}),this.update=(u=new c.Z.Vector3,h=(new c.Z.Quaternion).setFromUnitVectors(e.up,new c.Z.Vector3(0,1,0)),d=h.clone().invert(),p=new c.Z.Vector3,f=new c.Z.Quaternion,function(){var e=this.object.position,t=(u.copy(e).sub(this.target),u.applyQuaternion(h),g=Math.atan2(u.x,u.z),v=Math.atan2(Math.sqrt(u.x*u.x+u.z*u.z),u.y),g+=y,v+=b,g=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,g)),v=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,v)),v=Math.max(1e-6,Math.min(Math.PI-1e-6,v)),u.length()*x);return t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(w),u.x=t*Math.sin(v)*Math.sin(g),u.y=t*Math.cos(v),u.z=t*Math.sin(v)*Math.cos(g),u.applyQuaternion(d),e.copy(this.target).add(u),this.object.lookAt(this.target),!0===this.enableDamping?(y*=1-this.dampingFactor,b*=1-this.dampingFactor):b=y=0,x=1,w.set(0,0,0),!(!(S||1e-6<p.distanceToSquared(this.object.position)||1e-6<8*(1-f.dot(this.object.quaternion)))||(p.copy(this.object.position),f.copy(this.object.quaternion),S=!1))})}function x(e,t){var r=new y(e,this),n=(this.domElement=void 0!==t?t:document,Object.defineProperty(this,"constraint",{get:function(){return r}}),this.getPolarAngle=function(){return r.getPolarAngle()},this.getAzimuthalAngle=function(){return r.getAzimuthalAngle()},this.setPolarAngle=function(e){return r.setPolarAngle(e)},this.setAzimuthalAngle=function(e){return r.setAzimuthalAngle(e)},this.enabled=!0,this.center=this.target,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.screenSpacePanning=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:c.Z.MOUSE.LEFT,ZOOM:c.Z.MOUSE.MIDDLE,PAN:c.Z.MOUSE.RIGHT},this),a=new c.Z.Vector2,i=new c.Z.Vector2,s=new c.Z.Vector2,o=new c.Z.Vector2,l=new c.Z.Vector2,u=new c.Z.Vector2,h=new c.Z.Vector2,d=new c.Z.Vector2,p=new c.Z.Vector2,f=-1,m=f,g=(this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,{type:"change"}),v={type:"start"},b={type:"end"};function x(e,t){var a=n.domElement===document?n.domElement.body:n.domElement;r.pan(e,t,a.clientWidth,a.clientHeight)}function w(){return Math.pow(.95,n.zoomSpeed)}function S(e){if(!1!==n.enabled){if(e.preventDefault(),e.button===n.mouseButtons.ORBIT){if(!1===n.enableRotate)return;m=0,a.set(e.clientX,e.clientY)}else if(e.button===n.mouseButtons.ZOOM){if(!1===n.enableZoom)return;m=1,h.set(e.clientX,e.clientY)}else if(e.button===n.mouseButtons.PAN){if(!1===n.enablePan)return;m=2,o.set(e.clientX,e.clientY)}m!==f&&(document.addEventListener("mousemove",M,!1),document.addEventListener("mouseup",T,!1),n.dispatchEvent(v))}}function M(e){if(null!=e&&null!=(t=e.preventDefault)&&t.call(e),!1!==n.enabled){var t=n.domElement===document?n.domElement.body:n.domElement;if(0===m){if(!1===n.enableRotate)return;i.set(e.clientX,e.clientY),s.subVectors(i,a),r.rotateLeft(2*Math.PI*s.x/t.clientWidth*n.rotateSpeed),r.rotateUp(2*Math.PI*s.y/t.clientHeight*n.rotateSpeed),a.copy(i)}else if(1===m){if(!1===n.enableZoom)return;d.set(e.clientX,e.clientY),p.subVectors(d,h),0<p.y?r.dollyIn(w()):p.y<0&&r.dollyOut(w()),h.copy(d)}else if(2===m){if(!1===n.enablePan)return;l.set(e.clientX,e.clientY),u.subVectors(l,o),x(u.x,u.y),o.copy(l)}m!==f&&n.update()}}function T(){!1!==n.enabled&&(document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",T),n.dispatchEvent(b),m=f)}function _(e){var t;!1!==n.enabled&&!1!==n.enableZoom&&m===f&&(e.stopPropagation(),void(t=0)!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),0<t?r.dollyOut(w()):t<0&&r.dollyIn(w()),n.update(),n.dispatchEvent(v),n.dispatchEvent(b))}function E(e){if(!1!==n.enabled&&!1!==n.enableKeys&&!1!==n.enablePan)switch(e.keyCode){case n.keys.UP:x(0,n.keyPanSpeed),n.update();break;case n.keys.BOTTOM:x(0,-n.keyPanSpeed),n.update();break;case n.keys.LEFT:x(n.keyPanSpeed,0),n.update();break;case n.keys.RIGHT:x(-n.keyPanSpeed,0),n.update()}}function k(e){if(!1!==n.enabled){switch(e.touches.length){case 1:if(!1===n.enableRotate)return;m=3,a.set(e.touches[0].pageX,e.touches[0].pageY);break;case 2:if(!1===n.enableZoom)return;m=4;var t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY;t=Math.sqrt(t*t+r*r),h.set(0,t);break;case 3:if(!1===n.enablePan)return;m=5,o.set(e.touches[0].pageX,e.touches[0].pageY);break;default:m=f}m!==f&&n.dispatchEvent(v)}}function D(e){if(e.stopPropagation(),!1!==n.enabled){var t=n.domElement===document?n.domElement.body:n.domElement;switch(e.touches.length){case 1:if(!1===n.enableRotate)return;if(3!==m)return;i.set(e.touches[0].pageX,e.touches[0].pageY),s.subVectors(i,a),r.rotateLeft(2*Math.PI*s.x/t.clientWidth*n.rotateSpeed),r.rotateUp(2*Math.PI*s.y/t.clientHeight*n.rotateSpeed),a.copy(i),n.update();break;case 2:if(!1===n.enableZoom)return;if(4!==m)return;var c=e.touches[0].pageX-e.touches[1].pageX,g=e.touches[0].pageY-e.touches[1].pageY;c=Math.sqrt(c*c+g*g),d.set(0,c),p.subVectors(d,h),0<p.y?r.dollyOut(w()):p.y<0&&r.dollyIn(w()),h.copy(d),n.update();break;case 3:if(!1===n.enablePan)return;if(5!==m)return;l.set(e.touches[0].pageX,e.touches[0].pageY),u.subVectors(l,o),x(u.x,u.y),o.copy(l),n.update();break;default:m=f}}}function P(){!1!==n.enabled&&(n.dispatchEvent(b),m=f)}function A(e){e.preventDefault()}this.update=function(){this.autoRotate&&m===f&&r.rotateLeft(2*Math.PI/60/60*n.autoRotateSpeed),!0===r.update()&&this.dispatchEvent(g)},this.reset=function(){m=f,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(g),this.update()},this.dispose=function(){this.domElement.removeEventListener("contextmenu",A,!1),this.domElement.removeEventListener("mousedown",S,!1),this.domElement.removeEventListener("mousewheel",_,!1),this.domElement.removeEventListener("MozMousePixelScroll",_,!1),this.domElement.removeEventListener("touchstart",k,!1),this.domElement.removeEventListener("touchend",P,!1),this.domElement.removeEventListener("touchmove",D,!1),document.removeEventListener("mousemove",M,!1),document.removeEventListener("mouseup",T,!1),window.removeEventListener("keydown",E,!1)},this.domElement.addEventListener("contextmenu",A,!1),this.domElement.addEventListener("mousedown",S,!1),this.domElement.addEventListener("mousewheel",_,{passive:!0}),this.domElement.addEventListener("MozMousePixelScroll",_,!1),this.domElement.addEventListener("touchstart",k,{passive:!0}),this.domElement.addEventListener("touchend",P,!1),this.domElement.addEventListener("touchmove",D,{passive:!0}),window.addEventListener("keydown",E,!1),this.update()}c.Z.MOUSE,(x.prototype=Object.create(c.Z.EventDispatcher.prototype)).constructor=x,Object.defineProperties(x.prototype,{object:{get:function(){return this.constraint.object}},target:{get:function(){return this.constraint.target},set:function(e){console.warn("Three.OrbitControls: target is now immutable. Use target.set() instead."),this.constraint.target.copy(e)}},minDistance:{get:function(){return this.constraint.minDistance},set:function(e){this.constraint.minDistance=e}},maxDistance:{get:function(){return this.constraint.maxDistance},set:function(e){this.constraint.maxDistance=e}},minZoom:{get:function(){return this.constraint.minZoom},set:function(e){this.constraint.minZoom=e}},maxZoom:{get:function(){return this.constraint.maxZoom},set:function(e){this.constraint.maxZoom=e}},minPolarAngle:{get:function(){return this.constraint.minPolarAngle},set:function(e){this.constraint.minPolarAngle=e}},maxPolarAngle:{get:function(){return this.constraint.maxPolarAngle},set:function(e){this.constraint.maxPolarAngle=e}},minAzimuthAngle:{get:function(){return this.constraint.minAzimuthAngle},set:function(e){this.constraint.minAzimuthAngle=e}},maxAzimuthAngle:{get:function(){return this.constraint.maxAzimuthAngle},set:function(e){this.constraint.maxAzimuthAngle=e}},enableDamping:{get:function(){return this.constraint.enableDamping},set:function(e){this.constraint.enableDamping=e}},dampingFactor:{get:function(){return this.constraint.dampingFactor},set:function(e){this.constraint.dampingFactor=e}},noZoom:{get:function(){return console.warn("Three.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("Three.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("Three.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("Three.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("Three.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("Three.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("Three.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("Three.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("Three.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.constraint.enableDamping},set:function(e){console.warn("Three.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.constraint.enableDamping=!e}},dynamicDampingFactor:{get:function(){return console.warn("Three.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor},set:function(e){console.warn("Three.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor=e}}});const w=x;class S{create(e,t){return new w(e,t)}static toJSON(e){return e.target}static setTarget(e,t,r){var{x:n,y:a,z:i}=t,{x:r,y:s,z:o}=r||e.target;this.setTargetData.anima&&(this.setTargetData.anima.kill(),this.setTargetData.anima=null,this.setTarget(e,t,this.setTargetData.nowData)),this.setTargetData.anima=(0,u.anima)({x:r,y:s,z:o},{x:n,y:a,z:i},.5,(t=>{var{x:r,y:n,z:a}=t;e.target.set(r,n,a),e.update(),this.setTargetData.nowData=t}),(()=>{this.setTargetData.anima=null}))}}S.setTargetData={anima:null,nowData:null};var M=r(1794),T=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const _=i.fnDebounce;class E{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new M.Z,this.specialKeyDebounce=_((()=>{this.ctrl=!1,this.shift=!1,this.alt=!1}),1e3),this.allFn={s_saveScene:()=>T(this,void 0,void 0,(function*(){this.events.runScene.optionsEx.log("正在保存","base","info"),this.events.runScene.cb.scene.saveNet.cb("")})),d_copyModel:()=>{var e,t=this.events.runScene.modelEx.select;t&&(this.events.runScene.modelEx.selectNull(),(e=this.events.runScene.modelEx.clone(t,!1))&&this.events.runScene.modelEx.add(e,t.parent,{isClone:!0,select:!0}))},f_focusModel:()=>{var e=this.events.runScene.modelEx.select;e&&this.events.runScene.modelEx.focus(e)},z_undo:e=>{this.events.runScene.undoEx.undo()},y_redo:e=>{this.events.runScene.undoEx.redo()}},this.events=e}init(e){"running"!==this.events.runScene.optionsEx.options.mode&&(document.addEventListener("keydown",this.keyDown.bind(this)),document.addEventListener("keyup",this.keyUp.bind(this)),this.events.runScene.cb.model.setSelect.add("reset-unexec",(()=>{this.unExec.delete("delete")})))}keyDown(e){return T(this,void 0,void 0,(function*(){if("INPUT"!==document.activeElement.nodeName){var t=e.key.toLowerCase();if(this.events.runScene.cb.events.key.down.cb({key:t,event:e}),!this.unExec.get(t))switch(t){case" ":break;case"s":this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene());break;case"d":this.ctrl&&(e.preventDefault(),this.allFn.d_copyModel());break;case"alt":this.alt=!0,this.specialKeyDebounce();break;case"control":case"ctrl":this.ctrl=!0,this.specialKeyDebounce();break;case"shift":this.shift=!0,this.specialKeyDebounce();break;case"f11":this.events.runScene.cb.resize.cb(this.events.runScene.renderEx.getDomSize());break;case"w":e.preventDefault(),e.stopPropagation(),this.events.runScene.helperEx.transContro.changeMode("position");break;case"e":this.events.runScene.helperEx.transContro.changeMode("rotation");break;case"r":this.events.runScene.helperEx.transContro.changeMode("scale"),e.preventDefault();break;case"f":this.allFn.f_focusModel();break;case"delete":this.events.runScene.helperEx.unfocus();var r=this.events.runScene.multipSelector.getSelectedList("value");this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||r),r&&this.events.runScene.multipSelector.delete();break;case"z":if(!this.ctrl)return;this.allFn.z_undo(e);break;case"y":if(!this.ctrl)return;this.allFn.y_redo(e)}}}))}keyUp(e){if("INPUT"!==document.activeElement.nodeName){var t=e.key.toLowerCase();switch(this.events.runScene.cb.events.key.up.cb({key:t,event:e}),t){case"meta":break;case"s":if(this.ctrl)break;return;case"alt":this.alt=!1;break;case"control":case"ctrl":this.ctrl=!1;break;case"shift":this.shift=!1}}}}var k=r(3801);class D{constructor(e){this.downPosition={0:{x:0,y:0},2:{x:0,y:0}},this.enableUp=!0,this.isMove=!1,this.moveEvent=new MouseEvent("move"),this.down=e=>{0!==e.button&&2!==e.button||(this.downPosition[e.button]={x:e.offsetX,y:e.offsetY}),this.isMove=!0},this.up=e=>{var t,r,n,a;this.isMove=!1,1===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.offsetX,r=e.offsetY,({x:n,y:a}=this.downPosition[e.button]),t===n&&r===a&&(0===e.button&&this.trigger(e),2===e.button&&(this.events.runScene.modelEx.select||this.trigger(e),this.events.runScene.cb.events.pointer.rightTrigger.cb(e))))},this.selectable=!0,this.events=e}init(e){var t=this.events.runScene.optionsEx.options.event.base;let r=e;"dom"===t?r=e:"canvas"===t?r=this.events.runScene.assetsEx.renderer.domElement:"window"===t&&(r=window),r.addEventListener("pointerdown",this.down.bind(this)),r.addEventListener("pointerup",this.up.bind(this)),r.addEventListener("pointerdown",this.events.runScene.cb.events.pointer.down.cb),r.addEventListener("pointerup",this.events.runScene.cb.events.pointer.up.cb),r.addEventListener("pointermove",(e=>{this.moveEvent=e,this.events.runScene.cb.events.pointer.move.cb(e)})),r.addEventListener("mousemove",this.events.runScene.cb.events.mouse.move.cb),r.addEventListener("mousedown",this.events.runScene.cb.events.mouse.down.cb),r.addEventListener("mouseup",this.events.runScene.cb.events.mouse.up.cb)}getTriggerModels(e){const t=new s.Raycaster,r=new s.Vector2,{engineDom:n,camera:a,scene:i}=this.events.runScene.assetsEx.get();var{top:o,left:l,width:c,height:u}=n.getBoundingClientRect(),l=e.pageX-l,o=(e=e.pageY-o,r.x=l/c*2-1,r.y=-e/u*2+1,t.setFromCamera(r,a),i.children.filter((e=>{if((!this.events.runScene.helperEx.isHelper(e)||e.userData.id)&&!e.userData.unClick)return e})));const h=t.intersectObjects(o,!0);return this.events.runScene.cb.events.pointer.trigger.cb(h),h.map((e=>e.object))}removeHideOrLockModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)&&!k.zf.isLock(e,!0)&&h.selectableModel.is(e)))}trigger(e){let t=this.removeHideOrLockModel(this.getTriggerModels(e));if(this.selectable){if(!t)return this.events.runScene.multipSelector.setEmpty(),void this.events.runScene.modelEx.selectNull();if(this.events.runScene.helperEx.isHelper(t)&&(e=this.events.runScene.uniqueEx.getId(t),t=this.events.runScene.uniqueEx.model.get(e)),!this.enableUp){if(t===this.events.runScene.helperEx.transContro.multipObj)return;this.enableUp=!0}if(this.events.runScene.cb.model.click.cb(t),this.events.key.ctrl)return this.enableUp=!1,this.events.runScene.multipSelector.add(t);if(this.events.key.shift){const e=t.parent;return e?void e.children.map((e=>{this.events.runScene.multipSelector.add(e)})):void 0}this.events.runScene.modelEx.setSelectByModel(t),this.events.runScene.lightEx.isLight(t)&&this.events.runScene.lightEx.setSelect(t)}}}var P=r(272),A=r(3729);class O{constructor(e){this.options=new M.Z,this.addOptions=e=>{var{name:e,map:t}=e;this.options.set(e,t)},this.map={click:new M.Z},this.onClick=e=>{var t=(0,A.Ki)(e);if(t){const r=this.map.click.get(t);r&&r.map(((t,r)=>{const n=this.options.get(t);n&&n.parse({model:e,childs:r.toArray()})}))}},this.events=e}init(){this.events.runScene.cb.model.click.add("event-model",this.onClick),this.events.runScene.cb.events.model.addOptions.add("event-model",this.addOptions)}set(e){var t,{model:t,type:r,child:n,method:a}=e;if(t=(0,A.Ki)(t)){let i=this.map[a],s=i.get(t),o=(s||(s=new M.Z,i.set(t,s)),s.get(r));o||(o=new P.Z,s.set(r,o)),o.add(n),this.bindDataForModel(e)}}bindDataForModel(e){const{model:t,type:r,child:n,method:a}=e;let i=t.userData.events;i||(t.userData.events=i=[]),i.push(a+"-"+r+"-"+n)}}function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(){R=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=p.asyncIterator||"@@asyncIterator",i=p.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var a,i,s,o;return t=t&&t.prototype instanceof u?t:u,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(a=e,i=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return c;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,c):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,s),r)){if(r===c)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(a,i,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var c={};function u(){}function h(){}function d(){}var p,f,m=(s(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=u.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(a,i){function s(){return new t((function(n,s){!function n(a,i,s,o){var c;if("throw"!==(a=l(e[a],e,i)).type)return(i=(c=a.arg).value)&&"object"==C(i)&&r.call(i,"__await")?t.resolve(i.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(i).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,o)}));o(a.arg)}(a,i,n,s)}))}return n=n?n.then(s,s):s()}}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function y(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t,a=e[n];if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(a=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=a}return{next:S}}function S(){return{value:void 0,done:!0}}return s(m,"constructor",h.prototype=d),s(d,"constructor",h),h.displayName=s(d,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,a,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,a,i){void 0===i&&(i=Promise);var s=new v(o(t,r,n,a),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(m),s(m,i,"Generator"),s(m,n,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(y),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;0<=a;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(o&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}var s=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),y(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,a=this.tryEntries[t];if(a.tryLoc===e)return"throw"===(r=a.completion).type&&(n=r.arg,y(a)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}function L(e,t,r,n,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function U(e,t,r){t&&B(e.prototype,t),r&&B(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var j={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},F=function(){function e(){I(this,e),this.pluginCallbacks=[],this.register((function(e){return new le(e)})),this.register((function(e){return new ce(e)})),this.register((function(e){return new de(e)})),this.register((function(e){return new pe(e)})),this.register((function(e){return new fe(e)})),this.register((function(e){return new me(e)})),this.register((function(e){return new ue(e)})),this.register((function(e){return new he(e)})),this.register((function(e){return new ge(e)})),this.register((function(e){return new ve(e)}))}return U(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){for(var a=new oe,i=[],s=0,o=this.pluginCallbacks.length;s<o;s++)i.push(this.pluginCallbacks[s](a));a.setPlugins(i),a.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,n,a,t)}))}}]),e}(),N=5120,z=5121,V=5122,G=5123,H=(n=9728,9729),W=9984,q=9985,K=9986,Z=9987,X=33071,Q=33648,Y=10497,J="KHR_mesh_quantization",$={},ee=($[s.NearestFilter]=n,$[s.NearestMipmapNearestFilter]=W,$[s.NearestMipmapLinearFilter]=K,$[s.LinearFilter]=H,$[s.LinearMipmapNearestFilter]=q,$[s.LinearMipmapLinearFilter]=Z,$[s.ClampToEdgeWrapping]=X,$[s.RepeatWrapping]=Y,$[s.MirroredRepeatWrapping]=Q,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),te=new s.Color;function re(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function ne(e){return 4*Math.ceil(e/4)}function ae(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=ne(e.byteLength);if(n===e.byteLength)return e;var a=new Uint8Array(n);if(a.set(new Uint8Array(e)),0!==r)for(var i=e.byteLength;i<n;i++)a[i]=r;return a.buffer}function ie(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function se(e,t){return void 0!==e.toBlob?new Promise((function(r){return e.toBlob(r,t)})):("image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r}));var r}var oe=function(){function e(){I(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,r;return U(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=R().mark((function e(t,r){var n,a,i,s,o,l,c,u,h,d=arguments;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=2<d.length&&void 0!==d[2]?d[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:return i=(a=this).buffers,s=a.json,n=a.options,e.next=12,a.options.myOptions.helper.done(s);case 12:l=a.extensionsUsed,c=a.extensionsRequired,o=new Blob(i,{type:"application/octet-stream"}),l=Object.keys(l),c=Object.keys(c),0<l.length&&(s.extensionsUsed=l),0<c.length&&(s.extensionsRequired=c),s.buffers&&0<s.buffers.length&&(s.buffers[0].byteLength=o.size),!0===n.binary?((u=new FileReader).readAsArrayBuffer(o),u.onloadend=function(){var e=ae(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),ae((n=JSON.stringify(s),(new TextEncoder).encode(n).buffer),32)),a=new DataView(new ArrayBuffer(8)),i=(a.setUint32(0,n.byteLength,!0),a.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((l=new DataView(i)).setUint32(0,1179937895,!0),l.setUint32(4,2,!0),12+a.byteLength+n.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,o,!0),new Blob([i,a,n,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){r(c.result)}}):s.buffers&&0<s.buffers.length?((h=new FileReader).readAsDataURL(o),h.onloadend=function(){var e=h.result;s.buffers[0].uri=e,r(s)}):r(s);case 21:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(e){L(i,n,a,s,o,"next",e)}function o(e){L(i,n,a,s,o,"throw",e)}s(void 0)}))},function(e,t){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var a=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&a.gltfExtensions){for(var i in void 0===t.extensions&&(t.extensions={}),a.gltfExtensions)t.extensions[i]=a.gltfExtensions[i],n[i]=!0;delete a.gltfExtensions}0<Object.keys(a).length&&(t.extras=a)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(r)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new s.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),n=new s.Vector3,a=0,i=r.count;a<i;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;function r(e){return e.encoding===s.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=e?e.image:null,a=t?t.image:null,i=Math.max(n?n.width:0,a?a.width:0),o=Math.max(n?n.height:0,a?a.height:0),l=ie(),c=(l.width=i,l.height=o,l.getContext("2d")),u=(c.fillStyle="#00ffff",c.fillRect(0,0,i,o),c.getImageData(0,0,i,o));if(n){c.drawImage(n,0,0,i,o);for(var h=r(e),d=c.getImageData(0,0,i,o).data,p=2;p<d.length;p+=4)u.data[p]=256*h(d[p]/256)}if(a){c.drawImage(a,0,0,i,o);for(var f=r(t),m=c.getImageData(0,0,i,o).data,g=1;g<m.length;g+=4)u.data[g]=256*f(m[g]/256)}return c.putImageData(u,0,0),(n=(e||t).clone()).source=new s.Source(l),n.encoding=s.LinearEncoding,n}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,a){var i,o=this.json;switch(o.bufferViews||(o.bufferViews=[]),t){case N:case z:i=1;break;case V:case G:i=2;break;default:i=4}for(var l=ne(n*e.itemSize*i),c=new DataView(new ArrayBuffer(l)),u=0,h=r;h<r+n;h++)for(var d=0;d<e.itemSize;d++){var p=void 0;4<e.itemSize?p=e.array[h*e.itemSize+d]:(0===d?p=e.getX(h):1===d?p=e.getY(h):2===d?p=e.getZ(h):3===d&&(p=e.getW(h)),!0===e.normalized&&(p=s.MathUtils.normalize(p,e.array))),5126===t?c.setFloat32(u,p,!0):5124===t?c.setInt32(u,p,!0):5125===t?c.setUint32(u,p,!0):t===V?c.setInt16(u,p,!0):t===G?c.setUint16(u,p,!0):t===N?c.setInt8(u,p):t===z&&c.setUint8(u,p),u+=i}var f={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==a&&(f.target=a),34962===a&&(f.byteStride=e.itemSize*i),this.byteOffset+=l,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){var e=ae(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var a,i=this.json;if(e.array.constructor===Float32Array)a=5126;else if(e.array.constructor===Int32Array)a=5124;else if(e.array.constructor===Uint32Array)a=5125;else if(e.array.constructor===Int16Array)a=V;else if(e.array.constructor===Uint16Array)a=G;else if(e.array.constructor===Int8Array)a=N;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");a=z}if(0===(n=void 0===n?e.count:n))return null;var o,l=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},a=t;a<t+r;a++)for(var i=0;i<e.itemSize;i++){var o=void 0;4<e.itemSize?o=e.array[a*e.itemSize+i]:(0===i?o=e.getX(a):1===i?o=e.getY(a):2===i?o=e.getZ(a):3===i&&(o=e.getW(a)),!0===e.normalized&&(o=s.MathUtils.normalize(o,e.array))),n.min[i]=Math.min(n.min[i],o),n.max[i]=Math.max(n.max[i],o)}return n}(e,r=void 0===r?0:r,n);return r={bufferView:(void 0!==t&&(o=e===t.index?34963:34962),t=this.processBufferView(e,a,r,n,o)).id,byteOffset:t.byteOffset,componentType:a,count:n,max:l.max,min:l.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(r.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(r)-1}},{key:"processImage",value:function(e,t,r,n){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var i=this,o=i.cache,l=i.json,c=i.options,u=i.pending;if(void 0!==(o.images.has(e)||o.images.set(e,{}),o=o.images.get(e))[r=a+":flipY/"+r.toString()])return o[r];l.images||(l.images=[]);var h={mimeType:a},d=ie(),p=(d.width=Math.min(e.width,c.maxTextureSize),d.height=Math.min(e.height,c.maxTextureSize),d.getContext("2d"));if(void 0!==e.data){t!==s.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}else p.drawImage(e,0,0,d.width,d.height);return!0===c.binary?(null==n||null==(t=n.userData)?void 0:t.blob)instanceof Blob?u.push(new Promise((function(e){i.processBufferViewImage(n.userData.blob).then((function(t){h.bufferView=t,e()}))}))):u.push(se(d,a).then((function(e){return i.processBufferViewImage(e)})).then((function(e){h.bufferView=e}))):void 0!==d.toDataURL?h.uri=d.toDataURL(a):u.push(se(d,a).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){h.uri=e}))),p=l.images.push(h)-1,o[r]=p}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:$[e.magFilter],minFilter:$[e.minFilter],wrapS:$[e.wrapS],wrapT:$[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n=("image/webp"===(a=e.userData.mimeType)&&(a="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e,a)}),a=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,a),this.options.myOptions.helper.parseTexture({texture:e,textureDef:n}),a}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n={pbrMetallicRoughness:{}},a=(this.options.myOptions.helper.parseMaterial({material:e,materialDef:n,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),i=(re(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),i={index:this.processTexture(a)},this.applyTextureTransform(i,a),n.pbrMetallicRoughness.metallicRoughnessTexture=i),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(i=e.emissive,0<Math.max(i.r,i.g,i.b)&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),n.emissiveTexture=a)),e.normalMap&&(i={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(i.scale=e.normalScale.x),this.applyTextureTransform(i,e.normalMap),n.normalTexture=i),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===s.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return t.materials.set(e,i),i}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,i=e.material.length;a<i;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,c,u,h=e.geometry,d=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,p={},f={},m=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},b=h.getAttribute("normal"),y=(void 0===b||this.isNormalizedNormalAttribute(b)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),h.setAttribute("normal",this.createNormalizedNormalAttribute(b))),null);for(c in h.attributes)"morph"!==c.slice(0,5)&&(l=h.attributes[c],c=v[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(l))?f[c]=t.attributes.get(this.getUID(l)):(y=null,u=l.array,"JOINTS_0"!==c||u instanceof Uint16Array||u instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new s.BufferAttribute(new Uint16Array(u),l.itemSize,l.normalized)),null!==(u=this.processAccessor(y||l,h))&&(c.startsWith("_")||this.detectMeshQuantization(c,l),f[c]=u,t.attributes.set(this.getUID(l),u))));if(void 0!==b&&h.setAttribute("normal",b),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var M in e.morphTargetDictionary)S[e.morphTargetDictionary[M]]=M;for(var T=0;T<e.morphTargetInfluences.length;++T){var _,E={},k=!1;for(_ in h.morphAttributes)if("position"!==_&&"normal"!==_)k||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),k=!0);else{var D=h.morphAttributes[_][T],P=_.toUpperCase(),A=h.attributes[_];if(t.attributes.has(this.getUID(D,!0)))E[P]=t.attributes.get(this.getUID(D,!0));else{var O=D.clone();if(!h.morphTargetsRelative)for(var C=0,R=D.count;C<R;C++)for(var L=0;L<D.itemSize;L++)0===L&&O.setX(C,D.getX(C)-A.getX(C)),1===L&&O.setY(C,D.getY(C)-A.getY(C)),2===L&&O.setZ(C,D.getZ(C)-A.getZ(C)),3===L&&O.setW(C,D.getW(C)-A.getW(C));E[P]=this.processAccessor(O,h),t.attributes.set(this.getUID(A,!0),E[P])}}g.push(E),x.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&w.push(S[T])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((b=Array.isArray(e.material))&&0===h.groups.length)return null;for(var I=b?e.material:[e.material],B=b?h.groups:[{materialIndex:0,start:void 0,count:void 0}],U=0,j=B.length;U<j;U++){var F={mode:d,attributes:f},N=(this.serializeUserData(h,F),0<g.length&&(F.targets=g),null!==h.index&&(N=this.getUID(h.index),void 0===B[U].start&&void 0===B[U].count||(N+=":"+B[U].start+":"+B[U].count),t.attributes.has(N)?F.indices=t.attributes.get(N):(F.indices=this.processAccessor(h.index,h,B[U].start,B[U].count),t.attributes.set(N,F.indices)),null===F.indices&&delete F.indices),this.processMaterial(I[B[U].materialIndex]));null!==N&&(F.material=N),m.push(F)}return p.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),b=r.meshes.push(p)-1,t.meshes.set(o,b),b}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[J]){var r=void 0;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized"),t=e.split("_",1)[0],null!=(e=j[t])&&e.includes(r)&&(this.extensionsUsed[J]=!0,this.extensionsRequired[J]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:s.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,a=(r.animations||(r.animations=[]),(e=F.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),i=[],o=[],l=0;l<a.length;++l){var c=a[l],u=s.PropertyBinding.parseTrackName(c.name),h=s.PropertyBinding.findNode(t,u.nodeName),d=ee[u.propertyName];if(!(h="bones"===u.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(u.objectIndex):void 0:h)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;u=c.values.length/c.times.length;var p=void(d===ee.morphTargetInfluences&&(u/=h.morphTargetInfluences.length));!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",u/=3):p=c.getInterpolation()===s.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new s.BufferAttribute(c.times,1)),output:this.processAccessor(new s.BufferAttribute(c.values,u)),interpolation:p}),i.push({sampler:o.length-1,target:{node:n.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:i}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var o=[],l=new Float32Array(16*a.bones.length),c=new s.Matrix4,u=0;u<a.bones.length;++u){var h=a.bones[u];h=this.options.myOptions.helper.getNodeMapValueWithBone(h,r),o.push(h),c.copy(a.boneInverses[u]),c.multiply(e.bindMatrix).toArray(l,16*u)}return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new s.BufferAttribute(l,16)),joints:o,skeleton:r.get(i)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,a=this.options,i=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(e=a.myOptions.helper.parseNode({object:e,nodeDef:s,options:this}),a.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),re(r,[0,0,0,1])||(s.rotation=r),re(h,[0,0,0])||(s.translation=h),re(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===re(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,c=e.children.length;l<c;l++){var u=e.children[l];u.userData.isTemp||!u.visible&&!1!==a.onlyVisible||null!==(u=this.processNode(u))&&o.push(u)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var h=n.nodes.push(s)-1;return i.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),a=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),i=0,s=e.children.length;i<s;i++){var o=e.children[i];o.userData.isTemp||!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&a.push(o)}0<a.length&&(n.nodes=a),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new s.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,r,n=this.options,a=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),i=0;i<e.length;i++)e[i]instanceof s.Scene?this.processScene(e[i]):a.push(e[i]);1===a.length?(t=a[0],"model"===n.myOptions.helper.type&&((r=new s.Group).name="glb_model",r.add(t),t=r),this.processScene(t)):1<a.length&&this.processObjects(a);for(var o=0;o<this.skins.length;++o)this.processSkin(this.skins[o]);for(var l=0;l<n.animations.length;++l)this.processAnimation(n.animations[l],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),le=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_lights_punctual"}return U(e,[{key:"writeNode",value:function(e,t){var r,n,a;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(a=this.writer).json,a=a.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),a[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},a[this.name]=!0),(a=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),ce=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_unlit"}return U(e,[{key:"writeMaterial",value:function(e,t){e.isMeshBasicMaterial&&(e=this.writer.extensionsUsed,t.extensions=t.extensions||{},t.extensions[this.name]={},e[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9)}}]),e}(),ue=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(n=(r=this.writer).extensionsUsed,(a={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(i={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(i,e.clearcoatMap),a.clearcoatTexture=i),a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(i={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(i,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=i),e.clearcoatNormalMap&&(i={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(i,e.clearcoatNormalMap),a.clearcoatNormalTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),he=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(n=(r=this.writer).extensionsUsed,(a={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(i={index:r.processTexture(e.iridescenceMap)},r.applyTextureTransform(i,e.iridescenceMap),a.iridescenceTexture=i),a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(i={index:r.processTexture(e.iridescenceThicknessMap)},r.applyTextureTransform(i,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),de=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_transmission"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).transmissionFactor=e.transmission,e.transmissionMap&&(i={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(i,e.transmissionMap),a.transmissionTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),pe=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_volume"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).thicknessFactor=e.thickness,e.thicknessMap&&(i={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(i,e.thicknessMap),a.thicknessTexture=i),a.attenuationDistance=e.attenuationDistance,a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),fe=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_ior"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(r=this.writer.extensionsUsed,(n={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}(),me=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_specular"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(te)||e.specularIntensityMap||e.specularColorTexture)&&(n=(r=this.writer).extensionsUsed,a={},e.specularIntensityMap&&(i={index:r.processTexture(e.specularIntensityMap)},r.applyTextureTransform(i,e.specularIntensityMap),a.specularTexture=i),e.specularColorMap&&(i={index:r.processTexture(e.specularColorMap)},r.applyTextureTransform(i,e.specularColorMap),a.specularColorTexture=i),a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ge=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_sheen"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!=e.sheen&&(n=(r=this.writer).extensionsUsed,a={},e.sheenRoughnessMap&&(i={index:r.processTexture(e.sheenRoughnessMap)},r.applyTextureTransform(i,e.sheenRoughnessMap),a.sheenRoughnessTexture=i),e.sheenColorMap&&(i={index:r.processTexture(e.sheenColorMap)},r.applyTextureTransform(i,e.sheenColorMap),a.sheenColorTexture=i),a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ve=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(r=this.writer.extensionsUsed,(n={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}();function be(e){return(be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ye(){ye=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=p.asyncIterator||"@@asyncIterator",i=p.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var a,i,s,o;return t=t&&t.prototype instanceof u?t:u,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(a=e,i=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return c;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,c):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,s),r)){if(r===c)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(a,i,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var c={};function u(){}function h(){}function d(){}var p,f,m=(s(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=u.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(a,i){function s(){return new t((function(n,s){!function n(a,i,s,o){var c;if("throw"!==(a=l(e[a],e,i)).type)return(i=(c=a.arg).value)&&"object"==be(i)&&r.call(i,"__await")?t.resolve(i.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(i).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,o)}));o(a.arg)}(a,i,n,s)}))}return n=n?n.then(s,s):s()}}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function y(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t,a=e[n];if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(a=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=a}return{next:S}}function S(){return{value:void 0,done:!0}}return s(m,"constructor",h.prototype=d),s(d,"constructor",h),h.displayName=s(d,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,a,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,a,i){void 0===i&&(i=Promise);var s=new v(o(t,r,n,a),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(m),s(m,i,"Generator"),s(m,n,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(y),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;0<=a;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(o&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}var s=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),y(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,a=this.tryEntries[t];if(a.tryLoc===e)return"throw"===(r=a.completion).type&&(n=r.arg,y(a)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}function xe(e,t,r,n,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}function we(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Se(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Me(e,t,r){t&&Se(e.prototype,t),r&&Se(e,r),Object.defineProperty(e,"prototype",{writable:!1})}F.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),i=new e.ValueBufferType(e.values.length+n),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var o=0;o<n;o++)i[o]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;a[0]=t,a.set(e.times,1),i.set(s.evaluate(t),0),i.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;a[a.length-1]=t,a.set(e.times,0),i.set(e.values,0),i.set(s.evaluate(t),e.values.length),r=a.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){a.set(e.times.slice(0,l+1),0),a[l+1]=t,a.set(e.times.slice(l+1),l+2),i.set(e.values.slice(0,(l+1)*n),0),i.set(s.evaluate(t),(l+1)*n),i.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=a,e.values=i,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,i=0;i<a.length;++i){var o=a[i],l=s.PropertyBinding.parseTrackName(o.name),c=s.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.push(o);else{if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(s.InterpolateLinear)}var u=c.morphTargetInfluences.length,h=c.morphTargetDictionary[l.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0===n[c.uuid]){for(var p=new((d=o.clone()).ValueBufferType)(u*d.times.length),f=0;f<d.times.length;f++)p[f*u+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,n[c.uuid]=d,r.push(d)}else{var m=o.createInterpolant(new o.ValueBufferType(1));d=n[c.uuid];for(var g=0;g<d.times.length;g++)d.values[g*u+h]=m.evaluate(d.times[g]);for(var v=0;v<o.times.length;v++){var b=this.insertKeyframe(d,o.times[v]);d.values[b*u+h]=o.values[v]}}}}return e.tracks=r,e}};var Te={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},_e=function(){function e(){we(this,e),this.pluginCallbacks=[],this.register((function(e){return new Ne(e)})),this.register((function(e){return new ze(e)})),this.register((function(e){return new He(e)})),this.register((function(e){return new We(e)})),this.register((function(e){return new qe(e)})),this.register((function(e){return new Ke(e)})),this.register((function(e){return new Ve(e)})),this.register((function(e){return new Ge(e)})),this.register((function(e){return new Ze(e)})),this.register((function(e){return new Xe(e)}))}return Me(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){for(var a=new Fe,i=[],s=0,o=this.pluginCallbacks.length;s<o;s++)i.push(this.pluginCallbacks[s](a));a.setPlugins(i),a.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,n,a,t)}))}}]),e}(),Ee=5120,ke=5121,De=5122,Pe=5123,Ae=(n=9728,W=9729,K=9984,H=9985,q=9986,Z=9987,X=33071,Y=33648,Q=10497,"KHR_mesh_quantization"),Oe={},Ce=(Oe[s.NearestFilter]=n,Oe[s.NearestMipmapNearestFilter]=K,Oe[s.NearestMipmapLinearFilter]=q,Oe[s.LinearFilter]=W,Oe[s.LinearMipmapNearestFilter]=H,Oe[s.LinearMipmapLinearFilter]=Z,Oe[s.ClampToEdgeWrapping]=X,Oe[s.RepeatWrapping]=Q,Oe[s.MirroredRepeatWrapping]=Y,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),Re=new s.Color;function Le(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Ie(e){return 4*Math.ceil(e/4)}function Be(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Ie(e.byteLength);if(n===e.byteLength)return e;var a=new Uint8Array(n);if(a.set(new Uint8Array(e)),0!==r)for(var i=e.byteLength;i<n;i++)a[i]=r;return a.buffer}function Ue(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function je(e,t){return void 0!==e.toBlob?new Promise((function(r){return e.toBlob(r,t)})):("image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r}));var r}var Fe=function(){function e(){we(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,r;return Me(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=ye().mark((function e(t,r){var n,a,i,s,o,l,c,u=arguments;return ye().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=2<u.length&&void 0!==u[2]?u[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:i=(o=this).buffers,a=o.json,n=o.options,s=o.extensionsUsed,o=o.extensionsRequired,i=new Blob(i,{type:"application/octet-stream"}),s=Object.keys(s),o=Object.keys(o),0<s.length&&(a.extensionsUsed=s),0<o.length&&(a.extensionsRequired=o),a.buffers&&0<a.buffers.length&&(a.buffers[0].byteLength=i.size),!0===n.binary?((l=new FileReader).readAsArrayBuffer(i),l.onloadend=function(){var e=Be(l.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Be((n=JSON.stringify(a),(new TextEncoder).encode(n).buffer),32)),i=new DataView(new ArrayBuffer(8)),s=(i.setUint32(0,n.byteLength,!0),i.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((c=new DataView(s)).setUint32(0,1179937895,!0),c.setUint32(4,2,!0),12+i.byteLength+n.byteLength+t.byteLength+e.byteLength),c=(c.setUint32(8,o,!0),new Blob([s,i,n,t,e],{type:"application/octet-stream"})),u=new FileReader;u.readAsArrayBuffer(c),u.onloadend=function(){r(u.result)}}):a.buffers&&0<a.buffers.length?((c=new FileReader).readAsDataURL(i),c.onloadend=function(){var e=c.result;a.buffers[0].uri=e,r(a)}):r(a);case 19:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(e){xe(i,n,a,s,o,"next",e)}function o(e){xe(i,n,a,s,o,"throw",e)}s(void 0)}))},function(e,t){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var a=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&a.gltfExtensions){for(var i in void 0===t.extensions&&(t.extensions={}),a.gltfExtensions)t.extensions[i]=a.gltfExtensions[i],n[i]=!0;delete a.gltfExtensions}0<Object.keys(a).length&&(t.extras=a)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(r)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new s.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),n=new s.Vector3,a=0,i=r.count;a<i;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;function r(e){return e.encoding===s.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=e?e.image:null,a=t?t.image:null,i=Math.max(n?n.width:0,a?a.width:0),o=Math.max(n?n.height:0,a?a.height:0),l=Ue(),c=(l.width=i,l.height=o,l.getContext("2d")),u=(c.fillStyle="#00ffff",c.fillRect(0,0,i,o),c.getImageData(0,0,i,o));if(n){c.drawImage(n,0,0,i,o);for(var h=r(e),d=c.getImageData(0,0,i,o).data,p=2;p<d.length;p+=4)u.data[p]=256*h(d[p]/256)}if(a){c.drawImage(a,0,0,i,o);for(var f=r(t),m=c.getImageData(0,0,i,o).data,g=1;g<m.length;g+=4)u.data[g]=256*f(m[g]/256)}return c.putImageData(u,0,0),(n=(e||t).clone()).source=new s.Source(l),n.encoding=s.LinearEncoding,n}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,a){var i,o=this.json;switch(o.bufferViews||(o.bufferViews=[]),t){case Ee:case ke:i=1;break;case De:case Pe:i=2;break;default:i=4}for(var l=Ie(n*e.itemSize*i),c=new DataView(new ArrayBuffer(l)),u=0,h=r;h<r+n;h++)for(var d=0;d<e.itemSize;d++){var p=void 0;4<e.itemSize?p=e.array[h*e.itemSize+d]:(0===d?p=e.getX(h):1===d?p=e.getY(h):2===d?p=e.getZ(h):3===d&&(p=e.getW(h)),!0===e.normalized&&(p=s.MathUtils.normalize(p,e.array))),5126===t?c.setFloat32(u,p,!0):5124===t?c.setInt32(u,p,!0):5125===t?c.setUint32(u,p,!0):t===De?c.setInt16(u,p,!0):t===Pe?c.setUint16(u,p,!0):t===Ee?c.setInt8(u,p):t===ke&&c.setUint8(u,p),u+=i}var f={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==a&&(f.target=a),34962===a&&(f.byteStride=e.itemSize*i),this.byteOffset+=l,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){var e=Be(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var a,i=this.json;if(e.array.constructor===Float32Array)a=5126;else if(e.array.constructor===Int32Array)a=5124;else if(e.array.constructor===Uint32Array)a=5125;else if(e.array.constructor===Int16Array)a=De;else if(e.array.constructor===Uint16Array)a=Pe;else if(e.array.constructor===Int8Array)a=Ee;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");a=ke}if(0===(n=void 0===n?e.count:n))return null;var o,l=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},a=t;a<t+r;a++)for(var i=0;i<e.itemSize;i++){var o=void 0;4<e.itemSize?o=e.array[a*e.itemSize+i]:(0===i?o=e.getX(a):1===i?o=e.getY(a):2===i?o=e.getZ(a):3===i&&(o=e.getW(a)),!0===e.normalized&&(o=s.MathUtils.normalize(o,e.array))),n.min[i]=Math.min(n.min[i],o),n.max[i]=Math.max(n.max[i],o)}return n}(e,r=void 0===r?0:r,n);return r={bufferView:(void 0!==t&&(o=e===t.index?34963:34962),t=this.processBufferView(e,a,r,n,o)).id,byteOffset:t.byteOffset,componentType:a,count:n,max:l.max,min:l.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(r.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(r)-1}},{key:"processImage",value:function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var a=this,i=a.cache,o=a.json,l=a.options,c=a.pending,u=(i.images.has(e)||i.images.set(e,{}),i=i.images.get(e),n+":flipY/"+r.toString());if(void 0!==i[u])return i[u];o.images||(o.images=[]);var h={mimeType:n},d=Ue(),p=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if(!0===r&&(p.translate(0,d.height),p.scale(1,-1)),void 0!==e.data){t!==s.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}else p.drawImage(e,0,0,d.width,d.height);return!0===l.binary?c.push(je(d,n).then((function(e){return a.processBufferViewImage(e)})).then((function(e){h.bufferView=e}))):void 0!==d.toDataURL?h.uri=d.toDataURL(n):c.push(je(d,n).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){h.uri=e}))),r=o.images.push(h)-1,i[u]=r}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Oe[e.magFilter],minFilter:Oe[e.minFilter],wrapS:Oe[e.wrapS],wrapT:Oe[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n=("image/webp"===(a=e.userData.mimeType)&&(a="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,a)}),a=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,a),a}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n={pbrMetallicRoughness:{}},a=(!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),i=(Le(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),i={index:this.processTexture(a)},this.applyTextureTransform(i,a),n.pbrMetallicRoughness.metallicRoughnessTexture=i),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(i=e.emissive,0<Math.max(i.r,i.g,i.b)&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),n.emissiveTexture=a)),e.normalMap&&(i={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(i.scale=e.normalScale.x),this.applyTextureTransform(i,e.normalMap),n.normalTexture=i),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===s.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return t.materials.set(e,i),i}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,i=e.material.length;a<i;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,c,u,h=e.geometry,d=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,p={},f={},m=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},b=h.getAttribute("normal"),y=(void 0===b||this.isNormalizedNormalAttribute(b)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),h.setAttribute("normal",this.createNormalizedNormalAttribute(b))),null);for(c in h.attributes)"morph"!==c.slice(0,5)&&(l=h.attributes[c],c=v[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(l))?f[c]=t.attributes.get(this.getUID(l)):(y=null,u=l.array,"JOINTS_0"!==c||u instanceof Uint16Array||u instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new s.BufferAttribute(new Uint16Array(u),l.itemSize,l.normalized)),null!==(u=this.processAccessor(y||l,h))&&(c.startsWith("_")||this.detectMeshQuantization(c,l),f[c]=u,t.attributes.set(this.getUID(l),u))));if(void 0!==b&&h.setAttribute("normal",b),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var M in e.morphTargetDictionary)S[e.morphTargetDictionary[M]]=M;for(var T=0;T<e.morphTargetInfluences.length;++T){var _,E={},k=!1;for(_ in h.morphAttributes)if("position"!==_&&"normal"!==_)k||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),k=!0);else{var D=h.morphAttributes[_][T],P=_.toUpperCase(),A=h.attributes[_];if(t.attributes.has(this.getUID(D,!0)))E[P]=t.attributes.get(this.getUID(D,!0));else{var O=D.clone();if(!h.morphTargetsRelative)for(var C=0,R=D.count;C<R;C++)for(var L=0;L<D.itemSize;L++)0===L&&O.setX(C,D.getX(C)-A.getX(C)),1===L&&O.setY(C,D.getY(C)-A.getY(C)),2===L&&O.setZ(C,D.getZ(C)-A.getZ(C)),3===L&&O.setW(C,D.getW(C)-A.getW(C));E[P]=this.processAccessor(O,h),t.attributes.set(this.getUID(A,!0),E[P])}}g.push(E),x.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&w.push(S[T])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((b=Array.isArray(e.material))&&0===h.groups.length)return null;for(var I=b?e.material:[e.material],B=b?h.groups:[{materialIndex:0,start:void 0,count:void 0}],U=0,j=B.length;U<j;U++){var F={mode:d,attributes:f},N=(this.serializeUserData(h,F),0<g.length&&(F.targets=g),null!==h.index&&(N=this.getUID(h.index),void 0===B[U].start&&void 0===B[U].count||(N+=":"+B[U].start+":"+B[U].count),t.attributes.has(N)?F.indices=t.attributes.get(N):(F.indices=this.processAccessor(h.index,h,B[U].start,B[U].count),t.attributes.set(N,F.indices)),null===F.indices&&delete F.indices),this.processMaterial(I[B[U].materialIndex]));null!==N&&(F.material=N),m.push(F)}return p.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),b=r.meshes.push(p)-1,t.meshes.set(o,b),b}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[Ae]){var r=void 0;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized"),t=e.split("_",1)[0],null!=(e=Te[t])&&e.includes(r)&&(this.extensionsUsed[Ae]=!0,this.extensionsRequired[Ae]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:s.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,a=(r.animations||(r.animations=[]),(e=_e.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),i=[],o=[],l=0;l<a.length;++l){var c=a[l],u=s.PropertyBinding.parseTrackName(c.name),h=s.PropertyBinding.findNode(t,u.nodeName),d=Ce[u.propertyName];if(!(h="bones"===u.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(u.objectIndex):void 0:h)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;u=c.values.length/c.times.length;var p=void(d===Ce.morphTargetInfluences&&(u/=h.morphTargetInfluences.length));!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",u/=3):p=c.getInterpolation()===s.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new s.BufferAttribute(c.times,1)),output:this.processAccessor(new s.BufferAttribute(c.values,u)),interpolation:p}),i.push({sampler:o.length-1,target:{node:n.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:i}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var o=[],l=new Float32Array(16*a.bones.length),c=new s.Matrix4,u=0;u<a.bones.length;++u)o.push(r.get(a.bones[u])),c.copy(a.boneInverses[u]),c.multiply(e.bindMatrix).toArray(l,16*u);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new s.BufferAttribute(l,16)),joints:o,skeleton:r.get(i)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,a=this.options,i=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(a.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),Le(r,[0,0,0,1])||(s.rotation=r),Le(h,[0,0,0])||(s.translation=h),Le(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Le(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,c=e.children.length;l<c;l++){var u=e.children[l];!u.visible&&!1!==a.onlyVisible||null!==(u=this.processNode(u))&&o.push(u)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var h=n.nodes.push(s)-1;return i.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),a=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),i=0,s=e.children.length;i<s;i++){var o=e.children[i];!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&a.push(o)}0<a.length&&(n.nodes=a),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new s.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t=this.options,r=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),n=0;n<e.length;n++)e[n]instanceof s.Scene?this.processScene(e[n]):r.push(e[n]);0<r.length&&this.processObjects(r);for(var a=0;a<this.skins.length;++a)this.processSkin(this.skins[a]);for(var i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),Ne=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_lights_punctual"}return Me(e,[{key:"writeNode",value:function(e,t){var r,n,a;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(a=this.writer).json,a=a.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),a[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},a[this.name]=!0),(a=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),ze=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_unlit"}return Me(e,[{key:"writeMaterial",value:function(e,t){e.isMeshBasicMaterial&&(e=this.writer.extensionsUsed,t.extensions=t.extensions||{},t.extensions[this.name]={},e[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9)}}]),e}(),Ve=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(n=(r=this.writer).extensionsUsed,(a={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(i={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(i,e.clearcoatMap),a.clearcoatTexture=i),a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(i={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(i,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=i),e.clearcoatNormalMap&&(i={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(i,e.clearcoatNormalMap),a.clearcoatNormalTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Ge=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(n=(r=this.writer).extensionsUsed,(a={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(i={index:r.processTexture(e.iridescenceMap)},r.applyTextureTransform(i,e.iridescenceMap),a.iridescenceTexture=i),a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(i={index:r.processTexture(e.iridescenceThicknessMap)},r.applyTextureTransform(i,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),He=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_transmission"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).transmissionFactor=e.transmission,e.transmissionMap&&(i={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(i,e.transmissionMap),a.transmissionTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),We=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_volume"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).thicknessFactor=e.thickness,e.thicknessMap&&(i={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(i,e.thicknessMap),a.thicknessTexture=i),a.attenuationDistance=e.attenuationDistance,a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),qe=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_ior"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(r=this.writer.extensionsUsed,(n={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}(),Ke=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_specular"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(Re)||e.specularIntensityMap||e.specularColorTexture)&&(n=(r=this.writer).extensionsUsed,a={},e.specularIntensityMap&&(i={index:r.processTexture(e.specularIntensityMap)},r.applyTextureTransform(i,e.specularIntensityMap),a.specularTexture=i),e.specularColorMap&&(i={index:r.processTexture(e.specularColorMap)},r.applyTextureTransform(i,e.specularColorMap),a.specularColorTexture=i),a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Ze=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_sheen"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!=e.sheen&&(n=(r=this.writer).extensionsUsed,a={},e.sheenRoughnessMap&&(i={index:r.processTexture(e.sheenRoughnessMap)},r.applyTextureTransform(i,e.sheenRoughnessMap),a.sheenRoughnessTexture=i),e.sheenColorMap&&(i={index:r.processTexture(e.sheenColorMap)},r.applyTextureTransform(i,e.sheenColorMap),a.sheenColorTexture=i),a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Xe=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(r=this.writer.extensionsUsed,(n={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}();_e.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),i=new e.ValueBufferType(e.values.length+n),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var o=0;o<n;o++)i[o]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;a[0]=t,a.set(e.times,1),i.set(s.evaluate(t),0),i.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;a[a.length-1]=t,a.set(e.times,0),i.set(e.values,0),i.set(s.evaluate(t),e.values.length),r=a.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){a.set(e.times.slice(0,l+1),0),a[l+1]=t,a.set(e.times.slice(l+1),l+2),i.set(e.values.slice(0,(l+1)*n),0),i.set(s.evaluate(t),(l+1)*n),i.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=a,e.values=i,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,i=0;i<a.length;++i){var o=a[i],l=s.PropertyBinding.parseTrackName(o.name),c=s.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.push(o);else{if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(s.InterpolateLinear)}var u=c.morphTargetInfluences.length,h=c.morphTargetDictionary[l.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0===n[c.uuid]){for(var p=new((d=o.clone()).ValueBufferType)(u*d.times.length),f=0;f<d.times.length;f++)p[f*u+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,n[c.uuid]=d,r.push(d)}else{var m=o.createInterpolant(new o.ValueBufferType(1));d=n[c.uuid];for(var g=0;g<d.times.length;g++)d.values[g*u+h]=m.evaluate(d.times[g]);for(var v=0;v<o.times.length;v++){var b=this.insertKeyframe(d,o.times[v]);d.values[b*u+h]=o.values[v]}}}}return e.tracks=r,e}};class Qe{constructor(e){this.map=new P.Z,this.loadMap=new M.Z,this.exportMap=new M.Z,this.runScene=e,this.loadMap}bind(e){this.processMap(e),this.map.add(e)}processMap(e){e.loadCallBacks.map(((e,t)=>{let r=this.loadMap.get(e);r||(r=new P.Z,this.loadMap.set(e,r)),r.add(t)})),e.exportCallBacks.map(((e,t)=>{let r=this.exportMap.get(e);r||(r=new P.Z,this.exportMap.set(e,r)),r.add(t)}))}loadCallback(e){const{type:t,json:r,data:n,config:a,core:i}=e;return null==(e=this.loadMap.get(t))?void 0:e.map((e=>e({json:r,data:n,config:a,core:i})))}}var Ye=r(3625),Je=r(4330),$e=r(1269),et=r(932),tt=r(110),rt=r(3736),nt=r(6272);class at{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:tt.Z},this.geoDefMaterialMap=new M.Z;var{type:e,runScene:t,helper:r}=e;this.type=e,this.helper=r,this.runScene=t}parse(e){var t=this.createTextureGroup(e);"scene"===this.type&&this.parseScene(t),this.parseModel(e),this.materialMapToJson(),this.setMultipMaterial(t,Object.keys(this.textureMap))}createTextureGroup(e){const t=new s.Group;return t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),t}parseUnDelAbleTexture(){(0,i.mapObj)(this.runScene.uniqueEx.texture.map,((e,t)=>{t=t.texture,Ye.unDelAbleTexture.is(t)&&(this.mergeSame(t).isSame||this.parseTexture(t))}))}parseScene(e){this.helper.ex=Object.assign(Object.assign({},this.helper.ex),this._getBaseEx(e)),this.parseUnDelAbleTexture()}_getBaseEx(e){var t=this.runScene.sceneEx.get(),r=this.runScene.assetsEx.get().controls,n=this.runScene.optionsEx.exporterOptions.outTime,a=this.runScene.sceneEx.envStrength;return{version:{core:"0.0.83",editor:"0.0.2"},base64:(0,nt.Ni)(String(n)),lights:$e.ZP.toJSON(this.runScene.lightEx.getLightsByScene()),camera:b.Z.toJSON(this.runScene),sceneEx:Object.assign(Object.assign({},rt.ZP.toJSON(t,this.runScene)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),envStrength:a,controls:S.toJSON(r),objects:this.runScene.objects.toJSON(),tags:this.runScene.tags.toJSON(),options:this.runScene.exporter.gltf.options.getOptions(t)}}_bindSceneTextures(e){var t=this.runScene.sceneEx.get();const r={};if((0,Ye.isTexture)(t.background)||(0,Ye.isTexture)(t.environment)){this.runScene.pp.setUpdate(!1);const{background:n,environment:a}=t,i=(this.runScene.pp.setUpdate(!0),(0,h.createDefModel)("Box")),s=(0,et.createDefMaterial)();i.material=s,e.add(i),t=s.userData.id,r.materialId=t;let o=[];(0,Ye.isTexture)(n)&&(n.userData.notCompress=!0,o.push({type:"map",texture:n}),303===(s.map=n).mapping&&(r.backgroundMapping=303)),(0,Ye.isTexture)(a)&&(a.userData.notCompress=!0,o.push({type:"envMap",texture:a}),s.envMap=a),this.materialMap[t]={normalMaterial:s,models:[],normal:{},textures:o}}return r}compressLocal(e){var{x:t,y:r,z:n}=e.position;0===t&&0===r&&0===n||(e.position.set(0,0,0),e.userData.local=t+","+r+","+n)}parseModel(e){const t=new Set;e.traverse((e=>t.add(e))),t.forEach((e=>{this._processMaterial(e),this._processModel(e)}))}_processModel(e){var t;(0,h.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,rt.M)(e,"animations",t));let r=e;const n=this.modelType[e.type];n&&(t=n.modelTools.toNormal(e),e.parent.add(t),e.parent.remove(e),r=t),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(r)}_processMaterial(e){if((0,et.isMaterial)(e.material)){const n=this.materialMap[e.material.userData.id];if(n)return n.normalMaterial&&(e.material=n.normalMaterial),void n.models.push(e);var t=this.runScene.materialEx.isBaseMaterial(e.material),r=e.material;const{material:a,normal:i,textures:s}=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(e):this.runScene.materialEx.toNromal(e.material);e.material=a,t=r.userData.id,a.userData.id=t,this.materialMap[t]={oldMaterial:r,normalMaterial:a,models:[e],normal:i,textures:s}}}materialMapToJson(){(0,i.mapObj)(this.materialMap,((e,t)=>{var{normalMaterial:t,textures:r,normal:n}=t,a=t.userData.id;this.helper.ex.materialMap[a]||(this.helper.ex.materialMap[a]={normal:n,textures:{}},this.mergeAndRemoveTexture(r,t))}))}mergeSame(e){e.userData||(e.userData={});var t=e.userData;if((0,Ye.isClonedTexture)(e))e=this.parseCloneTexture(e);else for(const i in this.textureMap){var r=this.textureMap[i],{md5:n,texture:a}=r;if(t.md5===n&&e.mapping===a.mapping&&!(0,Ye.isClonedTexture)(r.texture))return{isSame:!0,texture:a}}return this.textureMap[e.userData.id]=Object.assign(Object.assign({},t),{texture:e}),{isSame:!1,texture:e}}parseTexture(e){var t,{format:r,repeat:n,center:a,rotation:i,offset:s}=e;const o={format:r};this.runScene.modelEx.isNavieV2(n,1)||(({x:r,y:t}=n),o.repeat=r===t?r:n),this.runScene.modelEx.isNavieV2(a,0)||(({x:t,y:r}=a),o.center=t===r?t:a),this.runScene.modelEx.isNavieV2(s,0)||(({x:n,y:r}=s),o.offset=n===r?n:s),0!==i&&(o.rotation=i),this.helper.ex.textureMap[e.userData.id]=o}mergeAndRemoveTexture(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){return e.map((e=>{var{type:e,texture:r}=e;this.runScene.uniqueEx.texture.add(r),t[e]=null;const n=this.mergeSame(r).texture;this.helper.ex.textureMap[n.userData.id]||this.parseTexture(n),"normalMap"!==e||n.userData.isNormalMap||(n.userData.isNormalMap=!0),this.helper.ex.materialMap[t.userData.id].textures[e]=n.userData.id}))}))}parseCloneTexture(e){const t=e.clone();t.userData=Object.assign({},e.userData);var{width:e,height:r}=e.image;const n=document.createElement("canvas");return n.width=e,n.height=r,t.image=n,t.userData.blob=new Blob([]),t}setMultipMaterial(e,t){const r=this.runScene.modelEx.create(),n=(0,et.createDefMaterial)();r.material=n,e.add(r);for(const e of Je.sG){if(!t.length)return;var a=t.pop();if(!a)return;n[e]=this.textureMap[a].texture}t.length&&this.setMultipMaterial(e,t)}getMaterialFromModel(e){return e&&e.geometry?(e=e.geometry.uuid,this.geoDefMaterialMap.get(e)||this.geoDefMaterialMap.set(e,(0,et.createDefMaterial)()),{material:this.geoDefMaterialMap.get(e),normal:{},textures:[]}):{material:this.runScene.materialEx.defMaterial,normal:{},textures:[]}}}class it extends o{constructor(){super(...arguments),this.savedMap=new M.Z,this.clonedMap=new M.Z}getSameNode(e){return this.savedMap.find(((t,r)=>r.materialUuid===e.material.uuid&&r.geometryUuid===e.geometry.uuid))}parseUnClonedModel(e){var t,r=(0,A.Ki)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,h.setClonedModel)(e,t.id),this.savedMap.set(r,{id:r,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,h.getClonedIdModel)(e),r=(0,A.Ki)(e);this.clonedMap.get(t)||this.clonedMap.set(t,{newId:void 0,ids:new Set});const n=this.clonedMap.get(t);n&&(n.ids.add(r),n.newId||this.runScene.uniqueEx.model.get(t)||(t=(0,A.Ki)(e),n.newId=t),n.newId&&(n.newId!==r?(0,h.setClonedModel)(e,n.newId):(0,h.delClonedModel)(e)))}parseNode(e){(0,h.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class st{constructor(){this.savedMap=new M.Z}getSameCount(e){return this.savedMap.filter(((t,r)=>r.geometry.attributes.normal.count===e),"value")}setSameNode(e,t){e.geometry=t}getSameGeo(e,t){var{normal:r,position:n,uv:a}=e.attributes;for(const e of t){var{normal:i,position:s,uv:o}=e.attributes;if(r.array.length===i.array.length&&n.array.length===s.array.length&&a.array.length===o.array.length&&(i=(0,nt.F1)([...r.array],[...i.array],20),s=(0,nt.F1)([...n.array],[...s.array],20),o=(0,nt.F1)([...a.array],[...o.array],20),i&&s&&o))return e}}parseNode(e){if(e&&e.geometry&&e.geometry.attributes&&e.geometry.attributes.normal&&e.geometry.attributes.position&&e.geometry.attributes.uv&&!this.savedMap.get(e.geometry.uuid)){var t=e.geometry,r=(r=t.attributes.normal).count;const a=this.getSameCount(r);if(a){var n=this.getSameGeo(t,a.map((e=>e.geometry)));if(n)return this.setSameNode(e,n)}this.savedMap.set(t.uuid,{count:r,geometry:t})}}}class ot{constructor(){this.optionsConfigs={}}getParse(e){return this.optionsConfigs[e]}addOption(e){var t=e.type;if(this.optionsConfigs[t])throw TypeError("该配置项已被挂载");this.optionsConfigs[t]=e}getOptions(e){return Object.values(this.optionsConfigs).map((t=>{const{process:r,type:n}=t;return{type:n,data:r(e)}}))}}class lt{constructor(e){this.helperModels=[],this.mergeSameGeo=new st;var{type:e,runScene:t,model:r}=e;this.runScene=t,this.type=e,this.bindClondId=new it(t),this.ex={materialMap:{},textureMap:{},type:e},this.before=new at({helper:this,type:e,runScene:t}),this.before.parse(r)}parseNode(e){let{object:t,nodeDef:r}=e;return this.mergeSameGeo.parseNode(t),this.bindClondId.parseNode(t),(0,i.mapObj)(this.runScene.modelEx.defNodeMap,((e,n)=>{t[e]!==n&&(r[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,r.wireframe=!0),e=((null==(e=t.userData)?void 0:e.normal)||{}).type,t=e?this.runScene.modelEx.importAndExport.toNromal({type:e,model:t,runScene:this.runScene}):t}parseMaterial(e){const{material:t,materialDef:r}=e;r.id=t.userData.id,this.ex.materialMap[t.userData.id]||(this.ex.materialMap[t.userData.id]={normal:{},textures:{}}),this.ex.materialMap[t.userData.id].normal=Object.assign(Object.assign({},this.ex.materialMap[t.userData.id].normal),this.runScene.materialEx.getDefNromals(t))}parseTexture(e){const{texture:t,textureDef:r}=e;var{notCompress:e,minFilter:n}=t.userData,{width:e,height:n}=(e&&(r.notCompress=!0),r.unDelAble=t.userData.unDelAble,r.unDelAbleRef=t.userData.unDelAbleRef,r.uvScript=t.userData.uvScript,r.md5=t.userData.md5,r.id=t.userData.id,r.isHdr=t.userData.isHdr,n&&(r.minFilter=n),(0,Ye.isClonedTexture)(t)&&(r.cloneSourceId=(0,Ye.getCloneIdFromTexture)(t)),r.format=t.userData.format,(0,Ye.getSizeByTexture)(t));r.size={w:e,h:n}}getNodeMapValueWithBone(e,t){for(const r of t.keys())if(r.userData.id===e.userData.id)return t.get(r)}done(e){e.asset.ex=this.ex,this.runScene.optionsEx.log([e,"json"]),this.runScene.cb.exporter.gltf.complete.cb({json:e})}}var ct=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class ut extends o{constructor(e){super(e),this._gltf=new F,this._originGltf=new _e,this.options=new ot,this.module=new Qe(e)}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t){return ct(this,void 0,void 0,(function*(){const r=new lt({type:t,runScene:this.runScene,model:e});return new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),(e=>{console.log(e,"e")}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:r,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return ct(this,void 0,void 0,(function*(){return new Promise((t=>{this._originGltf.parse(e,(e=>{t(e)}),(()=>{}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,animations:[...e.animations]})}))}))}model(e,t=!0){return ct(this,void 0,void 0,(function*(){let r=e||this.runScene.modelEx.select,n=[];if(0!==(n=r?[r]:this.runScene.multipSelector.getSelectedList("value")).length){var a=(r=n[0]).name||r.type;const e=new s.Group;e.name="models",h.uselessGroup.set(e,!0),n.map((t=>e.add(this.runScene.modelEx.clone(t,!1))));var o=yield this.getArrayBuffer(e,"model");return t&&(0,i.downloadFile)(new Blob([o]),a+".glb"),o}}))}material(e){var t;return ct(this,void 0,void 0,(function*(){if(r=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,h.createDefModel)("Group");let t=r;(t=r instanceof Array?t:[r]).map((t=>{const r=(0,h.createDefModel)("Box");r.material=t,e.add(r)}));var r=r.name||"material",n=yield this.getArrayBuffer(e,"material");(0,i.downloadFile)(new Blob([n]),r+".glb")}}))}scene(e=!0,t="scene"){return ct(this,void 0,void 0,(function*(){this.runScene.cb.exporter.gltf.before.cb(null);var r=yield this.getArrayBuffer(this.runScene.sceneEx.getClear(),t);return e&&(0,i.downloadFile)(new Blob([r]),"scene.glb"),r}))}originModel(e){return ct(this,void 0,void 0,(function*(){var t,r;e&&(t=e.name||e.type,r=yield this.getOriginArrayBuffer(e),(0,i.downloadFile)(new Blob([r]),t+".glb"))}))}}class ht extends o{constructor(e){super(e),this.gltf=new ut(e)}}n=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(n(""))}catch(r){n=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}for(var dt=Uint8Array,pt=Uint16Array,ft=Uint32Array,mt=new dt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gt=new dt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),vt=new dt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bt=(K=function(e,t){for(var r=new pt(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var a=new ft(r[30]);for(n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)a[i]=i-r[n]<<5|n;return[r,a]},(q=K(mt,2))[0]),yt=(W=q[1],(bt[28]=258,W[258]=28,H=K(gt,0))[0]),xt=(H[1],new pt(32768)),wt=0;wt<32768;++wt){var St=(43690&wt)>>>1|(21845&wt)<<1;xt[wt]=((65280&(St=(61680&(St=(52428&St)>>>2|(13107&St)<<2))>>>4|(3855&St)<<4))>>>8|(255&St)<<8)>>>1}var Mt=function(e,t,r){for(var n=e.length,a=0,i=new pt(t);a<n;++a)++i[e[a]-1];var s=new pt(t);for(a=0;a<t;++a)s[a]=s[a-1]+i[a-1]<<1;if(r){var o=new pt(1<<t),l=15-t;for(a=0;a<n;++a)if(e[a])for(var c=a<<4|e[a],u=t-e[a],h=s[e[a]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)o[xt[h]>>>l]=c}else for(o=new pt(n),a=0;a<n;++a)e[a]&&(o[a]=xt[s[e[a]-1]++]>>>15-e[a]);return o},Tt=new dt(288);for(wt=0;wt<144;++wt)Tt[wt]=8;for(wt=144;wt<256;++wt)Tt[wt]=9;for(wt=256;wt<280;++wt)Tt[wt]=7;for(wt=280;wt<288;++wt)Tt[wt]=8;var _t=new dt(32);for(wt=0;wt<32;++wt)_t[wt]=5;var Et=Mt(Tt,9,1),kt=Mt(_t,5,1),Dt=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Pt=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},At=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},Ot=function(e){return(e/8|0)+(7&e&&1)},Ct=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof pt?pt:e instanceof ft?ft:dt)(r-(t=null==t||t<0?0:t));return n.set(e.subarray(t,r)),n};Z=new dt(0),X="undefined"!=typeof TextDecoder&&new TextDecoder;try{X.decode(Z,{stream:!0})}catch(r){}function Rt(e,t,r){var n=r.length-e-1;if(t>=r[n])return n-1;if(t<=r[e])return e;for(var a=e,i=n,s=Math.floor((a+i)/2);t<r[s]||t>=r[s+1];)t<r[s]?i=s:a=s,s=Math.floor((a+i)/2);return s}function Lt(e,t,r,n){for(var a=[],i=[],s=[],o=a[0]=1;o<=r;++o){i[o]=t-n[e+1-o],s[o]=n[e+o]-t;for(var l=0,c=0;c<o;++c){var u=s[c+1],h=i[o-c],d=a[c]/(u+h);a[c]=l+u*d,l=h*d}a[o]=l}return a}function It(e,t,r,n,a){for(var i=a<e?a:e,o=[],l=Rt(e,n,t),c=function(e,t,r,n,a){for(var i=[],s=0;s<=r;++s)i[s]=0;for(var o=[],l=0;l<=n;++l)o[l]=i.slice(0);for(var c=[],u=0;u<=r;++u)c[u]=i.slice(0);c[0][0]=1;for(var h=i.slice(0),d=i.slice(0),p=1;p<=r;++p){h[p]=t-a[e+1-p],d[p]=a[e+p]-t;for(var f=0,m=0;m<p;++m){var g=d[m+1],v=h[p-m],b=(c[p][m]=g+v,c[m][p-1]/c[p][m]);c[m][p]=f+g*b,f=v*b}c[p][p]=f}for(var y=0;y<=r;++y)o[0][y]=c[y][r];for(var x=0;x<=r;++x){for(var w=0,S=1,M=[],T=0;T<=r;++T)M[T]=i.slice(0);for(var _=M[0][0]=1;_<=n;++_){var E=0,k=x-_,D=r-_;_<=x&&(M[S][0]=M[w][0]/c[1+D][k],E=M[S][0]*c[k][D]);for(var P=x-1<=D?_-1:r-x,A=-1<=k?1:-k;A<=P;++A)M[S][A]=(M[w][A]-M[w][A-1])/c[1+D][k+A],E+=M[S][A]*c[k+A][D];x<=D&&(M[S][_]=-M[w][_-1]/c[1+D][x],E+=M[S][_]*c[x][D]),o[_][x]=E;var O=w;w=S,S=O}}for(var C=r,R=1;R<=n;++R){for(var L=0;L<=r;++L)o[R][L]*=C;C*=r-R}return o}(l,n,e,i,t),u=[],h=0;h<r.length;++h){var d=r[h].clone(),p=d.w;d.x*=p,d.y*=p,d.z*=p,u[h]=d}for(var f=0;f<=i;++f){for(var m=u[l-e].clone().multiplyScalar(c[f][0]),g=1;g<=e;++g)m.add(u[l-e+g].clone().multiplyScalar(c[f][g]));o[f]=m}for(var v=i+1;v<=a+1;++v)o[v]=new s.Vector4(0,0,0);return o}function Bt(e){for(var t=e.length,r=[],n=[],a=0;a<t;++a){var i=e[a];r[a]=new s.Vector3(i.x,i.y,i.z),n[a]=i.w}for(var o=[],l=0;l<t;++l){for(var c=r[l].clone(),u=1;u<=l;++u)c.sub(o[l-u].clone().multiplyScalar(function(e,t){for(var r=1,n=2;n<=e;++n)r*=n;for(var a=1,i=2;i<=t;++i)a*=i;for(var s=2;s<=e-t;++s)a*=s;return r/a}(l,u)*n[u]));o[l]=c.divideScalar(n[0])}return o}function Ut(e){return(Ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function jt(e,t){return(jt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ft(e){return(Ft=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Nt,zt,Vt,Gt=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jt(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ft(e);if(r=t?(r=Ft(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ut(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i,o){var l;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(l=r.call(this)).degree=e,l.knots=t,l.controlPoints=[],l.startKnot=i||0,l.endKnot=o||l.knots.length-1;for(var c=0;c<a.length;++c){var u=a[c];l.controlPoints[c]=new s.Vector4(u.x,u.y,u.z,u.w)}return l}return t=n,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new s.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,r,n){for(var a=Rt(e,n,t),i=Lt(a,n,e,t),o=new s.Vector4(0,0,0,0),l=0;l<=e;++l){var c=r[a-e+l],u=i[l],h=c.w*u;o.x+=c.x*h,o.y+=c.y*h,o.z+=c.z*h,o.w+=c.w*u}return o}(this.degree,this.knots,this.controlPoints,e),1!==e.w&&e.divideScalar(e.w),t.set(e.x,e.y,e.z)}},{key:"getTangent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new s.Vector3,r=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),Bt(It(r=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(r[1]).normalize(),t}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(s.Curve);function Ht(e){return(Ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Wt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Kt(e,t,r){t&&qt(e.prototype,t),r&&qt(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Zt(e,t){return(Zt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Xt(e){return(Xt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Qt=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Zt(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Xt(e);if(r=t?(r=Xt(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ht(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){return Wt(this,n),r.call(this,e)}return Kt(n,[{key:"load",value:function(e,t,r,n){var a=this,i=""===a.path?s.LoaderUtils.extractUrlBase(e):a.path,o=new s.FileLoader(this.manager);o.setPath(a.path),o.setResponseType("arraybuffer"),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,(function(r){try{t(a.parse(r,i))}catch(r){n?n(r):console.error(r),a.manager.itemError(e)}}),r,n)}},{key:"parse",value:function(e,t){if(n="Kaydara FBX Binary \0",(r=e).byteLength>=n.length&&n===pr(r,0,n.length))Nt=(new tr).parse(e);else{if(!function(e){for(var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0,n=0;n<t.length;++n)if(function(t){var n=e[0];return e=e.slice(r+1),r++,n}()===t[n])return;return 1}(r=pr(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(ar(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+ar(r));Nt=(new er).parse(r)}var r,n=new s.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Yt(n,this.manager).parse(Nt)}}]),n}(s.Loader),Yt=function(){function e(t,r){Wt(this,e),this.textureLoader=t,this.manager=r}return Kt(e,[{key:"parse",value:function(){zt=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new Jt).parse(t);return this.parseScene(t,r,e),Vt}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in Nt&&Nt.Connections.connections.forEach((function(t){var r=t[0],n=t[1],a=(t=t[2],e.has(r)||e.set(r,{parents:[],children:[]}),{ID:n,relationship:t});e.get(r).parents.push(a),e.has(n)||e.set(n,{parents:[],children:[]}),a={ID:r,relationship:t},e.get(n).children.push(a)})),e}},{key:"parseImages",value:function(){var e,t={},r={};if("Video"in Nt.Objects){var n,a=Nt.Objects.Video;for(n in a){var i,s,o=a[n];t[parseInt(n)]=o.RelativeFilename||o.Filename,"Content"in o&&(s=o.Content instanceof ArrayBuffer&&0<o.Content.byteLength,i="string"==typeof o.Content&&""!==o.Content,(s||i)&&(s=this.parseImage(a[n]),r[o.RelativeFilename||o.Filename]=s))}}for(e in t){var l=t[e];void 0!==r[l]?t[e]=r[l]:t[e]=t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,r=e.Content,n=e.RelativeFilename||e.Filename,a=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(a){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+a+'" is not supported.')}return"string"==typeof r?"data:"+t+";base64,"+r:(e=new Uint8Array(r),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in Nt.Objects){var r,n=Nt.Objects.Texture;for(r in n){var a=this.parseTexture(n[r],e);t.set(parseInt(r),a)}}return t}},{key:"parseTexture",value:function(e,t){var r=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),n=e.WrapModeV;return r=void 0!==r?r.value:0,n=void 0!==n?n.value:0,t.wrapS=0===r?s.RepeatWrapping:s.ClampToEdgeWrapping,t.wrapT=0===n?s.RepeatWrapping:s.ClampToEdgeWrapping,"Scaling"in e&&(r=e.Scaling.value,t.repeat.x=r[0],t.repeat.y=r[1]),"Translation"in e&&(n=e.Translation.value,t.offset.x=n[0],t.offset.y=n[1]),t}},{key:"loadTexture",value:function(e,t){var r,n=this.textureLoader.path,a=zt.get(e.id).children;return a="tga"===(void 0!==a&&0<a.length&&void 0!==t[a[0].ID]&&(0!==(r=t[a[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0)),t=e.FileName.slice(-3).toLowerCase())?null===(a=this.manager.getHandler(".tga"))?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),new s.Texture):(a.setPath(this.textureLoader.path),a.load(r)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new s.Texture):this.textureLoader.load(r),this.textureLoader.setPath(n),a}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in Nt.Objects){var r,n=Nt.Objects.Material;for(r in n){var a=this.parseMaterial(n[r],e);null!==a&&t.set(parseInt(r),a)}}return t}},{key:"parseMaterial",value:function(e,t){var r,n=e.id,a=e.attrName,i=e.ShadingModel;if("object"===Ht(i)&&(i=i.value),!zt.has(n))return null;switch(e=this.parseParameters(e,t,n),i.toLowerCase()){case"phong":r=new s.MeshPhongMaterial;break;case"lambert":r=new s.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),r=new s.MeshPhongMaterial}return r.setValues(e),r.name=a,r}},{key:"parseParameters",value:function(e,t,r){var n={},a=(e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=(new s.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(n.color=(new s.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=(new s.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(n.emissive=(new s.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=(new s.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(n.specular=(new s.Color).fromArray(e.SpecularColor.value)),this);return zt.get(r).children.forEach((function(e){var r=e.relationship;switch(r){case"Bump":n.bumpMap=a.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":n.aoMap=a.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=a.getTexture(t,e.ID),void 0!==n.map&&(n.map.encoding=s.sRGBEncoding);break;case"DisplacementColor":n.displacementMap=a.getTexture(t,e.ID);break;case"EmissiveColor":n.emissiveMap=a.getTexture(t,e.ID),void 0!==n.emissiveMap&&(n.emissiveMap.encoding=s.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=a.getTexture(t,e.ID);break;case"ReflectionColor":n.envMap=a.getTexture(t,e.ID),void 0!==n.envMap&&(n.envMap.mapping=s.EquirectangularReflectionMapping,n.envMap.encoding=s.sRGBEncoding);break;case"SpecularColor":n.specularMap=a.getTexture(t,e.ID),void 0!==n.specularMap&&(n.specularMap.encoding=s.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=a.getTexture(t,e.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in Nt.Objects&&t in Nt.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=zt.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in Nt.Objects){var r,n=Nt.Objects.Deformer;for(r in n){var a,i=n[r],s=zt.get(parseInt(r));"Skin"===i.attrType?((a=this.parseSkeleton(s,n)).ID=r,1<s.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=s.parents[0].ID,e[r]=a):"BlendShape"===i.attrType&&((a={id:r}).rawTargets=this.parseMorphTargets(s,n),a.id=r,1<s.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=a)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var r=[];return e.children.forEach((function(e){var n=t[e.ID];"Cluster"===n.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new s.Matrix4).fromArray(n.TransformLink.a)},"Indexes"in n&&(e.indices=n.Indexes.a,e.weights=n.Weights.a),r.push(e))})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var r=[],n=0;n<e.children.length;n++){var a=e.children[n],i=t[a.ID],s={name:i.attrName,initialWeight:i.DeformPercent,id:i.id,fullWeights:i.FullWeights.a};if("BlendShapeChannel"!==i.attrType)return;s.geoID=zt.get(parseInt(a.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(s)}return r}},{key:"parseScene",value:function(e,t,r){Vt=new s.Group;var n=this.parseModels(e.skeletons,t,r),a=Nt.Objects.Model,i=this;n.forEach((function(e){var t=a[e.ID];i.setLookAtProperties(e,t),zt.get(e.ID).parents.forEach((function(t){void 0!==(t=n.get(t.ID))&&t.add(e)})),null===e.parent&&Vt.add(e)})),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),Vt.traverse((function(e){var t;e.userData.transformData&&(e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld),t=ur(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new $t).parse(),1===Vt.children.length&&Vt.children[0].isGroup&&(Vt.children[0].animations=r,Vt=Vt.children[0]),Vt.animations=r}},{key:"parseModels",value:function(e,t,r){var n,a=new Map,i=Nt.Objects.Model;for(n in i){var o=parseInt(n),l=i[n],c=zt.get(o),u=this.buildSkeleton(c,e,o,l.attrName);if(!u){switch(l.attrType){case"Camera":u=this.createCamera(c);break;case"Light":u=this.createLight(c);break;case"Mesh":u=this.createMesh(c,t,r);break;case"NurbsCurve":u=this.createCurve(c,t);break;case"LimbNode":case"Root":u=new s.Bone;break;default:u=new s.Group}u.name=l.attrName?s.PropertyBinding.sanitizeNodeName(l.attrName):"",u.ID=o}this.getTransformData(u,l),a.set(o,u)}return a}},{key:"buildSkeleton",value:function(e,t,r,n){var a=null;return e.parents.forEach((function(e){for(var i in t)!function(i){var o=t[i];o.rawBones.forEach((function(t,i){var l;t.ID===e.ID&&(l=a,(a=new s.Bone).matrixWorld.copy(t.transformLink),a.name=n?s.PropertyBinding.sanitizeNodeName(n):"",a.ID=r,o.bones[i]=a,null!==l&&a.add(l))}))}(i)})),a}},{key:"createCamera",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Nt.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new s.Object3D;else{var n=0,a=(void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1),1),i=(void 0!==r.NearPlane&&(a=r.NearPlane.value/1e3),1e3),o=(void 0!==r.FarPlane&&(i=r.FarPlane.value/1e3),window.innerWidth),l=window.innerHeight,c=(void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(o=r.AspectWidth.value,l=r.AspectHeight.value),o/l),u=45,h=(void 0!==r.FieldOfView&&(u=r.FieldOfView.value),r.FocalLength?r.FocalLength.value:null);switch(n){case 0:t=new s.PerspectiveCamera(u,c,a,i),null!==h&&t.setFocalLength(h);break;case 1:t=new s.OrthographicCamera(-o/2,o/2,l/2,-l/2,a,i);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new s.Object3D}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Nt.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new s.Object3D;else{e=void 0===r.LightType?0:r.LightType.value;var n=16777215,a=(void 0!==r.Color&&(n=(new s.Color).fromArray(r.Color.value)),void 0===r.Intensity?1:r.Intensity.value/100),i=(void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(a=0),0);switch(void 0!==r.FarAttenuationEnd&&(i=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),e){case 0:t=new s.PointLight(n,a,i,1);break;case 1:t=new s.DirectionalLight(n,a);break;case 2:var o=Math.PI/3,l=(void 0!==r.InnerAngle&&(o=s.MathUtils.degToRad(r.InnerAngle.value)),0);void 0!==r.OuterAngle&&(l=s.MathUtils.degToRad(r.OuterAngle.value),l=Math.max(l,1)),t=new s.SpotLight(n,a,i,o,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new s.PointLight(n,a)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,r){var n,a=null,i=null,o=[];return e.children.forEach((function(e){t.has(e.ID)&&(a=t.get(e.ID)),r.has(e.ID)&&o.push(r.get(e.ID))})),1<o.length?i=o:0<o.length?i=o[0]:(i=new s.MeshPhongMaterial({color:13421772}),o.push(i)),"color"in a.attributes&&o.forEach((function(e){e.vertexColors=!0})),a.FBX_Deformer?(n=new s.SkinnedMesh(a,i)).normalizeSkinWeights():n=new s.Mesh(a,i),n}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,r){return t.has(r.ID)?t.get(r.ID):e}),null);var r=new s.LineBasicMaterial({color:3342591,linewidth:1});return new s.Line(e,r)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?hr(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&zt.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=Nt.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),Vt.add(e.target)):e.lookAt((new s.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,r){var n,a=this.parsePoseNodes();for(n in e)!function(n){var i=e[n];zt.get(parseInt(i.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,zt.get(e).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new s.Skeleton(i.bones),a[e.ID])})))}))}(n)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in Nt.Objects){var t,r,n=Nt.Objects.Pose;for(t in n)"BindPose"===n[t].attrType&&0<n[t].NbPoseNodes&&(r=n[t].PoseNode,Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new s.Matrix4).fromArray(t.Matrix.a)})):e[r.Node]=(new s.Matrix4).fromArray(r.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,r;"GlobalSettings"in Nt&&"AmbientColor"in Nt.GlobalSettings&&(r=(t=Nt.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new s.Color(r,e,t),Vt.add(new s.AmbientLight(r,1))))}}]),e}(),Jt=function(){function e(){Wt(this,e),this.negativeMaterialIndices=!1}return Kt(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in Nt.Objects){var r,n=Nt.Objects.Geometry;for(r in n){var a=zt.get(parseInt(r));a=this.parseGeometry(a,n[r],e),t.set(parseInt(r),a)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}},{key:"parseGeometry",value:function(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,r){var n,a=r.skeletons,i=[],s=e.parents.map((function(e){return Nt.Objects.Model[e.ID]}));if(0!==s.length)return n=e.children.reduce((function(e,t){return void 0!==a[t.ID]?a[t.ID]:e}),null),e.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&i.push(r.morphTargets[e.ID])})),e=s[0],s={},"RotationOrder"in e&&(s.eulerOrder=hr(e.RotationOrder.value)),"InheritType"in e&&(s.inheritType=parseInt(e.InheritType.value)),"GeometricTranslation"in e&&(s.translation=e.GeometricTranslation.value),"GeometricRotation"in e&&(s.rotation=e.GeometricRotation.value),"GeometricScaling"in e&&(s.scale=e.GeometricScaling.value),e=ur(s),this.genGeometry(t,n,i,e)}},{key:"genGeometry",value:function(e,t,r,n){var a,i,o=new s.BufferGeometry,l=(e.attrName&&(o.name=e.attrName),this.parseGeoNode(e,t)),c=this.genBuffers(l),u=new s.Float32BufferAttribute(c.vertex,3);return u.applyMatrix4(n),o.setAttribute("position",u),0<c.colors.length&&o.setAttribute("color",new s.Float32BufferAttribute(c.colors,3)),t&&(o.setAttribute("skinIndex",new s.Uint16BufferAttribute(c.weightsIndices,4)),o.setAttribute("skinWeight",new s.Float32BufferAttribute(c.vertexWeights,4)),o.FBX_Deformer=t),0<c.normal.length&&(u=(new s.Matrix3).getNormalMatrix(n),(t=new s.Float32BufferAttribute(c.normal,3)).applyNormalMatrix(u),o.setAttribute("normal",t)),c.uvs.forEach((function(e,t){var r="uv"+(t+1).toString();o.setAttribute(r=0===t?"uv":r,new s.Float32BufferAttribute(c.uvs[t],2))})),l.material&&"AllSame"!==l.material.mappingType&&(a=c.materialIndex[0],i=0,c.materialIndex.forEach((function(e,t){e!==a&&(o.addGroup(i,t-i,a),a=e,i=t)})),0<o.groups.length&&(t=(u=o.groups[o.groups.length-1]).start+u.count)!==c.materialIndex.length&&o.addGroup(t,c.materialIndex.length-t,a),0===o.groups.length&&o.addGroup(0,c.materialIndex.length,c.materialIndex[0])),this.addMorphTargets(o,e,r,n),o}},{key:"parseGeoNode",value:function(e,t){var r={};if(r.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],r.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];for(var n=0;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return r.weightTable={},null!==t&&(r.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(n,a){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:t,weight:e.weights[a]})}))})),r}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,a=!1,i=[],s=[],o=[],l=[],c=[],u=[],h=this;return e.vertexIndices.forEach((function(d,p){var f,m,g,v,b=!1,y=(d<0&&(d^=-1,b=!0),[]),x=[];if(i.push(3*d,3*d+1,3*d+2),e.color&&(v=or(p,r,d,e.color),o.push(v[0],v[1],v[2])),e.skeleton){for(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){x.push(e.weight),y.push(e.id)})),4<x.length&&(a||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),a=!0),m=[0,0,0,0],g=[0,0,0,0],x.forEach((function(e,t){var r=e,n=y[t];g.forEach((function(e,t,a){e<r&&(a[t]=r,r=e,a=m[t],m[t]=n,n=a)}))})),y=m,x=g);x.length<4;)x.push(0),y.push(0);for(var w=0;w<4;++w)c.push(x[w]),u.push(y[w])}e.normal&&(v=or(p,r,d,e.normal),s.push(v[0],v[1],v[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=or(p,r,d,e.material)[0])<0&&(h.negativeMaterialIndices=!0,f=0),e.uv&&e.uv.forEach((function(e,t){e=or(p,r,d,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),n++,b&&(4<n&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),h.genFace(t,e,i,f,s,o,l,c,u,n),r++,n=0,i=[],s=[],o=[],l=[],c=[],u=[])})),t}},{key:"genFace",value:function(e,t,r,n,a,i,s,o,l,c){for(var u=2;u<c;u++)!function(c){e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[3*(c-1)]]),e.vertex.push(t.vertexPositions[r[3*(c-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(c-1)+2]]),e.vertex.push(t.vertexPositions[r[3*c]]),e.vertex.push(t.vertexPositions[r[3*c+1]]),e.vertex.push(t.vertexPositions[r[3*c+2]]),t.skeleton&&(e.vertexWeights.push(o[0]),e.vertexWeights.push(o[1]),e.vertexWeights.push(o[2]),e.vertexWeights.push(o[3]),e.vertexWeights.push(o[4*(c-1)]),e.vertexWeights.push(o[4*(c-1)+1]),e.vertexWeights.push(o[4*(c-1)+2]),e.vertexWeights.push(o[4*(c-1)+3]),e.vertexWeights.push(o[4*c]),e.vertexWeights.push(o[4*c+1]),e.vertexWeights.push(o[4*c+2]),e.vertexWeights.push(o[4*c+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(c-1)]),e.weightsIndices.push(l[4*(c-1)+1]),e.weightsIndices.push(l[4*(c-1)+2]),e.weightsIndices.push(l[4*(c-1)+3]),e.weightsIndices.push(l[4*c]),e.weightsIndices.push(l[4*c+1]),e.weightsIndices.push(l[4*c+2]),e.weightsIndices.push(l[4*c+3])),t.color&&(e.colors.push(i[0]),e.colors.push(i[1]),e.colors.push(i[2]),e.colors.push(i[3*(c-1)]),e.colors.push(i[3*(c-1)+1]),e.colors.push(i[3*(c-1)+2]),e.colors.push(i[3*c]),e.colors.push(i[3*c+1]),e.colors.push(i[3*c+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(a[0]),e.normal.push(a[1]),e.normal.push(a[2]),e.normal.push(a[3*(c-1)]),e.normal.push(a[3*(c-1)+1]),e.normal.push(a[3*(c-1)+2]),e.normal.push(a[3*c]),e.normal.push(a[3*c+1]),e.normal.push(a[3*c+2])),t.uv&&t.uv.forEach((function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(s[r][0]),e.uvs[r].push(s[r][1]),e.uvs[r].push(s[r][2*(c-1)]),e.uvs[r].push(s[r][2*(c-1)+1]),e.uvs[r].push(s[r][2*c]),e.uvs[r].push(s[r][2*c+1])}))}(u)}},{key:"addMorphTargets",value:function(e,t,r,n){var a;0!==r.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],a=this,r.forEach((function(r){r.rawTargets.forEach((function(r){var i=Nt.Objects.Geometry[r.geoID];void 0!==i&&a.genMorphGeometry(e,t,i,n,r.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,r,n,a){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var i=void 0!==r.Vertices?r.Vertices.a:[],o=void 0!==r.Indexes?r.Indexes.a:[],l=3*e.attributes.position.count,c=new Float32Array(l),u=0;u<o.length;u++){var h=3*o[u];c[h]=i[3*u],c[1+h]=i[3*u+1],c[2+h]=i[3*u+2]}l=this.genBuffers({vertexIndices:t,vertexPositions:c}),(t=new s.Float32BufferAttribute(l.vertex,3)).name=a||r.attrName,t.applyMatrix4(n),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.Normals.a,a=[];return"IndexToDirect"===r&&("NormalIndex"in e?a=e.NormalIndex.a:"NormalsIndex"in e&&(a=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:a,mappingType:t,referenceType:r}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:2,buffer:e.UV.a,indices:n="IndexToDirect"===r?e.UVIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:4,buffer:e.Colors.a,indices:n="IndexToDirect"===r?e.ColorIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=e.Materials.a,a=[],i=0;i<n.length;++i)a.push(i);return{dataSize:1,buffer:n,indices:a,mappingType:t,referenceType:r}}},{key:"parseNurbsGeometry",value:function(e){var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new s.BufferGeometry;for(var r=t-1,n=(t=e.KnotVector.a,[]),a=e.Points.a,i=0,o=a.length;i<o;i+=4)n.push((new s.Vector4).fromArray(a,i));if("Closed"===e.Form)n.push(n[0]);else if("Periodic"===e.Form)for(var l=r,c=t.length-1-l,u=0;u<r;++u)n.push(n[u]);return e=new Gt(r,t,n,l,c).getPoints(12*n.length),(new s.BufferGeometry).setFromPoints(e)}}]),e}(),$t=function(){function e(){Wt(this,e)}return Kt(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var r in t)r=t[r],r=this.addClip(r),e.push(r);return e}},{key:"parseClips",value:function(){var e;if(void 0!==Nt.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=Nt.Objects.AnimationCurveNode,r=new Map;for(e in t){var n=t[e];null!==n.attrName.match(/S|R|T|DeformPercent/)&&(n={id:n.id,attr:n.attrName,curves:{}},r.set(n.id,n))}return r}},{key:"parseAnimationCurves",value:function(e){var t,r=Nt.Objects.AnimationCurve;for(t in r){var n,a={id:r[t].id,times:r[t].KeyTime.a.map(ir),values:r[t].KeyValueFloat.a},i=zt.get(a.id);void 0!==i&&(n=i.parents[0].ID,(i=i.parents[0].relationship).match(/X/)?e.get(n).curves.x=a:i.match(/Y/)?e.get(n).curves.y=a:i.match(/Z/)?e.get(n).curves.z=a:i.match(/d|DeformPercent/)&&e.has(n)&&(e.get(n).curves.morph=a))}}},{key:"parseAnimationLayers",value:function(e){var t,r=Nt.Objects.AnimationLayer,n=new Map;for(t in r)!function(t){var r=[],a=zt.get(parseInt(t));void 0!==a&&(a.children.forEach((function(t,n){if(e.has(t.ID)){var a=e.get(t.ID);if(void 0!==a.curves.x||void 0!==a.curves.y||void 0!==a.curves.z){if(void 0===r[n]){var i=zt.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==i){var o=Nt.Objects.Model[i.toString()];if(void 0===o)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var l={modelName:o.attrName?s.PropertyBinding.sanitizeNodeName(o.attrName):"",ID:o.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Vt.traverse((function(e){e.ID===o.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new s.Matrix4),"PreRotation"in o&&(l.preRotation=o.PreRotation.value),"PostRotation"in o&&(l.postRotation=o.PostRotation.value),r[n]=l}}r[n]&&(r[n][a.attr]=a)}else void 0!==a.curves.morph&&(void 0===r[n]&&(i=zt.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=zt.get(i).parents[0].ID,t=zt.get(t).parents[0].ID,t=zt.get(t).parents[0].ID,t={modelName:(t=Nt.Objects.Model[t]).attrName?s.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:Nt.Objects.Deformer[i].attrName},r[n]=t),r[n][a.attr]=a)}})),n.set(parseInt(t),r))}(t);return n}},{key:"parseAnimStacks",value:function(e){var t,r=Nt.Objects.AnimationStack,n={};for(t in r){var a=(1<(a=zt.get(parseInt(t)).children).length&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers."),e.get(a[0].ID));n[t]={name:r[t].attrName,layer:a}}return n}},{key:"addClip",value:function(e){var t=[],r=this;return e.layer.forEach((function(e){t=t.concat(r.generateTracks(e))})),new s.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new s.Vector3,n=new s.Quaternion,a=new s.Vector3;return e.transform&&e.transform.decompose(r,n,a),r=r.toArray(),n=(new s.Euler).setFromQuaternion(n,e.eulerOrder).toArray(),a=a.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(r=this.generateVectorTrack(e.modelName,e.T.curves,r,"position"))&&t.push(r),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(r=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(r),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.S.curves,a,"scale"))&&t.push(n),void 0!==e.DeformPercent&&void 0!==(r=this.generateMorphTrack(e))&&t.push(r),t}},{key:"generateVectorTrack",value:function(e,t,r,n){var a=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(a,t,r),new s.VectorKeyframeTrack(e+"."+n,a,t)}},{key:"generateRotationTrack",value:function(e,t,r,n,a,i){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(s.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(s.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(s.MathUtils.degToRad));for(var o=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(o,t,r),c=(void 0!==n&&((n=n.map(s.MathUtils.degToRad)).push(i),n=(new s.Euler).fromArray(n),n=(new s.Quaternion).setFromEuler(n)),void 0!==a&&((a=a.map(s.MathUtils.degToRad)).push(i),a=(new s.Euler).fromArray(a),a=(new s.Quaternion).setFromEuler(a).invert()),new s.Quaternion),u=new s.Euler,h=[],d=0;d<l.length;d+=3)u.set(l[d],l[d+1],l[d+2],i),c.setFromEuler(u),void 0!==n&&c.premultiply(n),void 0!==a&&c.multiply(a),c.toArray(h,d/3*4);return new s.QuaternionKeyframeTrack(e+".quaternion",o,h)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),n=Vt.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new s.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,r)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),1<(t=(t=void 0!==e.z?t.concat(e.z.times):t).sort((function(e,t){return e-t}))).length){for(var r=1,n=t[0],a=1;a<t.length;a++){var i=t[a];i!==n&&(n=t[r]=i,r++)}t=t.slice(0,r)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,r){var n=r,a=[],i=-1,s=-1,o=-1;return e.forEach((function(e){t.x&&(i=t.x.times.indexOf(e)),t.y&&(s=t.y.times.indexOf(e)),t.z&&(o=t.z.times.indexOf(e)),-1!==i?(e=t.x.values[i],a.push(e),n[0]=e):a.push(n[0]),-1!==s?(e=t.y.values[s],a.push(e),n[1]=e):a.push(n[1]),-1!==o?(e=t.z.values[o],a.push(e),n[2]=e):a.push(n[2])})),a}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var r=e.values[t-1],n=e.values[t]-r;if(180<=(a=Math.abs(n))){for(var a,i=n/(a/=180),s=r+i,o=(n=e.times[t-1],(e.times[t]-n)/a),l=n+o,c=[],u=[];l<e.times[t];)c.push(l),l+=o,u.push(s),s+=i;e.times=fr(e.times,t,c),e.values=fr(e.values,t,u)}}}}]),e}(),er=function(){function e(){Wt(this,e)}return Kt(e,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(e){this.nodeStack.push(e),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),--this.currentIndent}},{key:"setCurrentProp",value:function(e,t){this.currentProp=e,this.currentPropName=t}},{key:"parse",value:function(e){this.currentIndent=0,this.allNodes=new nr,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,r=e.split(/[\r\n]+/);return r.forEach((function(e,n){var a,i=e.match(/^[\s\t]*;/),s=e.match(/^[\s\t]*$/);i||s||(i=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),a=e.match("^\\t{"+(t.currentIndent-1)+"}}"),i?t.parseNodeBegin(e,i):s?t.parseNodeProperty(e,s,r[++n]):a?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var r=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:r}),a=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(r,n):r in a?("PoseNode"===r?a.PoseNode.push(n):void 0!==a[r].id&&(a[r]={},a[r][a[r].id]=a[r]),""!==t.id&&(a[r][t.id]=n)):"number"==typeof t.id?(a[r]={},a[r][t.id]=n):"Properties70"!==r&&(a[r]="PoseNode"===r?[n]:n),"number"==typeof t.id&&(n.id=t.id),""!==t.name&&(n.attrName=t.name),""!==t.type&&(n.attrType=t.type),this.pushStack(n)}},{key:"parseNodeAttr",value:function(e){var t=e[0],r=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),n="";return 1<e.length&&(r=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:r,type:n}}},{key:"parseNodeProperty",value:function(e,t,r){var n=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===n&&","===t&&(t=r.replace(/"/g,"").replace(/,$/,"").trim()),r=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,n,t);else{if("C"===n){e=t.split(",").slice(1);for(var a=parseInt(e[0]),i=(e=parseInt(e[1]),(i=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),s=(n="connections",t=[a,e]),o=i,l=0,c=s.length,u=o.length;l<u;l++,c++)s[c]=o[l];void 0===r[n]&&(r[n]=[])}"Node"===n&&(r.id=t),n in r&&Array.isArray(r[n])?r[n].push(t):"a"!==n?r[n]=t:r.a=t,this.setCurrentProp(r,n),"a"===n&&","!==t.slice(-1)&&(r.a=dr(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=dr(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,r){r=r.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var n=r[0],a=r[1],i=r[2],s=r[3],o=r[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":o=parseFloat(o);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":o=dr(o)}this.getPrevNode()[n]={type:a,type2:i,flag:s,value:o},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),tr=function(){function e(){Wt(this,e)}return Kt(e,[{key:"parse",value:function(e){var t=new rr(e),r=(t.skip(23),t.getUint32());if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new nr;!this.endOfContent(t);){var a=this.parseNode(t,r);null!==a&&n.add(a.name,a)}return n}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var r={},n=7500<=t?e.getUint64():e.getUint32(),a=7500<=t?e.getUint64():e.getUint32(),i=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),s=e.getString(i);if(0===n)return null;for(var o=[],l=0;l<a;l++)o.push(this.parseProperty(e));i=0<o.length?o[0]:"";var c=1<o.length?o[1]:"",u=2<o.length?o[2]:"";for(r.singleProperty=1===a&&e.getOffset()===n;n>e.getOffset();){var h=this.parseNode(e,t);null!==h&&this.parseSubNode(s,r,h)}return r.propertyList=o,"number"==typeof i&&(r.id=i),""!==c&&(r.attrName=c),""!==u&&(r.attrType=u),""!==s&&(r.name=s),r}},{key:"parseSubNode",value:function(e,t,r){var n,a,i,s,o;!0===r.singleProperty?(a=r.propertyList[0],Array.isArray(a)?(t[r.name]=r).a=a:t[r.name]=a):"Connections"===e&&"C"===r.name?(n=[],r.propertyList.forEach((function(e,t){0!==t&&n.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(n)):"Properties70"===r.name?Object.keys(r).forEach((function(e){t[e]=r[e]})):"Properties70"===e&&"P"===r.name?(a=r.propertyList[0],e=r.propertyList[1],i=r.propertyList[2],s=r.propertyList[3],0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),o="Color"===(e=0===e.indexOf("Lcl ")?e.replace("Lcl ","Lcl_"):e)||"ColorRGB"===e||"Vector"===e||"Vector3D"===e||0===e.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[a]={type:e,type2:i,flag:s,value:o}):void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)}},{key:"parseProperty",value:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),n=e.getUint32(),a=e.getUint32();if(0===n)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}n=function(e,t){return function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new dt(0);function a(e){var r=t.length;r<e&&((r=new dt(Math.max(2*r,e))).set(t),t=r)}var i=!t||r,s=!r||r.i,o=(r=r||{},t=t||new dt(3*n),r.f||0),l=r.p||0,c=r.b||0,u=r.l,h=r.d,d=r.m,p=r.n,f=8*n;do{if(!u){r.f=o=Pt(e,l,1);var m=Pt(e,l+1,3);if(l+=3,!m){var g=e[(_=Ot(l)+4)-4]|e[_-3]<<8;if(n<(S=_+g)){if(s)throw"unexpected EOF";break}i&&a(c+g),t.set(e.subarray(_,S),c),r.b=c+=g,r.p=l=8*S;continue}if(1==m)u=Et,h=kt,d=9,p=5;else{if(2!=m)throw"invalid block type";g=Pt(e,l,31)+257;for(var v=Pt(e,l+10,15)+4,b=g+Pt(e,l+5,31)+1,y=(l+=14,new dt(b)),x=new dt(19),w=0;w<v;++w)x[vt[w]]=Pt(e,l+3*w,7);l+=3*v;var S,M=(1<<(S=Dt(x)))-1,T=Mt(x,S,1);for(w=0;w<b;){var _,E=T[Pt(e,l,M)];if(l+=15&E,(_=E>>>4)<16)y[w++]=_;else{var k=0,D=0;for(16==_?(D=3+Pt(e,l,3),l+=2,k=y[w-1]):17==_?(D=3+Pt(e,l,7),l+=3):18==_&&(D=11+Pt(e,l,127),l+=7);D--;)y[w++]=k}}m=y.subarray(0,g);var P=y.subarray(g);d=Dt(m),p=Dt(P),u=Mt(m,d,1),h=Mt(P,p,1)}if(f<l){if(s)throw"unexpected EOF";break}}i&&a(c+131072);for(var A=(1<<d)-1,O=(1<<p)-1,C=l;;C=l){var R=(k=u[At(e,l)&A])>>>4;if(f<(l+=15&k)){if(s)throw"unexpected EOF";break}if(!k)throw"invalid length/literal";if(R<256)t[c++]=R;else{if(256==R){C=l,u=null;break}var L,I=R-254,B=(264<R&&(L=mt[w=R-257],I=Pt(e,l,(1<<L)-1)+bt[w],l+=L),(R=h[At(e,l)&O])>>>4);if(!R)throw"invalid distance";if(l+=15&R,P=yt[B],3<B&&(L=gt[B],P+=At(e,l)&(1<<L)-1,l+=L),f<l){if(s)throw"unexpected EOF";break}i&&a(c+131072);for(var U=c+I;c<U;c+=4)t[c]=t[c-P],t[c+1]=t[c+1-P],t[c+2]=t[c+2-P],t[c+3]=t[c+3-P];c=U}}r.l=u,r.p=C,r.b=c,u&&(o=1,r.m=d,r.d=h,r.n=p)}while(!o);return c==t.length?t:Ct(t,0,c)}((function(e){if(8!=(15&e[0])||7<e[0]>>>4||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),t)}(new Uint8Array(e.getArrayBuffer(a)));var i=new rr(n.buffer);switch(t){case"b":case"c":return i.getBooleanArray(r);case"d":return i.getFloat64Array(r);case"f":return i.getFloat32Array(r);case"i":return i.getInt32Array(r);case"l":return i.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}]),e}(),rr=function(){function e(t,r){Wt(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r,this._textDecoder=new TextDecoder}return Kt(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,-(4294967296*(t=4294967295==(e=4294967295&~e)?t+1&4294967295:t)+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){var t=this.offset,r=new Uint8Array(this.dv.buffer,t,e);return 0<=(this.skip(e),e=r.indexOf(0))&&(r=new Uint8Array(this.dv.buffer,t,e)),this._textDecoder.decode(r)}}]),e}(),nr=function(){function e(){Wt(this,e)}return Kt(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function ar(e){if(e=e.match(/FBXVersion: (\d+)/))return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function ir(e){return e/46186158e3}var sr=[];function or(e,t,r,n){var a;switch(n.mappingType){case"ByPolygonVertex":a=e;break;case"ByPolygon":a=t;break;case"ByVertice":a=r;break;case"AllSame":a=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}for(var i=(a="IndexToDirect"===n.referenceType?n.indices[a]:a)*n.dataSize,s=i+n.dataSize,o=sr,l=n.buffer,c=s,u=i,h=0;u<c;u++,h++)o[h]=l[u];return o}var lr=new s.Euler,cr=new s.Vector3;function ur(e){var t=new s.Matrix4,r=new s.Matrix4,n=new s.Matrix4,a=new s.Matrix4,i=new s.Matrix4,o=new s.Matrix4,l=new s.Matrix4,c=new s.Matrix4,u=new s.Matrix4,h=new s.Matrix4,d=new s.Matrix4,p=new s.Matrix4,f=e.inheritType||0,m=(e.translation&&t.setPosition(cr.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),r.makeRotationFromEuler(lr.fromArray(m))),e.rotation&&((m=e.rotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),n.makeRotationFromEuler(lr.fromArray(m))),e.postRotation&&((m=e.postRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),a.makeRotationFromEuler(lr.fromArray(m)),a.invert()),e.scale&&i.scale(cr.fromArray(e.scale)),e.scalingOffset&&l.setPosition(cr.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(cr.fromArray(e.scalingPivot)),e.rotationOffset&&c.setPosition(cr.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(cr.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(d.copy(e.parentMatrix),h.copy(e.parentMatrixWorld)),r.clone().multiply(n).multiply(a)),g=(((e=new s.Matrix4).extractRotation(h),g=new s.Matrix4).copyPosition(h),g.clone().invert().multiply(h)),v=(g=e.clone().invert().multiply(g),i),b=new s.Matrix4;return 0===f?b.copy(e).multiply(m).multiply(g).multiply(v):1===f?b.copy(e).multiply(g).multiply(m).multiply(v):(f=(new s.Matrix4).scale((new s.Vector3).setFromMatrixScale(d)).clone().invert(),d=g.clone().multiply(f),b.copy(e).multiply(m).multiply(d).multiply(v)),g=u.clone().invert(),f=o.clone().invert(),e=t.clone().multiply(c).multiply(u).multiply(r).multiply(n).multiply(a).multiply(g).multiply(l).multiply(o).multiply(i).multiply(f),m=(new s.Matrix4).copyPosition(e),d=h.clone().multiply(m),p.copyPosition(d),(e=p.clone().multiply(b)).premultiply(h.invert()),e}function hr(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function dr(e){return e.split(",").map((function(e){return parseFloat(e)}))}function pr(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),(new TextDecoder).decode(new Uint8Array(e,t,r))}function fr(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function mr(e){return(mr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function gr(e,t){return(gr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function vr(e){return(vr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var br=/^[og]\s*(.+)?/,yr=/^mtllib /,xr=/^usemtl /,wr=/^usemap /,Sr=/\s+/,Mr=new s.Vector3,Tr=new s.Vector3,_r=new s.Vector3,Er=new s.Vector3,kr=new s.Vector3,Dr=new s.Color;function Pr(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var r=this._finalize(!1);return r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==r?r:this).smooth,groupStart:void 0!==r?r.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){return(e={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1}).clone=this.clone.bind(e),e}},this.materials.push(e),e},currentMaterial:function(){if(0<this.materials.length)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var r=this.materials.length-1;0<=r;r--)this.materials[r].groupCount<=0&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone&&((e=r.clone(0)).inherited=!0,this.object.materials.push(e)),this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseNormalIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseUVIndex:function(e,t){return 2*(0<=(e=parseInt(e,10))?e-1:e+t/2)},addVertex:function(e,t,r){var n=this.vertices,a=this.object.geometry.vertices;a.push(n[e+0],n[e+1],n[e+2]),a.push(n[t+0],n[t+1],n[t+2]),a.push(n[r+0],n[r+1],n[r+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){var n=this.normals,a=this.object.geometry.normals;a.push(n[e+0],n[e+1],n[e+2]),a.push(n[t+0],n[t+1],n[t+2]),a.push(n[r+0],n[r+1],n[r+2])},addFaceNormal:function(e,t,r){var n=this.vertices,a=this.object.geometry.normals;Mr.fromArray(n,e),Tr.fromArray(n,t),_r.fromArray(n,r),kr.subVectors(_r,Tr),Er.subVectors(Mr,Tr),kr.cross(Er),kr.normalize(),a.push(kr.x,kr.y,kr.z),a.push(kr.x,kr.y,kr.z),a.push(kr.x,kr.y,kr.z)},addColor:function(e,t,r){var n=this.colors,a=this.object.geometry.colors;void 0!==n[e]&&a.push(n[e+0],n[e+1],n[e+2]),void 0!==n[t]&&a.push(n[t+0],n[t+1],n[t+2]),void 0!==n[r]&&a.push(n[r+0],n[r+1],n[r+2])},addUV:function(e,t,r){var n=this.uvs,a=this.object.geometry.uvs;a.push(n[e+0],n[e+1]),a.push(n[t+0],n[t+1]),a.push(n[r+0],n[r+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,n,a,i,s,o,l){var c=this.vertices.length;e=this.parseVertexIndex(e,c),t=this.parseVertexIndex(t,c),r=this.parseVertexIndex(r,c),this.addVertex(e,t,r),this.addColor(e,t,r),void 0!==s&&""!==s?(c=this.normals.length,e=this.parseNormalIndex(s,c),t=this.parseNormalIndex(o,c),r=this.parseNormalIndex(l,c),this.addNormal(e,t,r)):this.addFaceNormal(e,t,r),void 0!==n&&""!==n?(s=this.uvs.length,e=this.parseUVIndex(n,s),t=this.parseUVIndex(a,s),r=this.parseUVIndex(i,s),this.addUV(e,t,r),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,r=0,n=e.length;r<n;r++){var a=this.parseVertexIndex(e[r],t);this.addVertexPoint(a),this.addColor(a)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,n=this.uvs.length,a=0,i=e.length;a<i;a++)this.addVertexLine(this.parseVertexIndex(e[a],r));for(var s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],n))}};return e.startObject("",!1),e}var Ar=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gr(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=vr(e);if(r=t?(r=vr(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===mr(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"load",value:function(e,t,r,n){var a=this,i=new s.FileLoader(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,(function(r){try{t(a.parse(r))}catch(r){n?n(r):console.error(r),a.manager.itemError(e)}}),r,n)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t=new Pr,r=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),n=[],a=0,i=r.length;a<i;a++){var o=r[a].trimStart();if(0!==o.length){var l,c=o.charAt(0);if("#"!==c)if("v"===c){var u=o.split(Sr);switch(u[0]){case"v":t.vertices.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),7<=u.length?(Dr.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6])).convertSRGBToLinear(),t.colors.push(Dr.r,Dr.g,Dr.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]))}}else if("f"===c){for(var h=o.slice(1).trim().split(Sr),d=[],p=0,f=h.length;p<f;p++){var m=h[p];0<m.length&&(m=m.split("/"),d.push(m))}for(var g=d[0],v=1,b=d.length-1;v<b;v++){var y=d[v],x=d[v+1];t.addFace(g[0],y[0],x[0],g[1],y[1],x[1],g[2],y[2],x[2])}}else if("l"===c){var w=o.substring(1).trim().split(" "),S=[],M=[];if(-1===o.indexOf("/"))S=w;else for(var T=0,_=w.length;T<_;T++){var E=w[T].split("/");""!==E[0]&&S.push(E[0]),""!==E[1]&&M.push(E[1])}t.addLineGeometry(S,M)}else"p"===c?(l=o.slice(1).trim().split(" "),t.addPointGeometry(l)):null!==(n=br.exec(o))?(l=(" "+n[0].slice(1).trim()).slice(1),t.startObject(l)):xr.test(o)?t.object.startMaterial(o.substring(7).trim(),t.materialLibraries):yr.test(o)?t.materialLibraries.push(o.substring(7).trim()):wr.test(o)?console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'):"s"===c?(1<(n=o.split(" ")).length?(c=n[1].trim().toLowerCase(),t.object.smooth="0"!==c&&"off"!==c):t.object.smooth=!0,(c=t.object.currentMaterial())&&(c.smooth=t.object.smooth)):"\0"!==o&&console.warn('THREE.OBJLoader: Unexpected line: "'+o+'"')}}t.finalize();var k,D=new s.Group;if(1==(D.materialLibraries=[].concat(t.materialLibraries),e=!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length)))for(var P=0,A=t.objects.length;P<A;P++){var O=t.objects[P],C=O.geometry,R=O.materials,L="Line"===C.type,I="Points"===C.type,B=!1;if(0!==C.vertices.length){for(var U=new s.BufferGeometry,j=(U.setAttribute("position",new s.Float32BufferAttribute(C.vertices,3)),0<C.normals.length&&U.setAttribute("normal",new s.Float32BufferAttribute(C.normals,3)),0<C.colors.length&&(B=!0,U.setAttribute("color",new s.Float32BufferAttribute(C.colors,3))),!0===C.hasUVIndices&&U.setAttribute("uv",new s.Float32BufferAttribute(C.uvs,2)),[]),F=0,N=R.length;F<N;F++){var z,V=R[F],G=V.name+"_"+V.smooth+"_"+B,H=t.materials[G];null!==this.materials&&(H=this.materials.create(V.name),!L||!H||H instanceof s.LineBasicMaterial?!I||!H||H instanceof s.PointsMaterial||(z=new s.PointsMaterial({size:10,sizeAttenuation:!1}),s.Material.prototype.copy.call(z,H),z.color.copy(H.color),z.map=H.map,H=z):(z=new s.LineBasicMaterial,s.Material.prototype.copy.call(z,H),z.color.copy(H.color),H=z)),void 0===H&&((H=L?new s.LineBasicMaterial:I?new s.PointsMaterial({size:1,sizeAttenuation:!1}):new s.MeshPhongMaterial).name=V.name,H.flatShading=!V.smooth,H.vertexColors=B,t.materials[G]=H),j.push(H)}if(C=void 0,1<j.length){for(var W=0,q=R.length;W<q;W++){var K=R[W];U.addGroup(K.groupStart,K.groupCount,W)}C=new(L?s.LineSegments:I?s.Points:s.Mesh)(U,j)}else C=new(L?s.LineSegments:I?s.Points:s.Mesh)(U,j[0]);C.name=O.name,D.add(C)}}else 0<t.vertices.length&&(e=new s.PointsMaterial({size:1,sizeAttenuation:!1}),(k=new s.BufferGeometry).setAttribute("position",new s.Float32BufferAttribute(t.vertices,3)),0<t.colors.length&&void 0!==t.colors[0]&&(k.setAttribute("color",new s.Float32BufferAttribute(t.colors,3)),e.vertexColors=!0),k=new s.Points(k,e),D.add(k));return D}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(s.Loader),Or=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const Cr=t.FBXLoader;class Rr{constructor(e){this.parses={fbx:new Cr,obj:new Ar,object:new s.ObjectLoader},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parseFiles(e){return Promise.all(e.map((e=>this.parse(e))))}parse(e){return Or(this,void 0,void 0,(function*(){let t;switch(this.getBack(e).toLowerCase()){case"gltf":case"glb":t=this.glb(e);break;case"fbx":t=this.fbx(e);break;case"obj":t=this.obj(e);break;case"json":t=this.json(e)}return this.runScene.modelEx.beforeLoad(yield t)}))}img(e){console.log(e,"file")}glb(e){return Or(this,void 0,void 0,(function*(){var t=yield(0,i.parseFile)(e,"arrayBuffer");let r="model";return t=yield this.runScene.loaderer.gltf.parse(t,{triggerCb:!0,callBack:{beforeParse:e=>{"scene"===(e=(e.asset.ex||{}).type)&&this.runScene.clean()},getJSON(e){r=(null==(e=e.asset.ex)?void 0:e.type)||"model"}}}),{type:r,result:t}}))}fbx(e){return Or(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,i.parseFile)(e,"arrayBuffer");const r=this.parses.fbx.parse(t,"");return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(r)}}))}obj(e){return Or(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,i.parseFile)(e,"text"):e;const r=this.parses.obj.parse(t);return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(r)}}))}json(e){return Or(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,i.parseFile)(e,"text"):e,r=JSON.parse(t);return"timeLine"===r.type?{type:"timeLine",result:r.data}:{type:"model",result:this.runScene.loaderer.json.parse(t)}}))}}class Lr extends o{constructor(e){super(e),this._lastRenderMode=null,this.setRenderMode=(()=>{let e=!1;const t=()=>{e||(this.runScene.cb.loaderer.gltf.loaded.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),this.runScene.cb.loaderer.gltf.complete.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),e=!0)},r=()=>{const{renderer:e,controls:t}=this.runScene.assetsEx;var r=this.runScene.render;"tick"===this._lastRenderMode?e.setAnimationLoop(null):"controlsChange"===this._lastRenderMode&&t.removeEventListener("change",r)},n=e=>{var t=this.runScene.render;const{renderer:r,controls:n}=this.runScene.assetsEx;"tick"===e?r.setAnimationLoop(t):"controlsChange"===e&&n.addEventListener("change",t)};return e=>{this._lastRenderMode!==e&&(t(),r(),n(e),this._lastRenderMode=e)}})()}setGlow(e){this.runScene.pp.params.glow.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}}class Ir extends r(8624).Ys{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new s.Vector3,this.beginScale=new s.Vector3,this.posStart=new s.Vector2,this.posEnd=new s.Vector2,this.deleteRedundantParts()}deleteRedundantParts(){this.transGizmo.gizmo.translate.children.splice(1,1),this.transGizmo.gizmo.translate.children.splice(3,1),this.transGizmo.gizmo.translate.children.splice(5,1),this.transGizmo.gizmo.scale.children.splice(0,1),this.transGizmo.gizmo.scale.children.splice(2,1),this.transGizmo.gizmo.scale.children.splice(4,1)}pointerDown(e){void 0===this.object||null===this.axis||this.dragging||0!==e.button||(this.posStart.set(e.x,e.y),this.beginScale.set(this.object.scale.x,this.object.scale.y,this.object.scale.z),super.pointerDown(e))}pointerMove(e){if(super.pointerMove(e),void 0!==this.object&&null!==this.axis&&this.dragging&&-1===e.button&&"scale"===this.mode&&-1!==this.axis.search("XYZ")){this.posEnd.set(e.x,e.y),e=(Math.abs(this.beginScale.x)+Math.abs(this.beginScale.y)+Math.abs(this.beginScale.z))/3;let t=12*this.pointStart.distanceTo(this.pointEnd)/e;this.posEnd.x>this.posStart.x&&(t*=-1),(t=-1.1<t&&t<1.1?1:t)<0&&(t=-1.1/t),this.scaleCoefficient.set(t,t,t),this.object.scale.copy(this._scaleStart).multiply(this.scaleCoefficient)}}}class Br extends s.Object3D{constructor(e){super(),this.isViewHelper=!0,this.animating=!1,this.controls=null,this.dummy=new s.Object3D,this.turnRate=2*Math.PI,this.targetPosition=new s.Vector3,this.targetQuaternion=new s.Quaternion,this.q1=new s.Quaternion,this.q2=new s.Quaternion,this.radius=0,this.clock=new s.Clock,this.runScene=e,e=this.runScene.assetsEx.get().controls,this.controls=e,this.runScene.cb.render.add("view-helper",(()=>{this.update(this.clock.getDelta())}))}prepareAnimationData(e){const t=this.runScene.assetsEx.get().camera;var r=this.controls.target;switch(e){case"posX":this.targetPosition.set(1,0,0),this.targetQuaternion.setFromEuler(new s.Euler(0,.5*Math.PI,0));break;case"posY":this.targetPosition.set(0,1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*-Math.PI,0,0));break;case"posZ":this.targetPosition.set(0,0,1),this.targetQuaternion.setFromEuler(new s.Euler);break;case"negX":this.targetPosition.set(-1,0,0),this.targetQuaternion.setFromEuler(new s.Euler(0,.5*-Math.PI,0));break;case"negY":this.targetPosition.set(0,-1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*Math.PI,0,0));break;case"negZ":this.targetPosition.set(0,0,-1),this.targetQuaternion.setFromEuler(new s.Euler(0,Math.PI,0));break;default:console.error("ViewHelper: Invalid axis.")}this.radius=t.position.distanceTo(r),this.targetPosition.multiplyScalar(this.radius).add(r),this.dummy.position.copy(r),this.dummy.lookAt(t.position),this.q1.copy(this.dummy.quaternion),this.dummy.lookAt(this.targetPosition),this.q2.copy(this.dummy.quaternion),this.animating=!0}update(e){if(this.animating){const r=this.runScene.assetsEx.get().camera;e*=this.turnRate;var t=this.controls.target;this.q1.rotateTowards(this.q2,e),r.position.set(0,0,1).applyQuaternion(this.q1).multiplyScalar(this.radius).add(t),r.quaternion.rotateTowards(this.targetQuaternion,e),0===this.q1.angleTo(this.q2)&&(this.animating=!1)}}}class Ur{constructor(e){this.grid=null,this.transContro=null,this.boxHelper=null,this.clean=()=>{this.unfocus()},this.deepIsHelper=e=>"Scene"===e.type||!this.isHelper(e)&&!!e.parent&&this.deepIsHelper(e.parent),this.getBoxHelper=e=>(e=new s.BoxHelper(e),this.setHelper(e),this.runScene.assetsEx.get().scene.add(e),e),this.runScene=e,"running"!==this.runScene.optionsEx.options.mode&&(this.runScene.cb.clean.add("EngineHelper",this.clean),this.transContro=new class{constructor(e){this.tansControls=null,this.controlsMode="position",this.isDraggingChange=!1,this.modelNewVal=new c.Z.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.multipObj=null,this.speaceType="world",this.draggingChanged=e=>{var t=this.runScene.assetsEx.get().controls,r=this.controlsMode,n=this.runScene.modelEx.select||this.runScene.multipSelector.getLast();n&&(this.runScene.multipSelector.draggingchanged(e),t.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(n[r]),this.isDraggingChange=!0):(this.runScene.multipSelector.isEmpty()&&this.runScene.modelEx.setV3({model:n,info:r,newV3:this.runScene.modelEx.cloneV3(n[r]),oldV3:this.modelNewVal},!0,!1),this.isDraggingChange=!1),this.runScene.assetsEx.get().controls.enabled=!e.value)},this.runScene=e}init(){const{camera:e,scene:t,engineDom:r}=this.runScene.assetsEx.get();this.tansControls=new Ir(e,r),this.tansControls.addEventListener("dragging-changed",this.draggingChanged),this.tansControls.addEventListener("change",this.transChangeFn.bind(this)),this.tansControls.name="helper",t.add(this.tansControls),this.tansControls.traverse((e=>e.isHelper=!0))}changeMode(e){this.controlsMode=e,this.tansControls.setMode(this.transControlsStatusMap[e])}transControSize(e){this.tansControls.setSize(e?this.tansControls.size+.1:Math.max(this.tansControls.size-.1,.1))}changeState(e){this.tansControls.enabled=e}addObject(e){this.removeFocus(),this.tansControls.attach(e)}removeFocus(){this.tansControls.detach()}changeSpaceState(){this.tansControls.setSpace("local"===this.tansControls.space?"world":"local"),this.tansControls.detach()}setSpeace(e){e=e||("world"===this.speaceType?"local":"world"),this.speaceType=e,this.tansControls.setSpace(e),this.addObject(this.runScene.modelEx.select)}transChangeFn(e){var t=this.runScene.modelEx.select;t&&(this.runScene.lightEx.update(t),this.runScene.helperEx.boxHelper.setFromObject(t)),this.runScene.multipSelector.transChange(),this.runScene.cb.tranControls.changing.cb(t)}close(){this.tansControls.enabled=!1}open(){this.tansControls.enabled=!0}reset(){this.dispose(),this.init()}dispose(){this.tansControls&&(this.tansControls.removeEventListener("dragging-changed",this.draggingChanged),this.tansControls.removeEventListener("change",this.transChangeFn),this.tansControls.dispose(),this.runScene.assetsEx.get().scene.remove(this.tansControls))}}(e),this.viewHelper=new Br(e),this.grid=this.createGrid(),this.init())}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new c.Z.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material.opacity=.75,e.material.transparent=!0,e}dispose(){}reset(){"running"!==this.runScene.optionsEx.options.mode&&this.transContro.reset()}isHelper(e){return"GridHelper"===e.type||"CubeCamera"===e.type||e.isTransformControls||e.userData.isHelper}setHelper(e,t=!1,r){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,r&&r(e)})),e}focus(e){"running"!==this.runScene.optionsEx.options.mode&&(this.boxHelper||(this.boxHelper=this.getBoxHelper(e)),(0,$e.RQ)(e)||(this.boxHelper.visible=!0,this.boxHelper.setFromObject(e)),this.transContro.addObject(e),this.focusModelId=this.runScene.uniqueEx.getId(e))}unfocus(){"running"!==this.runScene.optionsEx.options.mode&&(this.transContro.removeFocus(),this.boxHelper&&(this.boxHelper.visible=!1),this.focusModelId=void 0)}}var jr=r(2510),Fr=r(4380),Nr=r(8089);class zr{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new M.Z,this.tempOldval=new ua.Vector3,this.runScene=e}add(e,t=!1){if("array"===(0,i.getType)(e))return e.map((e=>this.add(e)));var r=this.runScene.modelEx.select;if(r&&(this.runScene.modelEx.selectNull(),delete this.selectors[e.uuid],this.add(r)),"BoxHelper"!==e.type){if(this.selectors[e.uuid]){if(this.remove(e),this.removeBoxHelper(e),!t)return;this.add(e)}this.addBoxHelper(e),this.selectors[e.uuid]=e,this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!0}),this.runScene.helperEx.focus(e)}}setInfo(e,t,r,n,a,i){"position"!==t&&(a=n,i=r);const s=this.getSelectedList("value");var{x:a,y:o,z:l}=a;const c=a-i.x,u=o-i.y,h=l-i.z,d=[new Fr.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];s.map((r=>{if(r!==e){var{x:n,y:a,z:i}=r[t],n=n+=c,a=a+=u,i=i+=h;let e=r[t].clone();e.x=n,e.y=a,e.z=i,n=new Fr.Z({target:r,info:t,oldV3:this.runScene.modelEx.cloneV3(r[t]),newV3:e,runScene:this.runScene}).execute(),d.push(n),this.boxHelperMap[r.uuid].setFromObject(r)}})),this.boxHelperMap[e.uuid].setFromObject(e),this.runScene.undoEx.addUndo(d)}draggingchanged(e){const t=this.runScene.assetsEx.get().controls;var r;this.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,e.value?this.isEmpty()||(t.enabled=!1,e=this.getLast(),r=this.runScene.helperEx.transContro.controlsMode,this.tempOldval="position"===r?(0,Nr.VU)(e,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(e[r]),this.saveV3(r)):t.enabled||this.isEmpty()||(this.runScene.events.mouse.enableUp=!1,this.useV3())}transChange(){if(!this.isEmpty()&&!this.runScene.assetsEx.controls.enabled){var e=this.runScene.helperEx.transContro.controlsMode,t=this.getLast();let r;this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),r="position"===e?(0,Nr.VU)(t,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(t[e]),this.getInfo({model:t,type:e,newV3:r,oldV3:this.tempOldval}),this.tempOldval.copy(r)}}saveV3(e){this.getSelectedList("value").map((t=>{var r=(0,A.Ki)(t);this.savedV3.set(r,{model:t,type:e,val:this.runScene.modelEx.cloneV3(t[e])})}))}useV3(){var e=this.savedV3.map(((e,{type:t,val:r,model:n})=>new Fr.Z({target:n,info:t,newV3:this.runScene.modelEx.cloneV3(n[t]),oldV3:r,runScene:this.runScene})));this.runScene.undoEx.addUndo(e),this.savedV3.clear()}getInfo(e){const{model:t,type:r,newV3:n,oldV3:a}=e,i=this.getSelectedList("value");var{x:e,y:s,z:o}=n;const l=e-a.x,c=s-a.y,u=o-a.z;t[r].copy(n),i.map((e=>{if(e!==t){var{x:n,y:a,z:i}=e[r],n=n+=l,a=a+=c,i=i+=u;let t=e[r].clone();t.x=n,t.y=a,t.z=i,e[r].copy(t),this.boxHelperMap[e.uuid].setFromObject(e)}})),this.boxHelperMap[t.uuid].setFromObject(t)}getLast(){var e=this.getSelectedList("value");return e[e.length-1]}addBoxHelper(e){var t=this.runScene.helperEx.getBoxHelper(e);this.boxHelperMap[e.uuid]=t}removeBoxHelper(e){this.runScene.assetsEx.get().scene.remove(this.boxHelperMap[e.uuid]),this.boxHelperMap[e.uuid]=null,delete this.selectors[e.uuid]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));this.runScene.cb.model.unFocus.cb(e),this.selectors[e.uuid]=null,delete this.selectors[e.uuid]}isEmpty(){return 0===this.getSelectedList("key").length}getSelectedList(e){return"key"===e?Object.keys(this.selectors):Object.values(this.selectors)}getSelect(){var e=Object.values(this.selectors);return 0!==e.length?e:void 0}selectedLoop(e){return Object.keys(this.selectors).map((t=>e(t,this.selectors[t])))}delete(){this.setBoxHelperEmpty(),this.setEmpty(),this.runScene.helperEx.unfocus()}setBoxHelperEmpty(){var e=Object.values(this.boxHelperMap);this.runScene.assetsEx.get().scene.remove(...e),this.boxHelperMap={}}setEmpty(){this.isEmpty()||(this.getSelectedList("value").map((e=>{this.runScene.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={},this.runScene.cb.model.multiSelect.setEmpty.cb())}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new s.Group;const t=new s.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var r=[...this.getSelectedList("value")],n=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),(0,Nr.qg)(e));t.position.copy(n),this.runScene.cb.model.multipDrop.cb({models:r,dropModel:t}),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new s.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}rename(e){const{prefix:t,rmPrefixLength:r,back:n,rmBackLength:a,fullName:i,step:s}=e,o=this.getSelectedList("value");0!==o.length&&(e=o.map(((e,o)=>{let l=e.name;if(0===i.length){if(0!==r){if(r>l.length)return;l=l.substring(r)}if(0!==a){if(a>l.length)return;l=l.substring(0,l.length-a)}0<t.length&&(l=t+l),0<n.length&&(l+=n)}else l=i+(o+1)*s;return new jr.Z({target:e,info:"name",newVal:l,oldVal:e.name,runScene:this.runScene}).execute()})),this.runScene.undoEx.addUndo(e))}align(e){const t=this.getSelectedList("value");if(0!==t.length){const[n]=t;var r=t.map((t=>{var r=t.position.clone();const a=("all"===e?n:t).position.clone();return"all"!==e&&(a[e]=n.position[e]),new Fr.Z({target:t,info:"position",oldV3:r,newV3:a,runScene:this.runScene}).execute()}));this.runScene.multipSelector.add(t,!0),this.runScene.undoEx.addUndo(r)}}}function Vr(e){return(Vr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Gr(e,t){return(Gr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Hr(e){return(Hr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Wr=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gr(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Hr(e);if(r=t?(r=Hr(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Vr(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var e=n.SkyShader;return e=new s.ShaderMaterial({name:"SkyShader",fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:s.UniformsUtils.clone(e.uniforms),side:s.BackSide,depthWrite:!1}),(e=r.call(this,new s.BoxGeometry(1,1,1),e)).isSky=!0,e}return t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(s.Mesh),qr=(Wr.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new s.Vector3},up:{value:new s.Vector3(0,1,0)}},vertexShader:"\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}",fragmentShader:"\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\tconst vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPos );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\n\t\t}"},r(7585)),Kr=r(6651);const Zr={color:"#000000",intensity:1};class Xr{diff(e,t){const r={};return(0,i.mapObj)(Zr,(n=>{var a=e[n];(0,nt.Xq)(a,t[n])&&(r[n]=a)})),r}setConfig(e,t){var{color:t,intensity:r,shadow:n}=t,{mapSize:n,camera:a}=n||{},{far:a,near:i,scale:s}=a||{};void 0!==s&&(e.shadow.camera.scale.x=s,e.shadow.camera.scale.y=s,e.shadow.camera.scale.z=s),void 0!==i&&(e.shadow.camera.near=i),void 0!==a&&(e.shadow.camera.far=a),void 0!==n&&(e.shadow.mapSize.x=n,e.shadow.mapSize.y=n),void 0!==r&&(e.intensity=r),void 0!==t&&(e.color=(0,Nr.e9)(t)),e.shadow.camera.updateProjectionMatrix(),null!=(s=e.cameraHelper)&&s.update()}}class Qr extends o{constructor(){super(...arguments),this.allState=["morning","noon","evening","night"],this.sun=new ua.Vector3,this.light=new Xr,this.sky=new Wr,this.baseLightConfig={name:"天空定向光",type:"DirectionalLight",castShadow:!0},this.skyData=this.getData(),this.lastTime={index:0,name:"morning"},this.skyChangeArr=[],this.lightChangeArr=[],this.uniforms=null,this.inied=!1,this.currentLightConfig={},this.backUpSkyData=this.getData(),this.currentAnimas=[],this.awaitAnimas=[],this.animaInstance=null,this.animaIndex={begin:0,end:0},this.getNromalFn=()=>{this.playSky()},this.getSpecialFn=()=>{var e=this.allState[0];this.setSkyConfig(e),this.setLightSpecialConfig(e),this.lightAnima(e),0!==this.animaIndex.end&&(this.currentAnimas=this.getAnimasDataByState(this.allState[this.animaIndex.end],e),this.playSky())}}init(){this.addScene(),this.initSnapshot()}initSnapshot(){this.runScene.cb.snapshot.create.add("sky",(e=>{e.data.set("sky",{state:this.skyData.currentState})})),this.runScene.cb.snapshot.set.add("sky",(e=>{(e=e.snapshot.data.get("sky"))&&e.state!==this.skyData.currentState&&this.setState(e.state)}))}initLight(){if(!this.directionalLight){var e=new qr.Z(this.runScene).get();const[t]=e;this.runScene.lightEx.add(e,{addToTree:!1}),(this.directionalLight=t).name="skyLight"}}addScene(){this.initLight(),et.materialIgnore.set(this.sky.material,!0),(0,h.setHelper)(this.sky),h.selectableModel.close(this.sky),h.selectableModel.close(this.directionalLight),(0,h.setHelper)(this.directionalLight),this.directionalLight.helper&&(this.directionalLight.helper.visible=!1),this.runScene.modelEx.add(this.sky,void 0,{addToTree:!1})}setOpen(e){const t=this.runScene.assetsEx.get().renderer;this.sky.visible!==e&&this.directionalLight&&(this.directionalLight.visible=e,t.toneMapping=e?4:0,this.skyData.isShow=e,this.sky.visible=e)}toJSON(){var{currentState:e,effectController:t,isShow:r,lightConfig:n,size:a}=this.skyData;return{currentState:e,effectController:t,isShow:r,lightConfig:n,size:a}}parseJSON(e){var t,r,n;e&&(({isShow:t,currentState:r,size:n}=e),this.skyData.isShow=t,this.initLight(),this.parseLightConfig(e),this.inied||(this.init(),this.inied=!0),this.parseSkyConfig(r,n),this.setOpen(t))}parseLightConfig(e){var t,{isShow:r,effectController:n,currentState:a,lightConfig:i,size:s}=e;e&&i&&(e=i.shadow,t=n[a].lightConfig,qr.Z.setConfig(this.directionalLight,Object.assign(Object.assign({shadow:e},t),this.baseLightConfig)),this.directionalLight.visible=r,this.skyData.lightConfig=i,this.skyData.isShow=r,this.skyData.effectController=n,this.skyData.currentState=a,this.skyData.size=s,this.sky.visible=r,this.setLightSpecialConfig(a),this.lightAnima(a))}parseSkyConfig(e,t){this.setSkyConfig(e),this.setSkyScale(t)}setState(e){var t=this.skyData.currentState;this.doAnimaByState(e,t),this.runScene.cb.objects.sky.setState.cb({state:e}),this.saveLastTimeState({oldState:t,state:e,index:this.allState.findIndex((t=>t===e))})}saveLastTimeState(e){var{oldState:e,state:t,index:r}=e;this.lastTime.name=e,this.lastTime.index=r,this.skyData.currentState=t}getLightDataByState(e){let t=new ua.Vector3,r=new ua.Vector3;switch(e){case"morning":t.x=0,t.y=0,t.z=-this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2;break;case"noon":t.x=0,t.y=this.skyData.size/2,t.z=0,r.x=0,r.y=-1*this.skyData.size,r.z=0;break;case"evening":case"night":t.x=0,t.y=0,t.z=this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2*-1}return{position:t,targetPosition:r}}getIdxByState(e){return this.allState.findIndex((t=>t===e))}setSkyConfig(e){const{renderer:t,scene:r,camera:n}=this.runScene.assetsEx.get();this.sky.material.uniforms.turbidity.value=this.skyData.effectController[e].turbidity,this.sky.material.uniforms.mieCoefficient.value=this.skyData.effectController[e].mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=this.skyData.effectController[e].mieDirectionalG,t.toneMappingExposure=this.skyData.effectController[e].exposure,t.render(r,n);var a=ua.MathUtils.degToRad(90-this.skyData.effectController[e].elevation);e=ua.MathUtils.degToRad(this.skyData.effectController[e].azimuth),this.sun.setFromSphericalCoords(1,a,e),this.sky.material.uniforms.sunPosition.value.copy(this.sun)}setSkyScale(e){this.sky.scale.setScalar(e),this.skyData.size=e}setSky(e){var{state:e,type:t,val:r}=e;this.skyData.effectController[e][t]=r,this.setSkyConfig(e)}setCurrentState(e){this.skyData.currentState=e}setStateTime(e){var{info:e,time:t}=e;this.skyData.effectController[e].time=t}clean(){this.setOpen(!1),this.skyData=this.getData(),this.directionalLight&&this.runScene.modelEx.remove(this.directionalLight)}setLight(e,t){switch(e){case"mapSize":this.skyData.lightConfig.shadow.mapSize=t,this.directionalLight.shadow.mapSize.x=t,this.directionalLight.shadow.mapSize.y=t;break;case"near":this.skyData.lightConfig.shadow.camera.near=t,this.directionalLight.shadow.camera.near=t;break;case"far":this.skyData.lightConfig.shadow.camera.far=t,this.directionalLight.shadow.camera.far=t;break;case"scale":this.skyData.lightConfig.shadow.camera.scale=t,this.directionalLight.shadow.camera.scale.set(t,t,t);break;case"top":this.skyData.lightConfig.shadow.camera.top=t,this.skyData.lightConfig.shadow.camera.bottom=t,this.skyData.lightConfig.shadow.camera.left=t,this.skyData.lightConfig.shadow.camera.right=t,this.directionalLight.shadow.camera.top=t,this.directionalLight.shadow.camera.bottom=t,this.directionalLight.shadow.camera.left=t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.updateProjectionMatrix(),null!=(r=this.directionalLight.cameraHelper)&&r.update();break;case"color":this.skyData.effectController[this.skyData.currentState].lightConfig.color=t;var r=new ua.Color(t);this.directionalLight.color=r;break;case"intensity":this.skyData.effectController[this.skyData.currentState].lightConfig.intensity=t,this.directionalLight.intensity=t}}setLightSpecialConfig(e){var{color:e,intensity:t}=this.skyData.effectController[e].lightConfig;this.directionalLight.color=(0,Nr.e9)(e),this.directionalLight.intensity=t}getAnimasDataByState(e,t){e=this.getIdxByState(e);const r=[];if((t=this.getIdxByState(t))<e){this.animaIndex={begin:e,end:t};var n=e-t;let l=t;for(let e=0;e<n;e++){var{color:a,intensity:i}=this.skyData.effectController[this.allState[l]].lightConfig,{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]),{color:a,intensity:i}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:a,intensity:i,position:s,targetPosition:o})}),l++,this.skyData.effectController[this.allState[l]].lightConfig),{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]);r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:a,intensity:i,position:s,targetPosition:o}),onDone:this.getNromalFn})}}else{var l=3-t;this.animaIndex={begin:t,end:e};let n=t;if(0==l)return r.push({onDone:this.getSpecialFn}),r;for(let e=0;e<l;e++){var{color:c,intensity:u}=this.skyData.effectController[this.allState[n]].lightConfig,{position:h,targetPosition:d}=this.getLightDataByState(this.allState[n]),{position:h,targetPosition:d}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:c,intensity:u,position:h,targetPosition:d})}),n++,this.getLightDataByState(this.allState[n]));r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:c,intensity:u,position:h,targetPosition:d}),onDone:3===n?this.getSpecialFn:this.getNromalFn})}}return r}playSky(){if(0!==this.currentAnimas.length){const t=this.currentAnimas.shift();var e=this.currentAnimas.shift();if(!e)return t.onDone();this.playAnima(t,e)}}playAnima(e,t){const r=this.runScene.assetsEx.get().renderer;this.animaInstance=u.anima(Object.assign(Object.assign({},e.data),{x:this.directionalLight.position.x,y:this.directionalLight.position.y,z:this.directionalLight.position.z,tx:this.directionalLight.target.position.x,ty:this.directionalLight.target.position.y,tz:this.directionalLight.target.position.z}),Object.assign(Object.assign({},t.data),{ease:"none"}),e.data.time,(e=>{var{r:n,g:a,b:i}=e,s=(this.onUpdated(e),this.sky.material.uniforms.turbidity.value=e.turbidity,this.sky.material.uniforms.mieCoefficient.value=e.mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=e.mieDirectionalG,r.toneMappingExposure=e.exposure,ua.MathUtils.degToRad(90-e.elevation)),o=ua.MathUtils.degToRad(t.data.azimuth);this.sun.setFromSphericalCoords(1,s,o),this.sky.material.uniforms.sunPosition.value.copy(this.sun),s=new ua.Color(n,a,i),this.directionalLight.color=s,this.directionalLight.intensity=e.intensity,this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(e.tx,e.ty,e.tz)}),(()=>{t.onDone(),this.animaInstance=null}))}doAnimaByState(e,t){e=this.getAnimasDataByState(e,t),this.animaInstance?this.awaitAnimas=e:(this.currentAnimas=e,this.playSky())}onUpdated(e){var t;0!==this.awaitAnimas.length&&(this.animaInstance.kill(),this.animaInstance=null,[t]=this.awaitAnimas,this.currentAnimas=[...this.awaitAnimas],this.awaitAnimas=[],null!=t&&t.data&&(this.currentAnimas.unshift({data:t.data,onDone:this.getNromalFn}),this.currentAnimas.unshift({data:e})),this.playSky())}lightAnima(e){var{position:e,targetPosition:t}=this.getLightDataByState(e);this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(t.x,t.y,t.z)}transDataToAnimaData(e){var{sky:e,color:t,position:r,targetPosition:n,intensity:a}=e,{x:r,y:i,z:s}=r,{x:n,y:o,z:l}=n,{r:t,g:c,b:u}=(0,nt.fh)((0,nt.I8)(t));return Object.assign(Object.assign({},e),{r:t,g:c,b:u,x:r,y:i,z:s,tx:n,ty:o,tz:l,intensity:a})}getData(){return{isShow:!1,size:5e3,lightConfig:{shadow:{mapSize:512,camera:{near:.5,far:500,scale:1,top:5,bottom:5,left:5,right:5}}},effectController:{morning:{turbidity:2,rayleigh:1,mieCoefficient:.007,mieDirectionalG:.7,elevation:0,azimuth:180,exposure:.3,lightConfig:Object.assign(Object.assign({},(0,Kr.d9)(Zr)),{color:"#3DC1F1"}),time:1},noon:{turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:90,azimuth:180,exposure:1,time:1,lightConfig:Object.assign(Object.assign({},(0,Kr.d9)(Zr)),{color:"#FFFFFF"})},evening:{turbidity:2,rayleigh:.3,mieCoefficient:.011,mieDirectionalG:.67,elevation:3,azimuth:0,exposure:.3762,lightConfig:Object.assign(Object.assign({},(0,Kr.d9)(Zr)),{color:"#FFFFFF"}),time:1},night:{turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:2,azimuth:0,exposure:.2624,lightConfig:Object.assign(Object.assign({},(0,Kr.d9)(Zr)),{color:"#B8A277"}),time:1}},currentState:"morning"}}}class Yr{constructor(e){this.clean=()=>{this.sky.clean()},this.sky=new Qr(e),this.runScene=e,this.runScene.cb.clean.add("Objects",this.clean)}init(){}toJSON(){return{sky:this.sky.toJSON()}}parseJSON(e){this.sky.parseJSON(e.sky)}}function Jr(){var e=0,t=document.createElement("div");function r(e){return t.appendChild(e.dom),e}function n(r){for(var n=0;n<t.children.length;n++)t.children[n].style.display=n===r?"block":"none";e=r}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(r){r.preventDefault(),n(++e%t.children.length)}),!1);var a,i=(performance||Date).now(),s=i,o=0,l=r(new Jr.Panel("FPS","#0ff","#002")),c=r(new Jr.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(a=r(new Jr.Panel("MB","#f08","#201"))),n(0),{REVISION:16,dom:t,addPanel:r,showPanel:n,begin:function(){i=(performance||Date).now()},end:function(){o++;var e,t=(performance||Date).now();return c.update(t-i,200),s+1e3<=t&&(l.update(1e3*o/(t-s),100),s=t,o=0,a&&(e=performance.memory,a.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576))),t},update:function(){i=this.end()},domElement:t,setMode:n}}Jr.Panel=function(e,t,r){var n=1/0,a=0,i=Math.round,s=i(window.devicePixelRatio||1),o=80*s,l=48*s,c=3*s,u=2*s,h=3*s,d=15*s,p=74*s,f=30*s,m=document.createElement("canvas"),g=(m.width=o,m.height=l,m.style.cssText="width:80px;height:48px",m.getContext("2d"));return g.font="bold "+9*s+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=r,g.fillRect(0,0,o,l),g.fillStyle=t,g.fillText(e,c,u),g.fillRect(h,d,p,f),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(h,d,p,f),{dom:m,update:function(l,v){n=Math.min(n,l),a=Math.max(a,l),g.fillStyle=r,g.globalAlpha=1,g.fillRect(0,0,o,d),g.fillStyle=t,g.fillText(i(l)+" "+e+" ("+i(n)+"-"+i(a)+")",c,u),g.drawImage(m,h+s,d,p-s,f,h,d,p-s,f),g.fillRect(h+p-s,d,s,f),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(h+p-s,d,s,i((1-l/v)*f))}}};const $r=Jr;class en{constructor(e,t){this.options={msg:{show:!1,level:"base"},run:!0,decodePath:"./draco/",showFps:!1,loadInterval:2e3,mode:"running",hideLocal:!1,instanceClone:!0,render2:!1,render3:!1,coverSameId:!1,renderConfig:{mode:"tick",frame:-1,scriptFrame:-1,matrixAutoUpdate:!1},event:{base:"dom"},texture:{load:!0,lazyLoad:{open:!1,intervalTime:16.6},quality:1}},this.exporterOptions={compressTexture:!1,notMaterial:!1,outTime:(0,u.getTime)(7)},this.sceneOptions={loaded:!1},this.setLoadInterval=(()=>{let e=null;return t=>{const{inputInterval:r,cb:n}=t;e&&clearTimeout(e),e=setTimeout((()=>{n(),e=null,clearTimeout(e)}),r)}})(),this.runScene=e,this.options=(0,u.deepMergeObject)(this.options,t||{})}init(e){this.options.showFps&&(this.addFps(e),this.runScene.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(e){this.stats=$r(),this.stats.showPanel(0),e.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",r="success"){var n;null!=(n=null==(n=this.options)?void 0:n.msg)&&n.show&&("base"===this.options.msg.level&&"base"===t&&this.runScene.cb.baseLog.cb({msg:e,type:r}),console.log(e))}}class tn{constructor(e){this.glowModelLength=new Set,this.outlineModelLength=new Set,this.runScene=e,this.initGlow(),this.initOutline()}initGlow(){const{setLayers:e,add:t,remove:r}=this.runScene.cb.model;e.add("pp-set-glow",(e=>{var{model:e,val:t}=e;0===t&&0===this.glowModelLength.size||this[0===t?"glowRemove":"glowAdd"](e)})),t.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowAdd(e)})),r.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowRemove(e)}))}glowAdd(e){this.glowModelLength.add(e.userData.id),0<this.glowModelLength.size&&(this.runScene.cb.pp.glow.setStatus.cb(!0),this.runScene.pp.params.glow.isBloom=!0)}glowRemove(e){this.glowModelLength.delete(e.userData.id),this.glowModelLength.size<=0&&(this.runScene.cb.pp.glow.setStatus.cb(!1),this.runScene.pp.params.glow.isBloom=!1)}initOutline(){const{setOutline:e,add:t,remove:r}=this.runScene.cb.model;e.add("pp-set-outline",(e=>{var{model:e,val:t}=e;!t&&0===this.outlineModelLength.size||this[t?"outlineAdd":"outlineRemove"](e)})),t.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineAdd(e)})),r.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineRemove(e)}))}outlineAdd(e){this.outlineModelLength.add(e.userData.id),0<this.outlineModelLength.size&&(this.runScene.cb.pp.outline.setStatus.cb(!0),this.runScene.pp.params.outline.isOutline=!0)}outlineRemove(e){this.outlineModelLength.delete(e.userData.id),this.outlineModelLength.size<=0&&(this.runScene.cb.pp.outline.setStatus.cb(!1),this.runScene.pp.params.outline.isOutline=!1)}}var rn=r(6608),nn=r(5180),an=r(4819),sn={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new s.Color(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"};function on(e){return(on="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ln(e,t){return(ln=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function cn(e){return(cn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var un=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ln(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cn(e);if(r=t?(r=cn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===on(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i){var o;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(o=r.call(this)).strength=void 0!==t?t:1,o.radius=a,o.threshold=i,o.resolution=void 0!==e?new s.Vector2(e.x,e.y):new s.Vector2(256,256),o.clearColor=new s.Color(0,0,0),o.renderTargetsHorizontal=[],o.renderTargetsVertical=[],o.nMips=5;var l=Math.round(o.resolution.x/2),c=Math.round(o.resolution.y/2);o.renderTargetBright=new s.WebGLRenderTarget(l,c),o.renderTargetBright.texture.name="UnrealBloomPass.bright",o.renderTargetBright.texture.generateMipmaps=!1;for(var u=0;u<o.nMips;u++){var h;((h=new s.WebGLRenderTarget(l,c)).texture.name="UnrealBloomPass.h"+u,h.texture.generateMipmaps=!1,o.renderTargetsHorizontal.push(h),h=new s.WebGLRenderTarget(l,c)).texture.name="UnrealBloomPass.v"+u,h.texture.generateMipmaps=!1,o.renderTargetsVertical.push(h),l=Math.round(l/2),c=Math.round(c/2)}a=sn;for(var d=(o.highPassUniforms=s.UniformsUtils.clone(a.uniforms),o.highPassUniforms.luminosityThreshold.value=i,o.highPassUniforms.smoothWidth.value=.01,o.materialHighPassFilter=new s.ShaderMaterial({uniforms:o.highPassUniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,defines:{}}),o.separableBlurMaterials=[],[3,5,7,9,11]),p=(l=Math.round(o.resolution.x/2),c=Math.round(o.resolution.y/2),0);p<o.nMips;p++)o.separableBlurMaterials.push(o.getSeperableBlurMaterial(d[p])),o.separableBlurMaterials[p].uniforms.texSize.value=new s.Vector2(l,c),l=Math.round(l/2),c=Math.round(c/2);return o.compositeMaterial=o.getCompositeMaterial(o.nMips),o.compositeMaterial.uniforms.blurTexture1.value=o.renderTargetsVertical[0].texture,o.compositeMaterial.uniforms.blurTexture2.value=o.renderTargetsVertical[1].texture,o.compositeMaterial.uniforms.blurTexture3.value=o.renderTargetsVertical[2].texture,o.compositeMaterial.uniforms.blurTexture4.value=o.renderTargetsVertical[3].texture,o.compositeMaterial.uniforms.blurTexture5.value=o.renderTargetsVertical[4].texture,o.compositeMaterial.uniforms.bloomStrength.value=t,o.compositeMaterial.uniforms.bloomRadius.value=.1,o.compositeMaterial.needsUpdate=!0,o.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],o.bloomTintColors=[new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1)],o.compositeMaterial.uniforms.bloomTintColors.value=o.bloomTintColors,e=rn.C,o.copyUniforms=s.UniformsUtils.clone(e.uniforms),o.copyUniforms.opacity.value=1,o.materialCopy=new s.ShaderMaterial({uniforms:o.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:s.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),o.enabled=!0,o.needsSwap=!1,o._oldClearColor=new s.Color,o.oldClearAlpha=1,o.basic=new s.MeshBasicMaterial,o.fsQuad=new an.T(null),o}return t=n,(e=[{key:"dispose",value:function(){for(var e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(var t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose();for(var r=0;r<this.separableBlurMaterials.length;r++)this.separableBlurMaterials[r].dispose();this.compositeMaterial.dispose(),this.materialCopy.dispose(),this.basic.dispose(),this.fsQuad.dispose()}},{key:"setSize",value:function(e,t){var r=Math.round(e/2),n=Math.round(t/2);this.renderTargetBright.setSize(r,n);for(var a=0;a<this.nMips;a++)this.renderTargetsHorizontal[a].setSize(r,n),this.renderTargetsVertical[a].setSize(r,n),this.separableBlurMaterials[a].uniforms.texSize.value=new s.Vector2(r,n),r=Math.round(r/2),n=Math.round(n/2)}},{key:"render",value:function(e,t,r,a,i){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var s=e.autoClear,o=(e.autoClear=!1,e.setClearColor(this.clearColor,0),i&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=r.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e),this.renderTargetBright),l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,i&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?e.setRenderTarget(null):e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s}},{key:"getSeperableBlurMaterial",value:function(e){return new s.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new s.Vector2(.5,.5)},direction:{value:new s.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}},{key:"getCompositeMaterial",value:function(e){return new s.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(an.w);un.BlurDirectionX=new s.Vector2(1,0),un.BlurDirectionY=new s.Vector2(0,1);class hn extends an.w{constructor(e,t,r){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==r?r:"tDiffuse",e instanceof s.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=s.UniformsUtils.clone(e.uniforms),this.material=new s.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new an.T(this.material)}render(e,t,r){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}class dn extends an.w{constructor(e,t,r,n,a){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=r,this.clearColor=n,this.clearAlpha=void 0!==a?a:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new s.Color,this.oldCameraLayer=t.layers.mask}render(e,t,r){var n=e.autoClear;let a,i;e.autoClear=!1,void 0!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this.oldClearColor),a=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.sceneBg&&(this.scene.background=null),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,this.clearDepth,e.autoClearStencil),this.camera.layers.set(this.layerIndex),e.render(this.scene,this.camera),this.camera.layers.mask=this.oldCameraLayer,this.scene.background=this.sceneBg,this.clearColor&&e.setClearColor(this.oldClearColor,a),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),this.scene.background=this.sceneBg,e.autoClear=n}}const pn={uniforms:{baseTexture:{value:null},bloomTexture:{value:null}},vertexShader:"\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n \n varying vec2 vUv;\n \n void main() {\n vec4 lastColor = texture2D(baseTexture, vUv);\n \n // gl_FragColor = lastColor;\n // gl_FragColor = texture2D(bloomTexture, vUv);\n gl_FragColor = lastColor + texture2D(bloomTexture, vUv);\n }\n "};class fn{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomRenderPass?(this.bloomRenderPass.scene=this.mtuPP.mainScene,this.bloomRenderPass.camera=this.mtuPP.mainCamera):(this.bloomRenderPass=new dn(this.mtuPP.mainScene,this.mtuPP.mainCamera),this.bloomRenderPass.layerIndex=this.mtuPP.BLOOM_SCENE,this.bloomRenderPass.clearDepth=!1),this.bloomPass?this.bloomPass.setSize(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y):this.bloomPass=new un(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.params.glow.radius,this.bloomPass.strength=this.mtuPP.params.glow.strength,this.bloomPass.threshold=this.mtuPP.params.glow.threshold,this.mixingPass||(this.mixingPass=new hn(pn,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new nn.T(rn.C),this.effectCopy.clear=!1,this.effectCopy.renderToScreen=!1,this.effectCopy.needsSwap=!1,this.effectCopy.material.depthWrite=!1),this.mtuPP.effectComposer.addPass(this.effectCopy),this.mtuPP.effectComposer.addPass(this.bloomRenderPass),this.mtuPP.effectComposer.addPass(this.bloomPass),this.mtuPP.effectComposer.addPass(this.mixingPass)}setGlowData(e,t){this.bloomPass[e]=t}dispose(){this.bloomRenderPass=null,this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.mixingPass=null,this.effectCopy=null}setSceneBg(){this.bloomRenderPass&&(this.bloomRenderPass.sceneBg=this.mtuPP.sceneBackground)}enablePass(e){this.bloomRenderPass&&this.bloomRenderPass.enabled!==e&&(this.bloomRenderPass.enabled=e,this.bloomPass.enabled=e,this.mixingPass.enabled=e,this.effectCopy.enabled=e)}}function mn(e){return(mn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function gn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function bn(e,t,r){t&&vn(e.prototype,t),r&&vn(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function yn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xn(e,t)}function xn(e,t){return(xn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function wn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Sn(e);if(r=t?(r=Sn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===mn(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function Sn(e){return(Sn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Mn=function(){yn(t,an.w);var e=wn(t);function t(r,n){var a;return gn(this,t),(a=e.call(this)).scene=r,a.camera=n,a.clear=!0,a.needsSwap=!1,a.inverse=!1,a}return bn(t,[{key:"render",value:function(e,t,r){var n,a,i=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0),a=this.inverse?(n=0,1):(n=1,0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),s.buffers.stencil.setFunc(i.ALWAYS,n,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(i.EQUAL,1,4294967295),s.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),s.buffers.stencil.setLocked(!0)}}]),t}(),Tn=function(){yn(t,an.w);var e=wn(t);function t(){var r;return gn(this,t),(r=e.call(this)).needsSwap=!1,r}return bn(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();var _n=function(){function e(t,r){var n;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.renderer=t,void 0===r?(n=t.getSize(new s.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=n.width,this._height=n.height,(r=new s.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"):(this._pixelRatio=1,this._width=r.width,this._height=r.height),this.renderTarget1=r,this.renderTarget2=r.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new nn.T(rn.C),this.clock=new s.Clock}var t,r;return t=e,(r=[{key:"swapBuffers",value:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}},{key:"addPass",value:function(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"insertPass",value:function(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"removePass",value:function(e){-1!==(e=this.passes.indexOf(e))&&this.passes.splice(e,1)}},{key:"isLastEnabledPass",value:function(e){for(var t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}},{key:"render",value:function(e){void 0===e&&(e=this.clock.getDelta());for(var t=this.renderer.getRenderTarget(),r=!1,n=0,a=this.passes.length;n<a;n++){var i,s,o=this.passes[n];!1!==o.enabled&&(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(n),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),o.needsSwap&&(r&&(i=this.renderer.getContext(),(s=this.renderer.state.buffers.stencil).setFunc(i.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),s.setFunc(i.EQUAL,1,4294967295)),this.swapBuffers()),void 0!==Mn&&(o instanceof Mn?r=!0:o instanceof Tn&&(r=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new s.Vector2),this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}},{key:"setSize",value:function(e,t){this._width=e,this._height=t;var r=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(r,n),this.renderTarget2.setSize(r,n);for(var a=0;a<this.passes.length;a++)this.passes[a].setSize(r,n)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}},{key:"dispose",value:function(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const En="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",kn="\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n \n varying vec2 vUv;\n \n void main() {\n gl_FragColor = (texture2D(baseTexture, vUv) + vec4(1.0) * texture2D(bloomTexture, vUv));\n }\n ";class Dn{constructor(e){this.mtuPP=e,this.bloomLayer=new ua.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new ua.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new ua.Color),this.mtuPP.sceneFogColor.copy(e.fog.color)),e.background&&(this.mtuPP.sceneBackground=e.background),this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomPass=new un(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.params.glow.radius,this.bloomPass.strength=this.mtuPP.params.glow.strength,this.bloomPass.threshold=this.mtuPP.params.glow.threshold,this.mtuPP.effectComposer.addPass(this.bloomPass),this.finalPass=new nn.T(new ua.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:En,fragmentShader:kn,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new ua.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.params.pp.samples});this.finalComposer=new _n(this.mtuPP.renderer,e),this.finalComposer.addPass(this.mtuPP.renderPass),this.finalComposer.addPass(this.finalPass)}renderBloom(e){var t;this.mtuPP.sceneFogColor&&null!=(t=this.mtuPP.mainScene.fog)&&t.color.copy(this.mtuPP.BLACK_COLOR),this.mtuPP.sceneBackground&&(this.mtuPP.mainScene.background=this.mtuPP.BLACK_COLOR),e?(this.mtuPP.mainScene.traverse((e=>{e.isMesh&&!this.bloomLayer.test(e.layers)&&(this.materials[e.uuid]=e.material,e.material=this.darkMaterial)})),this.mtuPP.effectComposer.render(),this.mtuPP.mainScene.traverse((e=>{this.materials[e.uuid]&&(e.material=this.materials[e.uuid],delete this.materials[e.uuid])}))):(this.mtuPP.mainCamera.layers.set(this.mtuPP.BLOOM_SCENE),this.mtuPP.effectComposer.render(),this.mtuPP.mainCamera.layers.set(this.mtuPP.ENTIRE_SCENE)),this.mtuPP.sceneFogColor&&null!=(t=this.mtuPP.mainScene.fog)&&t.color.copy(this.mtuPP.sceneFogColor),this.mtuPP.sceneBackground&&(this.mtuPP.mainScene.background=this.mtuPP.sceneBackground)}render(){this.renderBloom(!0),this.finalComposer.render()}setGlowData(e,t){this.bloomPass[e]=t}setSize(e,t){this.finalComposer&&this.finalComposer.setSize(e,t)}dispose(){this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.finalPass=null,this.finalComposer&&(this.finalComposer.renderTarget1&&(this.finalComposer.renderTarget1.dispose(),this.finalComposer.renderTarget1=null),this.finalComposer.renderTarget2&&(this.finalComposer.renderTarget2.dispose(),this.finalComposer.renderTarget2=null),this.finalComposer=null)}enablePass(e){this.bloomPass&&this.bloomPass.enabled!==e&&(this.bloomPass.enabled=e,this.finalPass.enabled=e)}}var Pn=r(228);class An extends s.ShaderMaterial{constructor(...e){super(...e),["opacity","map","emissiveMap","roughnessMap","metalnessMap"].forEach((e=>{Object.defineProperty(this,e,{get(){if(e in this.uniforms)return this.uniforms[e].value},set(t){e in this.uniforms&&(this.uniforms[e].value=t)}})}))}}class On extends An{constructor(...e){super(...e),this.modifiedDefines={},this.modifiedUniforms={}}setDefine(e,t){const r=this.defines,n=this.modifiedDefines;null==t?e in r&&(e in n||(n[e]=r[e]),delete r[e]):r[e]!==t&&(e in n||(n[e]=e in r?r[e]:void 0),r[e]=t)}setTextureUniform(e,t){const r=this.uniforms,n=this.modifiedUniforms;e in n||(n[e]=r[e].value),r[e].value=t}finalize(){const e=this.modifiedDefines;var t=this.defines;for(const r in e)void 0===e[r]?r in t&&(this.needsUpdate=!0):t[r]!==e[r]&&(this.needsUpdate=!0),delete e[r];const r=this.modifiedUniforms;var n=this.uniforms;for(const e in r)r[e]!==n[e].value&&(this.needsUpdate=!0),delete r[e]}}const Cn=new WeakMap;class Rn{constructor(e){this._replacementMaterial=new On(e),this._replacementMaterials=new WeakMap,this.overrideUniforms={},this.overrideDefines={}}replace(e,t=!1,r=!0){const n=this;function a(e){if(!e.isHelper&&(e.isMesh||e.isSkinnedMesh)){if(!i.has(e)){const t=n.createMaterial(e);i.set(e,t)}const t=i.get(e);if(null!==t){let a=e.material;r?s.set(e,a):a=s.get(e),a||console.error("ShaderReplacement : Material for object was not cached before replacing shader.",e),n.updateUniforms(e,a,t),t.finalize&&t.finalize(),e.material=t}}}const i=this._replacementMaterials,s=Cn;if(Array.isArray(e))if(t)for(let t=0,r=e.length;t<r;t++)e[t].traverse(a);else for(let t=0,r=e.length;t<r;t++)a(e[t]);else t?e.traverse(a):a(e)}reset(e,t){function r(e){e.isHelper||(n.has(e)?(e.material=n.get(e),n.delete(e)):(e.isSkinnedMesh||e.isMesh)&&console.error("ShaderReplacement : Material for object was not cached before resetting.",e))}const n=Cn;if(Array.isArray(e))if(t)for(let t=0,n=e.length;t<n;t++)r(e[t]);else for(let t=0,n=e.length;t<n;t++)e[t].traverse(r);else t?e.traverse(r):r(e)}createMaterial(e){return this._replacementMaterial.clone()}updateUniforms(e,t,r){var n=this._replacementMaterial.defines,a=t.defines;const i=r.defines;if(r.side=t.side,r.flatShading=t.flatShading,r.skinning=t.skinning,a){for(const e in a)r.setDefine(e,a[e]);for(const e in i)e in a?r.setDefine(e,a[e]):r.setDefine(e,n[e])}const s=r.uniforms;if(t.isShaderMaterial){var o=t.uniforms;for(const e in s){var l=o[e];const t=s[e];l&&l.value!==t.value&&(t.value&&t.value.isTexture||l.value&&l.value.isTexture?r.setTextureUniform(e,l.value):t.value=l.value)}}else for(const e in s){const n=s[e];e in t&&t[e]!==n.value&&(n.value&&n.value.isTexture||t[e]&&t[e].isTexture?r.setTextureUniform(e,t[e]):n.value=t[e])}var{overrideDefines:c,overrideUniforms:u}=this;for(const e in c)null===c[e]||void 0===c[e]?delete i[e]:i[e]!==c[e]&&(i[e]=c[e],r.needsUpdate=!0);for(const e in u)e in s&&(s[e].value=u[e].value)}dispose(){}}class Ln extends Rn{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:s.ShaderLib.normal.vertexShader,fragmentShader:"\n\t\t\t\t#define NORMAL\n\t\t\t\tuniform float opacity;\n\t\t\t\t#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\t\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#endif\n\t\t\t\t#ifndef FLAT_SHADED\n\t\t\t\t\tvarying vec3 vNormal;\n\t\t\t\t\t#ifdef USE_TANGENT\n\t\t\t\t\t\tvarying vec3 vTangent;\n\t\t\t\t\t\tvarying vec3 vBitangent;\n\t\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\t#include <packing>\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\t#include <normal_fragment_begin>\n\t\t\t\t\t#include <normal_fragment_maps>\n\t\t\t\t\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t\t\t\t}\n\t\t\t"}),this.useNormalMaps=!1}createMaterial(...e){return super.createMaterial(...e)}updateUniforms(e,t,r){super.updateUniforms(e,t,r),r.setDefine("USE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("TANGENTSPACE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("ALPHATEST",r.uniforms.alphaTest.value||void 0),r.setDefine("USE_ALPHAMAP",0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?"":void 0),r.setDefine("USE_MAP",0!==r.defines.ALPHATEST&&r.uniforms.map.value?"":void 0),r.setDefine("USE_UV","USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?"":void 0)}}class In extends Rn{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:"\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <common>\n\t\t\t\t#include <uv_pars_vertex>\n\t\t\t\t#include <displacementmap_pars_vertex>\n\t\t\t\t#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\t\t\t\t#include <clipping_planes_pars_vertex>\n\t\t\t\tvoid main() {\n\t\t\t\t\t#include <uv_vertex>\n\t\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t\t#include <morphnormal_vertex>\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <skinnormal_vertex>\n\t\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <displacementmap_vertex>\n\t\t\t\t\t#include <project_vertex>\n\t\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t\t#include <clipping_planes_vertex>\n\t\t\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\t\t\t\tuniform float opacity;\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\tgl_FragColor = vec4( vViewPosition.z );\n\t\t\t\t}\n\t\t\t"}),this.invertSide=!1}updateUniforms(e,t,r){super.updateUniforms(e,t,r),this.invertSide&&(r.side=r.side===s.FrontSide?s.BackSide:s.FrontSide),e=r.defines.ALPHATEST,0===r.uniforms.alphaTest.value?delete r.defines.ALPHATEST:r.defines.ALPHATEST=r.uniforms.alphaTest.value,e!==r.defines.ALPHATEST&&(r.needsUpdate=!0),e=r.defines.USE_ALPHAMAP,0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?r.defines.USE_ALPHAMAP="":delete r.defines.USE_ALPHAMAP,e!==r.defines.USE_ALPHAMAP&&(r.needsUpdate=!0),e=r.defines.USE_MAP,0!==r.defines.ALPHATEST&&r.uniforms.map.value?r.defines.USE_MAP="":delete r.defines.USE_MAP,e!==r.defines.USE_MAP&&(r.needsUpdate=!0),e=r.defines.USE_UV,"USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?r.defines.USE_UV="":delete r.defines.USE_UV,e!==r.defines.USE_UV&&(r.needsUpdate=!0)}}const Bn={uniforms:{tex:{value:null},displayRoughness:{value:0}},vertexShader:"\n\t\tvarying vec3 vViewPosition;\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\t#include <begin_vertex>\n\t\t\t#include <project_vertex>\n\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\tvUv = uv;\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tex;\n\t\tuniform float displayRoughness;\n\t\tvoid main() {\n\t\t\tvec4 texVal = texture2D( tex, vUv );\n\t\t\tfloat roughness = texVal.a;\n\t\t\tvec3 packedNormal = texVal.xyz;\n\t\t\tvec3 unpackedNormal = ( packedNormal - 0.5 ) * 2.0;\n\t\t\tgl_FragColor = mix(\n\t\t\t\tvec4( unpackedNormal, 1.0 ),\n\t\t\t\tvec4( roughness, roughness, roughness, 1.0 ),\n\t\t\t\tdisplayRoughness\n\t\t\t);\n\n\t\t}\n\t"},Un={uniforms:{tex:{value:null}},vertexShader:"\n\t\tvarying vec3 vViewPosition;\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\t#include <begin_vertex>\n\t\t\t#include <project_vertex>\n\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\tvUv = uv;\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tex;\n\t\tuniform float divide;\n\t\tvoid main() {\n\t\t\tvec4 texVal = texture2D( tex, vUv );\n\t\t\tfloat depthVal = mod( - texVal.r, 1.0 );\n\t\t\tgl_FragColor = vec4( depthVal );\n\n\t\t}\n\t"},jn={defines:{NUM_DIRECTIONS:32,NUM_STEPS:16,RADIUS:"2.0",ENABLE_FALLOFF:1,FALLOFF_START2:"0.16",FALLOFF_END2:"4.0",ENABLE_ROTATION_JITTER:1,ENABLE_RADIUS_JITTER:1,ENABLE_COLOR_BOUNCE:1,JITTER_TYPE:0},uniforms:{colorBuffer:{value:null},normalBuffer:{value:null},depthBuffer:{value:null},renderSize:{value:new s.Vector2},blueNoiseTex:{value:null},blueNoiseSize:{value:1},clipInfo:{value:new s.Vector4},projInfo:{value:new s.Vector4},params:{value:new s.Vector2},lightBounceIntensity:{value:1}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\t#define TWO_PI\t\t\t6.2831853071795864\n\t\t#define HALF_PI\t\t\t1.5707963267948966\n\t\t#define ONE_OVER_PI\t\t0.3183098861837906\n\n\t\t#include <common>\n\t\t#include <packing>\n\t\tvarying vec2 vUv;\n\n\t\tuniform sampler2D noiseTexture;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform vec2 renderSize;\n\n\t\tuniform vec4 projInfo;\n\t\tuniform vec4 clipInfo;\n\t\tuniform vec4 params;\n\t\tuniform float lightBounceIntensity;\n\n\t\t#if ENABLE_ROTATION_JITTER == 2 || ENABLE_RADIUS_JITTER == 2\n\t\tuniform float blueNoiseSize;\n\t\tuniform sampler2D blueNoiseTex;\n\t\t#endif\n\n\t\tfloat roundF(float f) {\n\t\t\treturn f < 0.5 ? floor(f) : ceil(f);\n\t\t}\n\n\t\tvec2 roundV2(vec2 v) {\n\t\t\tv.x = roundF(v.x);\n\t\t\tv.y = roundF(v.y);\n\t\t\treturn v;\n\t\t}\n\n\t\tvec3 UnpackNormal(vec4 d) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec4 GetViewPosition( vec2 uv ) {\n\n\t\t\tfloat near = clipInfo.x;\n\t\t\tfloat far = clipInfo.y;\n\n\t\t\tvec2 basesize = renderSize;\n\t\t\tvec2 coord = ( uv / basesize );\n\n\t\t\t// d is expected to be [ 0.0, 1.0 ]\n\t\t\tfloat d = texture2D( depthBuffer, coord ).r;\n\t\t\td = d == 0.0 ? far : d;\n\t\t\td = ( abs( d ) - near ) / ( far - near );\n\n\t\t\tvec4 ret = vec4( 0.0 );\n\t\t\tret.w = d;\n\t\t\tret.z = near + d * ( far - near );\n\t\t\tret.xy = ( uv * projInfo.xy + projInfo.zw ) * ret.z;\n\n\t\t\treturn ret;\n\n\t\t}\n\n\t\tfloat Falloff( float dist2 ) {\n\n\t\t\treturn 2.0 * clamp(\n\t\t\t\t( dist2 - FALLOFF_START2 ) / ( FALLOFF_END2 - FALLOFF_START2 ),\n\t\t\t\t0.0,\n\t\t\t\t1.0\n\t\t\t);\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec2 screenCoord = gl_FragCoord.xy;\n\t\t\tvec4 vpos = GetViewPosition( renderSize * vUv );\n\n\t\t\t// if it's the background\n\t\t\tif ( vpos.w == 1.0 ) {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0);\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tvec4 s;\n\t\t\tvec3 vnorm\t= UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tvec3 vdir\t= normalize( - vpos.xyz );\n\t\t\tvec3 dir, ws;\n\n\t\t\t// calculation uses left handed system\n\t\t\tvnorm.z = - vnorm.z;\n\n\t\t\tvec2 noises\t= vec2( 0.0 );\n\t\t\tvec2 offset;\n\t\t\tvec2 horizons = vec2( - 1.0, - 1.0 );\n\n\t\t\t// scale the search radius by the depth and camera FOV\n\t\t\tfloat radius = ( RADIUS * clipInfo.z ) / vpos.z;\n\t\t\tradius = max( float( NUM_STEPS ), radius );\n\n\t\t\tfloat stepSize\t= radius / float( NUM_STEPS );\n\t\t\tfloat phi\t\t= 0.0;\n\t\t\tfloat ao\t\t= 0.0;\n\t\t\tfloat division\t= noises.y * stepSize;\n\t\t\tfloat currStep\t= 1.0 + division + 0.25 * stepSize * params.y;\n\t\t\tfloat dist2, invdist, falloff, cosh;\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\t\t\tvec3 color = vec3( 0.0 );\n\t\t\t#endif\n\n\t\t\t#if ENABLE_ROTATION_JITTER == 1\n\n\t\t\t// Rotation jitter approach from\n\t\t\t// https://github.com/MaxwellGengYF/Unity-Ground-Truth-Ambient-Occlusion/blob/9cc30e0f31eb950a994c71866d79b2798d1c508e/Shaders/GTAO_Common.cginc#L152-L155\n\t\t\tfloat rotJitterOffset = PI * fract( 52.9829189 * fract( dot( screenCoord, vec2( 0.06711056, 0.00583715 ) ) ) );\n\n\t\t\t#elif ENABLE_ROTATION_JITTER == 2\n\n\t\t\tfloat rotJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).r;\n\n\t\t\t#endif\n\n\t\t\t#if ENABLE_RADIUS_JITTER == 1\n\n\t\t\tfloat jitterMod = ( gl_FragCoord.x + gl_FragCoord.y ) * 0.25;\n\t\t\tfloat radiusJitterOffset = mod( jitterMod, 1.0 ) * stepSize * 0.25;\n\n\t\t\t#elif ENABLE_RADIUS_JITTER == 2\n\n\t\t\tfloat radiusJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).g;\n\n\t\t\t#endif\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < NUM_DIRECTIONS; i ++ ) {\n\n\t\t\t\tphi = float( i ) * ( PI / float( NUM_DIRECTIONS ) ) + params.x * PI;\n\n\t\t\t\t#if ENABLE_ROTATION_JITTER != 0\n\n\t\t\t\tphi += rotJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tcurrStep = 1.0 + 0.25 * stepSize * params.y;\n\n\n\t\t\t\t#if ENABLE_RADIUS_JITTER != 0\n\n\t\t\t\tcurrStep += radiusJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tdir = vec3( cos( phi ), sin( phi ), 0.0 );\n\t\t\t\thorizons = vec2( - 1.0 );\n\n\t\t\t\t// calculate horizon angles\n\t\t\t\tfor ( int j = 0; j < NUM_STEPS; ++ j ) {\n\n\t\t\t\t\toffset = roundV2(dir.xy * currStep);\n\n\t\t\t\t\t// h1\n\t\t\t\t\ts = GetViewPosition( screenCoord + offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.x = max( horizons.x, cosh - falloff );\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tvec3 ptColor, ptDir;\n\t\t\t\t\tfloat alpha;\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord + offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\t// h2\n\t\t\t\t\ts = GetViewPosition( screenCoord - offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.y = max( horizons.y, cosh - falloff );\n\n\t\t\t\t\t// increment\n\t\t\t\t\tcurrStep += stepSize;\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord - offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t}\n\n\t\t\t\thorizons = acos( horizons );\n\n\t\t\t\t// calculate gamma\n\t\t\t\tvec3 bitangent\t= normalize( cross( dir, vdir ) );\n\t\t\t\tvec3 tangent\t= cross( vdir, bitangent );\n\t\t\t\tvec3 nx\t\t\t= vnorm - bitangent * dot( vnorm, bitangent );\n\n\t\t\t\tfloat nnx\t\t= length( nx );\n\t\t\t\tfloat invnnx\t= 1.0 / ( nnx + 1e-6 );\t\t\t// to avoid division with zero\n\t\t\t\tfloat cosxi\t\t= dot( nx, tangent ) * invnnx;\t// xi = gamma + HALF_PI\n\t\t\t\tfloat gamma\t\t= acos( cosxi ) - HALF_PI;\n\t\t\t\tfloat cosgamma\t= dot( nx, vdir ) * invnnx;\n\t\t\t\tfloat singamma2\t= - 2.0 * cosxi;\t\t\t\t\t// cos(x + HALF_PI) = -sin(x)\n\n\t\t\t\t// clamp to normal hemisphere\n\t\t\t\thorizons.x = gamma + max( - horizons.x - gamma, - HALF_PI );\n\t\t\t\thorizons.y = gamma + min( horizons.y - gamma, HALF_PI );\n\n\t\t\t\t// Riemann integral is additive\n\t\t\t\tao += nnx * 0.25 * (\n\t\t\t\t\t( horizons.x * singamma2 + cosgamma - cos( 2.0 * horizons.x - gamma ) ) +\n\t\t\t\t\t( horizons.y * singamma2 + cosgamma - cos( 2.0 * horizons.y - gamma ) ) );\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// PDF = 1 / pi and must normalize with pi because of Lambert\n\t\t\tao = ao / float( NUM_DIRECTIONS );\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\tcolor /= float( NUM_STEPS * NUM_DIRECTIONS ) * 2.0 / lightBounceIntensity;\n\t\t\tgl_FragColor = vec4( color, ao );\n\n\t\t\t#else\n\n\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, ao );\n\n\t\t\t#endif\n\t\t}\n\t"},Fn={defines:{BLUR_ITERATIONS:5,BLUR_MODE:0,AO_ONLY:0,COLOR_ONLY:0,DEPTH_THRESHOLD:"5e-1"},uniforms:{fullSize:{value:new s.Vector2},aoSize:{value:new s.Vector2},normalBuffer:{value:null},depthBuffer:{value:null},colorBuffer:{value:null},gtaoBuffer:{value:null},intensity:{value:1},blurStride:{value:1},ambientColor:{value:new s.Color},ambientIntensity:{value:0}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform vec3 ambientColor;\n\t\tuniform float ambientIntensity;\n\t\tuniform vec2 aoSize;\n\t\tuniform vec2 fullSize;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D gtaoBuffer;\n\t\tuniform float intensity;\n\t\tuniform int blurStride;\n\n\t\tvec3 UnpackNormal( vec4 d ) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec3 MultiBounce( float ao, vec3 albedo ) {\n\t\t\tvec3 x = vec3( ao );\n\t\t\tvec3 a = 2.0404 * albedo - vec3( 0.3324 );\n\t\t\tvec3 b = -4.7951 * albedo + vec3( 0.6417 );\n\t\t\tvec3 c = 2.7552 * albedo + vec3( 0.6903 );\n\t\t\treturn max( x, ( ( x * a + b ) * x + c ) * x );\n\t\t}\n\n\t\tvoid main() {\n\t\t\tvec4 color = texture2D( colorBuffer, vUv );\n\t\t\t// NO_BLUR\n\t\t\t#if BLUR_MODE == 0\n\t\t\t\tvec4 accumSample = texture2D( gtaoBuffer, vUv );\n\t\t\t#else\n\t\t\tvec2 currTexel = vUv * fullSize;\n\t\t\tvec2 currAoTexel = vUv * aoSize;\n\n\t\t\t// aoPixels per full size ones. Should be 1/2 at\n\t\t\tvec2 texelRatio = aoSize / fullSize;\n\n\t\t\tvec3 currNormal = UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tfloat currDepth = texture2D( depthBuffer, vUv ).r;\n\n\t\t\t// TODO: pull this sampling out into a function\n\t\t\tvec4 accumSample = vec4( 0.0 );\n\t\t\tfloat totalWeight = 1e-10;\n\t\t\tfloat pixelOffset = - float( BLUR_ITERATIONS ) / 2.0;\n\t\t\tpixelOffset += mod( float( BLUR_ITERATIONS ), 2.0 ) == 0.0 ? 0.0 : 0.5;\n\t\t\tpixelOffset *= float( blurStride );\n\n\t\t\t// BOX_BLUR\n\t\t\t#if BLUR_MODE == 1\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int x = 0; x < BLUR_ITERATIONS; x ++ ) {\n\n\t\t\t\t#pragma unroll_loop_start\n\t\t\t\tfor ( int y = 0; y < BLUR_ITERATIONS; y ++ ) {\n\n\t\t\t\t\tvec2 step = vec2( float( x ), float( y ) ) * float( blurStride );\n\n\t\t\t\t\t// iterate over full res pixels\n\t\t\t\t\tvec2 offsetUv = currTexel + ( pixelOffset + step ) / texelRatio;\n\t\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\t\t// get the associated pixel in the AO buffer\n\t\t\t\t\tvec2 aoUv = currAoTexel + pixelOffset + step;\n\t\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t\t// if the pixels are close enough in space then blur them together\n\t\t\t\t\tfloat offsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\t\tif ( abs( offsetDepth - currDepth ) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\t\t// Weigh the sample based on normal similarity\n\t\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\t\tfloat weight = max( 0.0, dot( offsetNormal, currNormal ) );\n\n\t\t\t\t\t\t// square the weight to give pixels with a closer normal even higher priority\n\t\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\t\t// accumulate\n\t\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// CROSS_BLUR\n\t\t\t#elif BLUR_MODE == 2\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// DIAGONAL_BLUR\n\t\t\t#elif BLUR_MODE == 3\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t#endif\n\n\t\t\taccumSample /= totalWeight;\n\n\t\t\t#endif\n\n\t\t\tfloat gtao = accumSample.a;\n\n\t\t\t#if COLOR_ONLY\n\n\t\t\tgl_FragColor = vec4( accumSample.rgb, 1.0 );\n\n\t\t\t#elif AO_ONLY\n\n\t\t\tvec3 rgb = mix( vec3( 1.0 ), vec3( accumSample.a ), intensity );\n\t\t\tgl_FragColor = vec4( rgb, 1.0 );\n\n\t\t\t#else\n\n\t\t\tvec3 rgb = mix( color.rgb, color.rgb * MultiBounce( gtao, color.rgb ), intensity );\n\t\t\tvec3 delta = color.rgb - rgb;\n\t\t\tvec3 ambient = ambientColor * delta * ambientIntensity;\n\n\t\t\tfloat colorFade = ( 1.0 - pow( 1.0 - gtao, 2.0 ) );\n\t\t\tgl_FragColor = vec4( rgb + ambient + accumSample.rgb * ( 0.75 + colorFade * 0.25 ), color.a );\n\n\t\t\t#endif\n\n\t\t}\n\t\t"};class Nn{constructor(e){this.count=0,this.size=-1,this.sigma=-1,this.radius=-1,this.lookupTable=null,this.score=null,this.binaryPattern=null,this.resize(e),this.setSigma(1.5)}findVoid(){var e,{score:t,binaryPattern:r}=this;let n=1/0,a=-1;for(let i=0,s=r.length;i<s;i++)0===r[i]&&(e=t[i])<n&&(n=e,a=i);return a}findCluster(){var e,{score:t,binaryPattern:r}=this;let n=-1/0,a=-1;for(let i=0,s=r.length;i<s;i++)1===r[i]&&(e=t[i])>n&&(n=e,a=i);return a}setSigma(e){if(e!==this.sigma){var t=~~(Math.sqrt(20*Math.pow(e,2))+1),r=2*t+1;const s=new Float32Array(r*r);var n=e*e;for(let e=-t;e<=t;e++)for(let o=-t;o<=t;o++){var a=(t+o)*r+e+t,i=e*e+o*o;s[a]=Math.pow(Math.E,-i/(2*n))}this.lookupTable=s,this.sigma=e,this.radius=t}}resize(e){this.size!==e&&(this.size=e,this.score=new Float32Array(e*e),this.binaryPattern=new Uint8Array(e*e))}invert(){const{binaryPattern:e,score:t,size:r}=this;t.fill(0);for(let t=0,i=e.length;t<i;t++){var n,a;0===e[t]?(n=~~(t/r),a=t-n*r,this.updateScore(a,n,1),e[t]=1):e[t]=0}}updateScore(e,t,r){const{size:n,score:a,lookupTable:i}=this;var s=this.radius,o=2*s+1;for(let u=-s;u<=s;u++)for(let h=-s;h<=s;h++){var l=i[(s+h)*o+u+s];let d=e+u,p=(d=d<0?n+d:d%n,t+h);var c=(p=p<0?n+p:p%n)*n+d;a[c]+=r*l}}addPointIndex(e){this.binaryPattern[e]=1;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,1),this.count++}removePointIndex(e){this.binaryPattern[e]=0;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,-1),this.count--}copy(e){this.resize(e.size),this.score.set(e.score),this.binaryPattern.set(e.binaryPattern),this.setSigma(e.sigma),this.count=e.count}}class zn{constructor(){this.random=Math.random,this.sigma=1.5,this.size=64,this.majorityPointsRatio=.1,this.samples=new Nn(1),this.savedSamples=new Nn(1)}generate(){const{samples:e,savedSamples:t,sigma:r,majorityPointsRatio:n,size:a}=this;e.resize(a),e.setSigma(r);var i=Math.floor(a*a*n),s=e.binaryPattern,o=s,l=i;o.fill(0);for(let e=0;e<l;e++)o[e]=1;var[c,u=Math.random]=[s,this.random];for(let e=c.length-1;0<e;e--){var h=~~((u()-1e-6)*e),d=c[e];c[e]=c[h],c[h]=d}for(let t=0,r=s.length;t<r;t++)1===s[t]&&e.addPointIndex(t);for(;;){var p=e.findCluster(),f=(e.removePointIndex(p),e.findVoid());if(p===f){e.addPointIndex(p);break}e.addPointIndex(f)}const m=new Uint32Array(a*a);let g;for(t.copy(e),g=e.count-1;0<=g;){var v=e.findCluster();e.removePointIndex(v),m[v]=g,g--}var b=a*a;for(g=t.count;g<b/2;){var y=t.findVoid();t.addPointIndex(y),m[y]=g,g++}for(t.invert();g<b;){var x=t.findCluster();t.removePointIndex(x),m[x]=g,g++}return{data:m,maxValue:b}}}class Vn extends an.w{constructor(e,t){super(),this.enabled=!0,this.needsSwap=!0,this.scene=e,this.camera=t,this.debug={display:Vn.DEFAULT},this.renderTargetScale=1,this.enableJitter=!0,this.radiusJitter=0,this.rotationJitter=0,this.numSteps=8,this.numDirections=8,this.intensity=1,this.radius=2,this.directionOffset=0,this.stepOffset=0,this.blurMode=Vn.BOX_BLUR,this.blurIterations=4,this.blurStride=1,this.enableFalloff=!0,this.falloffStart=.4,this.falloffEnd=2,this.ambientColor=new s.Color,this.ambientIntensity=0,this.lightBounceIntensity=1,this._gtaoBuffer=new s.WebGLRenderTarget(1,1,{format:s.RGBAFormat}),this._depthBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat,type:s.HalfFloatType}),this._depthReplacement=new In,this._normalBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat}),this._normalReplacement=new Ln,this.gtaoQuad=new an.T(new s.ShaderMaterial(jn)),this.debugPackedQuad=new an.T(new s.ShaderMaterial(Bn)),this.debugDepthQuad=new an.T(new s.ShaderMaterial(Un)),this.compositeQuad=new an.T(new s.ShaderMaterial(Fn));const r=new zn,n=(r.size=32,new Uint8Array(4*Math.pow(32,2)));for(let e=0;e<4;e++){var a=r.generate(),i=a.data,o=a.maxValue;for(let t=0,r=i.length;t<r;t++)n[4*t+e]=i[t]/o*255}this.blueNoiseTex=new s.DataTexture(n,r.size,r.size,s.RGBAFormat),this.blueNoiseTex.wrapS=s.RepeatWrapping,this.blueNoiseTex.wrapT=s.RepeatWrapping,this.blueNoiseTex.minFilter=s.LinearFilter,this.blueNoiseTex.needsUpdate=!0}dispose(){}setSize(e,t){var r=this.renderTargetScale,n=Math.floor(e*r);r=Math.floor(t*r),this._depthBuffer.setSize(e,t),this._normalBuffer.setSize(e,t),this._gtaoBuffer.setSize(n,r)}render(e,t,r){t=this.renderToScreen?null:t;const{scene:n,camera:a,debug:i,debugPackedQuad:o,debugDepthQuad:l,compositeQuad:c,gtaoQuad:u}=this,h=u.material;Vn.RendererState.copy(e,n);var d=()=>{Vn.RendererState.restore(e,n),f.reset(n,!0)},p=this._depthBuffer;const f=this._depthReplacement;if(n.background=null,f.replace(n,!0,!0),e.setRenderTarget(p),e.setClearColor(Vn.BlackColor,0),e.clear(),e.render(n,a),i.display===Vn.DEPTH)return e.setRenderTarget(t),l.material.uniforms.texture.value=p.texture,l.render(e),void d();const m=this._normalReplacement;var g=this._normalBuffer;if(m.replace(n,!0,!1),e.setRenderTarget(g),e.clear(),e.render(n,a),i.display===Vn.NORMAL)return e.setRenderTarget(t),e.clear(),o.material.uniforms.displayRoughness.value=0,o.material.uniforms.texture.value=g.texture,o.render(e),void d();this.numSteps!==h.defines.NUM_STEPS&&(h.defines.NUM_STEPS=this.numSteps,h.needsUpdate=!0),this.numDirections!==h.defines.NUM_DIRECTIONS&&(h.defines.NUM_DIRECTIONS=this.numDirections,h.needsUpdate=!0),this.radius.toFixed(16)!==h.defines.RADIUS&&(h.defines.RADIUS=this.radius.toFixed(16),h.needsUpdate=!0),Math.pow(this.falloffStart,2).toFixed(16)===h.defines.FALLOFF_START2&&Math.pow(this.falloffEnd,2).toFixed(16)===h.defines.FALLOFF_END2&&this.enableFalloff===Boolean(h.defines.ENABLE_FALLOFF)||(h.defines.FALLOFF_START2=Math.pow(this.falloffStart,2).toFixed(16),h.defines.FALLOFF_END2=Math.pow(this.falloffEnd,2).toFixed(16),h.defines.ENABLE_FALLOFF=this.enableFalloff?1:0,h.needsUpdate=!0),this.rotationJitter!==h.defines.ENABLE_ROTATION_JITTER&&(h.defines.ENABLE_ROTATION_JITTER=this.rotationJitter,h.needsUpdate=!0),this.radiusJitter!==h.defines.ENABLE_RADIUS_JITTER&&(h.defines.ENABLE_RADIUS_JITTER=this.radiusJitter,h.needsUpdate=!0),0!==this.lightBounceIntensity!==Boolean(h.defines.ENABLE_COLOR_BOUNCE)&&(h.defines.ENABLE_COLOR_BOUNCE=0!==this.lightBounceIntensity?1:0,h.needsUpdate=!0);var v=this._gtaoBuffer,b=Math.floor(v.texture.image.width),y=Math.floor(v.texture.image.height),x=a.projectionMatrix,w=s.MathUtils.DEG2RAD*a.fov;h.uniforms.params.value.set(this.directionOffset,this.stepOffset),h.uniforms.projInfo.value.set(2/(b*x.elements[0]),2/(y*x.elements[5]),-1/x.elements[0],-1/x.elements[5]),h.uniforms.clipInfo.value.set(a.near,a.far,y/(2*Math.tan(.5*w))*.5,0),h.uniforms.normalBuffer.value=g.texture,h.uniforms.depthBuffer.value=p.texture,h.uniforms.colorBuffer.value=r.texture,h.uniforms.lightBounceIntensity.value=this.lightBounceIntensity,h.uniforms.renderSize.value.set(Math.floor(v.texture.image.width),Math.floor(v.texture.image.height)),h.uniforms.blueNoiseTex.value=this.blueNoiseTex,h.uniforms.blueNoiseSize.value=this.blueNoiseTex.image.width,e.setRenderTarget(v),e.clear(),u.render(e);const S=c.material;S.uniforms.depthBuffer.value=p.texture,S.uniforms.normalBuffer.value=g.texture,S.uniforms.colorBuffer.value=r.texture,S.uniforms.gtaoBuffer.value=v.texture,S.uniforms.intensity.value=this.intensity,S.uniforms.aoSize.value.set(v.width,v.height),S.uniforms.fullSize.value.set(r.width,r.height),S.uniforms.blurStride.value=this.blurStride,S.uniforms.ambientColor.value.copy(this.ambientColor),S.uniforms.ambientIntensity.value=this.ambientIntensity,this.blurIterations!==S.defines.BLUR_ITERATIONS&&(S.defines.BLUR_ITERATIONS=this.blurIterations,S.needsUpdate=!0),this.blurMode!==S.defines.BLUR_MODE&&(S.defines.BLUR_MODE=this.blurMode,S.needsUpdate=!0),i.display===Vn.AO_SAMPLE?1!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=1,S.needsUpdate=!0):0!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=0,S.needsUpdate=!0),i.display===Vn.COLOR_SAMPLE?1!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=1,S.needsUpdate=!0):0!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=0,S.needsUpdate=!0),e.setRenderTarget(t),e.clear(),c.render(e),d()}}Vn.NO_JITTER=0,Vn.RANDOM_JITTER=1,Vn.BLUENOISE_JITTER=2,Vn.DEFAULT=0,Vn.DEPTH=1,Vn.NORMAL=2,Vn.AO_SAMPLE=3,Vn.COLOR_SAMPLE=4,Vn.NO_BLUR=0,Vn.BOX_BLUR=1,Vn.CROSS_BLUR=2,Vn.DIAGONAL_BLUR=3,Vn.BlackColor=new s.Color(0),Vn.RendererState=new class{constructor(){this.clearAlpha=0,this.clearColor=new s.Color,this.renderTarget=null,this.outputEncoding=s.LinearEncoding,this.overrideMaterial=null,this.shadowsEnabled=!1,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.background=null,this.autoUpdate=!0}copy(e,t){e&&(this.clearAlpha=e.getClearAlpha(),this.clearColor=e.getClearColor(this.clearColor),this.renderTarget=e.getRenderTarget(),this.shadowsEnabled=e.shadowMap.enabled,this.outputEncoding=e.outputEncoding,this.autoClear=e.autoClear,this.autoClearColor=e.autoClearColor,this.autoClearDepth=e.autoClearDepth,this.autoClearStencil=e.autoClearStencil),t&&(this.overrideMaterial=t.overrideMaterial,this.background=t.background,this.autoUpdate=t.autoUpdate)}restore(e,t){e&&(e.setClearAlpha(this.clearAlpha),e.setClearColor(this.clearColor),e.setRenderTarget(this.renderTarget),e.shadowMap.enabled=this.shadowsEnabled,e.outputEncoding=this.outputEncoding,e.autoClear=this.autoClear,e.autoClearColor=this.autoClearColor,e.autoClearDepth=this.autoClearDepth,e.autoClearStencil=this.autoClearStencil),t&&(t.overrideMaterial=this.overrideMaterial,t.background=this.background,t.autoUpdate=this.autoUpdate),this.renderTarget=null,this.overrideMaterial=null}};class Gn{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.gtaoPass||(this.gtaoPass=new Vn(this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.gtaoPass)}setAOData(e,t){"rotationJitter"===e||"radiusJitter"===e?"NONE"===t?this.gtaoPass[e]=0:"RANDOM"===t?this.gtaoPass[e]=1:"BLUE_NOISE"===t&&(this.gtaoPass[e]=2):"blurMode"===e?"NO_BLUR"===t?this.gtaoPass[e]=0:"BOX_BLUR"===t?this.gtaoPass[e]=1:"CROSS_BLUR"===t?this.gtaoPass[e]=2:"DIAGONAL_BLUR"===t&&(this.gtaoPass[e]=3):this.gtaoPass[e]="ambientColor"===e?new ua.Color(t):t}dispose(){this.gtaoPass&&(this.gtaoPass.dispose(),this.gtaoPass=null)}enablePass(e){this.gtaoPass&&this.gtaoPass.enabled!==e&&(this.gtaoPass.enabled=e)}}function Hn(e){return(Hn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Wn(e,t){return(Wn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function qn(e){return(qn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Kn=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Wn(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=qn(e);if(r=t?(r=qn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Hn(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i,o){var l;if(this instanceof n)return(l=r.call(this)).scene=e,l.camera=t,l.overrideMaterial=a,l.clearColor=i,l.clearAlpha=void 0!==o?o:0,l.clear=!0,l.clearDepth=!1,l.needsSwap=!1,l._oldClearColor=new s.Color,l;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"render",value:function(e,t,r){var n,a,i=e.autoClear;e.autoClear=!1,void 0!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),n=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,n),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=a),e.autoClear=i}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(an.w),Zn={uniforms:{tDiffuse:{value:null},resolution:{value:new s.Vector2(1/1024,1/512)}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\tprecision highp float;\n\n\tuniform sampler2D tDiffuse;\n\n\tuniform vec2 resolution;\n\n\tvarying vec2 vUv;\n\n\t// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)\n\n\t//----------------------------------------------------------------------------------\n\t// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag\n\t// SDK Version: v3.00\n\t// Email: gameworks@nvidia.com\n\t// Site: http://developer.nvidia.com/\n\t//\n\t// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n\t//\n\t// Redistribution and use in source and binary forms, with or without\n\t// modification, are permitted provided that the following conditions\n\t// are met:\n\t// * Redistributions of source code must retain the above copyright\n\t// notice, this list of conditions and the following disclaimer.\n\t// * Redistributions in binary form must reproduce the above copyright\n\t// notice, this list of conditions and the following disclaimer in the\n\t// documentation and/or other materials provided with the distribution.\n\t// * Neither the name of NVIDIA CORPORATION nor the names of its\n\t// contributors may be used to endorse or promote products derived\n\t// from this software without specific prior written permission.\n\t//\n\t// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n\t// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\t// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n\t// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n\t// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\t// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n\t// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n\t// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n\t// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t//\n\t//----------------------------------------------------------------------------------\n\n\t#ifndef FXAA_DISCARD\n\t\t\t//\n\t\t\t// Only valid for PC OpenGL currently.\n\t\t\t// Probably will not work when FXAA_GREEN_AS_LUMA = 1.\n\t\t\t//\n\t\t\t// 1 = Use discard on pixels which don't need AA.\n\t\t\t// For APIs which enable concurrent TEX+ROP from same surface.\n\t\t\t// 0 = Return unchanged color on pixels which don't need AA.\n\t\t\t//\n\t\t\t#define FXAA_DISCARD 0\n\t#endif\n\n\t/*--------------------------------------------------------------------------*/\n\t#define FxaaTexTop(t, p) texture2D(t, p, -100.0)\n\t#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)\n\t/*--------------------------------------------------------------------------*/\n\n\t#define NUM_SAMPLES 5\n\n\t// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha\n\tfloat contrast( vec4 a, vec4 b ) {\n\t\t\tvec4 diff = abs( a - b );\n\t\t\treturn max( max( max( diff.r, diff.g ), diff.b ), diff.a );\n\t}\n\n\t/*============================================================================\n\n\t\t\t\t\t\t\t\t\tFXAA3 QUALITY - PC\n\n\t============================================================================*/\n\n\t/*--------------------------------------------------------------------------*/\n\tvec4 FxaaPixelShader(\n\t\t\tvec2 posM,\n\t\t\tsampler2D tex,\n\t\t\tvec2 fxaaQualityRcpFrame,\n\t\t\tfloat fxaaQualityEdgeThreshold,\n\t\t\tfloat fxaaQualityinvEdgeThreshold\n\t) {\n\t\t\tvec4 rgbaM = FxaaTexTop(tex, posM);\n\t\t\tvec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\t// . S .\n\t\t\t// W M E\n\t\t\t// . N .\n\n\t\t\tbool earlyExit = max( max( max(\n\t\t\t\t\tcontrast( rgbaM, rgbaN ),\n\t\t\t\t\tcontrast( rgbaM, rgbaS ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaE ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaW ) )\n\t\t\t\t\t< fxaaQualityEdgeThreshold;\n\t\t\t// . 0 .\n\t\t\t// 0 0 0\n\t\t\t// . 0 .\n\n\t\t\t#if (FXAA_DISCARD == 1)\n\t\t\t\t\tif(earlyExit) FxaaDiscard;\n\t\t\t#else\n\t\t\t\t\tif(earlyExit) return rgbaM;\n\t\t\t#endif\n\n\t\t\tfloat contrastN = contrast( rgbaM, rgbaN );\n\t\t\tfloat contrastS = contrast( rgbaM, rgbaS );\n\t\t\tfloat contrastE = contrast( rgbaM, rgbaE );\n\t\t\tfloat contrastW = contrast( rgbaM, rgbaW );\n\n\t\t\tfloat relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );\n\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\tbool horzSpan = relativeVContrast > 0.;\n\t\t\t// . 1 .\n\t\t\t// 0 0 0\n\t\t\t// . 1 .\n\n\t\t\t// 45 deg edge detection and corners of objects, aka V/H contrast is too similar\n\t\t\tif( abs( relativeVContrast ) < .3 ) {\n\t\t\t\t\t// locate the edge\n\t\t\t\t\tvec2 dirToEdge;\n\t\t\t\t\tdirToEdge.x = contrastE > contrastW ? 1. : -1.;\n\t\t\t\t\tdirToEdge.y = contrastS > contrastN ? 1. : -1.;\n\t\t\t\t\t// . 2 . . 1 .\n\t\t\t\t\t// 1 0 2 ~= 0 0 1\n\t\t\t\t\t// . 1 . . 0 .\n\n\t\t\t\t\t// tap 2 pixels and see which ones are \"outside\" the edge, to\n\t\t\t\t\t// determine if the edge is vertical or horizontal\n\n\t\t\t\t\tvec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongH = contrast( rgbaM, rgbaAlongH );\n\t\t\t\t\t// . 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 H\n\n\t\t\t\t\tvec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongV = contrast( rgbaM, rgbaAlongV );\n\t\t\t\t\t// V 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 .\n\n\t\t\t\t\trelativeVContrast = matchAlongV - matchAlongH;\n\t\t\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\t\t\tif( abs( relativeVContrast ) < .3 ) { // 45 deg edge\n\t\t\t\t\t\t\t// 1 1 .\n\t\t\t\t\t\t\t// 0 0 1\n\t\t\t\t\t\t\t// . 0 1\n\n\t\t\t\t\t\t\t// do a simple blur\n\t\t\t\t\t\t\treturn mix(\n\t\t\t\t\t\t\t\t\trgbaM,\n\t\t\t\t\t\t\t\t\t(rgbaN + rgbaS + rgbaE + rgbaW) * .25,\n\t\t\t\t\t\t\t\t\t.4\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\thorzSpan = relativeVContrast > 0.;\n\t\t\t}\n\n\t\t\tif(!horzSpan) rgbaN = rgbaW;\n\t\t\tif(!horzSpan) rgbaS = rgbaE;\n\t\t\t// . 0 . 1\n\t\t\t// 1 0 1 -> 0\n\t\t\t// . 0 . 1\n\n\t\t\tbool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );\n\t\t\tif(!pairN) rgbaN = rgbaS;\n\n\t\t\tvec2 offNP;\n\t\t\toffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n\t\t\toffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n\n\t\t\tbool doneN = false;\n\t\t\tbool doneP = false;\n\n\t\t\tfloat nDist = 0.;\n\t\t\tfloat pDist = 0.;\n\n\t\t\tvec2 posN = posM;\n\t\t\tvec2 posP = posM;\n\n\t\t\tint iterationsUsed = 0;\n\t\t\tint iterationsUsedN = 0;\n\t\t\tint iterationsUsedP = 0;\n\t\t\tfor( int i = 0; i < NUM_SAMPLES; i++ ) {\n\t\t\t\t\titerationsUsed = i;\n\n\t\t\t\t\tfloat increment = float(i + 1);\n\n\t\t\t\t\tif(!doneN) {\n\t\t\t\t\t\t\tnDist += increment;\n\t\t\t\t\t\t\tposN = posM + offNP * nDist;\n\t\t\t\t\t\t\tvec4 rgbaEndN = FxaaTexTop(tex, posN.xy);\n\t\t\t\t\t\t\tdoneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );\n\t\t\t\t\t\t\titerationsUsedN = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!doneP) {\n\t\t\t\t\t\t\tpDist += increment;\n\t\t\t\t\t\t\tposP = posM - offNP * pDist;\n\t\t\t\t\t\t\tvec4 rgbaEndP = FxaaTexTop(tex, posP.xy);\n\t\t\t\t\t\t\tdoneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );\n\t\t\t\t\t\t\titerationsUsedP = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(doneN || doneP) break;\n\t\t\t}\n\n\n\t\t\tif ( !doneP && !doneN ) return rgbaM; // failed to find end of edge\n\n\t\t\tfloat dist = min(\n\t\t\t\t\tdoneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,\n\t\t\t\t\tdoneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.\n\t\t\t);\n\n\t\t\t// hacky way of reduces blurriness of mostly diagonal edges\n\t\t\t// but reduces AA quality\n\t\t\tdist = pow(dist, .5);\n\n\t\t\tdist = 1. - dist;\n\n\t\t\treturn mix(\n\t\t\t\t\trgbaM,\n\t\t\t\t\trgbaN,\n\t\t\t\t\tdist * .5\n\t\t\t);\n\t}\n\n\tvoid main() {\n\t\t\tconst float edgeDetectionQuality = .2;\n\t\t\tconst float invEdgeDetectionQuality = 1. / edgeDetectionQuality;\n\n\t\t\tgl_FragColor = FxaaPixelShader(\n\t\t\t\t\tvUv,\n\t\t\t\t\ttDiffuse,\n\t\t\t\t\tresolution,\n\t\t\t\t\tedgeDetectionQuality, // [0,1] contrast needed, otherwise early discard\n\t\t\t\t\tinvEdgeDetectionQuality\n\t\t\t);\n\n\t}\n\t"},Xn={uniforms:{tDiffuse:{value:null},offset:{value:1},darkness:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float offset;\n\t\tuniform float darkness;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t// Eskil's vignette\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tvec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );\n\t\t\tgl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );\n\n\t\t}"};const Qn={radius:{type:"number",val:.6,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},strength:{type:"number",val:1.5,shortKey:"s",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},threshold:{type:"number",val:0,shortKey:"t",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}}},Yn={edgeStrength:{type:"number",val:3,shortKey:"es",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeGlow:{type:"number",val:0,shortKey:"eg",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeThickness:{type:"number",val:1,shortKey:"et",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},pulsePeriod:{type:"number",val:0,shortKey:"pp",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},visibleEdgeColor:{type:"color_str",val:"#FFFFFF",shortKey:"vec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},hiddenEdgeColor:{type:"color_str",val:"#190A05",shortKey:"hec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}}},Jn={directionOffset:{type:"number",val:0,shortKey:"do",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},stepOffset:{type:"number",val:0,shortKey:"so",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},rotationJitter:{type:"other",val:"NONE",shortKey:"roj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radiusJitter:{type:"other",val:"NONE",shortKey:"raj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numSteps:{type:"number",val:8,shortKey:"ns",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numDirections:{type:"number",val:1,shortKey:"nd",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},intensity:{type:"number",val:1,shortKey:"i",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radius:{type:"number",val:2,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},enableFalloff:{type:"other",val:!0,shortKey:"ef",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffStart:{type:"number",val:.4,shortKey:"fs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffEnd:{type:"number",val:2,shortKey:"fe",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},renderTargetScale:{type:"number",val:.5,shortKey:"rts",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurMode:{type:"other",val:"NO_BLUR",shortKey:"bm",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurIterations:{type:"number",val:5,shortKey:"bi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurStride:{type:"number",val:1,shortKey:"bs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientColor:{type:"color_str",val:"#FFFFFF",shortKey:"ac",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientIntensity:{type:"number",val:0,shortKey:"ai",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},lightBounceIntensity:{type:"number",val:0,shortKey:"lbi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}}};var $n=r(1398);class ea{constructor(e){this.params=this.getDefaultParams(),this.clean=()=>{this.resetParams(),this.reset()},this.ENTIRE_SCENE=0,this.BLOOM_SCENE=1,this.BLACK_COLOR=new ua.Color(0),this.runScene=e,this.info=new tn(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new ua.Vector2,this.sceneFogColor=null,this.sceneBackground=null,this.isUpdate=!0,this.runScene.exporter.gltf.options.addOption({type:"post-processing",process:e=>this.toJSON(),parse:e=>{e=JSON.parse(e),this.fromJSON(e)}}),this.runScene.cb.clean.add("pp",this.clean),this.runScene.cb.setScene.add("post-processing",(({type:e,val:t})=>{"fog"===e&&t&&t.show&&(this.sceneFogColor?this.sceneFogColor.copy(t.color):this.sceneFogColor=new ua.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,Ye.isTexture)(this.sceneBackground)&&this.sceneBackground.dispose(),this.sceneBackground=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setSceneBg():this.isSafari)})),this.runScene.snapshot.bind({name:"glow",target:this.params.glow,def:Qn}),this.runScene.snapshot.bind({name:"outline",target:this.params.outline,def:Yn}),this.runScene.snapshot.bind({name:"ao",target:this.params.ao,def:Jn,set:e=>{const t=e.snapshot.data.get("ao");t&&($n.LV.set({def:Jn,runScene:this.runScene,data:t,target:this.params.ao,map:e}),e.data.completedCbs.push((()=>{(0,i.mapObj)(Jn,((e,r)=>{var{type:r,val:n,shortKey:a}=r;"other"===r&&this.setAOData(e,void 0!==t[a]?t[a]:n)}))})))}})}getDefaultParams(){return{pp:{samples:2},glow:{isBloom:!1,radius:.6,strength:1.5,threshold:0},outline:{isOutline:!1,edgeStrength:3,edgeGlow:0,edgeThickness:1,pulsePeriod:0,visibleEdgeColor:"#FFFFFF",hiddenEdgeColor:"#190A05"},ao:{isAO:!1,directionOffset:0,stepOffset:0,rotationJitter:"NONE",radiusJitter:"NONE",numSteps:8,numDirections:1,intensity:1,radius:2,enableFalloff:!0,falloffStart:.4,falloffEnd:2,renderTargetScale:.5,blurMode:"NO_BLUR",blurIterations:5,blurStride:1,ambientColor:"#FFFFFF",ambientIntensity:0,lightBounceIntensity:0},vignette:{isVignette:!1,offset:1,darkness:1}}}resetParams(){(0,nt.U)(this.params,this.getDefaultParams())}init(){try{var{camera:e,scene:t,renderer:r}=this.runScene.assetsEx.get();this.mainScene=t,this.mainCamera=e,this.renderer=r,this.renderer&&(this.renderer.getSize(this.rtSize),this.postProcessing())}catch(e){console.log("Error: ",e)}this.runScene.cb.loaderer.gltf.loadNode.add("outline-objects",(({node:e,nodeDef:t})=>{t.extras&&t.extras.outline&&this.mtOutline.addSelectedObject(e)}))}postProcessing(){this.effectComposer=new _n(this.renderer,this.getNewRenderTarget(this.params.pp.samples)),this.renderPass=new Kn(this.mainScene,this.mainCamera),this.fxaaPass=new nn.T(Zn),this.fxaaPass.uniforms.resolution.value.set(1/window.innerWidth,1/window.innerHeight),this.vignettePass=new nn.T(Xn),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow(),this.ppAO(),this.effectComposer.addPass(this.vignettePass)}getNewRenderTarget(e){const t=new ua.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:e});return t.depthTexture=new ua.DepthTexture(this.rtSize.x,this.rtSize.y),t.depthTexture.type=ua.UnsignedIntType,t.depthTexture.format=ua.DepthFormat,t.texture.format=ua.RGBAFormat,t.texture.encoding=ua.sRGBEncoding,t}ppOutline(){this.mtOutline=new Pn.Q(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new fn(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new Dn(this))}ppAO(){this.mtAO=new Gn(this)}toJSON(){const e={};var{pp:t,glow:r,outline:n,ao:a,vignette:i}=this.params;return e.ppParams=Object.assign({},t),e.bloomParams=Object.assign({},r),e.outlineParams=Object.assign({},n),e.aoParams=Object.assign({},a),e.vignetteParams=Object.assign({},i),JSON.stringify(e)}fromJSON(e){var{ppParams:e,bloomParams:t,outlineParams:r,aoParams:n,vignetteParams:a}=e;e&&(e=e.samples,this.params.pp.samples=e,this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))),t&&(this.params.glow.isBloom=t.isBloom,this.setGlowData("radius",t.radius),this.setGlowData("strength",t.strength),this.setGlowData("threshold",t.threshold),this.runScene.cb.pp.glow.setData.cb(this.params.glow)),r&&this.mtOutline&&(this.params.outline.isOutline=r.isOutline,this.setOutlineData("edgeStrength",r.edgeStrength),this.setOutlineData("edgeGlow",r.edgeGlow),this.setOutlineData("edgeThickness",r.edgeThickness),this.setOutlineData("pulsePeriod",r.pulsePeriod),this.setOutlineData("visibleEdgeColor",r.visibleEdgeColor),this.setOutlineData("hiddenEdgeColor",r.hiddenEdgeColor),this.runScene.cb.pp.outline.setData.cb(this.params.outline)),n&&this.mtAO&&(this.params.ao.isAO=n.isAO,this.setAOData("directionOffset",n.directionOffset),this.setAOData("stepOffset",n.stepOffset),this.setAOData("rotationJitter",n.rotationJitter),this.setAOData("radiusJitter",n.radiusJitter),this.setAOData("numSteps",n.numSteps),this.setAOData("numDirections",n.numDirections),this.setAOData("intensity",n.intensity),this.setAOData("radius",n.radius),this.setAOData("enableFalloff",n.enableFalloff),this.setAOData("falloffStart",n.falloffStart),this.setAOData("falloffEnd",n.falloffEnd),this.setAOData("renderTargetScale",n.renderTargetScale),this.setAOData("blurMode",n.blurMode),this.setAOData("blurIterations",n.blurIterations),this.setAOData("blurStride",n.blurStride),this.setAOData("ambientColor",n.ambientColor),this.setAOData("ambientIntensity",n.ambientIntensity),this.setAOData("lightBounceIntensity",n.lightBounceIntensity),this.runScene.cb.pp.ao.setData.cb(this.params.ao)),a&&this.vignettePass&&(this.params.vignette.isVignette=a.isVignette,this.setVignetteData("offset",a.offset),this.setVignetteData("darkness",a.darkness),this.runScene.cb.pp.vignette.setData.cb(this.params.vignette))}setUpdate(e){this.isUpdate=e}clearAllOutlineObj(){this.mtOutline.clearAllOutlineObj()}update(){this.isUpdate&&this.mainScene&&this.mainCamera&&this.renderer&&(this.params.glow.isBloom||this.params.outline.isOutline||this.params.ao.isAO||this.params.vignette.isVignette?(this.vignettePass.enabled=this.params.vignette.isVignette,this.mtAO&&this.mtAO.enablePass(this.params.ao.isAO),this.mtOutline&&this.mtOutline.enablePass(this.params.outline.isOutline),this.isChrome&&this.mtuGlow?(this.mtuGlow.enablePass(this.params.glow.isBloom),this.effectComposer.render()):this.isSafari&&this.threeGlow&&(this.threeGlow.enablePass(this.params.glow.isBloom),this.threeGlow.render())):this.renderer.render(this.mainScene,this.mainCamera))}setSize(e,t){this.rtSize.x=e,this.rtSize.y=t,this.effectComposer&&this.effectComposer.setSize(e,t),this.isChrome&&this.mtuGlow||this.isSafari&&this.threeGlow&&this.threeGlow.setSize(e,t)}reset(){this.runScene.pp.dispose(),this.runScene.pp.init()}dispose(){this.isChrome&&this.mtuGlow?this.mtuGlow.dispose():this.isSafari&&this.threeGlow&&this.threeGlow.dispose(),this.mtOutline&&this.mtOutline.dispose(),this.renderPass=null,this.effectComposer&&(this.effectComposer.renderTarget1&&(this.effectComposer.renderTarget1.dispose(),this.effectComposer.renderTarget1=null),this.effectComposer.renderTarget2&&(this.effectComposer.renderTarget2.dispose(),this.effectComposer.renderTarget2=null),this.effectComposer=null)}setPPData(e,t){this.params.pp[e]=t,"samples"===e&&this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))}setGlowData(e,t){this.params.glow[e]=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setGlowData(e,t):this.isSafari&&this.threeGlow&&this.threeGlow.setGlowData(e,t)}setOutlineData(e,t){this.params.outline[e]=t,this.mtOutline&&this.mtOutline.setOutlineData(e,t)}addOutlineObj(e,t=!0){this.mtOutline.addSelectedObject(e,t)}setAOData(e,t){this.params.ao[e]=t,this.mtAO&&this.mtAO.setAOData(e,t)}setVignetteData(e,t){this.params.vignette[e]=t,this.vignettePass&&(this.vignettePass.uniforms[e].value=t)}}var ta=r(7738);class ra extends o{constructor(e){super(e),this.map=new M.Z,this.playLimit=new nt.cM,this.renderName="script-texture-render",this._clock=new s.Clock,this.bindEvent()}parse(e,t){var r=(0,A.Ki)(t);0===Object.keys(e||{}).length?this.map.has(r)&&this.map.delete(r):this.map.set(r,{texture:t,uvScript:e})}bindEvent(){this.runScene.cb.texture.setAnima.add("script-texture-set-anima",(({uvScript:e,texture:t})=>this.parse(e,t))),this.runScene.cb.texture.add.add("script-texture-add-texture",(e=>{var t=e.userData.uvScript;t&&this.parse(t,e)}))}_playAll(){this.map.forEach((e=>{const{texture:t,uvScript:r}=e;var{moveX:e,moveY:n,rotate:a}=r;t.userData.scriptTextre||(t.userData.scriptTextre={offsetX:t.offset.x,offsetY:t.offset.y,rotation:t.rotation}),e&&(t.offset.x+=e),n&&(t.offset.y+=n),a&&(t.rotation+=a)}))}playAll(){const{scriptFrame:e,mode:t}=this.runScene.optionsEx.options.renderConfig;-1===e&&"tick"===t?this.runScene.cb.render.add(this.renderName,(()=>{this._playAll()})):this.runScene.cb.render.add(this.renderName,(()=>{this.playLimit.update({cb:()=>{this._playAll()},cbRate:1/e,now:this._clock.getDelta()})}))}closeAll(){this.map.forEach((e=>{const t=e.texture;let r=0,n=0,a=0;t.userData.scriptTextre&&(r=(e=t.userData.scriptTextre).offsetX,n=e.offsetY,a=e.rotation,delete t.userData.scriptTextre),t.offset.x=r,t.offset.y=n,t.rotation=a})),this.runScene.cb.render.delete(this.renderName)}has(e){return void 0!==e.userData.uvScript}get(e){return e.userData.uvScript}set(e,t){t.userData.uvScript=e}}class na extends o{constructor(e){super(e),this.runAll=!1,this.texture=new ra(e)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll())}}class aa{constructor(e){this.map=new M.Z,this.clean=()=>{this.clear()},this.runScene=e,this.runScene.cb.clean.add("Tags",this.clean),this.runScene.cb.model.remove.add("Tags",(({model:e})=>{const t=(0,A.Ki)(e);t&&this.map.map(((e,r)=>{r.delete(t)}))}))}get(e){return this.map.get(e)}add(e){this.get(e)||this.map.set(e,new P.Z)}rename(e,t){const r=this.get(e);r&&(this.addId(t,r.toArray()),this.remove(e))}addId(e,t){this.map.has(e)||this.add(e),this.map.get(e).add(t)}addModel(e,t){if(this.map.has(e)||this.add(e),(0,nt.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,A.Ki)(t))}reflash(e){const t=this.map.get(e);if(t){let e=[];t.forEach((t=>{this.runScene.modelEx.getById(t)||e.push(t)})),e.map((e=>t.remove(e)))}}removeModel(e,t){if(this.map.has(e))return(0,nt.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,A.Ki)(t))}remove(e){this.map.delete(e)}clear(){this.map.clear(),this.runScene.cb.tags.clear.cb()}toJSON(){const e={};return this.map.map(((t,r)=>{e[t]=[...r.filter((e=>this.runScene.modelEx.getById(e)))]})),e}parseJSON(e){let t={};(0,i.mapObj)(e,((e,r)=>{t[e]=new P.Z(r)})),this.map=M.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}class ia{constructor(e,t){this.showTransform=!1,this.data=new Proxy({},{set:(e,t,r)=>(e[t]=r,!0)}),this.uuid="",this.getAnimaByModelData=(()=>{const e=(e,t,r,n)=>{const a={},s={};if(e=ia.isNotNow(e)?this.getAllData():e,(0,i.mapObj)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(a[r]=t[r],s[r]=e[r]):"color"===n&&(0,i.mapObj)(e[r],((e,n)=>{var i=r+e;a[i]=t[r][e],s[i]=n})))})),!(0,i.emptyObj)(a))return{begin:a,end:s}};return(t,r,n,a=!1,s)=>{let o=a?n.time:0;const l=Object.keys(t).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));var c=(0,i.lastArrayEle)(l),h=a?"0.00":String(n.time);return c!==h&&(t[h]=Object.assign({},c),l.push(h)),l.map((l=>{var c=t[String(l)],h=.001*((h=a?o-l:l-o)<=0?.001:h)*n.speed;o=l;{var d=r,p=c,f=h,m=s;const t={color(e){const{animaData:t,defType:r}=e,n={};(0,i.mapObj)(t,(e=>{var a;-1!==e.indexOf(r)&&(a=e.substring(r.length),["r","g","b"].includes(a)&&(n[a]=t[e]))}));var{r:e,g:a,b:s}=n;if(e&&a&&s)return n}};return()=>{let r;return{promise:new Promise((n=>{var a;if(!(a=e(p,d,0,m)))return n(0);var{begin:a,end:s}=a;return r=(0,u.anima)(a,s,f,(e=>{(0,i.mapObj)(m,((r,n)=>{n=n.type;var a,i=e[r];"number"===n?d[r]=i:"color"===n&&(i=t.color({animaData:e,defType:r}))&&(({r:n,g:i,b:a}=i),d[r].setRGB(n,i,a))}))}),n)})),anima:r}}}}))}})(),this.runScene=t,this.target=e,this.target.userData.isTimeLineUsed=!0,this.uuid=this.getId(e)}toJSON(){var{data:e,type:t}=this;return{data:e,type:t}}addData(e,t,r=!1){return 1e3<Number(e)&&(e="1000.00"),r?this.data[e]=this.getAllData():(this.data[e]||(this.data[e]={}),this.data[e][t]=this.getData(t)),this.data[e]}addTriggerNowData(e){return this.data[e]=this.getAllData(!0)}removeData(e){delete this.data[e]}static isNotNow(e){return"notNow"===Object.values(e)[0]}static getAllDefValByType(e,t,r=!1){const n={};return(0,i.mapObj)(e,(a=>{n[a]=r?"notNow":ia.getValByType(t,a,e)})),n}static getValByType(e,t,r){var n,a;return r=r[t].type,e=e[t],"number"===r?e:"color"===r?(({r:t,g:n,b:a}=e),{r:t,g:n,b:a}):"V3"===r?(0,u.v3ToMap)(e):""}static SetTargetByData(e){const{baseType:t,data:r,defType:n,target:a}=e;var i,s;"number"===t?a[n]=r:"color"===t&&(({r:e,g:i,b:s}=r),a[n].setRGB(e,i,s))}getAllData(e=!1){return ia.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return ia.getValByType(this.target,e,this.defOptions)}static getTarget(e,t){}getAnima(e,t){return this.getAnimaByModelData(this.data,this.target,e,t,this.defOptions)}setTargetByBetween(e,t,r){ia.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,la[r])(e);return n.data=t,n}reset(){(0,i.mapObj)(this.defOptions,((e,t)=>{ia.SetTargetByData({baseType:t.type,data:ia.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}ia.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,a,s)=>{(0,i.mapObj)(a,((a,i)=>{var o,l,c,u,h,d;i=i.type,void 0!==t[a]&&void 0!==r[a]&&ia.SetTargetByData({baseType:i,data:(o=t[a],l=r[a],c=n,"number"===i?e(o,l,c):"color"===i?(({r:i,g:o,b:u}=o),({r:l,g:h,b:d}=l),{r:e(i,l,c),g:e(o,h,c),b:e(u,d,c)}):void 0),defType:a,target:s})}))}})();const sa=ia;class oa extends o{constructor(){super(...arguments),this.mount=e=>{e.core.module.set("timeline",this)},this.after=e=>{var t,{json:e,config:r}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&r.module.timeline&&this.runScene.timeLineEx.parseSavedGroupMap((null==(t=e.asset.ex)?void 0:t.timeLine)||{})}}init(){var e={name:"timeline",loadCallBacks:new M.Z({afterParse:this.after,mountModule:this.mount}),exportCallBacks:new M.Z};this.runScene.exporter.gltf.module.bind(e)}}const la={model:class extends sa{constructor(e,t){super(e,t),this.type="model",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:a}=e,{x:t,y:i,z:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==i?(i-n)*r+n:n,z:a!==s?(s-a)*r+a:a}};return(t,r,n)=>{var a,{position:t,scale:i,rotation:s}=t,{position:r,scale:o,rotation:l}=r;t&&r&&(({x:t,y:r,z:a}=e(t,r,n)),this.target.position.set(t,r,a)),i&&o&&(({x:t,y:r,z:a}=e(i,o,n)),this.target.scale.set(t,r,a)),s&&l&&(({x:i,y:o,z:t}=e(s,l,n)),this.target.rotation.set(i,o,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:a}=t,{position:e,scale:i,rotation:s}=sa.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},i?{sx:n.x,sy:n.y,sz:n.z}:{},s?{rx:a.x,ry:a.y,rz:a.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},i?{sx:i.x,sy:i.y,sz:i.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{})}};return(t,r,n,a=!1)=>{let s=a?n.time:0;const o=Object.keys(t).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,i.lastArrayEle)(o),c=a?"0.00":String(n.time)+".00";return l!==c&&(t[c]={position:"notNow",rotation:"notNow",scale:"notNow"},o.push(c)),o.map((i=>{var o,l,c,h,d=t[String(i)],p=.001*((p=a?s-i:i-s)<=0?.001:p)*n.speed;return s=i,o=r,l=d,c=p,h=n,()=>{let t;return{promise:new Promise((r=>{var{begin:n,end:a}=e(l,o,h);return t=(0,u.anima)(n,a,c,(e=>{var{px:e,py:t,pz:r,sx:n,sy:a,sz:i,rx:s,ry:c,rz:u}=e;l.position&&o.position.set(e,t,r),l.scale&&o.scale.set(n,a,i),l.rotation&&o.rotation.set(s,c,u)}),r)})),anima:t}}}))}})(),this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}isRemoved(){return!(this.target&&this.target.parent)}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z)}},camera:class extends sa{constructor(e,t){super(e,t),this.type="camera",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"},target:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:a}=e,{x:t,y:i,z:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==i?(i-n)*r+n:n,z:a!==s?(s-a)*r+a:a}};return(t,r,n)=>{var a,{position:t,scale:i,rotation:s,target:o}=t,{position:r,scale:l,rotation:c,target:u}=r;t&&r&&(({x:t,y:r,z:a}=e(t,r,n)),this.target.position.set(t,r,a)),i&&l&&(({x:t,y:r,z:a}=e(i,l,n)),this.target.scale.set(t,r,a)),s&&c&&(({x:i,y:l,z:t}=e(s,c,n)),this.target.rotation.set(i,l,t)),o&&u&&(({x:r,y:a,z:s}=e(o,u,n)),this.controls.target.set(r,a,s))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:a}=t,{position:e,scale:i,rotation:s,target:o}=sa.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},i?{sx:n.x,sy:n.y,sz:n.z}:{},s?{rx:a.x,ry:a.y,rz:a.z}:{},o?{tx:this.controls.target.x,ty:this.controls.target.y,tz:this.controls.target.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},i?{sx:i.x,sy:i.y,sz:i.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{},o?{tx:o.x,ty:o.y,tz:o.z}:{})}},t=(t,r,n,a)=>()=>{let i;return{promise:new Promise((s=>{var{begin:o,end:l}=e(r,t,a);return i=(0,u.anima)(o,l,n,(e=>{var{px:e,py:n,pz:a,sx:i,sy:s,sz:o,rx:l,ry:c,rz:u,tx:h,ty:d,tz:p}=e;r.position&&t.position.set(e,n,a),r.scale&&t.scale.set(i,s,o),r.rotation&&t.rotation.set(l,c,u),r.target&&this.controls.target.set(h,d,p)}),s)})),anima:u.anima}};return(e,r,n,a=!1)=>{let s=a?n.time:0;const o=Object.keys(e).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,i.lastArrayEle)(o),c=a?"0.00":String(n.time);return l!==c&&(e[c]=Object.assign({},l),o.push(c)),o.map((i=>{var o=e[String(i)],l=.001*((l=a?s-i:i-s)<=0?.001:l)*n.speed;return s=i,t(r,o,l,n)}))}})(),this.controls=this.runScene.assetsEx.get().controls,this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}getBeginData(e){return this.getAllData()}isRemoved(){return!this.target}getAllData(e=!1){var{position:t,scale:r,rotation:n}=this.target;return{position:e?"notNow":(0,u.v3ToMap)(t),scale:e?"notNow":(0,u.v3ToMap)(r),rotation:e?"notNow":(0,u.v3ToMap)(n),target:e?"notNow":(0,u.v3ToMap)(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let a;if("position"===e)a=(0,u.v3ToMap)(t);else if("scale"===e)a=(0,u.v3ToMap)(r);else if("rotation"===e)a=(0,u.v3ToMap)(n);else{if("target"!==e)throw TypeError("输入值不存在");a=(0,u.v3ToMap)(this.controls.target)}return a}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r,target:n}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z),this.controls.target.set(n.x,n.y,n.z)}},material:class extends sa{constructor(e,t){super(e,t),this.type="material",this.defOptions={roughness:{type:"number"},metalness:{type:"number"},opacity:{type:"number"},emissive:{type:"color"},color:{type:"color"}},this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.material.get(e)}isRemoved(){return!0}getId(){return this.runScene.uniqueEx.getId(this.target)}}};r(3263);class ca{constructor(){this.list={}}on(e,t){this.list[e]=t}emit(...e){if(void 0===this.list[e[0]])throw Error("请先挂载在使用---"+[e[0]]);return this.list[e[0]](...[...e].filter(((e,t)=>0!==t)))}off(e){this.list[e]&&delete this.list[e]}}const ua=c.Z,ha=class{constructor(e){this._clock=new s.Clock,this.cb=new v,this.script=new na(this),this.uniqueEx=new A.ZP(this),this.fileEx=new Rr(this),this.snapshot=new $n.ZP(this),this.undoEx=new Kr.ZP(this),this.textureEx=new Ye.default(this),this.controlsEx=new S,this.assetsEx=new m(this),this.renderEx=new ta.Z(this),this.events=new class{constructor(e){this.key=new E(this),this.mouse=new D(this),this.model=new O(this),this.runScene=e}init(e){this.key.init(e),this.mouse.init(e),this.model.init(),window.addEventListener("resize",(()=>{this.runScene.cb.resize.cb(this.runScene.renderEx.getDomSize())}))}}(this),this.multipSelector=new zr(this),this.helperEx=null,this.materialEx=new et.default(this),this.cameraEx=new b.Z(this),this.sceneEx=new rt.ZP(this),this.modelEx=new h.default(this),this.loaderer=new l.Z(this),this.exporter=new ht(this),this.lightEx=new $e.ZP(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.animaMap={},this.groupMap={},this.clean=()=>{this.reset()},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var r,n,a=((e,t)=>{let r=-1,n=1e3;const a=Object.keys(e).sort(((e,t)=>Number(e)-Number(t)));if(1!==a.length&&(a.map(((e,a)=>{e=Number(e),0<(e=t-e)&&e<n&&(n=e,r=a)})),-1!==r)){var i=a[r],s=a[r+1],o=e[i];if(e=e[s],o&&e){var l=Object.values(o)[0],c=Object.values(e)[0];if("notNow"!==l&&"notNow"!==c)return{left:o,right:e,progress:(t-Number(i))/(Number(s)-Number(i))}}}})(e.data,t);a&&(({left:a,right:r,progress:n}=a),e.setTargetByBetween(a,r,n))}))},this.runScene=e,this.runScene.cb.clean.add("TimeLine",this.clean),this.exportAndImport=new oa(e)}init(){this.exportAndImport.init()}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.cb.timeLine.reset.cb("")}pause(e){var t,r;if(this.groupMap[e]){this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1;const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.run=!1}))}}resume(e){const t=this.groupMap[e];if(t){this.groupMap[e].run=!0;const r=this.animaMap[e];r&&r.length&&r.map((r=>{const{controls:n,promise:a}=r;n.run=!0,a.then((()=>{if(t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}))}}closeGroup(e){var t,r;this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1,this.runScene.cb.timeLine.closeGroup.cb(e);const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.clean=!0}))}resetGroup(e){var t=this.groupMap[e];t&&(this.closeGroup(e),this.runScene.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,i.mapObj)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){Object.keys(e).map((t=>{const r=e[t],n={};(0,i.mapObj)(r.data,((e,t)=>{var{type:t,data:r}=t;const a=la[t];if(t=a.getTarget(e,this.runScene)){const i=new a(t,this.runScene);i.data=r,n[e]=i}})),r.data=n,this.groupMap[t]=r,this.runScene.cb.timeLine.setGroupMap.cb({group:r,groupName:t})}))}playGroup(e,t){const r=(0,nt.Gm)({onlyReverse:!1},t).onlyReverse,n=(this.runScene.helperEx.unfocus(),this.groupMap[e]);if(n&&!n.run){n.run=!0;const a=Object.keys(n.data).map((e=>{const t=n.data[e];if(t.data=new Proxy(t.data,{set:(e,t,r)=>(e[t]=r,!0)}),r)return t.getAnima(n,!0);const a=t.getAnima(n);return n.reverse&&(e=t.getAnima(n,!0),a.push(...e)),a}));this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=a.map((e=>(0,i.eachTriggerArrGetControls)(e)));let s=0;s=r?n.time*n.speed:n.time*n.speed*(n.reverse?2:1);const o=(new Date).valueOf(),l=s;let c;t=setInterval((()=>{var t=((new Date).valueOf()-o)/l;this.runScene.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);const u=new Promise((e=>c=setTimeout(e,s)));return this.timerMap[e]={setProgressTime:t,awaitRuned:c},u.then((()=>{if(clearInterval(this.timerMap[e].setProgressTime),n.run)return n.run=!1,n.loop?this.playGroup(e):void 0}))}}}(this),this.anima=new d(this),this.tags=new aa(this),this.globalConfig=new Lr(this),this.pp=new ea(this),this.objects=new Yr(this),this.inited=!1,this._renderLimit=new nt.cM,this._render=()=>{const{render2:e,render3:t}=this.assetsEx;var{scene:r,camera:n}=this.assetsEx.get();this.cb.render.cb(""),this.pp.update(),null!=t&&t.render(r,n),null!=e&&e.render(r,n)},this.render=()=>{if(null!=(e=this.optionsEx.options)&&e.run){const r=this._render;var{frame:e,mode:t}=this.optionsEx.options.renderConfig;-1!==e&&"tick"===t?(t=this._clock.getDelta(),this._renderLimit.update({cb(){r()},cbRate:1/e,now:t})):this._render()}},this.optionsEx=new en(this,e)}initLibs(e){if(!this.inited){this.inited=!0,this.snapshot.init(),this.materialEx.init(),this.modelEx.init(),this.sceneEx.init(),this.timeLineEx.init(),this.loaderer.init(),this.assetsEx.init(e),this.events.init(e),this.globalConfig.setRenderMode(this.optionsEx.options.renderConfig.mode),this.helperEx=new Ur(this);const{camera:t,controls:r}=this.assetsEx.get();this.uniqueEx.model.add(t),this.renderEx.setSize(),r.update(),this.pp.init(),this.cameraEx.reset(t),this.cb.inited.cb(0)}}init(e){return this.initLibs(e),this}load(e){var{path:e,dom:t,loadConfig:r}=e;return this.init(t),this.loadScene(e,r).then((e=>{0!==(null==e?void 0:e.length)&&this.modelEx.add(e)})),this}loadScene(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{getJSON:r,progress:n,complete:i}=this.cb.load;t=t||{};var s=Object.assign(Object.assign({},t),{callBack:Object.assign(Object.assign({},t.callBack),{getJSON:e=>{var n,a;null!=(a=null==(n=null==t?void 0:t.callBack)?void 0:n.getJSON)&&a.call(n,e),r.cb(e)},progress:e=>{var r,a;null!=(a=null==(r=null==t?void 0:t.callBack)?void 0:r.progress)&&a.call(r,e),n.cb(e)},complete:e=>{var r,n;null!=(n=null==(r=null==t?void 0:t.callBack)?void 0:r.complete)&&n.call(r,e),i.cb(e)}}),triggerCb:!1});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,s);this.optionsEx.log("正在拉取场景","base","info");var o=yield a().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var{total:e,loaded:t}=e;let r=t/e;1<(r=r<0?0:r)&&(r=1),t=Number(r.toFixed(2)),e=Math.floor(100*t),this.optionsEx.log("下载场景进度:"+e,"detail"),this.cb.load.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.sceneEx.clean(),this.optionsEx.log("下载场景失败:",e)}));return o?(this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(o,s)):void 0}))}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.cb.load[e])&&e.add("load-callback"+(0,i.getId)(),t),this}setSize(e,t){const{render2:r,render3:n}=this.assetsEx,a=this.assetsEx.get().renderer;this.cameraEx.setSize(),null!=n&&n.setSize(e,t),null!=r&&r.setSize(e,t),a.setSize(e,t,!0),this.pp.setSize(e,t)}clean(){this.cb.clean.cb(0)}}},3736:(e,t,r)=>{r.d(t,{ZP:()=>b,bv:()=>M,is:()=>S,UE:()=>w,M:()=>y});var n=r(6001),a=r(8881),i=r(932),s=r(8715),o=r(7738),l=r(1794),c=r(3625);class u{constructor(e){this.mount=e=>{e.core.module.set("scene",this)},this.parse={before:e=>{var t,r,n,a,i,s,{json:e,config:o,core:l}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&(({camera:t,lights:e,options:r,controls:n,tags:a,envStrength:i,objects:s}=e.asset.ex),void 0!==i&&this.runScene.sceneEx.setEnvStrength(i),this.parse.camera(t,o),this.parse.light(e,o,l),this.parse.controls(n,o),o.module.tags&&this.runScene.tags.parseJSON(a||{}),this.parse.options(r),s&&this.runScene.objects.parseJSON(s))},after:e=>{const{core:t,json:r,data:n,config:a}=e;if("scene"===(null==(e=null==(e=r.asset)?void 0:e.ex)?void 0:e.type)){var{options:e,json:i}=n;if(e=e.models,!t.loadConfig.module.model)return[];const s=e[0];if(t.module.get("model").data.map.map(((e,t)=>{this.runScene.uniqueEx.model.add(t)})),e=s.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e)),1===e.length){const[t]=e;t.animations=[...t.animations,...i.animations]}t.callback("loaded",""),this.runScene.optionsEx.sceneOptions.loaded=!0,this.parse.scene(r,a,t),t.models.push(...e)}},controls:(e,t)=>{var r;t.module.controls&&(({x:t,y:e,z:r}=e),this.runScene.assetsEx.controls.target.set(t,e,r),this.runScene.assetsEx.controls.update())},camera:(e,t)=>{if(t.module.camera){let o=e;e.temp&&(o=e.camera,this.runScene.cameraEx.temp=l.Z.formJSON(e.temp));var{position:t,far:e,near:r,fov:n,name:a,userData:i,rotation:s}=this.runScene.loaderer.object.parse(o);const c=this.runScene.assetsEx.get().camera;c.position.copy(t),c.far=e,c.near=r,c.fov=n,c.name=a,c.updateProjectionMatrix(),c.userData.id=i.id,this.runScene.uniqueEx.model.add(c),c.rotation.copy(s),this.runScene.assetsEx.get().controls.update()}},light:(e,t,r)=>{if(t.module.light){const t=[];e.map((e=>{var r=e.type;t.push(...this.runScene.lightEx.lightExMap[r].parseJSON(e))})),r.models.push(...t)}},scene:(e,t,r)=>{if(t.module.sceneConfig){const s=this.runScene.sceneEx.get();t=r.module.get("material").data.materialIns;var{materialId:r,backgroundMapping:e,backgroundColor:n,fog:i}=e.asset.ex.sceneEx;if(r&&(r=null==(t=t[r])?void 0:t.material)){const{map:t,envMap:n}=r;t&&(t.mapping=e||300,t.needsUpdate=!0,this.runScene.sceneEx.setBackground(t,!1),t.userData.isBackgroud=!0),n&&(s.environment=(0,c.setTextureMapping)(n))}if(n&&this.runScene.sceneEx.setBackground(new a.Color("#"+n)),i){const{color:e,far:t,near:r,show:n}=i,o=new a.Fog(e.includes("#")?e:"#"+e,r,t);!1===n?this.runScene.sceneEx.oldFog=o:s.fog=o,o.show=n,this.runScene.cb.setScene.cb({scene:s,type:"fog",val:o})}this.runScene.cb.setScene.cb({scene:s,type:"any",val:"any"})}},options:e=>{e.map((e=>{var{type:e,data:t}=e;const r=this.runScene.exporter.gltf.options.getParse(e);null!=r&&r.parse(t)}))}},this.toJSON=()=>{},this.runScene=e}init(){this.bindEvent()}bindEvent(){var e={name:"sceneConfig",loadCallBacks:new l.Z({beforeParse:this.parse.before,afterParse:this.parse.after,mountModule:this.mount}),exportCallBacks:new l.Z};this.runScene.exporter.gltf.module.bind(e)}}var h=r(8089);class d{constructor(e){this.create=e=>{e.data.set("scene",this.getDiff())},this.set=e=>{const t=e.snapshot.data.get("scene");if(t){const{fog:u,bgc:d,env:p,bgcm:f,envS:m}=t,g=this.runScene.assetsEx.get().scene,{animas:v,completedCbs:b}=e.data;let y=g.background;if(this.runScene.sceneEx.setEnvStrength(void 0!==m?m:1),d){const{type:t,data:r}=d;if("color"===t)(0,i.isColor)(y)||null===y?(e=null===y?"#000000":(0,h.J6)(y),null===y&&this.runScene.sceneEx.setBackground(new a.Color("#000000")),e!==d.data&&v.push({target:g,label:"background",type:"color",isUpdate:!0,begin:e,end:r})):(0,c.isTexture)(y)&&b.push((()=>{this.runScene.sceneEx.setBackground(new a.Color(r))}));else if("texture"===t){const e=this.runScene.uniqueEx.texture.get(d.data);e&&(0,c.setTextureMapping)(e,303===f?"repeat":"normal"),b.push((()=>{this.runScene.sceneEx.setBackground(e)}))}}else(0,i.isColor)(y)&&(y||(y=new a.Color,this.runScene.sceneEx.setBackground(y)),v.push({target:g,label:"background",type:"color",isUpdate:!0,begin:(0,h.J6)(y),end:"#000000"})),b.push((()=>{this.runScene.sceneEx.setBackground(null)}));var r,n,s,o,l;b.push((()=>{g.environment=this.runScene.uniqueEx.texture.get(null==p?void 0:p.data)})),g.fog&&u?(({color:e,near:r,far:n}=u),({color:l,near:s,far:o}=g.fog),e!==(l=(0,h.J6)(l))&&v.push({target:g,label:["fog","color"],begin:l,end:e,type:"color",isUpdate:!0}),s!==r&&v.push({target:g,label:["fog","near"],begin:s,end:r,type:"number",isUpdate:!0}),o!==n&&v.push({target:g,label:["fog","far"],begin:o,end:n,type:"number",isUpdate:!0})):b.push((()=>{g.fog=u?w(u):null})),b.push((()=>{this.runScene.cb.setScene.cb({scene:this.runScene.assetsEx.get().scene,type:"any",val:"any"})}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("scene",this.create),this.runScene.cb.snapshot.set.add("scene",this.set)}getDiff(){let e={};var t=((t=this.runScene.sceneEx.getJson("fog"))&&(e.fog=t),this.runScene.sceneEx.getJson("background")),r=this.runScene.assetsEx.scene;return void 0!==(t&&"texture"===(e.bgc=t).type&&303===r.background.mapping&&(e.bgcm=303),(t=this.runScene.sceneEx.getJson("environment"))&&(e.env=t),r=this.runScene.sceneEx.getEnvStrength())&&1!==r&&(e.envS=r),e}}var p=r(3735),f=r(2510),m=r(7169),g=r(3729),v=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class b{constructor(e){this.oldFog=null,this.removeMap={light:{valid:e=>this.runScene.lightEx.isLight(e),remove:e=>this.runScene.lightEx.remove(e)}},this.clean=()=>{this.cleanSceneInfo(this.get()),this.cleanNormal()},this.envStrength=1,this.runScene=e,this.exportAndImport=new u(e),this.snapshot=new d(e),this.runScene.cb.clean.add("EngineScene",this.clean)}init(){this.exportAndImport.init()}each(e){return this.runScene.assetsEx.get().scene.traverseAncestors(e)}get(){return new Proxy(this.runScene.assetsEx.get().scene,{set:(e,t,r)=>(e[t]=r,!0)})}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}getEnvStrength(){return this.envStrength}remove(e){if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const r in this.removeMap){const{valid:a,remove:i}=this.removeMap[r];if(a(e))return t.push(...(0,n.multiArrToArr)(i(e)))}t.push(new m.Z({model:e,runScene:this.runScene,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(t),t}for(const t in this.removeMap){const{valid:r,remove:n}=this.removeMap[t];if(r(e))return n(e)}this.runScene.modelEx.remove(e),this.runScene.helperEx.unfocus()}}cleanUnlessLevel(e){return this.runScene.modelEx.isUnlessLevel(e)&&!this.runScene.helperEx.isHelper(e)&&0!==e.children.length&&1===e.children.length?this.cleanUnlessLevel(e.children[0]):e}searchModel(e){return this.runScene.uniqueEx.model.findModelWithName(e)}getClearModels(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)))}getClear(){const e=this.get(),t=new a.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)&&s.normalModel.is(e))).map((e=>{const r=e.clone();(0,s.withAnima)(e)&&(r.animations=[...e.animations]),t.add(r)})),this.runScene.helperEx.setHelper(t),this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){this.setBackground(null).then(),this.setEnv(null).then(),e.fog=null,this.runScene.cb.setScene.cb({scene:e,type:"any",val:null})}setBackground(e,t=!0){return v(this,void 0,void 0,(function*(){e instanceof String&&(e=yield this.runScene.textureEx.load(e)),(0,c.isTexture)(e)&&(e.userData.isBackgroud=!0);var r=this.get(),n=new f.Z({target:r,info:"background",newVal:e,oldVal:r.background,runScene:this.runScene,cb:e=>{}}).execute();return t&&this.runScene.undoEx.addUndo(n),this.runScene.cb.setScene.cb({scene:r,type:"background",val:r.background}),e}))}isBackground(e){return e.userData.isBackgroud}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),(0,o.s)(e),t.dispose(),this.runScene.pp.dispose(),a.Cache.clear()}render(){}create(){return new a.Scene}setEnv(e){return v(this,void 0,void 0,(function*(){var t=this.runScene.assetsEx.scene;let r;return e instanceof String&&(r=yield this.runScene.textureEx.load(e)),e instanceof File&&(r=yield this.runScene.textureEx.parse(e)),r=(r=null!=e&&e.isTexture?this.runScene.textureEx.clone(e):r)&&(0,c.setTextureMapping)(r),this.setNormal({model:t,info:"environment",val:r}),this.runScene.cb.setScene.cb({scene:t,type:"environment",val:r}),r}))}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new f.Z({target:e,info:r,oldVal:e[r],newVal:n,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setRealReflection(){const{scene:e,renderer:t}=this.runScene.assetsEx;this.cubeRT||(this.cubeRT=new a.WebGLCubeRenderTarget(1024)),this.realReflectionCamera||(this.realReflectionCamera=new a.CubeCamera(.1,5e3,this.cubeRT),e.add(this.realReflectionCamera),this.runScene.cb.render.add("RealReflection-update",(()=>{this.realReflectionCamera.update(t,e)}))),this.isRealReflection?(this.preEnvMap=e.environment,this.setEnv(null).then(),this.setNormal({model:e,info:"environment",val:this.cubeRT.texture})):this.preEnvMap&&this.setEnv(this.preEnvMap).then(),this.testSphere||(this.testSphere=new a.Mesh(new a.SphereGeometry(15,32,16),new a.MeshStandardMaterial),e.add(this.testSphere),this.testSphere.scale.set(10,10,10),this.testSphere.position.set(0,600,0),this.testSphere.getWorldPosition(this.realReflectionCamera.position),this.testSphere.material.roughness=0,this.testSphere.material.metalness=1)}setFogShow(e){var t=this.runScene.assetsEx.scene,{show:e,color:r}=e;if(e){let e=this.oldFog||new a.Fog(r||"#ffffff");e.show=!0,this.setNormal({model:t,info:"fog",val:e})}else this.oldFog=t.fog,this.setNormal({model:t,info:"fog",val:null}),this.oldFog.show=!1;this.runScene.cb.setScene.cb({scene:t,type:"fog",val:t.fog})}setFog(e){var t=this.runScene.assetsEx.scene,{type:e,val:r,cb:n}=e;t=new p.Z({target:t,typeList:["fog",e],newVal:r,cb:n}).execute(),this.runScene.undoEx.addUndo(t)}sreenShotDefFile(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{width:r,height:a}=(this.runScene.helperEx.unfocus(),this.runScene.renderEx.getDomSize());const i=this.runScene.assetsEx.get().renderer.domElement;return this.runScene.pp.setSize(e,t),this.runScene.renderEx.setSize(e,t),this.runScene.pp.update(),e=i.toDataURL("image/png",1),t=(0,n.base64ToFile)(e,"screenShot.png"),this.runScene.pp.setSize(r,a),this.runScene.renderEx.setSize(),this.runScene.pp.update(),t}getJson(e){let t;var r=this.runScene.assetsEx.scene;if("fog"===e){var n=r.fog;n&&(t=x(n,null!==r.fog))}else if("background"===e){if(!r.background)return;t={type:(n=(0,i.isColor)(r.background))?"color":"texture",data:(n?h.J6:g.Ki)(r.background)}}else if("environment"===e){if(!r.environment)return;t={type:"texture",data:(0,g.Ki)(r.environment)}}return t}static toJSON(e,t){const r={};let n=!1,a=e.fog;return a?n=!0:a=t.sceneEx.oldFog,a&&(r.fog=x(a,n)),(0,i.isColor)(e.background)&&(r.backgroundColor=e.background.getHexString()),r}setEnvStrength(e){this.runScene.cb.scene.setEnvStrength.cb({val:e}),this.runScene.uniqueEx.material.each((t=>this.runScene.materialEx.setEnvStrength(t,e))),this.envStrength=e}}const y=(e,t,r)=>{e.userData[t]=r},x=(e,t)=>{var{color:e,far:r,near:n}=e;return{color:(0,h.J6)(e),show:t,far:r,near:n}},w=e=>{var{color:e,far:t,near:r}=e;return new a.Fog(e,r,t)},S=(e,t)=>(null==(e=null==e?void 0:e.userData)?void 0:e[t])||"",M=(e,t)=>{delete e.userData[t]}},1398:(e,t,r)=>{r.d(t,{LV:()=>p,ZP:()=>d});var n=r(6001),a=r(3263),i=r(1794),s=r(7201),o=r(3625),l=r(3729),c=r(4457),u=r(8089);const h=["number","color","color_obj","color_str","v2","v3"];class d{constructor(e){this.map=new i.Z,this.playing=new i.Z,this.unique={set:()=>{},get:()=>{}},this.toJSON=()=>JSON.stringify(this.map.toJSON()),this.parseJSON=e=>{const t=i.Z.formJSON(JSON.parse(e));t.map(((e,t)=>{t.data=i.Z.formJSON(t.data)})),this.map=t},this.clean=()=>{this.map.clear()},this.trans={set:(e,t)=>{var r,n,a,i,s,o=e.label instanceof Array?e.label.join("."):e.label;const l={begin:[],end:[]};return"color"===e.type||"color_obj"===e.type||"color_str"===e.type?(a=(0,u.sS)(e.begin),r=(0,u.sS)(e.end),i=o+"_"+t+"_r",s=o+"_"+t+"_g",n=o+"_"+t+"_b",l.begin.push({type:i,data:a.r}),l.begin.push({type:s,data:a.g}),l.begin.push({type:n,data:a.b}),l.end.push({type:i,data:r.r}),l.end.push({type:s,data:r.g}),l.end.push({type:n,data:r.b})):"number"===e.type?(l.begin.push({type:o+"_"+t,data:e.begin}),l.end.push({type:o+"_"+t,data:e.end})):"v2"!==e.type&&"v3"!==e.type||(a=o+"_"+t+"_x",i=o+"_"+t+"_y",s=o+"_"+t+"_z",l.begin.push({type:a,data:e.begin.x}),l.begin.push({type:i,data:e.begin.y}),"v3"===e.type&&(l.begin.push({type:s,data:e.begin.z}),l.end.push({type:s,data:e.end.z})),l.end.push({type:a,data:e.end.x}),l.end.push({type:i,data:e.end.y})),l},getKey(e){let t=[];var{unique:r,type:n}=e;return e=e.label instanceof Array?e.label.join("."):e.label,"v2"===n||"v3"===n?(t.push(e+"_"+r+"_x"),t.push(e+"_"+r+"_y"),t.push(e+"_"+r+"_z")):"color"===n||"color_obj"===n||"color_str"===n?(t.push(e+"_"+r+"_r"),t.push(e+"_"+r+"_g"),t.push(e+"_"+r+"_b")):"number"===n&&t.push(e+"_"+r),t},update:(e,t)=>{var r;const a=this.trans.getKey(e);let i=e.target,s=e.label,o=(e.label instanceof Array&&(s=(0,n.lastArrayEle)(e.label),i=(0,n.objLastMap)(e.target,e.label)),t[a[0]]),l=s;"color"===e.type||"color_obj"===e.type?(o={r:0,g:0,b:0},a.map((e=>{var[,,r]=e.split("_");e=t[e]/255,o[r]=e}))):"color_str"===e.type?o="#"+a.map((e=>Number(Number(t[e]).toFixed(0)).toString(16).padStart(2,"0"))).join(""):"v2"!==e.type&&"v3"!==e.type||(o={x:0,y:0,z:0},a.map((e=>{var[,,r]=e.split("_");o[r]=t[e]}))),null!=(r=e.onUpdate)&&r.call(e,{target:i,data:o,type:l,runScene:this.runScene})},exec:(e,t)=>{const r=this.trans.getKey(e);let a=e.target,i=e.label;e.label instanceof Array&&(i=(0,n.lastArrayEle)(e.label),a=(0,n.objLastMap)(e.target,e.label)),"color"===e.type||"color_str"===e.type||"color_obj"===e.type?r.map((e=>{var[,,r]=e.split("_");e=1<t[e]?t[e]/255:t[e],a[i][r]=e})):"number"===e.type?a[i]=t[r[0]]:"v2"!==e.type&&"v3"!==e.type||r.map((e=>{var[,,r]=e.split("_");a[i][r]=t[e]}))}},this.runScene=e}init(){this.runScene.exporter.gltf.options.addOption({type:"snapshot",process:this.toJSON,parse:this.parseJSON}),this.runScene.cb.clean.add("snapshrot",this.clean)}create(e){var{name:e,time:t}=e;return e={name:e,time:t,data:new i.Z},this.runScene.cb.snapshot.create.cb(e),e}resetItem(e){const{targets:t,names:r,type:n}=e;e=r.map((e=>this.map.get(e))).filter((e=>e)),this.runScene.cb.snapshot.resetItem.cb({targets:t,datas:e,type:n})}add(e){var t=this.create(e);return this.map.set(e.name,t),t}set(e,t){this.runScene.modelEx.selectNull();var r=this.map.get(e),{animaTime:t,isLinear:n}=Object.assign({animaTime:-1},t);if(r){const a={animas:[],completedCbs:[]};this.runScene.cb.snapshot.set.cb({snapshot:r,data:a}),0===a.animas.length?0!==a.completedCbs.length&&a.completedCbs.map((e=>e())):this.anima(e,a,{animaTime:-1===t?r.time:t,isLinear:n})}}del(e){var t=this.map.get(e);t&&this.runScene.cb.snapshot.delete.cb({name:e,data:t})}anima(e,t,r){if(this.runScene.modelEx.selectNull(),null==(a=this.playing.get(e))||!a.animaIns){const s=new i.Z,o={},l={};var{animaTime:a,isLinear:r}=r;const u={data:t,animaIns:null};t.animas.map(((e,t)=>{t=String(t);const{begin:r,end:n}=this.trans.set(e,t);r.map((e=>o[e.type]=e.data)),n.map((e=>l[e.type]=e.data)),s.set(t,Object.assign({unique:t},e))})),u.animaIns=(0,c.anima)(o,Object.assign(Object.assign({},l),{ease:r?"none":"easeOut"}),a,(e=>{(0,n.mapObj)(e,(t=>{var[,t]=t.split("_");(t=s.get(t))&&(t.isUpdate?this.trans.exec(t,e):this.trans.update(t,e))}))}),(()=>{u.animaIns.kill(),u.animaIns=null,u.data.completedCbs.map((e=>e()))})),this.playing.set(e,u)}}close(e){const t=this.playing.get(e);return!(!t||(null!=(e=t.animaIns)&&e.kill(),t.animaIns=null))}closeAll(){this.playing.map(((e,t)=>{t&&t.animaIns.kill(),t.animaIns=null}))}parseNromal(e,t){const{animas:r,completedCbs:a}=t.data,{target:i,type:s,begin:o,end:l,set:u,label:d,onUpdate:p}=e;if((0,c.isDef)(o,l))if(h.includes(s))r.push({target:i,type:s,begin:o,end:l,label:d,isUpdate:void 0===p,onUpdate:p});else if(u)u({target:i,begin:o,end:l});else{let e=i,t=d;d instanceof Array&&(e=(0,n.objLastMap)(i,d),t=(0,n.lastArrayEle)(d)),"texture"===s?e[t]=l:a.push((()=>{e[t]=l}))}}bind(e){const{name:t,def:r,target:n,create:a,set:i}=e;this.runScene.cb.snapshot.create.add(t,a||(e=>{e.data.set(t,p.getDiff(r,n))})),this.runScene.cb.snapshot.set.add(t,i||(e=>{var a=e.snapshot.data.get(t);a&&p.set({def:r,runScene:this.runScene,data:a,target:n,map:e})}))}}const p={toNormal(e){var t,{type:e,val:r}=e;let n=r;return"color"===e?n=(0,u.Lv)(r):"color_obj"===e?n=r:"color_str"===e?n=(0,c.MyHextoRgb)(r,!0):"texture"===e?(0,o.isTexture)(r)&&(n=(0,l.Ki)(r)):"v3"!==e&&"v2"!==e||(({x:e,y:r,z:t}=r),n={x:e,y:r,z:t}),n},parse(e){const{type:t,val:r,runScene:n}=e;let i=r;return"color"===t?i=a.YD.is(r)?r:(0,c.HextoRgb)(r,!0):"color_obj"===t?i=r:"color_str"===t&&(i=a.YD.is(r)?r:(0,c.HextoRgb)(r,!0)),"texture"===t&&null!==r?n.uniqueEx.texture.get(r):i},getDiff(e,t){let r={};return(0,n.mapObj)(e,((e,a)=>{const{label:i,get:s}=a;let o=t[e];s?o=s(t):i&&(o=(0,n.objLastMap)(t,i)[(0,n.lastArrayEle)(i)]),r[e]=o})),(0,s.replaceKVForObj)((0,c.getDiff)((0,s.replaceValForObj)(e,((e,t)=>t.val)),r),((t,r)=>{var{shortKey:t,type:n}=e[t];return{k:t,v:p.toNormal({type:n,val:r})}}))},set(e){const{def:t,data:r,target:a,runScene:i,map:s}=e;(0,n.mapObj)(t,((e,t)=>{const{type:o,val:l,shortKey:u,before:h,label:d,onUpdate:f,get:m,set:g}=t;let v=a,b=e;d&&(v=(0,n.objLastMap)(a,d),b=(0,n.lastArrayEle)(d)),t=p.toNormal({type:o,val:m?m(v):v[b]}),e=p.parse({type:o,val:void 0!==r[u]?r[u]:l,runScene:i}),(0,c.isDef)(t,e)&&(null!=h&&h({target:v,begin:t,end:e}),i.snapshot.parseNromal({target:v,label:b,type:o,set:g,begin:t,end:e,onUpdate:f},s))}))}}},3625:(e,t,r)=>{r.r(t),r.d(t,{bindTextureBaseData:()=>T,default:()=>y,disposeTexture:()=>M,getBlobByTexture:()=>_,getCloneIdFromTexture:()=>L,getImageDomByUrl:()=>V,getMimeByTexture:()=>w,getSizeByTexture:()=>O,getTextureGpuMemory:()=>S,getTextureMinFilter:()=>j,getUrlByTexture:()=>P,initTexture:()=>E,isClonedTexture:()=>R,isInvalidTexture:()=>G,isTexture:()=>C,loadTexture:()=>D,parseImageBitMapByBlob:()=>k,setTextureCloneId:()=>I,setTextureMapping:()=>A,setTextureMinFilter:()=>U,textureNameMap:()=>x,unDelAbleTexture:()=>z,updateTexture:()=>B});var n=r(6001),a=r(8881),i=r(6422),s=r(5247),o=r(932),l=r(3736);class c extends r(4616).Z{constructor(e){super(),this.info="函数修改",this.map=e}_execute(e,t){throw new Error("Method not implemented.")}execute(){return this.map.redo(),this}undo(){this.map.undo()}redo(){this.map.redo()}}const u=c;var h=r(8024),d=r(2510),p=r(3729),f=r(4457),m=r(1398);const g={repeat:{type:"v2",val:{x:1,y:1},shortKey:"re"},offset:{type:"v2",val:{x:0,y:0},shortKey:"of"},rotation:{type:"number",val:0,shortKey:"ro"},center:{type:"v2",val:{x:0,y:0},shortKey:"ce"}};class v{constructor(e){this.onDeleteSnapshot=e=>{const{data:t,name:r}=e;(e=t.data.get("texture"))&&(0,n.mapObj)(e,(e=>{(e=this.runScene.uniqueEx.texture.get(e))&&this.setUnDel(e,!1,r)}))},this.resetItem=e=>{"texture"===e.type&&e.datas.map((t=>{const{data:r,name:n}=t,a=r.get("texture")||{};e.targets.map((e=>{var t=(0,p.Ki)(e);t&&(a[t]=this.getItem(e,n))}))}))},this.setUnDel=(e,t,r)=>{if(t){if(z.is(e))return}else if(z.getRef(e)!=="snapshot_"+r)return;z.set(e,t,"snapshot_"+r)},this.getItem=(e,t)=>{this.setUnDel(e,!0,t);const r=m.LV.getDiff(g,e);return(t=this.runScene.script.texture.get(e))&&(r.uvScript=Object.assign({},t)),r},this.getDiff=e=>{let t={};return this.runScene.uniqueEx.texture.getAll().map((({texture:r})=>{var n=(0,p.Ki)(r);n&&(t[n]=this.getItem(r,e))})),t},this.create=e=>{e.data.set("texture",this.getDiff(e.name))},this.set=e=>{var t=e.snapshot.data.get("texture");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.texture.get(t))&&(m.LV.set({def:g,data:r,runScene:this.runScene,map:e,target:t}),this.runScene.script.texture.parse(r.uvScript,t),this.runScene.script.texture.set(r.uvScript,t))}))},this.runScene=e,this.runScene.cb.snapshot.create.add("texture",this.create),this.runScene.cb.snapshot.set.add("texture",this.set),this.runScene.cb.snapshot.delete.add("texture",this.onDeleteSnapshot),this.runScene.cb.snapshot.resetItem.add("texture",this.resetItem)}}var b=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class y{constructor(e){this.allTextures=new Set,this.rgbeLoader=new i.x,this.spcielBack=["hdr","pic"],this.setAnima=e=>{const{texture:t,type:r,val:n}=e,a=t.userData.uvScript||{};t.userData.uvScript||(t.userData.uvScript=a),0===n?delete a[r]:a[r]=n,this.runScene.cb.texture.setAnima.cb({texture:t,uvScript:a})},this.runScene=e,this.snapshot=new v(e)}load(e,t){return b(this,void 0,void 0,(function*(){var r=yield(0,f.urlToBlob)(e);return this.parse(r,t)}))}parse(e,t){return b(this,void 0,void 0,(function*(){let r;return t=(0,f.mergeObject)({flipY:!0},t),e instanceof File&&this.spcielBack.includes(e.name.substring(e.name.lastIndexOf(".")+1))?(r=yield this.parseHdr(e)).userData.isHdr=!0:r=yield D(e,t),this.afterLoad(r,e)}))}parseHdr(e){return this.rgbeLoader.loadAsync(URL.createObjectURL(e))}clone(e){const t=new a.Texture(e.image);return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,n.getId)(),cloneSourceId:(0,p.Ki)(e)}),(0,l.bv)(t,"minFilter"),T(t),this.getSameAndAddtoAll(t)}getDef(e){return e=new a.Texture(e),T(e),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))?(M(e),t):(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return b(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield T(e,t))}))}getSameTexture(e,t){if(!R(t))for(const n in this.runScene.uniqueEx.texture.map){var r=this.runScene.uniqueEx.texture.get(n);if(r.userData.md5===e&&r.mapping===t.mapping)return r}}initTextureAndAddtoAll(e){return b(this,void 0,void 0,(function*(){return E(e),T(e),this.addTextureToAll(e),e}))}addTextureToAll(e){var t=this.runScene.uniqueEx.texture.getLength();this.runScene.uniqueEx.texture.add(e),this.runScene.uniqueEx.texture.getLength()!==t&&this.runScene.cb.texture.add.cb(e)}getBlobAndBase64(e){return e.userData.blob?e.userData:(0,f.imgBitMapToBlobAndBase64)(e)}coverByImage(e,t){return b(this,void 0,void 0,(function*(){let r;r=C(t)?t:t?yield this.parse(t):null;var a=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(a){const t=[];(0,n.mapObj)(a,((n,a)=>{const i=this.runScene.uniqueEx.material.get(n);i&&a.forEach((n=>{t.push(new h.Z({target:i,info:n,newVal:r,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}remove(e){const t=(0,p.Ki)(e);var r=this.runScene.uniqueEx.texture.map[t];if(r){const a=[];r=r.materialMap,(0,n.mapObj)(r,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);r&&(t.forEach((e=>{a.push(new d.Z({target:r,info:e,oldVal:r[e],newVal:null,runScene:this.runScene,cb(){(0,o.updateMaterial)(r)}}).execute())})),(0,o.updateMaterial)(r))}));const i=this.runScene.uniqueEx.texture.map[t];a.push(new u({undo:()=>{this.runScene.cb.texture.add.cb(e),this.runScene.uniqueEx.texture.add(e)},redo:()=>{this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e)}}).execute(),new u({undo:()=>{this.runScene.uniqueEx.texture.map[t]=i},redo:()=>{delete this.runScene.uniqueEx.texture.map[t]}}).execute()),this.runScene.undoEx.addUndo(a)}}delete(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e),M(e)}reverseImageBitMapTexture(e){return b(this,void 0,void 0,(function*(){var{canvas:t,imageBitMap:r}=yield(0,f.reverseImageBitMap)(e.image);const i=new a.Texture(r);return i.needsUpdate=!0,r=this.runScene.uniqueEx.texture.map[e.userData.id],(0,n.mapObj)(r.materialMap,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);t.forEach((e=>{r[e]=i,this.runScene.uniqueEx.texture.addMaterial(i,{material:r,type:e})}))})),E(i),yield T(i),this.runScene.cb.texture.add.cb(i),this.delete(e),(0,f.disposeCanvas)(t),i}))}setUnDelAble(e,t,r="custom",n){z.set(e,t,r,n),this.runScene.cb.texture.set.cb({type:"unDelAble",texture:e,data:t})}getUsedModel(e,t=!0){if(e=(0,p.Ki)(e)){const r=[];if((e=this.runScene.uniqueEx.texture.map[e])&&((0,n.mapObj)(e.materialMap,(e=>{const t=this.runScene.uniqueEx.material.map[e];t&&r.push(...t.models.toArray())})),0!==r.length))return t&&this.runScene.multipSelector.add(r,!0),r}}getUsedMaterial(e){if((e=(0,p.Ki)(e))&&(e=this.runScene.uniqueEx.texture.map[e]))return(0,n.mapObj)(e.materialMap,(e=>null==(e=this.runScene.uniqueEx.material.map[e])?void 0:e.material)).filter((e=>e))}}const x={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},w=e=>1023===e.format?"image/png":"image/jpeg",S=e=>{var{width:e,height:t}=e.image;return e*t*4*1.33},M=e=>{var t,r;e&&(t=e.image,r=e.userData.url,t instanceof ImageBitmap?(0,f.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,f.disposeCanvas)(t),URL.revokeObjectURL(r),e.dispose())},T=(e,t)=>b(void 0,void 0,void 0,(function*(){var r=(0,f.isBlob)(e.userData.blob)?e.userData.blob:null;const n=t||r||(yield _(e));e.userData.blob=n,e.userData.mimeType=n.type;var{md5:r,url:a}=e.userData;return r||(e.userData.md5=(0,f.getMd5)(yield n.arrayBuffer())),a||(e.userData.url=URL.createObjectURL(n)),e.userData.isHdr&&(e.flipY=!0),e.userData.gm=S(e),e.needsUpdate=!0,e})),_=e=>(0,f.isBlob)(e.userData.blob)?e.userData.blob:(0,f.imgBitMapToBlob)(e.image),E=e=>{if(!e.userData.isHdr)return e.magFilter=1003,e.wrapS=s.Z.RepeatWrapping,e.wrapT=s.Z.RepeatWrapping,e.encoding=3e3,e.version=3,e.flipY=!1,"nearest"!==j(e)&&(e.minFilter=s.Z.LinearMipmapLinearFilter),e.needsUpdate=!0,e},k=(e,t)=>{let r={resizeQuality:"pixelated"};return null!=t&&t.flipY&&(r.imageOrientation="flipY"),createImageBitmap(e,r)},D=(e,t)=>b(void 0,void 0,void 0,(function*(){var r=yield k(yield V(e instanceof Blob?URL.createObjectURL(e):e),t);const n=new a.Texture(r);return n.needsUpdate=!0,n})),P=e=>null==(e=e.userData)?void 0:e.url,A=(e,t="repeat")=>(e.mapping="repeat"===t?s.Z.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),O=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}},C=e=>null==e?void 0:e.isTexture,R=e=>0<(null==(e=e.userData.cloneSourceId)?void 0:e.length),L=e=>e.userData.cloneSourceId,I=(e,t)=>{e.userData.cloneSourceId=t},B=e=>{e.needsUpdate=!0},U=(e,t)=>{e.minFilter=s.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,l.M)(e,"minFilter",t),B(e)},j=e=>(0,l.is)(e,"minFilter"),F="unDelAble",N="unDelAbleRef",z={is:e=>(0,l.is)(e,F),getRef:e=>(0,l.is)(e,N),set(e,t,r="custom",n){if(t)(0,l.M)(e,F,t),(0,l.M)(e,N,r);else{let t=!1;(t=!(!n&&(0,l.is)(e,N)!==r)||t)&&(delete e.userData[F],delete e.userData[N])}}},V=e=>{const t=document.createElement("img");return t.src=e,new Promise((e=>{t.addEventListener("load",(()=>{e(t)}))}))},G=e=>{var t;if(void 0!==(null==(t=e.source)?void 0:t.data.width)&&(0===(null==(t=e.source)?void 0:t.data.width)||0===e.source.data.height))return!0}},6651:(e,t,r)=>{r.d(t,{ZP:()=>n,d9:()=>a});class n{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.clean=()=>{this.reset()},this.runScene=e,this.runScene.cb.clean.add("Undo",this.clean)}undo(){if(0!==this.undos.length){const e=this.removeUndos(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.undo())):e.undo(),this.redos.push(e))}}addUndos(e){var t;return this.undos.push(e),t=this.dataMap.history.push(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.addUndos.cb({undoVal:e,undos:this.undos}),t}removeUndos(e){var t;return this.undos.splice(e),t=this.dataMap.history.splice(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.removeUndos.cb({index:e}),t}undoByIndex(e){e>this.dataMap.index?this.undos.slice(this.dataMap.index+1,e+1).map((e=>{e instanceof Array?e.map((e=>e.redo())):e.redo()})):e<this.dataMap.index&&this.undos.slice(e+1,this.dataMap.index+1).reverse().map((e=>{e instanceof Array?e.map((e=>e.undo())):e.undo()})),this.dataMap.index=e,this.runScene.cb.undo.undoByIndex.cb(e)}addUndo(e){this.dataMap.index!==this.undos.length&&this.removeUndos(this.dataMap.index+1),this.addUndos(e)}addRedo(e){this.redos.push(e)}redo(){if(0!==this.redos.length){const e=this.redos.splice(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.redo())):e.redo(),this.addUndo(e))}}reset(){this.undos=[],this.redos=[],this.dataMap.history=[],this.dataMap.index=0,this.runScene.cb.undo.reset.cb("")}}var a=function(e){if("object"!=typeof e)return e;if(null===e)return null;if(e){var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=a(e[t]),n[t]=r);return n}}},4773:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(1269);class a{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:r,addTree:n,isClone:a,runScene:i}=e;this.runScene=i,this.model=e,this.parent=t,!1===n&&(this.addTree=n),!0===a&&(this.isClone=a),r&&(this.cb=r)}remove(e){const{model:t,parent:r,addTree:n,runScene:a}=e;a.modelEx.select===t&&a.modelEx.selectNull(),r.remove(t),n&&a.uniqueEx.model.remove(t),n&&a.cb.model.remove.cb({model:t,parent:r}),this.cb(t,"remove"),a.uniqueEx.material.addModel(t,void 0,t.material)}add(e){const{model:t,parent:r,addTree:a,isClone:i,runScene:s}=e;r.add(t),a&&s.uniqueEx.model.add(t),a&&s.cb.model.add.cb({model:t,parent:r,isClone:i}),this.cb(t,"add"),s.uniqueEx.material.addModel(t,t.material),(0,n.RQ)(t)&&setTimeout((()=>{this.runScene.lightEx.update(t)}))}}},4616:(e,t,r)=>{r.d(t,{Z:()=>n});class n{}},8024:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(4330);class a extends r(4616).Z{constructor(e){super(),this.isUndoMaterial=!0,this.type="修改材质";var{target:e,info:t,newVal:r,oldVal:n,runScene:a,cb:i}=e;this.runScene=a,this.target=e,this.info=t,this.newVal=r,this.oldVal=n,this.cb=i}_execute(e,t){if(this.target[this.info]=e,this.target.needsUpdate=!0,n.zX.includes(this.info)){if(!e)return;this.runScene.uniqueEx.texture.addMaterial(e,{material:this.target,type:this.info})}"depthWrite"===this.info&&!0===e&&delete this.target.userData[this.info],null!=(e=this.cb)&&e.call(this,this)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,this.newVal)}redo(){this._execute(this.newVal,this.oldVal)}}const i=a},3735:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(6001);class a extends r(4616).Z{constructor(e){super(),this.type="多层级修改",this.isUndoMultipLevel=!0,this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,this.old=(0,n.objLastMap)(e.target,this.typeList)[(0,n.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,n.objLastMap)(this.target,this.typeList);t[(0,n.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t),"shadow"!==this.typeList[0]&&this.typeList[1]}undo(){this._execute(this.old)}redo(){this._execute(this.new)}}const i=a},2510:(e,t,r)=>{r.d(t,{Z:()=>a});class n extends r(4616).Z{constructor(e){super(),this.type="修改属性",this.isUndoNormal=!0,this.cb=e=>{};var{target:e,info:t,oldVal:r,newVal:n,runScene:a,cb:i,executeCb:s}=e;this.runScene=a,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,i&&(this.cb=i),s&&(this.executeCb=s)}_execute(e){var{target:t,info:r}=this;if(this.executeCb)return this.executeCb({target:t,info:r,val:e});this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(t=this.runScene.uniqueEx.model.parseName(this.target),r=e,this.runScene.cb.model.changeName.cb({model:this.target,name:e=t||e,oldName:r})):"material"===this.info?this.runScene.uniqueEx.material.addModel(this.target,e,e===this.newVal?this.oldVal:this.newVal):"visible"===this.info&&this.runScene.cb.model.setVisible.cb({model:this.target,visible:e}),this.runScene.cb.model.change.cb({type:this.info,model:this.target,val:e}),this.cb(this.target)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal)}redo(){this._execute(this.newVal)}}const a=n},7169:(e,t,r)=>{r.d(t,{Z:()=>n});class n extends r(4773).Z{constructor(e){super(e),this.type="移除模型",this.isUndoRemove=!0}undo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}redo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}_execute(e){return Promise.reject()}execute(){return this.redo(),this}}},4380:(e,t,r)=>{r.d(t,{Z:()=>a});class n extends r(4616).Z{constructor(e){super(),this.isUndoV3=!0,this.type="三维矩阵修改";var{target:e,info:t,newV3:r,oldV3:n,runScene:a}=e;this.target=e,this.info=t,this.runScene=a,this.newV3=r,this.oldV3=n,this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.cb.model.setSelect.cb(null),this.runScene.cb.model.setSelect.cb(this.target))}_execute(e){this.target[this.info].copy(e),this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&this.runScene.helperEx.focus(this.target)}execute(e=!0){return e&&this.redo(),this}undo(){this._execute(this.oldV3)}redo(){this._execute(this.newV3)}}const a=n},3729:(e,t,r)=>{r.d(t,{ZP:()=>d,Ki:()=>p,x:()=>f});var n=r(6001),a=r(272),i=r(932);class s{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,r){if(null!=e&&e.userData&&!i.materialIgnore.is(e)){let i=e.userData.id;if(i||(i=(0,n.getId)(),e.userData.id=i),this.map[i]){if(this.map[i].material.name!==e.name){const t=(0,n.getId)();e.userData.id=t,this.map[t]={material:e,models:new a.Z},this.unique.runScene.cb.unique.material.add.cb(e)}}else this.map[i]={material:e,models:new a.Z},this.unique.runScene.cb.unique.material.add.cb(e);t&&this.addModel(t,e,r)}}addModel(e,t,r){r&&t&&p(r)===p(t)||(null!=t&&t.userData&&(t=p(t),null!=(t=this.map[t])&&t.models.add(e)),r&&null!=(t=this.map[p(r)])&&t.models.delete(e))}each(e){return this.getAll("values").map((({material:t})=>e(t)))}getAll(e){return Object[e](this.map)}get(e){return null==(e=this.map[e])?void 0:e.material}getModels(e){return null==(e=this.map[e])?void 0:e.models}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&this.removes.push(e.uuid)}dispose(){(0,n.mapObj)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var o=r(1269),l=r(8715),c=r(158);class u extends class{constructor(e){this.map={},this.unique=e}add(e){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,n.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]=e,t)}get(e){return this.map[e]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));delete this.map[e.userData.id]}}{constructor(){super(...arguments),this.nameMap={},this.parseName=(()=>{const e=e=>{var t=e.lastIndexOf("_");return-1===t?-1:(e=e.slice(t+1),n.type.isNumber(e)?Number.parseInt(e):-1)},t=(r,n)=>{var a=(t=>{if(-1===e(t))return t;var r=t.lastIndexOf("_");return-1===r?t:t.slice(0,r)})(r)+"_"+n++;return this.nameMap[a]?t(r,n):a},r=e=>Object.keys(this.nameMap).find((t=>this.nameMap[t]===e)),a=["PerspectiveCamera"];return n=>{if(a.includes(n.type))return n.name=n.type;let i=n.name;if(i=i||n.type,!this.nameMap[i])return s=this.unique.getId(n),(o=r(s))&&delete this.nameMap[o],void(this.nameMap[i]=s);var s,o=this.nameMap[i];return this.unique.model.get(o)!==n?(s=e(i),s=t(i,o=-1===s?0:s),this.nameMap[s]=this.unique.getId(n),n.name=s):void 0}})()}add(e,t){var{reset:r,hasReset:a}=t||{ignoreMaterial:!1};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e&&!(0,l.isHelper)(e)){let i=e.userData.id;if(i&&!r||(i=(0,n.getId)(),e.userData.id=i),this.map[i]){if(!(a||(0,c.An)(this.unique.runScene)&&(0,c.FW)(this.unique.runScene).coverSameId))return void(e.name!==this.map[i].name&&this.unique.runScene.optionsEx.log(`解析模型出错,${e.name} 与 ${this.map[i].name} 拥有相同的id,请选择任意一个模型导出并删除,并重新导入。`,"base","error"));i=(0,n.getId)(),e.userData.id=i}return this.map[i]=e,this.parseName(e),e.material&&(this.unique.runScene.materialEx.parse(e.material),this.unique.material.add(e.material,e)),!e.children.length||(0,o.RQ)(e)||(0,l.isHelper)(e)?i:this.add(e.children,t)}}get(e){return this.map[e]}getModelsWithIds(e){return e.map((e=>this.get(e))).filter((e=>e))}getByName(e){return this.nameMap[e]}getIdByNames(e){return e.map((e=>this.getByName(e))).filter((e=>e))}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));e.traverse((e=>{delete this.nameMap[e.name]})),delete this.map[e.userData.id]}dispose(){this.map={},this.nameMap={}}findModelWithName(e){var t=Object.keys(this.nameMap).filter((t=>{const r=t.toLowerCase();return r===(t=e.toLowerCase())||-1!==r.indexOf(t)}));return t=this.getIdByNames(t),this.getModelsWithIds(t)}}class h{constructor(e){this.map={},this.unique=e}add(e){if(e&&e.userData){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,n.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]={texture:e,materialMap:{}},t)}}getLength(){return Object.keys(this.map).length}addMaterial(e,t,r){var n,a=e.userData.id||this.add(e);t&&(({material:t,type:n}=t),this.map[a]||(this.map[a]={materialMap:{},texture:e}),this.map[a].materialMap[t.userData.id]||(this.map[a].materialMap[t.userData.id]=new Set),this.map[a].materialMap[t.userData.id].add(n)),r&&(({material:e,type:t}=r),this.map[a].materialMap[e.userData.id]&&this.map[a].materialMap[e.userData.id].delete(t))}get(e){return null==(e=this.map[e])?void 0:e.texture}getMaterials(e){return null==(e=this.map[e])?void 0:e.materialMap}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));var t=this.map[e.userData.id];t&&((0,n.mapObj)(t.materialMap,((e,t)=>{const r=this.unique.runScene.uniqueEx.material.get(e);r&&t.forEach((e=>{r[e]=null}))})),delete this.map[e.userData.id])}dispose(){(0,n.mapObj)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}getAll(){return Object.values(this.map)}}class d{constructor(e){this.clean=()=>{this.dispose()},this.runScene=e,this.model=new u(this),this.material=new s(this),this.texture=new h(this),this.runScene.cb.clean.add("EngineModel",this.clean)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}const p=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||"",f=(e,t)=>{e.userData&&(e.userData.id=t)}},4457:(e,t,r)=>{r.r(t),r.d(t,{HextoRgb:()=>a.I8,LimitCb:()=>a.cM,MyHextoRgb:()=>a.Dn,addElesFromIndexToArr:()=>a.Rn,angleToNum:()=>i.Zv,anima:()=>a.gY,arrayBufferToBase64:()=>a.sM,arrayBufferToBlobUr:()=>a.oo,arrayToVector3:()=>i.F,base64ToArrayBuffer:()=>a.RG,base64ToBlob:()=>a.Jr,bitMapToCanvas:()=>n.Rd,blobToFile:()=>a.hl,bufferToArrayBuffer:()=>a.cO,canvasToBlob:()=>a._c,changeModelOpc:()=>i.Hg,changeModelOpcs:()=>i.Z7,clone:()=>a.d9,colorToRgb:()=>i.sS,compressImgToUrl:()=>n.jH,deepFindParentByUuid:()=>i.Q3,deepMergeObject:()=>a.U,disposeCanvas:()=>n.eZ,disposeImageBitMap:()=>n.oZ,domTo2Dui:()=>i.UZ,domTo3DSprite:()=>i.YG,domTo3Dui:()=>i.ol,fileAndBlobToCanvas:()=>a.OE,fileToBlob:()=>a.a_,filterFiles:()=>a.Rz,fromCode:()=>a.Ne,getArrIndexByItem:()=>a.B1,getBetweenByV3:()=>i.A2,getBetweenDomByIdx:()=>l,getCamAnimaData:()=>i.Gm,getCenter:()=>i.qg,getClock:()=>i.aM,getColorByHex:()=>i.e9,getCurve:()=>i.kG,getDate:()=>a._3,getDiff:()=>a.ad,getDistance:()=>i.Sp,getEmptyImageData:()=>n.mH,getFilesByDataTransfer:()=>a.xl,getFilesFromFileList:()=>a.kk,getHexByColor:()=>i.J6,getIdxInParent:()=>o,getImg:()=>n.Pk,getImgPixels:()=>n.BW,getImgPixels1:()=>n.Cm,getLine2:()=>i.SI,getMacro:()=>a.Ls,getMapByRgb:()=>a.fh,getMd5:()=>a.ZM,getModelByType:()=>i.Py,getModelMap:()=>i.yT,getNamesByNum:()=>a.nR,getOptions:()=>s.FW,getProgress:()=>a.xC,getRGBByHex:()=>i.OR,getRandomColor:()=>a.mr,getRes:()=>a.sR,getResultFromCanvas:()=>n.xK,getTime:()=>a.hK,getTruthBase64:()=>a.Mh,getType:()=>a.oL,getTypeByBase64:()=>a.Op,getTypeFromGlb:()=>s.te,getVideoTexture:()=>i.hX,getWorldLocal:()=>i.VU,hslToRgb:()=>n.ve,imgArrayBufferToBlobUrl:()=>n.lU,imgBitMapToBase64:()=>n.s4,imgBitMapToBlob:()=>n.gW,imgBitMapToBlobAndBase64:()=>n.v1,isBlob:()=>a.Lj,isDef:()=>a.Xq,isEditor:()=>s.hz,isEmpty:()=>a.xb,isRunning:()=>s.An,isVisible:()=>i.pn,longestCommonPrefix:()=>a.GG,mergeObject:()=>a.Gm,removeUnLess:()=>i.hs,resetCenter:()=>i.cm,reverseImageBitMap:()=>n.Fs,reverseImg:()=>n.rx,rgbToHex:()=>i.vq,rgbToHsl:()=>n.lC,rgbToStr:()=>i.$W,rgbaToRgb:()=>i.Di,rmArrEle:()=>a.J9,rmPartOfString:()=>a.h3,sameArr:()=>a.F1,sameV3:()=>i.x$,setParentVisible:()=>i.FT,strToNum:()=>a.LC,tColorToRgb:()=>i.Lv,textureToThreeD:()=>i.vp,toCode:()=>a.Ni,toTimeString:()=>a.U9,transByte:()=>a.iM,typeAnima:()=>u,urlToBlob:()=>a.pX,urlToCanvas:()=>a.o4,v3ToMap:()=>i.ln,validType:()=>a.lG,vector:()=>i.xr});var n=r(5137),a=r(6272),i=r(8089),s=r(158);const o=e=>[...e.parentElement.children].findIndex((t=>t===e)),l=e=>{var{dom:e,beginIdx:t,endIdx:r}=e;return[...e.children].slice(t,r+1)};var c=r(8881);const u=(e,t,r)=>{const{}=r||{},n={},i={};e.map(((e,t)=>{const{begin:r,end:s,type:o,label:l}=e,u="_"+o+"_"+l+"_"+String(t);if("color"===o&&r instanceof c.Color&&s instanceof c.Color){const e=(0,a.I8)("#"+r.getHexString(),!0),t=(0,a.I8)("#"+s.getHexString(),!0);["r","g","b"].map((r=>{var a=r+u;n[a]=e[r],i[a]=t[r]}))}"number"===o&&(n[e=l+u]=r,i[e]=s),"vector3"===o&&["x","y","z"].map((e=>{var t=e+u;n[t]=r[e],i[t]=s[e]})),"vector2"===o&&["x","y"].map((e=>{var t=e+u;n[t]=r[e],i[t]=s[e]}))}))};u([{begin:new c.Color(.5,.5,.5),end:new c.Color(0,0,0),label:"color",type:"color"},{begin:1,end:2,label:"a",type:"number"},{begin:new c.Vector3(1,1,1),end:new c.Vector3(2,2,2),label:"b",type:"vector3"},{begin:new c.Vector2(1,1),end:new c.Vector2(2,2),label:"c",type:"vector2"}],1)},5137:(e,t,r)=>{r.d(t,{BW:()=>f,Cm:()=>p,Fs:()=>x,Pk:()=>b,Rd:()=>m,eZ:()=>w,gW:()=>l,jH:()=>d,lC:()=>g,lU:()=>h,mH:()=>M,oZ:()=>S,rx:()=>c,s4:()=>o,v1:()=>u,ve:()=>v,xK:()=>y});var n=r(5247),a=r(3625),i=r(6272),s=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const o=e=>{const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),t.toDataURL()},l=e=>s(void 0,void 0,void 0,(function*(){const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),new Promise((e=>{t.toBlob((t=>{e(t)}))}))})),c=e=>{const t=document.createElement("canvas"),r=(t.width=e.width,t.height=e.height,t.getContext("2d"));r.translate(0,t.height),r.scale(1,-1),r.drawImage(e,0,0,t.width,t.height)},u=e=>s(void 0,void 0,void 0,(function*(){var t=e.image;const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d")),i=(0,a.getMimeByTexture)(e);return n.drawImage(t,0,0,r.width,r.height),new Promise((e=>{r.toBlob((t=>{e({blob:t,base64:r.toDataURL(i)})}),i)}))})),h=(e,t)=>URL.createObjectURL(new Blob([e],t)),d=(e,t)=>{const r=document.createElement("canvas"),n=r.getContext("2d");return r.width=e.width,r.height=e.height,n.drawImage(e,0,0,e.width,e.height),new Promise((e=>{r.toBlob((t=>{t&&e(URL.createObjectURL(t))}),"image/webp",t)}))},p=e=>s(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:a,canvas:s}=yield(0,i.OE)(URL.createObjectURL(r.userData.blob),{width:t.width,height:t.height});for(var o=a.getImageData(0,0,t.width,t.height,{colorSpace:"srgb"}),l=0,c=o.data.length;l<c;l+=4){var u=(d=g(o.data[l],o.data[l+1],o.data[l+2]))[0]/100,h=d[1]/100,d=d[2]/100;u=v(u,h,d),o.data[l]=u[0],o.data[l+1]=u[1],o.data[l+2]=u[2]}return a.putImageData(o,0,0),new n.Z.Texture(s)})),f=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=m(e).ctx.getImageData(0,0,t,r).data,a=[],i=0;i<n/4;i+=1)a.push(n.slice(4*i,4*(i+1)))},m=e=>{const t=document.createElement("canvas"),r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),{ctx:r,canvas:t}},g=(e,t,r)=>{e/=255,t/=255,r/=255;var n,a=Math.max(e,t,r),i=Math.min(e,t,r),s=(a+i)/2;if(a==i)n=l=0;else{var o=a-i,l=.5<s?o/(2-a-i):o/(a+i);switch(a){case e:n=(t-r)/o+(t<r?6:0);break;case t:n=(r-e)/o+2;break;case r:n=(e-t)/o+4}n/=6}return[100*n,100*l,100*s]},v=(e,t,r)=>{var n,a,i,s;return 0==t?a=i=s=r:(a=(n=function(e,t,r){return r<0&&(r+=1),1<r&&--r,r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e})(t=2*r-(r=r<.5?r*(1+t):r+t-r*t),r,e+1/3),i=n(t,r,e),s=n(t,r,e-1/3)),[255*a,255*i,255*s]},b=e=>{const t=new Image;return t.src=e,new Promise((e=>{t.onload=()=>{e(t)}}))},y=(e,t,r)=>{const n=(0,i.Gm)({base64Type:"webp"},r).base64Type;return new Promise(((r,a)=>{"blob"===t?e.toBlob((e=>{(e?r:a)(e)})):"base64"===t&&r(e.toDataURL("image/"+n))}))},x=e=>s(void 0,void 0,void 0,(function*(){var{width:t,height:r}=e;const n=document.createElement("canvas"),a=(n.width=t,n.height=r,n.getContext("2d"));if(a)return a.translate(0,r),a.scale(1,-1),a.drawImage(e,0,0,t,r),{imageBitMap:yield createImageBitmap(a.getImageData(0,0,t,r)),canvas:n}})),w=e=>{e.remove()},S=e=>{e.close()},M=e=>{var{width:e,height:t}=e;const r=document.createElement("canvas");return(r.width=e,r.height=t,r.getContext("2d")).drawImage(new Image,0,0),r}},6272:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{B1:()=>getArrIndexByItem,Dn:()=>MyHextoRgb,F1:()=>sameArr,GG:()=>longestCommonPrefix,Gm:()=>mergeObject,I8:()=>HextoRgb,J9:()=>rmArrEle,Jr:()=>base64ToBlob,LC:()=>strToNum,Lj:()=>isBlob,Ls:()=>getMacro,Mh:()=>getTruthBase64,Ne:()=>fromCode,Ni:()=>toCode,OE:()=>fileAndBlobToCanvas,Op:()=>getTypeByBase64,RG:()=>base64ToArrayBuffer,Rn:()=>addElesFromIndexToArr,Rz:()=>filterFiles,U:()=>deepMergeObject,U9:()=>toTimeString,Xq:()=>isDef,ZM:()=>getMd5,_3:()=>getDate,_c:()=>canvasToBlob,a_:()=>fileToBlob,ad:()=>getDiff,cM:()=>LimitCb,cO:()=>bufferToArrayBuffer,d9:()=>clone,fh:()=>getMapByRgb,gY:()=>anima,h3:()=>rmPartOfString,hK:()=>getTime,hl:()=>blobToFile,iM:()=>transByte,kk:()=>getFilesFromFileList,lG:()=>validType,mr:()=>getRandomColor,nR:()=>getNamesByNum,o4:()=>urlToCanvas,oL:()=>getType,oo:()=>arrayBufferToBlobUr,pX:()=>urlToBlob,sM:()=>arrayBufferToBase64,sR:()=>getRes,xC:()=>getProgress,xb:()=>isEmpty,xl:()=>getFilesByDataTransfer});var _allex_md5__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1129),_allex_md5__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_allex_md5__WEBPACK_IMPORTED_MODULE_0__),axios__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(3300),axios__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__),js_funcs__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(6001),js_funcs__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(js_funcs__WEBPACK_IMPORTED_MODULE_2__),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(2958),_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(3263),_UtilsImage__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(5137),__awaiter=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const anima=(e,t,r,n,a)=>{let i=Object.assign({},e),s=new _libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3(i,r,t).eventCallback("onUpdate",(e=>n&&n(i))).eventCallback("onComplete",(e=>{a&&a(),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3.killTweensOf(s)}));return s},base64ToArrayBuffer=e=>__awaiter(void 0,void 0,void 0,(function*(){-1!==e.indexOf(",")&&(e=getTruthBase64(e));const t=window.atob(e);var r=t.length;const n=new Uint8Array(r);for(let e=0;e<r;e++)n[e]=t.charCodeAt(e);return n.buffer})),getTruthBase64=e=>e.substring(e.indexOf(",")+1),arrayBufferToBlobUr=e=>URL.createObjectURL(new Blob([e])),arrayBufferToBase64=e=>{let t="";var r=new Uint8Array(e);for(let e=0,n=r.byteLength;e<n;e++)t+=String.fromCharCode(r[e]);return"data:image/jpg;base64,"+window.btoa(t)},urlToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return(yield axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:"blob"})).data})),base64ToBlob=e=>{let t=e.split(","),r=t[0].match(/:(.*?);/)[1],n=atob(t[1]),a=n.length,i=new Uint8Array(a);for(;a--;)i[a]=n.charCodeAt(a);return new Blob([i],{type:r})},fileToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return base64ToBlob(yield(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.parseFile)(e,"base64"))})),blobToFile=(e,t)=>new File([e],t),getTypeByBase64=e=>e.substring(e.indexOf(":")+1,e.indexOf(";")),transByte=e=>{let t="";const r=t=e<102.4?e.toFixed(2)+"B":e<1048576?(e/1024).toFixed(2)+"KB":e<1073741824?(e/1048576).toFixed(2)+"M":(e/1073741824).toFixed(2)+"G";return e=r.indexOf("."),"00"==r.substr(e+1,2)?r.substring(0,e)+r.substr(e+3,2):t},getMd5=e=>(0,_allex_md5__WEBPACK_IMPORTED_MODULE_0__.md5)(e),fileAndBlobToCanvas=(e,t)=>{var{width:t,height:r}=t;let n=new Image,a=(n.src=e,n.width=t,n.height=r,document.createElement("canvas")),i=(a.width=t,a.height=r,a.getContext("2d"));return new Promise((e=>{n.onload=function(){i.drawImage(n,0,0,a.width,a.height),e({canvas:a,ctx:i})}}))},getFilesByDataTransfer=e=>new Array(e.files.length).fill(0).map(((t,r)=>e.files.item(r))).filter((e=>null!==e)),canvasToBlob=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),getRes=(e,t)=>axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:t||"arraybuffer"}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),mergeObject=(e,t)=>Object.assign(e,t||{}),getMacro=(e,t=0)=>{let r=setTimeout((()=>(null!==r&&clearTimeout(r),r=null,e())),t)},clone=e=>{if(null===e)return null;if("object"!=typeof e)return e;var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]=r);return n},getNamesByNum=(e,t,r=1,n)=>new Array(t).fill("").map(((t,a)=>e+(a+r)+(n||""))),getType=e=>null==e?void 0:e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),deepMergeObject=(e,t)=>((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((r,n)=>{let a=t[r];void 0!==a&&("Object"===getType(n)&&"Object"===getType(a)&&(a=deepMergeObject(n,a)),e[r]=a)})),e),getArrIndexByItem=(e,t)=>e.find((e=>e===t)),getProgress=(e,t,r=!1)=>{let n=e/t;return r&&(n*=100),Number(n.toFixed(2))},urlToCanvas=e=>__awaiter(void 0,void 0,void 0,(function*(){if(!e)throw TypeError("该参数为空");var t=yield(0,_UtilsImage__WEBPACK_IMPORTED_MODULE_5__.Pk)(e);const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d"));return n.drawImage(t,0,0),{img:t,canvas:r,ctx:n}})),bufferToArrayBuffer=e=>{for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},isEmpty=e=>null==e||(Array.isArray(e)||"string"==typeof e?0===e.length:"number"==typeof e?0===e:"object"==typeof e?0===Object.keys(e).length:void 0),isBlob=e=>e&&e instanceof Blob,getTime=e=>{const t=new Date;return t.setTime(t.getTime()+864e5*e),t.getTime()},key="gltf-version-2.0",toCode=e=>{for(var t,r,n=key.length,a=key.split(""),i="",s=0;s<e.length;s++)i+=a[((r=((r=e.charCodeAt(s))-(t=r%n))/n)-(r%=n))/n%n]+a[r]+a[t];return i},fromCode=str=>{for(var st=key.length,b,b1,b2,b3,d=0,s,s=new Array(Math.floor(str.length/3)),b=s.length,i=0;i<b;i++)b1=key.indexOf(str.charAt(d)),d++,b2=key.indexOf(str.charAt(d)),d++,b3=key.indexOf(str.charAt(d)),d++,s[i]=b1*st*st+b2*st+b3;return b=eval("String.fromCharCode("+s.join(",")+")"),b},getFilesFromFileList=e=>{const t=[];for(let n=0;n<e.length;n++){var r=e.item(n);t.push(r)}return t},filterFiles=(e,t)=>"any"===t?e:e.filter((e=>-1!==e.type.indexOf(t))),toTimeString=e=>{if(e)return e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate()},rmPartOfString=(e,t)=>e.replace(new RegExp(t),""),rmArrEle=(e,t)=>{var r=e.findIndex((e=>e===t));if(-1!==r)return e.splice(r,1),r},addElesFromIndexToArr=(e,t,r)=>(t=Array.isArray(t)?t:[t],e.splice(r,0,...t)),sameArr=(e,t,r)=>{if("fill"===r){for(var[n,a]of e)if(n!==t[a])return!1;return!0}var i=e.length;const s=Math.floor(i/r);for(const n of new Array(r).fill("").map(((e,t)=>(t+1)*s)))if(e[n]!==t[n])return!1;return!0};class LimitCb{constructor(){this.timer=0}update(e){const{cb:t,now:r,cbRate:n}=e;this.timer+=r,this.timer>n&&(t(),this.timer=0)}}const longestCommonPrefix=e=>{if(0==e.length)return"";for(var t=e[0],r="",n=1;n<e.length;n++){for(var a=0;a<=e[n].length;a++){if(t[a]!=e[n][a]){t=r;break}r+=t[a]}r=""}return t},getRandomColor=()=>{let e=[];for(let t=0;t<3;++t){let t=Math.floor(256*Math.random()).toString(16);t=1==t.length?"0"+t:t,e.push(t)}return"#"+e.join("")},validType=(e,t)=>{var r;return"number"===t?(r=Number(e),!isNaN(r)):"array"===t?Array.isArray(e):void 0},isDef=(e,t)=>e instanceof Array?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.F6.isDef(e,t):_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.is(e)?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.isDef(e,t):e!==t,strToNum=e=>{if(e=e.replace(/[^\d]/g,""),e=Number(e),isNaN(e))throw TypeError("类型错误");return e},rgbArr=["r","g","b"],getMapByRgb=e=>{var t=e.split(",");const r={r:0,g:0,b:0};for(let e=0;e<rgbArr.length;e++){var n=rgbArr[e],a=t[e];if(!a)return;a=strToNum(a),r[n]=a}return r};function HextoRgb(e,t){if(-1!==e.toLocaleLowerCase().indexOf("rgb"))return e;if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e)){if(4===e.length){for(var r="#",n=1;n<4;n+=1)r+=e.slice(n,n+1).concat(e.slice(n,n+1));e=r}var a,i,s=[];for(n=1;n<7;n+=2)s.push(parseInt("0x"+e.slice(n,n+2)));return t?([t,a,i]=s,{r:t,g:a,b:i}):"RGB("+s.join(",")+")"}return e}const getDiff=(e,t,r=0)=>{const n={};return(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((e,r)=>{var a=t[e];isDef(r,a)&&(n[e]=a)})),n};function MyHextoRgb(e,t){if(-1!==(e=e.toLocaleLowerCase().slice(1)).indexOf("rgb"))return e;var[e,r,n,a,i,s]=e.split(""),r=(e=parseInt("0x"+e+r),parseInt("0x"+n+a)),n=parseInt("0x"+i+s);return t?{r:e,g:r,b:n}:"RGB("+e+","+r+","+n+")"}const getDate=e=>{const t=new Date(e);return t.getFullYear()+"/"+String(t.getMonth()+1).padStart(2,"0")+"/"+String(t.getDate()).padStart(2,"0")}},158:(e,t,r)=>{r.d(t,{An:()=>i,FW:()=>s,hz:()=>a,te:()=>n});const n=e=>{},a=e=>"editor"===e.optionsEx.options.mode,i=e=>"running"===e.optionsEx.options.mode,s=e=>e.optionsEx.options},8089:(e,t,r)=>{r.d(t,{Zv:()=>he,F:()=>ce,Hg:()=>ne,Z7:()=>ae,sS:()=>Se,Q3:()=>Pe,UZ:()=>te,YG:()=>re,ol:()=>ee,A2:()=>fe,Gm:()=>pe,qg:()=>Ee,aM:()=>me,e9:()=>ge,kG:()=>le,Sp:()=>$,J6:()=>ve,SI:()=>ue,Py:()=>De,yT:()=>de,OR:()=>be,hX:()=>oe,VU:()=>Y,pn:()=>Oe,hs:()=>se,cm:()=>Ce,vq:()=>Te,$W:()=>xe,Di:()=>Me,x$:()=>ye,FT:()=>Ae,Lv:()=>we,vp:()=>ie,ln:()=>_e,xr:()=>J});var n=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(r=t?(r=o(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=new n.Box3,c=new n.Vector3,u=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e);var r=s(a);function a(){var e;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");return(e=r.call(this)).isLineSegmentsGeometry=!0,e.type="LineSegmentsGeometry",e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new n.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new n.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return t=a,(e=[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new n.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new n.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new n.InterleavedBufferAttribute(e,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new n.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new n.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new n.InterleavedBufferAttribute(e,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new n.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new n.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),l.setFromBufferAttribute(t),this.boundingBox.union(l))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var r=this.boundingSphere.center,a=(this.boundingBox.getCenter(r),0),i=0,s=e.count;i<s;i++)c.fromBufferAttribute(e,i),a=Math.max(a,r.distanceToSquared(c)),c.fromBufferAttribute(t,i),a=Math.max(a,r.distanceToSquared(c));this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.InstancedBufferGeometry);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new n.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},n.ShaderLib.line={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,n.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var m=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=f(e);if(r=t?(r=f(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===h(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return p(n)}}(a);function a(e){var t;if(this instanceof a)return(t=r.call(this,{type:"LineMaterial",uniforms:n.UniformsUtils.clone(n.ShaderLib.line.uniforms),vertexShader:n.ShaderLib.line.vertexShader,fragmentShader:n.ShaderLib.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(p(t),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),t.setValues(e),t;throw new TypeError("Cannot call a class as a function")}return t=a,Object.defineProperty(t,"prototype",{writable:!1}),t}(n.ShaderMaterial);function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var y,x,w=new n.Vector3,S=new n.Vector3,M=new n.Vector4,T=new n.Vector4,_=new n.Vector4,E=new n.Vector3,k=new n.Matrix4,D=new n.Line3,P=new n.Vector3,A=new n.Box3,O=new n.Sphere,C=new n.Vector4;function R(e,t,r){return C.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),C.multiplyScalar(1/C.w),C.x=x/r.width,C.y=x/r.height,C.applyMatrix4(e.projectionMatrixInverse),C.multiplyScalar(1/C.w),Math.abs(Math.max(C.x,C.y))}var L=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=b(e);if(r=t?(r=b(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===g(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(a);function a(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new u,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),n=this,i=a;if(n instanceof i)return(n=r.call(this,e,t)).isLineSegments2=!0,n.type="LineSegments2",n;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,a=new Float32Array(2*t.count),i=0,s=0,o=t.count;i<o;i++,s+=2)w.fromBufferAttribute(t,i),S.fromBufferAttribute(r,i),a[s]=0===s?0:a[s-1],a[s+1]=a[s]+w.distanceTo(S);var l=new n.InstancedInterleavedBuffer(a,2,1);return e.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(l,1,1)),this}},{key:"raycast",value:function(e,t){var r=this.material.worldUnits,a=e.camera,i=(null!==a||r||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),void 0!==e.params.Line2&&e.params.Line2.threshold||0),s=(y=e.ray,e=this.matrixWorld,this.geometry),o=this.material;if(x=o.linewidth+i,null===s.boundingSphere&&s.computeBoundingSphere(),O.copy(s.boundingSphere).applyMatrix4(e),i=r?.5*x:R(a,Math.max(a.near,O.distanceToPoint(y.origin)),o.resolution),O.radius+=i,!1!==y.intersectsSphere(O)&&(null===s.boundingBox&&s.computeBoundingBox(),A.copy(s.boundingBox).applyMatrix4(e),i=r?.5*x:R(a,Math.max(a.near,A.distanceToPoint(y.origin)),o.resolution),A.expandByScalar(i),!1!==y.intersectsBox(A)))if(r)for(var l=this,c=t,u=l.matrixWorld,h=(s=l.geometry).attributes.instanceStart,d=s.attributes.instanceEnd,p=0,f=Math.min(s.instanceCount,h.count);p<f;p++){D.start.fromBufferAttribute(h,p),D.end.fromBufferAttribute(d,p),D.applyMatrix4(u);var m=new n.Vector3,g=new n.Vector3;y.distanceSqToSegment(D.start,D.end,g,m),g.distanceTo(m)<.5*x&&c.push({point:g,pointOnLine:m,distance:y.origin.distanceTo(g),object:l,face:null,faceIndex:p,uv:null,uv2:null})}else{var v=this,b=t,w=(e=a).projectionMatrix,S=v.material.resolution,C=v.matrixWorld,L=(o=v.geometry).attributes.instanceStart,I=o.attributes.instanceEnd,B=(o=Math.min(o.instanceCount,L.count),-e.near);y.at(1,_),_.w=1,_.applyMatrix4(e.matrixWorldInverse),_.applyMatrix4(w),_.multiplyScalar(1/_.w),_.x*=S.x/2,_.y*=S.y/2,_.z=0,E.copy(_),k.multiplyMatrices(e.matrixWorldInverse,C);for(var U,j,F,N,z=0,V=o;z<V;z++)M.fromBufferAttribute(L,z),T.fromBufferAttribute(I,z),M.w=1,T.w=1,M.applyMatrix4(k),T.applyMatrix4(k),M.z>B&&T.z>B||(M.z>B?(U=M.z-T.z,U=(M.z-B)/U,M.lerp(T,U)):T.z>B&&(U=T.z-M.z,j=(T.z-B)/U,T.lerp(M,j)),M.applyMatrix4(w),T.applyMatrix4(w),M.multiplyScalar(1/M.w),T.multiplyScalar(1/T.w),M.x*=S.x/2,M.y*=S.y/2,T.x*=S.x/2,T.y*=S.y/2,D.start.copy(M),D.start.z=0,D.end.copy(T),D.end.z=0,j=D.closestPointToPointParameter(E,!0),D.at(j,P),F=-1<=(F=n.MathUtils.lerp(M.z,T.z,j))&&F<=1,N=E.distanceTo(P)<.5*x,F&&N&&(D.start.fromBufferAttribute(L,z),D.end.fromBufferAttribute(I,z),D.start.applyMatrix4(C),D.end.applyMatrix4(C),F=new n.Vector3,N=new n.Vector3,y.distanceSqToSegment(D.start,D.end,N,F),b.push({point:N,pointOnLine:F,distance:y.origin.distanceTo(N),object:v,face:null,faceIndex:z,uv:null,uv2:null})))}}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Mesh);function I(e){return(I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function B(){return(B="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=j(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var F=function(){var e=n,t=u;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&U(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=j(e);if(r=t?(r=j(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===I(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e;if(this instanceof n)return(e=r.call(this)).isLineGeometry=!0,e.type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setPositions",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),a=0;a<t;a+=3)r[2*a]=e[a],r[2*a+1]=e[a+1],r[2*a+2]=e[a+2],r[2*a+3]=e[a+3],r[2*a+4]=e[a+4],r[2*a+5]=e[a+5];return B(j(n.prototype),"setPositions",this).call(this,r),this}},{key:"setColors",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),a=0;a<t;a+=3)r[2*a]=e[a],r[2*a+1]=e[a+1],r[2*a+2]=e[a+2],r[2*a+3]=e[a+3],r[2*a+4]=e[a+4],r[2*a+5]=e[a+5];return B(j(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function N(e){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function z(e,t){return(z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function V(e){return(V=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var G=function(){var e=n,t=L;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&z(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=V(e);if(r=t?(r=V(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===N(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new F,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),a=this,i=n;if(a instanceof i)return(a=r.call(this,e,t)).isLine2=!0,a.type="Line2",a;throw new TypeError("Cannot call a class as a function")}return e=n,Object.defineProperty(e,"prototype",{writable:!1}),e}(),H=r(699),W=r(3693),q=r(3263),K=(t=r(5247),r(932)),Z=r(6272);const X={uniforms:{uSeaFreq:{value:.16},uSeaHeight:{value:.6},uSeaChoppy:{value:4},uTime:{value:0},uCamPosition:{value:new n.Vector3(0,0,0)},uDirection:{value:null}},vertexShader:"\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n void main() {\n vec4 pos = vec4(position, 1.0);\n //模型空间坐标,z轴是高度,xy轴是平面\n vUv = pos.xy * 1.0;\n pos.z += getWave(vUv) * 1.0;\n vPosition = vec3(pos.x, pos.z, pos.y);\n vWorldPos = (modelMatrix * pos).xyz;\n \n gl_Position = projectionMatrix * modelViewMatrix * pos;\n }\n ",fragmentShader:"\n #define PI 3.14159265359\n #define invPI 0.3183098861837697\n #define invTWO_PI 0.15915494309\n \n const vec3 SEA_BASE = vec3(0.1, 0.19, 0.22);\n const vec3 SEA_WATER_COLOR = vec3(0.8, 0.9, 0.6);\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n uniform vec3 uCamPosition;\n uniform vec3 uDirection;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n // Math\n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n // Lighting\n float diffuse(vec3 n, vec3 l, float p) {\n return pow(dot(n, l) * 0.4 + 0.6, p);\n }\n float specular(vec3 n,vec3 l,vec3 e,float s) {\n float nrm = (s + 8.0) / (PI * 8.0);\n return pow(max(dot(reflect(e, n), l), 0.0), s) * nrm;\n }\n \n // Sky\n vec3 getSkyColor(vec3 e) {\n e.y = (max(e.y, 0.0) * 0.8 + 0.2) * 0.8;\n return vec3(pow(1.0 - e.y, 2.0), 1.0 - e.y, 0.6 + (1.0 - e.y) * 0.45) * 0.45;\n }\n \n // Sea\n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float map_detailed(vec3 p) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n vec2 uv = p.xz;\n uv.x *= 0.75;\n \n float d, h = 0.0;\n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n return p.y - h;\n }\n vec3 getSeaColor(vec3 p, vec3 n, vec3 l, vec3 eye, vec3 dist) {\n float fresnel = clamp(1.0 - dot(n, -eye), 0.0, 1.0);\n fresnel = pow(fresnel, 3.0) * 0.5;\n \n vec3 reflected = getSkyColor(reflect(eye, n));\n vec3 refracted = SEA_BASE + diffuse(n, l, 80.0) * SEA_WATER_COLOR * 0.12;\n \n vec3 color = mix(refracted, reflected, fresnel);\n \n float attenuation = max(1.0 - dot(dist, dist) * 0.001, 0.0);\n color += SEA_WATER_COLOR * (p.y - uSeaHeight) * 0.18 * attenuation;\n color += vec3(specular(n, l, eye, 60.0));\n \n return color;\n }\n \n // Sea Wave\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n // Tracing\n vec3 getNormal(vec3 p, float eps) {\n vec3 n;\n n.y = map_detailed(p);\n n.x = map_detailed(vec3(p.x + eps, p.y, p.z)) - n.y;\n n.z = map_detailed(vec3(p.x, p.y, p.z + eps)) - n.y;\n n.y = eps;\n return normalize(n);\n }\n \n void main() {\n vec3 light = normalize(vec3(0.0, 1.0, 0.8));\n vec3 dist = vWorldPos - uCamPosition;\n vec3 dir = normalize(dist);\n \n // 此数值控制生成水面法线的范围, 数值与范围成反比\n float EPSILON_NRM = 0.00003;\n vec3 N = getNormal(vWorldPos, dot(dist, dist) * EPSILON_NRM);\n vec3 color = getSeaColor(vWorldPos, N, light, dir, dist);\n \n // gl_FragColor = vec4(vPosition, 1.0);\n // gl_FragColor = vec4(vWorldPos, 1.0);\n // gl_FragColor = vec4(normalize(N), 1.0);\n gl_FragColor = vec4(pow(color, vec3(0.75)), 1.0);\n }\n "},Q=t.Z,Y=(e,t)=>(t.updateMatrixWorld(!0),t=new Q.Vector3,e.getWorldPosition(t),t),J={parse(e){var{x:e,y:t,z:r}=e;return void 0===r?new n.Vector2(e,t):new n.Vector3(e,t,r)},toJSON(e){var{x:e,y:t,z:r}=e;return null==r?{x:e,y:t}:{x:e,y:t,z:r}}},$=(e,t)=>e.distanceTo(t),ee=e=>new W.cp(e),te=e=>new H.j(e),re=e=>new W.P7(e),ne=(e,t=.5,r=!1)=>{if("Group"===e.type)throw TypeError("该模型为Group类型");if(!e.material)throw TypeError("该模型没有材质");if(void 0===e.material.oldOpc&&(e.material.oldOpc=e.material.opacity,e.material.oldTransparent=e.material.transparent),r)return e.material.opacity=e.material.oldOpc,void(e.material.transparent=e.material.oldTransparent);1===t?(e.material.transparent=!1,e.material.opacity=1):(e.material.transparent=!0,e.material.opacity=t)},ae=(e,t,r)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>ae(e,t,r))):ne(e,t,r)},ie=e=>(e.mapping=n.EquirectangularReflectionMapping,e),se=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},oe=(e,t)=>{let r=document.createElement("video");return r.style="position:absolute;top:0;left:0;z-index:1000000;",r.src=e,r.loop="loop",r.muted="muted",r.play(),t.appendChild(r),new n.VideoTexture(r)},le=(e,t=!1)=>{let r=new n.CatmullRomCurve3(e),a=new n.BufferGeometry;e=r.getSpacedPoints(100),a.setFromPoints(e),e=new n.LineBasicMaterial({color:26214});let i=new n.Line(a,e);return i.visible=t,{line:i,curve:r}},ce=e=>{let t=0;const r=[],a={},i={0:"x",1:"y",2:"z"};return e.map((e=>{var s,o,l;3===t&&(t=0,({x:s,y:o,z:l}=a),r.push(new n.Vector3(s,o,l))),a[i[t]]=e,t++})),r},ue=e=>{var{pointArray:e,material:t,lineWidth:r,colorArray:a}=e;const i=new F,s=(i.setPositions(e),t||new m({transparent:!0,side:n.DoubleSide,linewidth:r||5,vertexColors:!0})),o=(i.setColors(a||[1,1,1]),s.resolution.set(window.innerWidth,window.innerHeight),new G(i,s));return o.name="gw",o.computeLineDistances(),o},he=e=>3.1415926*e/180,de=(e,t="name",r)=>{const n={};return e.traverse((e=>{"id"===t?n[e.userData.id]=e:n[e[t]]=e,null!=r&&r(e)})),n},pe=(e,t,r,n,a,i)=>({cx:e,cy:t,cz:r,tx:n,ty:a,tz:i}),fe=(e,t)=>{var{x:e,y:r,z:n}=e,{x:t,y:a,z:i}=t;return{x:e-t,y:r-a,z:n-i}},me=()=>new Q.Clock,ge=e=>{var{r:e,g:t,b:r}=(0,Z.fh)((0,Z.I8)(e.includes("#")?e:"#"+e));return new Q.Color(e,t,r)},ve=e=>"#"+e.getHexString(),be=e=>e.r?e:(0,Z.fh)((0,Z.I8)(e.includes("#")?e:"#"+e)),ye=(e,t)=>e.x===t.x&&e.y===t.y&&e.z===t.z,xe=e=>{const{r:t,g:r,b:n}=e;return"rgb("+[t,r,n].map((e=>1<e?e:255*e)).join(",")+")"},we=e=>{var{r:e,g:t,b:r}=e;return{r:e,g:t,b:r}},Se=e=>{let t=e;return(0,K.isColor)(e)?t=we(e):q.YD.is(e)||(t=(0,Z.I8)(e,!0)),t},Me=e=>-1===e.toLocaleLowerCase().indexOf("rgba")?e:e.replace(/[a]/,"").split(",").slice(0,-1)+")",Te=e=>{if(-1!==(e=e.toLocaleLowerCase()).indexOf("#"))return e;if(e=Me(e),/^(rgb|RGB)/.test(e)){for(var t="#",r=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),n=0;n<r.length;n++){var a=Number(r[n]).toString(16);"0"===a&&(a+=a),t+=a}return t}return String(e)},_e=e=>{var{x:e,y:t,z:r}=e;return{x:e,y:t,z:r}},Ee=e=>(new n.Box3).expandByObject(e).getCenter(e),ke={water(e){var t=new Q.PlaneBufferGeometry(256,256,127,127);const r=new n.ShaderMaterial({name:"WaterMaterial",uniforms:X.uniforms,vertexShader:X.vertexShader,fragmentShader:X.fragmentShader}),a=new n.Mesh(t,r),i=(a.rotateX(-.5*Math.PI),new n.Clock);return setInterval((()=>{r.uniforms.uTime.value+=i.getDelta(),r.uniforms.uCamPosition.value=e.position}),16.6),a}},De=(e,t)=>{let r,a;switch(e){case"Group":r=new Q.Group;break;case"Box":a=new Q.BoxBufferGeometry(1,1,1,1,1,1),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Circle":a=new Q.CircleBufferGeometry(1,8,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Cylinder":a=new Q.CylinderBufferGeometry(1,1,1,8,1,!1,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Dodecahedron":a=new Q.DodecahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Icosahedron":a=new Q.IcosahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Lathe":var i=[new Q.Vector2(0,0),new Q.Vector2(.4,0),new Q.Vector2(.35,.05),new Q.Vector2(.1,.075),new Q.Vector2(.08,.1),new Q.Vector2(.08,.4),new Q.Vector2(.1,.42),new Q.Vector2(.14,.48),new Q.Vector2(.2,.5),new Q.Vector2(.25,.54),new Q.Vector2(.3,1.2)];a=new Q.LatheBufferGeometry(i,12,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial({side:Q.DoubleSide}));break;case"Octahedron":a=new Q.OctahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Plane":a=new Q.PlaneBufferGeometry(1,1,1,1),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Ring":a=new Q.RingBufferGeometry(.5,1,8,1,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Sphere":a=new Q.SphereBufferGeometry(1,8,6,0,2*Math.PI,0,Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Sprite":r=new Q.Sprite(new Q.SpriteMaterial);break;case"Tetrahedron":a=new Q.TetrahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Torus":a=new Q.TorusBufferGeometry(1,.4,8,6,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"TorusKnot":a=new Q.TorusKnotBufferGeometry(1,.4,64,8,2,3),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Tube":i=new Q.CatmullRomCurve3([new Q.Vector3(2,2,-2),new Q.Vector3(2,-2,-.6666666666666667),new Q.Vector3(-2,-2,.6666666666666667),new Q.Vector3(-2,2,2)]),a=new Q.TubeBufferGeometry(i,64,1,8,!1),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"water":r=ke.water(t?t.camera:{position:new n.Vector3})}if(r)return r.name=e,r},Pe=(()=>{const e=(t,r)=>!!(t=t.parent)&&"Scene"!==t.type&&(t.uuid===r?t:e(t,r));return(t,r)=>{if(t&&r)return e(t,r)}})(),Ae=(()=>{const e=(t,r)=>t.parent&&"Scene"!==t.parent.type?(t.parent.visible!==r&&(t.parent.visible=r),e(t.parent,r)):null;return(t,r)=>t?e(t,r):null})(),Oe=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&Oe(e.parent),Ce=(e,t=!1)=>{var[r,a,i]=e.geometry.attributes.position.array,[s,o,l]=(e.geometry.center(),e.geometry.attributes.position.array),{x:c,y:u,z:h}=e.position,c=new n.Vector3(c-(s-r),u-(o-a),h-(l-i));return t&&e.position.copy(c),c}},1129:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__1129__},3300:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__3300__},6001:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__6001__},8881:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__8881__},8624:(e,t,r)=>{r.d(t,{Ys:()=>M});var n=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p(e);if(r=t?(r=p(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return d(n)}}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=new n.Raycaster,m=new n.Vector3,g=new n.Vector3,v=new n.Quaternion,b={X:new n.Vector3(1,0,0),Y:new n.Vector3(0,1,0),Z:new n.Vector3(0,0,1)},y={type:"change"},x={type:"mouseDown"},w={type:"mouseUp",mode:null},S={type:"objectChange"},M=function(){c(t,n.Object3D);var e=h(t);function t(r,a){i(this,t),s=e.call(this),void 0===a&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),a=document),s.isTransformControls=!0,s.visible=!1,s.domElement=a,s.domElement.style.touchAction="none";var s,o=new F,l=(s._gizmo=o,s.add(o),new N),c=(s._plane=l,s.add(l),d(s));function u(e,t){var r=t;Object.defineProperty(c,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,l[e]=t,o[e]=t,c.dispatchEvent({type:e+"-changed",value:t}),c.dispatchEvent(y))}}),c[e]=t,l[e]=t,o[e]=t}u("camera",r),u("object",void 0),u("enabled",!0),u("axis",null),u("mode","translate"),u("translationSnap",null),u("rotationSnap",null),u("scaleSnap",null),u("space","world"),u("size",1),u("dragging",!1),u("showX",!0),u("showY",!0),u("showZ",!0),a=new n.Vector3,r=new n.Vector3;var h=new n.Quaternion,p=new n.Quaternion,f=new n.Vector3,m=new n.Quaternion,g=new n.Vector3,v=new n.Vector3,b=new n.Vector3,x=new n.Vector3;return u("worldPosition",a),u("worldPositionStart",r),u("worldQuaternion",h),u("worldQuaternionStart",p),u("cameraPosition",f),u("cameraQuaternion",m),u("pointStart",g),u("pointEnd",v),u("rotationAxis",b),u("rotationAngle",0),u("eye",x),s._offset=new n.Vector3,s._startNorm=new n.Vector3,s._endNorm=new n.Vector3,s._cameraScale=new n.Vector3,s._parentPosition=new n.Vector3,s._parentQuaternion=new n.Quaternion,s._parentQuaternionInv=new n.Quaternion,s._parentScale=new n.Vector3,s._worldScaleStart=new n.Vector3,s._worldQuaternionInv=new n.Quaternion,s._worldScale=new n.Vector3,s._positionStart=new n.Vector3,s._quaternionStart=new n.Quaternion,s._scaleStart=new n.Vector3,s._getPointer=function(e){var t;return this.domElement.ownerDocument.pointerLockElement?{x:0,y:0,button:e.button}:(t=this.domElement.getBoundingClientRect(),{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button})}.bind(d(s)),s._onPointerDown=function(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}.bind(d(s)),s._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(d(s)),s._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(d(s)),s._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(d(s)),s.domElement.addEventListener("pointerdown",s._onPointerDown),s.domElement.addEventListener("pointermove",s._onPointerHover),s.domElement.addEventListener("pointerup",s._onPointerUp),s}return o(t,[{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),l(p(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(f.setFromCamera(e,this.camera),e=T(this._gizmo.picker[this.mode],f),this.axis=e?e.object.name:null)}},{key:"pointerDown",value:function(e){void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis&&(f.setFromCamera(e,this.camera),(e=T(this._plane,f,!0))&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,x.mode=this.mode,this.dispatchEvent(x))}},{key:"pointerMove",value:function(e){var t=this.axis,r=this.mode,n=this.object,a=this.space;"scale"===r?a="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(a="world"),void 0!==n&&null!==t&&!1!==this.dragging&&-1===e.button&&(f.setFromCamera(e,this.camera),(e=T(this._plane,f,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===r?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===a&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),("local"===a&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart):this._offset.applyQuaternion(this._parentQuaternionInv)).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===a&&(n.position.applyQuaternion(v.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),"world"===a&&(n.parent&&n.position.add(m.setFromMatrixPosition(n.parent.matrixWorld)),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(m.setFromMatrixPosition(n.parent.matrixWorld))))):"scale"===r?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),g.set(e,e,e)):(m.copy(this.pointStart),g.copy(this.pointEnd),m.applyQuaternion(this._worldQuaternionInv),g.applyQuaternion(this._worldQuaternionInv),g.divide(m),-1===t.search("X")&&(g.x=1),-1===t.search("Y")&&(g.y=1),-1===t.search("Z")&&(g.z=1)),n.scale.copy(this._scaleStart).multiply(g),this.scaleSnap&&(-1!==t.search("X")&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===r&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(m.setFromMatrixPosition(this.camera.matrixWorld)),"E"===t?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(m.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(b[t]),m.copy(b[t]),"local"===a&&m.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(m.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===a&&"E"!==t&&"XYZE"!==t?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(y),this.dispatchEvent(S)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(w.mode=this.mode,this.dispatchEvent(w)),this.dragging=!1,this.axis=null)}},{key:"dispose",value:function(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,this}},{key:"reset",value:function(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(y),this.dispatchEvent(S),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return f}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSize",value:function(e){this.size=e}},{key:"setSpace",value:function(e){this.space=e}}]),t}();function T(e,t,r){for(var n=t.intersectObject(e,!0),a=0;a<n.length;a++)if(n[a].object.visible||r)return n[a];return!1}var _=new n.Euler,E=new n.Vector3(0,1,0),k=new n.Vector3(0,0,0),D=new n.Matrix4,P=new n.Quaternion,A=new n.Quaternion,O=new n.Vector3,C=new n.Matrix4,R=new n.Vector3(1,0,0),L=new n.Vector3(0,1,0),I=new n.Vector3(0,0,1),B=new n.Vector3,U=new n.Vector3,j=new n.Vector3,F=function(){c(t,n.Object3D);var e=h(t);function t(){i(this,t),(r=e.call(this)).isTransformControlsGizmo=!0,r.type="TransformControlsGizmo";var r,a=new n.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=new n.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=a.clone(),l=((((o.opacity=.15,s=s.clone()).opacity=.5,w=a.clone()).color.setHex(16711680),S=a.clone()).color.setHex(65280),a.clone()),c=(l.color.setHex(255),a.clone()),u=(c.color.setHex(16711680),c.opacity=.5,a.clone()),h=(u.color.setHex(65280),u.opacity=.5,a.clone()),d=(h.color.setHex(255),h.opacity=.5,a.clone());(d.opacity=.25,y=a.clone()).color.setHex(16776960),y.opacity=.25,a.clone().color.setHex(16776960);var p=(((a=a.clone()).color.setHex(7895160),g=new n.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new n.BoxGeometry(.08,.08,.08)),f=(p.translate(0,.04,0),new n.BufferGeometry);function m(e,t){return(e=new n.TorusGeometry(e,.0075,3,64,t*Math.PI*2)).rotateY(Math.PI/2),e.rotateX(Math.PI/2),e}(f.setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,0,0],3)),M=new n.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var g={X:[[new n.Mesh(g,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(g,w),[-.5,0,0],[0,0,Math.PI/2]],[new n.Mesh(M,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new n.Mesh(g,S),[0,.5,0]],[new n.Mesh(g,S),[0,-.5,0],[Math.PI,0,0]],[new n.Mesh(M,S)]],Z:[[new n.Mesh(g,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(g,l),[0,0,-.5],[-Math.PI/2,0,0]],[new n.Mesh(M,l),null,[Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),c.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},v={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.2,0),o)]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},b={START:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new n.Line(((b=new n.BufferGeometry).setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,1,1],3)),b),s),null,null,null,"helper"]],X:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},y=(a={XYZE:[[new n.Mesh(m(.5,1),a),null,[0,Math.PI/2,0]]],X:[[new n.Mesh(m(.5,.5),w)]],Y:[[new n.Mesh(m(.5,.5),S),null,[0,0,-Math.PI/2]]],Z:[[new n.Mesh(m(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new n.Mesh(m(.75,1),y),null,[0,Math.PI/2,0]]]},{AXIS:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),x={XYZE:[[new n.Mesh(new n.SphereGeometry(.25,10,8),o)]],X:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new n.Mesh(new n.TorusGeometry(.75,.1,2,24),o)]]},w={X:[[new n.Mesh(p,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(M,w),[0,0,0],[0,0,-Math.PI/2]],[new n.Mesh(p,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(p,S),[0,.5,0]],[new n.Mesh(M,S)],[new n.Mesh(p,S),[0,-.5,0],[0,0,Math.PI]]],Z:[[new n.Mesh(p,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(M,l),[0,0,0],[Math.PI/2,0,0]],[new n.Mesh(p,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),c),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.1,.1,.1),d.clone())]]},S={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},M={X:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function T(e){var t,r=new n.Object3D;for(t in e)for(var a=e[t].length;a--;){var i=e[t][a][0].clone(),s=e[t][a][1],o=e[t][a][2],l=e[t][a][3],c=e[t][a][4];(i.name=t,i.tag=c,s&&i.position.set(s[0],s[1],s[2]),o&&i.rotation.set(o[0],o[1],o[2]),l&&i.scale.set(l[0],l[1],l[2]),i.updateMatrix(),c=i.geometry.clone()).applyMatrix4(i.matrix),i.geometry=c,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),r.add(i)}return r}return r.gizmo={},r.picker={},r.helper={},r.add(r.gizmo.translate=T(g)),r.add(r.gizmo.rotate=T(a)),r.add(r.gizmo.scale=T(w)),r.add(r.picker.translate=T(v)),r.add(r.picker.rotate=T(x)),r.add(r.picker.scale=T(S)),r.add(r.helper.translate=T(b)),r.add(r.helper.rotate=T(y)),r.add(r.helper.scale=T(M)),r.picker.translate.visible=!1,r.picker.rotate.visible=!1,r.picker.scale.visible=!1,r}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:A,a=(this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode,[]);a=(a=(a=a.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var i=0;i<a.length;i++)!function(e){var t=a[e];if(t.visible=!0,t.rotation.set(0,0,0),e=void t.position.copy(r.worldPosition),e=r.camera.isOrthographicCamera?(r.camera.top-r.camera.bottom)/r.camera.zoom:r.worldPosition.distanceTo(r.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*r.camera.fov/360)/r.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*r.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.visible=!!r.axis,"X"===r.axis&&(v.setFromEuler(_.set(0,0,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(v.setFromEuler(_.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(v.setFromEuler(_.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(v.setFromEuler(_.set(0,Math.PI/2,0)),E.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(D.lookAt(k,E,L)),t.quaternion.multiply(v),t.visible=r.dragging),"E"===r.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(r.worldPositionStart),t.visible=r.dragging):"END"===t.name?(t.position.copy(r.worldPosition),t.visible=r.dragging):"DELTA"===t.name?(t.position.copy(r.worldPositionStart),t.quaternion.copy(r.worldQuaternionStart),m.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),m.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(m),t.visible=r.dragging):(t.quaternion.copy(n),r.dragging?t.position.copy(r.worldPositionStart):t.position.copy(r.worldPosition),r.axis&&(t.visible=-1!==r.axis.search(t.name)));t.quaternion.copy(n),"translate"===r.mode||"scale"===r.mode?("X"===t.name&&.99<Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(P.copy(n),E.copy(r.eye).applyQuaternion(v.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(D.lookAt(r.eye,k,L)),"X"===t.name&&(v.setFromAxisAngle(R,Math.atan2(-E.y,E.z)),v.multiplyQuaternions(P,v),t.quaternion.copy(v)),"Y"===t.name&&(v.setFromAxisAngle(L,Math.atan2(E.x,E.z)),v.multiplyQuaternions(P,v),t.quaternion.copy(v)),"Z"===t.name&&(v.setFromAxisAngle(I,Math.atan2(E.y,E.x)),v.multiplyQuaternions(P,v),t.quaternion.copy(v))),t.visible=t.visible&&(-1===t.name.indexOf("X")||r.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||r.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||r.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||r.showX&&r.showY&&r.showZ),t.material._color=t.material._color||t.material.color.clone(),t.material._opacity=t.material._opacity||t.material.opacity,t.material.color.copy(t.material._color),t.material.opacity=t.material._opacity,r.enabled&&r.axis&&(t.name===r.axis||r.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}(i);l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),N=function(){c(t,n.Mesh);var e=h(t);function t(){var r;return i(this,t),(r=e.call(this,new n.PlaneGeometry(1e5,1e5,2,2),new n.MeshBasicMaterial({visible:!1,wireframe:!0,side:n.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).isTransformControlsPlane=!0,r.type="TransformControlsPlane",r}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),B.copy(R).applyQuaternion("local"===r?this.worldQuaternion:A),U.copy(L).applyQuaternion("local"===r?this.worldQuaternion:A),j.copy(I).applyQuaternion("local"===r?this.worldQuaternion:A),E.copy(U),this.mode){case"translate":case"scale":switch(this.axis){case"X":E.copy(this.eye).cross(B),O.copy(B).cross(E);break;case"Y":E.copy(this.eye).cross(U),O.copy(U).cross(E);break;case"Z":E.copy(this.eye).cross(j),O.copy(j).cross(E);break;case"XY":O.copy(j);break;case"YZ":O.copy(B);break;case"XZ":E.copy(j),O.copy(U);break;case"XYZ":case"E":O.set(0,0,0)}break;default:O.set(0,0,0)}0===O.length()?this.quaternion.copy(this.cameraQuaternion):(C.lookAt(m.set(0,0,0),O,E),this.quaternion.setFromRotationMatrix(C)),l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}()},6422:(e,t,r)=>{r.d(t,{x:()=>c});var n=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(){return(i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(a);function a(e){if(this instanceof a)return(e=r.call(this,e)).type=n.HalfFloatType,e;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"parse",value:function(e){var t,r,a,i,s,o,l,c,u,h,d=function(e,t){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(t||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(t||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(t||""));break;default:console.error("THREE.RGBELoader: Error: "+(t||""))}return-1},p=function(e,t,r){t=t||1024;for(var n=e.pos,a=-1,i=0,s="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));(a=o.indexOf("\n"))<0&&i<t&&n<e.byteLength;)s+=o,i+=o.length,n+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));return-1<a&&(!1!==r&&(e.pos+=i+a+1),s+o.slice(0,a))},f=((e=new Uint8Array(e)).pos=0,function(e){var t,r,n=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,i=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(t=p(e)))return d(1,"no header found");if(!(r=t.match(/^#\?(\S+)/)))return d(3,"bad initial token");for(o.valid|=1,o.programtype=r[1],o.string+=t+"\n";!1!==(t=p(e));)if(o.string+=t+"\n","#"===t.charAt(0))o.comments+=t+"\n";else if((r=t.match(n))&&(o.gamma=parseFloat(r[1])),(r=t.match(a))&&(o.exposure=parseFloat(r[1])),(r=t.match(i))&&(o.valid|=2,o.format=r[1]),(r=t.match(s))&&(o.valid|=4,o.height=parseInt(r[1],10),o.width=parseInt(r[2],10)),2&o.valid&&4&o.valid)break;return 2&o.valid?4&o.valid?o:d(3,"missing image size specifier"):d(3,"missing format specifier")}(e));if(-1!==f){var m,g,v=f.width,b=f.height,y=function(e,t,r){var n=t;if(n<8||32767<n||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(n!==(e[2]<<8|e[3]))return d(3,"wrong scanline width");var a=new Uint8Array(4*t*r);if(!a.length)return d(4,"unable to allocate buffer space");for(var i=0,s=0,o=4*n,l=new Uint8Array(4),c=new Uint8Array(o),u=r;0<u&&s<e.byteLength;){if(s+4>e.byteLength)return d(1);if(l[0]=e[s++],l[1]=e[s++],l[2]=e[s++],l[3]=e[s++],2!=l[0]||2!=l[1]||(l[2]<<8|l[3])!=n)return d(3,"bad rgbe scanline format");for(var h=0,p=void 0;h<o&&s<e.byteLength;){var f=128<(p=e[s++]);if(f&&(p-=128),0===p||o<h+p)return d(3,"bad scanline data");if(f)for(var m=e[s++],g=0;g<p;g++)c[h++]=m;else c.set(e.subarray(s,s+p),h),h+=p,s+=p}for(var v=n,b=0;b<v;b++){var y=0;a[i]=c[b+0],y+=n,a[i+1]=c[b+y],y+=n,a[i+2]=c[b+y],y+=n,a[i+3]=c[b+y],i+=4}u--}return a}(e.subarray(e.pos),v,b);if(-1!==y){switch(this.type){case n.FloatType:for(var x=y.length/4,w=new Float32Array(4*x),S=0;S<x;S++)c=w,u=l=4*S,h=void 0,h=(o=y)[l+3],h=Math.pow(2,h-128)/255,c[u+0]=o[l+0]*h,c[u+1]=o[l+1]*h,c[u+2]=o[l+2]*h,c[u+3]=1;m=w,g=n.FloatType;break;case n.HalfFloatType:x=y.length/4;for(var M=new Uint16Array(4*x),T=0;T<x;T++)a=M,i=r=4*T,s=void 0,s=(t=y)[r+3],s=Math.pow(2,s-128)/255,a[i+0]=n.DataUtils.toHalfFloat(Math.min(t[r+0]*s,65504)),a[i+1]=n.DataUtils.toHalfFloat(Math.min(t[r+1]*s,65504)),a[i+2]=n.DataUtils.toHalfFloat(Math.min(t[r+2]*s,65504)),a[i+3]=n.DataUtils.toHalfFloat(1);m=M,g=n.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:v,height:b,data:m,header:f.string,gamma:f.gamma,exposure:f.exposure,type:g}}}return null}},{key:"setDataType",value:function(e){return this.type=e,this}},{key:"load",value:function(e,t,r,s){return i(l(a.prototype),"load",this).call(this,e,(function(e,r){switch(e.type){case n.FloatType:case n.HalfFloatType:e.encoding=n.LinearEncoding,e.minFilter=n.LinearFilter,e.magFilter=n.LinearFilter,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)}),r,s)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.DataTextureLoader)},4819:(e,t,r)=>{r.d(t,{T:()=>u,w:()=>o});var n=r(8881);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var o=function(){function e(){a(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return s(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}},{key:"dispose",value:function(){}}]),e}(),l=new n.OrthographicCamera(-1,1,1,-1,0,1),c=new n.BufferGeometry,u=(c.setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){a(this,e),this._mesh=new n.Mesh(c,t)}return s(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,l)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}())},5180:(e,t,r)=>{r.d(t,{T:()=>c});var n=r(8881),a=r(4819);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(i);function i(e,t){var s;if(this instanceof i)return(s=r.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof n.ShaderMaterial?(s.uniforms=e.uniforms,s.material=e):e&&(s.uniforms=n.UniformsUtils.clone(e.uniforms),s.material=new n.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:s.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),s.fsQuad=new a.T(s.material),s;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"render",value:function(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}},{key:"dispose",value:function(){this.material.dispose(),this.fsQuad.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(a.w)},699:(e,t,r)=>{function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}r.d(t,{M:()=>g,j:()=>u});var u=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,a=c(e);if(r=t?(r=c(this).constructor,Reflect.construct(a,arguments,r)):a.apply(this,arguments),a=this,r&&("object"===n(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==a)return a;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,i),(e=r.call(this)).isCSS2DObject=!0,e.element=t,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return s(i,[{key:"copy",value:function(e,t){return o(c(i.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this}}]),i}((t=r(8881)).Object3D),h=new t.Vector3,d=new t.Matrix4,p=new t.Matrix4,f=new t.Vector3,m=new t.Vector3,g=s((function e(){var t,r,n,i,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(a(this,e),this),l={objects:new WeakMap},c=void 0!==s.element?s.element:document.createElement("div");function u(e,t){return f.setFromMatrixPosition(e.matrixWorld),m.setFromMatrixPosition(t.matrixWorld),f.distanceToSquared(m)}c.style.overflow="hidden",this.domElement=c,this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),d.copy(t.matrixWorldInverse),p.multiplyMatrices(t.projectionMatrix,d),function e(t,r,a){var s;t.isCSS2DObject&&(h.setFromMatrixPosition(t.matrixWorld),h.applyMatrix4(p),s=!0===t.visible&&-1<=h.z&&h.z<=1&&!0===t.layers.test(a.layers),t.element.style.display=1==s?"":"none",1==s&&(t.onBeforeRender(o,r,a),(s=t.element).style.transform="translate(-50%,-50%) translate("+(h.x*n+n)+"px,"+(-h.y*i+i)+"px)",s.parentNode!==c&&c.appendChild(s),t.onAfterRender(o,r,a)),s={distanceToCameraSquared:u(a,t)},l.objects.set(t,s));for(var d=0,f=t.children.length;d<f;d++)e(t.children[d],r,a)}(e,e,t);for(var r=function(e){var t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),a=r.length,s=0,f=r.length;s<f;s++)r[s].element.style.zIndex=a-s},this.setSize=function(e,a){n=(t=e)/2,i=(r=a)/2,c.style.width=e+"px",c.style.height=a+"px"}}))},3693:(e,t,r)=>{r.d(t,{P7:()=>v,cp:()=>g,lX:()=>x});var n=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d(e);if(r=t?(r=d(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new n.Vector3,f=new n.Quaternion,m=new n.Vector3,g=function(){c(t,n.Object3D);var e=h(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return i(this,t),(r=e.call(this)).isCSS3DObject=!0,r.element=n,r.element.style.position="absolute",r.element.style.pointerEvents="auto",r.element.style.userSelect="none",r.element.setAttribute("draggable",!1),r.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),r}return o(t,[{key:"copy",value:function(e,r){return l(d(t.prototype),"copy",this).call(this,e,r),this.element=e.element.cloneNode(!0),this}}]),t}(),v=function(){c(t,g);var e=h(t);function t(r){return i(this,t),(r=e.call(this,r)).isCSS3DSprite=!0,r.rotation2D=0,r}return o(t,[{key:"copy",value:function(e,r){return l(d(t.prototype),"copy",this).call(this,e,r),this.rotation2D=e.rotation2D,this}}]),t}(),b=new n.Matrix4,y=new n.Matrix4,x=o((function e(){var t,r,n,a,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(i(this,e),this),l={camera:{fov:0,style:""},objects:new WeakMap},c=void 0!==s.element?s.element:document.createElement("div"),u=(c.style.overflow="hidden",this.domElement=c,document.createElement("div"));function h(e){return Math.abs(e)<1e-10?0:e}function d(e){return"matrix3d("+h((e=e.elements)[0])+","+h(-e[1])+","+h(e[2])+","+h(e[3])+","+h(e[4])+","+h(-e[5])+","+h(e[6])+","+h(e[7])+","+h(e[8])+","+h(-e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(-e[13])+","+h(e[14])+","+h(e[15])+")"}function g(e){return"translate(-50%,-50%)matrix3d("+h((e=e.elements)[0])+","+h(e[1])+","+h(e[2])+","+h(e[3])+","+h(-e[4])+","+h(-e[5])+","+h(-e[6])+","+h(-e[7])+","+h(e[8])+","+h(e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(e[13])+","+h(e[14])+","+h(e[15])+")"}u.style.transformStyle="preserve-3d",u.style.pointerEvents="none",c.appendChild(u),this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){var r=t.projectionMatrix.elements[5]*a,i=(l.camera.fov!==r&&(c.style.perspective=t.isPerspectiveCamera?r+"px":"",l.camera.fov=r),!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),t.isOrthographicCamera&&(i=-(t.right+t.left)/2,s=(t.top+t.bottom)/2),t.isOrthographicCamera?"scale("+r+")translate("+h(i)+"px,"+h(s)+"px)"+d(t.matrixWorldInverse):"translateZ("+r+"px)"+d(t.matrixWorldInverse)),s=i+"translate("+n+"px,"+a+"px)";l.camera.style!==s&&(u.style.transform=s,l.camera.style=s),function e(t,r,n,a){var i,s,c;t.isCSS3DObject&&(i=!0===t.visible&&!0===t.layers.test(n.layers),t.element.style.display=1==i?"":"none",1==i&&(t.onBeforeRender(o,r,n),i=t.isCSS3DSprite?(b.copy(n.matrixWorldInverse),b.transpose(),0!==t.rotation2D&&b.multiply(y.makeRotationZ(t.rotation2D)),t.matrixWorld.decompose(p,f,m),b.setPosition(p),b.scale(m),b.elements[3]=0,b.elements[7]=0,b.elements[11]=0,b.elements[15]=1,g(b)):g(t.matrixWorld),s=t.element,void 0!==(c=l.objects.get(t))&&c.style===i||(c={style:s.style.transform=i},l.objects.set(t,c)),s.parentNode!==u&&u.appendChild(s),t.onAfterRender(o,r,n)));for(var h=0,d=t.children.length;h<d;h++)e(t.children[h],r,n,a)}(e,e,t,i)},this.setSize=function(e,i){n=(t=e)/2,a=(r=i)/2,c.style.width=e+"px",c.style.height=i+"px",u.style.width=e+"px",u.style.height=i+"px"}}))},6608:(e,t,r)=>{r.d(t,{C:()=>n});var n={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor.a *= opacity;\n\n\n\t\t}"}},4091:(e,t,r)=>{r.d(t,{Vs:()=>function(e,t){if(t===n.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==n.TriangleFanDrawMode&&t!==n.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;var r=e.getIndex();if(null===r){var a=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var s=0;s<i.count;s++)a.push(s);e.setIndex(a),r=e.getIndex()}var o=r.count-2,l=[];if(t===n.TriangleFanDrawMode)for(var c=1;c<=o;c++)l.push(r.getX(0)),l.push(r.getX(c)),l.push(r.getX(c+1));else for(var u=0;u<o;u++)u%2==0?(l.push(r.getX(u)),l.push(r.getX(u+1)),l.push(r.getX(u+2))):(l.push(r.getX(u+2)),l.push(r.getX(u+1)),l.push(r.getX(u)));return l.length/3!=o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(l),t.clearGroups(),t},qf:()=>function(e){for(var t,r,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],s=null!==e[0].index,o=new Set(Object.keys(e[0].attributes)),l=new Set(Object.keys(e[0].morphAttributes)),c={},u={},h=e[0].morphTargetsRelative,d=new n.BufferGeometry,p=0,f=0;f<e.length;++f){var m,g,v=e[f],b=0;if(s!=(null!==v.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(m in v.attributes){if(!o.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;void 0===c[m]&&(c[m]=[]),c[m].push(v.attributes[m]),b++}if(b!==o.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". Make sure all geometries have the same number of attributes."),null;if(h!==v.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(g in v.morphAttributes){if(!l.has(g))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphAttributes must be consistent throughout all geometries."),null;void 0===u[g]&&(u[g]=[]),u[g].push(v.morphAttributes[g])}if(i){var y=void 0;if(s)y=v.index.count;else{if(void 0===v.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". The geometry must have either an index or a position attribute"),null;y=v.attributes.position.count}d.addGroup(p,y,f),p+=y}}if(s){for(var x=0,w=[],S=0;S<e.length;++S){for(var M=e[S].index,T=0;T<M.count;++T)w.push(M.getX(T)+x);x+=e[S].attributes.position.count}d.setIndex(w)}for(t in c){var _=a(c[t]);if(!_)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+t+" attribute."),null;d.setAttribute(t,_)}for(r in u){var E=u[r][0].length;if(0===E)break;d.morphAttributes=d.morphAttributes||{},d.morphAttributes[r]=[];for(var k=0;k<E;++k){for(var D=[],P=0;P<u[r].length;++P)D.push(u[r][P][k]);var A=a(D);if(!A)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" morphAttribute."),null;d.morphAttributes[r].push(A)}}return d}});var n=r(8881);function a(e){for(var t,r,a,i=0,s=0;s<e.length;++s){var o=e[s];if(o.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if((t=void 0===t?o.array.constructor:t)!==o.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if((r=void 0===r?o.itemSize:r)!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if((a=void 0===a?o.normalized:a)!==o.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=o.array.length}for(var l=new t(i),c=0,u=0;u<e.length;++u)l.set(e[u].array,c),c+=e[u].array.length;return new n.BufferAttribute(l,r,a)}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];return void 0!==t||(t=__webpack_module_cache__[e]={exports:{}},__webpack_modules__[e](t,t.exports,__webpack_require__)),t.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{__webpack_require__.d(__webpack_exports__,{default:()=>r});var e=__webpack_require__(8624),t=__webpack_require__(5857);const r={RunScene:t.ZP,Utils:t.cQ,ModelEx:t.ch,MaterialEx:t.al,TextureEx:t.Az,Three:t.Sf,ThreeEx:{TransformControls:e.Ys},Bus:t.Gc}})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));