aframe-babia-components 1.2.2 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/filters/babia-selector.js +256 -79
- package/components/filters/babia-treebuilder.js +1 -2
- package/components/geometries/babia-bar.js +13 -1
- package/components/geometries/babia-cyl.js +189 -0
- package/components/others/assets/tooltip.png +0 -0
- package/components/others/babia-camera.js +195 -0
- package/components/others/babia-controls.js +56 -31
- package/components/others/babia-navigator.js +55 -49
- package/components/others/babia-range-selector.js +218 -0
- package/components/others/babia-slider.js +36 -8
- package/components/others/babia-ui.js +246 -73
- package/components/others/common.js +91 -83
- package/components/queriers/babia-querycsv.js +96 -0
- package/components/queriers/babia-queryes.js +209 -131
- package/components/visualizers/babia-bars.js +15 -38
- package/components/visualizers/babia-barsmap.js +19 -34
- package/components/visualizers/babia-boats.js +221 -134
- package/components/visualizers/babia-bubbles.js +13 -26
- package/components/visualizers/babia-cyls.js +203 -201
- package/components/visualizers/babia-cylsmap.js +173 -241
- package/components/visualizers/babia-doughnut.js +6 -28
- package/components/visualizers/babia-network.js +191 -124
- package/components/visualizers/babia-pie.js +6 -30
- package/dist/aframe-babia-components.js +21913 -19571
- package/dist/aframe-babia-components.min.js +7 -1
- package/dist/aframe-babia-components.min.js.map +1 -1
- package/docs/APIs/CHARTS.md +33 -14
- package/docs/APIs/DATAMANAGEMENT.md +7 -0
- package/docs/APIs/OTHERS.md +42 -0
- package/docs/APIs/QUERIERS.md +18 -0
- package/docs/RELEASE_NOTES.md +58 -21
- package/docs/Tutorials/multiuser.md +47 -2
- package/examples/assets/door/New Bitmap Image.jpg +0 -0
- package/examples/assets/door/door.mtl +26 -0
- package/examples/assets/door/door.obj +6927 -0
- package/examples/assets/popups/0.png +0 -0
- package/examples/assets/popups/1.png +0 -0
- package/examples/assets/popups/10.png +0 -0
- package/examples/assets/popups/2.png +0 -0
- package/examples/assets/popups/3.png +0 -0
- package/examples/assets/popups/4.png +0 -0
- package/examples/assets/popups/5.png +0 -0
- package/examples/assets/popups/6.png +0 -0
- package/examples/assets/popups/7.png +0 -0
- package/examples/assets/popups/8.png +0 -0
- package/examples/assets/popups/9.png +0 -0
- package/examples/assets/popups/close.jpg +0 -0
- package/examples/assets/popups/info.jpg +0 -0
- package/examples/assets/textures/brownwall.png +0 -0
- package/examples/assets/textures/concrete.png +0 -0
- package/examples/assets/textures/white-wall-texture.jpg +0 -0
- package/examples/charts/cyls/index.html +13 -4
- package/examples/charts/cyls/primitive.html +76 -0
- package/examples/charts/cylsmap/index.html +14 -5
- package/examples/charts_querier/bars_querier/data.csv +10 -0
- package/examples/charts_querier/bars_querier/index_csv.html +80 -0
- package/examples/charts_querier/multichart_querier/manual_colors.html +81 -0
- package/examples/dashboard/chaoss-dashboards.html +259 -0
- package/examples/dashboard/chaoss-issues.html +248 -0
- package/examples/dashboard/chaoss-pr.html +248 -0
- package/examples/dashboard/index.html +247 -0
- package/examples/dashboard/issues_queries/80-percent-open-time.json +123 -0
- package/examples/dashboard/issues_queries/issues-by-organization.json +107 -0
- package/examples/dashboard/issues_queries/issues.json +117 -0
- package/examples/dashboard/issues_queries/median-open-time.json +123 -0
- package/examples/dashboard/issues_queries/organizations.json +130 -0
- package/examples/dashboard/issues_queries/projects.json +130 -0
- package/examples/dashboard/issues_queries/repositories.json +130 -0
- package/examples/dashboard/issues_queries/status.json +107 -0
- package/examples/dashboard/issues_queries/submitter.json +125 -0
- package/examples/dashboard/issues_queries/submitters.json +113 -0
- package/examples/dashboard/pullrequests_queries/80-percent-open-time.json +123 -0
- package/examples/dashboard/pullrequests_queries/median-open-time.json +123 -0
- package/examples/dashboard/pullrequests_queries/organizations.json +130 -0
- package/examples/dashboard/pullrequests_queries/projects.json +130 -0
- package/examples/dashboard/pullrequests_queries/pull-requests-by-organization.json +107 -0
- package/examples/dashboard/pullrequests_queries/pull-requests.json +117 -0
- package/examples/dashboard/pullrequests_queries/repositories.json +130 -0
- package/examples/dashboard/pullrequests_queries/status.json +107 -0
- package/examples/dashboard/pullrequests_queries/submitter.json +125 -0
- package/examples/dashboard/pullrequests_queries/submitters.json +113 -0
- package/examples/dashboard/range.html +88 -0
- package/examples/dashboard/template.html +136 -0
- package/examples/demos/1.0.11/index_multiuser_ui.html +1 -1
- package/examples/multi_bars/data.json +14 -0
- package/examples/multi_bars/data2.json +15 -0
- package/examples/multi_bars/data3.json +23 -0
- package/examples/multi_bars/easyrtc.js +11984 -0
- package/examples/multi_bars/index.html +97 -0
- package/examples/multi_bars/index1.html +111 -0
- package/examples/multi_bars/index2.html +102 -0
- package/examples/multi_bars/index3.html +104 -0
- package/examples/multi_boats/data3.json +174 -0
- package/examples/multi_boats/data4.json +192 -0
- package/examples/multi_boats/{index.html → index_multi_boats.html} +50 -55
- package/examples/multi_boats/jetuml.html +124 -115
- package/examples/multi_boats/jetuml_evolution_experiment.html +419 -0
- package/examples/multi_boats/only_queryjson.html +132 -0
- package/examples/multi_boats/only_queryjson2.html +167 -0
- package/examples/multi_boats/only_queryjson3.html +165 -0
- package/examples/multi_boats/queryjson_treebuilder.html +132 -0
- package/examples/multi_boats/with_selector.html +121 -111
- package/examples/multiuser/choose_avatar/index.html +18 -8
- package/examples/selector_boats/jetuml_from_3_2_to_1_0.json +62382 -0
- package/examples/ui/network/data.json +123 -0
- package/examples/ui/network/links.json +13 -0
- package/examples/ui/network/network.html +75 -0
- package/examples/ui/network/network_nodes_links.html +82 -0
- package/examples/ui/network/nodes.json +12 -0
- package/index.html +69 -3
- package/index.js +6 -1
- package/package.json +4 -3
- package/tests/screenshots/other_snapshots.js/chaoss-issues.png +0 -0
- package/tests/screenshots/other_snapshots.js/chaoss-pr.png +0 -0
- package/tests/screenshots/other_snapshots.js/template.png +0 -0
- package/tests/ui.js +7 -0
- package/webpack.common.js +1 -1
- package/webpack.devnossl.js +16 -0
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -79
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
!function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=11)}([function(t,e){let i=(t,e)=>{t.emit("babiaVisualizerUpdated",e)};t.exports.dataReadyToSend=(t,e)=>{e.interestedElements.forEach(e=>{i(e,t)})},t.exports.dispatchEventOnElement=i,t.exports.findDataComponent=(t,e,i)=>{let n="babiaQuerierDataReady";if(t.from){let r=document.getElementById(t.from);if(r.components["babia-filter"])i.dataComponent=r.components["babia-filter"],n="babiaFilterDataReady";else if(r.components["babia-queryjson"])i.dataComponent=r.components["babia-queryjson"];else if(r.components["babia-queryes"])i.dataComponent=r.components["babia-queryes"];else if(r.components["babia-querygithub"])i.dataComponent=r.components["babia-querygithub"];else{if(!r.components["babia-selector"])return void console.error("Problem registering to the querier",e);i.dataComponent=r.components["babia-selector"],n="babiaSelectorDataReady"}}else if(e.components["babia-filter"])i.dataComponent=e.components["babia-filter"],n="babiaFilterDataReady";else if(e.components["babia-queryjson"])i.dataComponent=e.components["babia-queryjson"];else if(e.components["babia-queryes"])i.dataComponent=e.components["babia-queryes"];else if(e.components["babia-querygithub"])i.dataComponent=e.components["babia-querygithub"];else if(e.components["babia-selector"])i.dataComponent=e.components["babia-selector"],n="babiaSelectorDataReady";else if(document.querySelectorAll("[babia-filter]").length>0)i.dataComponent=document.querySelectorAll("[babia-filter]")[0].components["babia-filter"],n="babiaFilterDataReady";else if(document.querySelectorAll("[babia-queryjson]").length>0)i.dataComponent=document.querySelectorAll("[babia-queryjson]")[0].components["babia-queryjson"];else if(document.querySelectorAll("[babia-queryjson]").length>0)i.dataComponent=document.querySelectorAll("[babia-queryes]")[0].components["babia-queryes"];else if(document.querySelectorAll("[babia-querygithub]").length>0)i.dataComponent=document.querySelectorAll("[babia-querygithub]")[0].components["babia-querygithub"];else{if(!(document.querySelectorAll("[babia-selector]").length>0))return void console.error("Error, querier not found",e,e.components,e.components["babia-selector"]);i.dataComponent=document.querySelectorAll("[babia-selector]")[0].components["babia-selector"],n="babiaSelectorDataReady"}return n},t.exports.findProdComponent=(t,e,i)=>{let n;if(t.from){let i=document.getElementById(t.from);if(i.components["babia-filter"])n=i.components["babia-filter"];else if(i.components["babia-queryjson"])n=i.components["babia-queryjson"];else if(i.components["babia-queryes"])n=i.components["babia-queryes"];else if(i.components["babia-querygithub"])n=i.components["babia-querygithub"];else if(i.components["babia-selector"])n=i.components["babia-selector"];else{if(!i.components["babia-treebuilder"])return void console.error("Problem registering to the querier",e);n=i.components["babia-treebuilder"]}}else{if(t.nodesFrom){let i=document.getElementById(t.nodesFrom);if(i.components["babia-filter"])prodComponentNodes=i.components["babia-filter"];else if(i.components["babia-queryjson"])prodComponentNodes=i.components["babia-queryjson"];else if(i.components["babia-queryes"])prodComponentNodes=i.components["babia-queryes"];else{if(!i.components["babia-querygithub"])return void console.error("Problem registering to the querier",e);prodComponentNodes=i.components["babia-querygithub"]}let n=document.getElementById(t.linksFrom);if(n.components["babia-filter"])prodComponentLinks=n.components["babia-filter"];else if(n.components["babia-queryjson"])prodComponentLinks=n.components["babia-queryjson"];else if(n.components["babia-queryes"])prodComponentLinks=n.components["babia-queryes"];else{if(!n.components["babia-querygithub"])return void console.error("Problem registering to the querier",e);prodComponentLinks=n.components["babia-querygithub"]}return{nodes:prodComponentNodes,links:prodComponentLinks}}if(e.components["babia-filter"]&&"babia-filter"!=i)n=e.components["babia-filter"];else if(e.components["babia-queryjson"]&&"babia-queryjson"!=i)n=e.components["babia-queryjson"];else if(e.components["babia-queryes"]&&"babia-queryes"!=i)n=e.components["babia-queryes"];else if(e.components["babia-querygithub"]&&"babia-querygithub"!=i)n=e.components["babia-querygithub"];else if(e.components["babia-selector"]&&"babia-selector"!=i)n=e.components["babia-selector"];else if(e.components["babia-treebuilder"])n=e.components["babia-treebuilder"];else if(document.querySelectorAll("[babia-filter]").length>0)n=document.querySelectorAll("[babia-filter]")[0].components["babia-filter"];else if(document.querySelectorAll("[babia-queryjson]").length>0)n=document.querySelectorAll("[babia-queryjson]")[0].components["babia-queryjson"];else if(document.querySelectorAll("[babia-queryjson]").length>0)n=document.querySelectorAll("[babia-queryes]")[0].components["babia-queryes"];else if(document.querySelectorAll("[babia-querygithub]").length>0)n=document.querySelectorAll("[babia-querygithub]")[0].components["babia-querygithub"];else if(document.querySelectorAll("[babia-selector]").length>0)n=document.querySelectorAll("[babia-selector]")[0].components["babia-selector"];else{if(!(document.querySelectorAll("[babia-treebuilder]").length>0))return void console.error("Error, querier not found",e,e.components,e.components["babia-selector"]);n=document.querySelectorAll("[babia-treebuilder]")[0].components["babia-treebuilder"]}}return n},t.exports.findNavComponent=(t,e)=>{let i;if(t.controller){let n=document.getElementById(t.controller);if(!n.components["babia-navigator"])return void console.error("Problem registering to the navigator",e);i=n.components["babia-navigator"]}else if(e.components["babia-navigator"])i=e.components["babia-navigator"];else{if(!(document.querySelectorAll("[babia-navigator]").length>0))return void console.error("Error, navigator not found",e,e.components,e.components["babia-navigator"]);i=document.querySelectorAll("[babia-navigator]")[0].components["babia-navigator"]}return i},t.exports.findTargetComponent=(t,e)=>{let i;if(t.target){{let e=document.getElementById(t.target);if(null==e)return void console.error("Target not exist.");if(e.components["babia-bars"])i=e.components["babia-bars"];else if(e.components["babia-barsmap"])i=e.components["babia-barsmap"];else if(e.components["babia-cyls"])i=e.components["babia-cyls"];else if(e.components["babia-cylsmap"])i=e.components["babia-cylsmap"];else if(e.components["babia-pie"])i=e.components["babia-pie"];else if(e.components["babia-doughnut"])i=e.components["babia-doughnut"];else if(e.components["babia-bubbles"])i=e.components["babia-bubbles"];else if(e.components["babia-city"])i=e.components["babia-city"];else{if(!e.components["babia-boats"])return void console.error("Visualizer not found.");i=e.components["babia-boats"]}}return i}console.error("Error: Target not inserted. ")},t.exports.colors={palettes:{blues:["#142850","#27496d","#00909e","#dae1e7"],foxy:["#f79071","#fa744f","#16817a","#024249"],flat:["#120136","#035aa6","#40bad5","#fcbf1e"],sunset:["#202040","#543864","#ff6363","#ffbd69"],bussiness:["#de7119","#dee3e2","#116979","#18b0b0"],icecream:["#f76a8c","#f8dc88","#f8fab8","#ccf0e1"],ubuntu:["#511845","#900c3f","#c70039","#ff5733"],pearl:["#efa8e4","#f8e1f4","#fff0f5","#97e5ef"],commerce:["#222831","#30475e","#f2a365","#ececec"]},get:function(t,e){let i=this.palettes[e].length;return this.palettes[e][t%i]}},t.exports.updateTitle=(t,e)=>{let i=document.createElement("a-entity");return i.classList.add("babiaxrTitle"),i.setAttribute("text-geometry",{value:t.title}),t.titleFont&&i.setAttribute("text-geometry",{font:t.titleFont}),t.titleColor&&i.setAttribute("material",{color:t.titleColor}),i.setAttribute("position",t.titlePosition),i.setAttribute("rotation",e),i},t.exports.parseJson=t=>{let e;return e="string"==typeof t||t instanceof String?JSON.parse(t):t,e}},function(t,e,i){"use strict";i.r(e);e.default=function(t){return t instanceof Function?t:"string"==typeof t?function(e){return e[t]}:function(e){return t}}},function(t,e,i){class n{constructor(t,e){this.currentId=0,this.notifiers={},this.data,this.function1=t,this.function2=e}set(t){console.log("produced",t),this.data=t;for(const t of Object.values(this.notifiers))t(this.data)}register(t,e){void 0!==this.data&&(console.log("Data was ready"),t(this.data));let i=this.currentId;return this.notifiers[i]=t,this.currentId++,e&&this.function1&&this.function1(e),i}unregister(t,e){delete this.notifiers[t],e&&this.function2&&this.function2(e)}}t.exports.NotiBuffer=n},function(t,e,i){const n=i(7);t.exports=function(t){return function(e,i){let r=i&&i.indent||0,a=i&&void 0!==i.join?i.join:"\n",o=Array(r+1).join(" "),s=[];for(let i=0;i<t;++i){let t=n(i),r=0===i?"":o;s.push(r+e.replace(/{var}/g,t))}return s.join(a)}}},function(t,e){t.exports=function(t){!function(t){if(!t)throw new Error("Eventify cannot use falsy object as events subject");for(var e=["on","fire","off"],i=0;i<e.length;++i)if(t.hasOwnProperty(e[i]))throw new Error("Subject cannot be eventified, since it already has property '"+e[i]+"'")}(t);var e=function(t){var e=Object.create(null);return{on:function(i,n,r){if("function"!=typeof n)throw new Error("callback is expected to be a function");var a=e[i];return a||(a=e[i]=[]),a.push({callback:n,ctx:r}),t},off:function(i,n){if(void 0===i)return e=Object.create(null),t;if(e[i])if("function"!=typeof n)delete e[i];else for(var r=e[i],a=0;a<r.length;++a)r[a].callback===n&&r.splice(a,1);return t},fire:function(i){var n,r=e[i];if(!r)return t;arguments.length>1&&(n=Array.prototype.splice.call(arguments,1));for(var a=0;a<r.length;++a){var o=r[a];o.callback.apply(o.ctx,n)}return t}}}(t);return t.on=e.on,t.off=e.off,t.fire=e.fire,t}},function(t,e,i){var n;!function(r){var a=/^\s+/,o=/\s+$/,s=0,l=r.round,c=r.min,h=r.max,u=r.random;function d(t,e){if(e=e||{},(t=t||"")instanceof d)return t;if(!(this instanceof d))return new d(t,e);var i=function(t){var e={r:0,g:0,b:0},i=1,n=null,s=null,l=null,u=!1,d=!1;"string"==typeof t&&(t=function(t){t=t.replace(a,"").replace(o,"").toLowerCase();var e,i=!1;if(B[t])t=B[t],i=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(e=V.rgb.exec(t))return{r:e[1],g:e[2],b:e[3]};if(e=V.rgba.exec(t))return{r:e[1],g:e[2],b:e[3],a:e[4]};if(e=V.hsl.exec(t))return{h:e[1],s:e[2],l:e[3]};if(e=V.hsla.exec(t))return{h:e[1],s:e[2],l:e[3],a:e[4]};if(e=V.hsv.exec(t))return{h:e[1],s:e[2],v:e[3]};if(e=V.hsva.exec(t))return{h:e[1],s:e[2],v:e[3],a:e[4]};if(e=V.hex8.exec(t))return{r:D(e[1]),g:D(e[2]),b:D(e[3]),a:Q(e[4]),format:i?"name":"hex8"};if(e=V.hex6.exec(t))return{r:D(e[1]),g:D(e[2]),b:D(e[3]),format:i?"name":"hex"};if(e=V.hex4.exec(t))return{r:D(e[1]+""+e[1]),g:D(e[2]+""+e[2]),b:D(e[3]+""+e[3]),a:Q(e[4]+""+e[4]),format:i?"name":"hex8"};if(e=V.hex3.exec(t))return{r:D(e[1]+""+e[1]),g:D(e[2]+""+e[2]),b:D(e[3]+""+e[3]),format:i?"name":"hex"};return!1}(t));"object"==typeof t&&(G(t.r)&&G(t.g)&&G(t.b)?(p=t.r,f=t.g,g=t.b,e={r:255*U(p,255),g:255*U(f,255),b:255*U(g,255)},u=!0,d="%"===String(t.r).substr(-1)?"prgb":"rgb"):G(t.h)&&G(t.s)&&G(t.v)?(n=N(t.s),s=N(t.v),e=function(t,e,i){t=6*U(t,360),e=U(e,100),i=U(i,100);var n=r.floor(t),a=t-n,o=i*(1-e),s=i*(1-a*e),l=i*(1-(1-a)*e),c=n%6;return{r:255*[i,s,o,o,l,i][c],g:255*[l,i,i,s,o,o][c],b:255*[o,o,l,i,i,s][c]}}(t.h,n,s),u=!0,d="hsv"):G(t.h)&&G(t.s)&&G(t.l)&&(n=N(t.s),l=N(t.l),e=function(t,e,i){var n,r,a;function o(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(t=U(t,360),e=U(e,100),i=U(i,100),0===e)n=r=a=i;else{var s=i<.5?i*(1+e):i+e-i*e,l=2*i-s;n=o(l,s,t+1/3),r=o(l,s,t),a=o(l,s,t-1/3)}return{r:255*n,g:255*r,b:255*a}}(t.h,n,l),u=!0,d="hsl"),t.hasOwnProperty("a")&&(i=t.a));var p,f,g;return i=L(i),{ok:u,format:t.format||d,r:c(255,h(e.r,0)),g:c(255,h(e.g,0)),b:c(255,h(e.b,0)),a:i}}(t);this._originalInput=t,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=l(100*this._a)/100,this._format=e.format||i.format,this._gradientType=e.gradientType,this._r<1&&(this._r=l(this._r)),this._g<1&&(this._g=l(this._g)),this._b<1&&(this._b=l(this._b)),this._ok=i.ok,this._tc_id=s++}function p(t,e,i){t=U(t,255),e=U(e,255),i=U(i,255);var n,r,a=h(t,e,i),o=c(t,e,i),s=(a+o)/2;if(a==o)n=r=0;else{var l=a-o;switch(r=s>.5?l/(2-a-o):l/(a+o),a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return{h:n,s:r,l:s}}function f(t,e,i){t=U(t,255),e=U(e,255),i=U(i,255);var n,r,a=h(t,e,i),o=c(t,e,i),s=a,l=a-o;if(r=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return{h:n,s:r,v:s}}function g(t,e,i,n){var r=[P(l(t).toString(16)),P(l(e).toString(16)),P(l(i).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function m(t,e,i,n){return[P(z(n)),P(l(t).toString(16)),P(l(e).toString(16)),P(l(i).toString(16))].join("")}function y(t,e){e=0===e?0:e||10;var i=d(t).toHsl();return i.s-=e/100,i.s=R(i.s),d(i)}function b(t,e){e=0===e?0:e||10;var i=d(t).toHsl();return i.s+=e/100,i.s=R(i.s),d(i)}function v(t){return d(t).desaturate(100)}function x(t,e){e=0===e?0:e||10;var i=d(t).toHsl();return i.l+=e/100,i.l=R(i.l),d(i)}function _(t,e){e=0===e?0:e||10;var i=d(t).toRgb();return i.r=h(0,c(255,i.r-l(-e/100*255))),i.g=h(0,c(255,i.g-l(-e/100*255))),i.b=h(0,c(255,i.b-l(-e/100*255))),d(i)}function A(t,e){e=0===e?0:e||10;var i=d(t).toHsl();return i.l-=e/100,i.l=R(i.l),d(i)}function w(t,e){var i=d(t).toHsl(),n=(i.h+e)%360;return i.h=n<0?360+n:n,d(i)}function C(t){var e=d(t).toHsl();return e.h=(e.h+180)%360,d(e)}function M(t){var e=d(t).toHsl(),i=e.h;return[d(t),d({h:(i+120)%360,s:e.s,l:e.l}),d({h:(i+240)%360,s:e.s,l:e.l})]}function I(t){var e=d(t).toHsl(),i=e.h;return[d(t),d({h:(i+90)%360,s:e.s,l:e.l}),d({h:(i+180)%360,s:e.s,l:e.l}),d({h:(i+270)%360,s:e.s,l:e.l})]}function E(t){var e=d(t).toHsl(),i=e.h;return[d(t),d({h:(i+72)%360,s:e.s,l:e.l}),d({h:(i+216)%360,s:e.s,l:e.l})]}function S(t,e,i){e=e||6,i=i||30;var n=d(t).toHsl(),r=360/i,a=[d(t)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,a.push(d(n));return a}function T(t,e){e=e||6;for(var i=d(t).toHsv(),n=i.h,r=i.s,a=i.v,o=[],s=1/e;e--;)o.push(d({h:n,s:r,v:a})),a=(a+s)%1;return o}d.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,i,n=this.toRgb();return t=n.r/255,e=n.g/255,i=n.b/255,.2126*(t<=.03928?t/12.92:r.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:r.pow((e+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:r.pow((i+.055)/1.055,2.4))},setAlpha:function(t){return this._a=L(t),this._roundA=l(100*this._a)/100,this},toHsv:function(){var t=f(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=f(this._r,this._g,this._b),e=l(360*t.h),i=l(100*t.s),n=l(100*t.v);return 1==this._a?"hsv("+e+", "+i+"%, "+n+"%)":"hsva("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=p(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=p(this._r,this._g,this._b),e=l(360*t.h),i=l(100*t.s),n=l(100*t.l);return 1==this._a?"hsl("+e+", "+i+"%, "+n+"%)":"hsla("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return g(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,i,n,r){var a=[P(l(t).toString(16)),P(l(e).toString(16)),P(l(i).toString(16)),P(z(n))];if(r&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1))return a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0);return a.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:l(this._r),g:l(this._g),b:l(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+l(this._r)+", "+l(this._g)+", "+l(this._b)+")":"rgba("+l(this._r)+", "+l(this._g)+", "+l(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:l(100*U(this._r,255))+"%",g:l(100*U(this._g,255))+"%",b:l(100*U(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+l(100*U(this._r,255))+"%, "+l(100*U(this._g,255))+"%, "+l(100*U(this._b,255))+"%)":"rgba("+l(100*U(this._r,255))+"%, "+l(100*U(this._g,255))+"%, "+l(100*U(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(F[g(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+m(this._r,this._g,this._b,this._a),i=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var r=d(t);i="#"+m(r._r,r._g,r._b,r._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+i+")"},toString:function(t){var e=!!t;t=t||this._format;var i=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(i=this.toRgbString()),"prgb"===t&&(i=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(i=this.toHexString()),"hex3"===t&&(i=this.toHexString(!0)),"hex4"===t&&(i=this.toHex8String(!0)),"hex8"===t&&(i=this.toHex8String()),"name"===t&&(i=this.toName()),"hsl"===t&&(i=this.toHslString()),"hsv"===t&&(i=this.toHsvString()),i||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return d(this.toString())},_applyModification:function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(x,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(A,arguments)},desaturate:function(){return this._applyModification(y,arguments)},saturate:function(){return this._applyModification(b,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(C,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(E,arguments)},triad:function(){return this._applyCombination(M,arguments)},tetrad:function(){return this._applyCombination(I,arguments)}},d.fromRatio=function(t,e){if("object"==typeof t){var i={};for(var n in t)t.hasOwnProperty(n)&&(i[n]="a"===n?t[n]:N(t[n]));t=i}return d(t,e)},d.equals=function(t,e){return!(!t||!e)&&d(t).toRgbString()==d(e).toRgbString()},d.random=function(){return d.fromRatio({r:u(),g:u(),b:u()})},d.mix=function(t,e,i){i=0===i?0:i||50;var n=d(t).toRgb(),r=d(e).toRgb(),a=i/100;return d({r:(r.r-n.r)*a+n.r,g:(r.g-n.g)*a+n.g,b:(r.b-n.b)*a+n.b,a:(r.a-n.a)*a+n.a})},d.readability=function(t,e){var i=d(t),n=d(e);return(r.max(i.getLuminance(),n.getLuminance())+.05)/(r.min(i.getLuminance(),n.getLuminance())+.05)},d.isReadable=function(t,e,i){var n,r,a=d.readability(t,e);switch(r=!1,(n=function(t){var e,i;e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),i=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA");"small"!==i&&"large"!==i&&(i="small");return{level:e,size:i}}(i)).level+n.size){case"AAsmall":case"AAAlarge":r=a>=4.5;break;case"AAlarge":r=a>=3;break;case"AAAsmall":r=a>=7}return r},d.mostReadable=function(t,e,i){var n,r,a,o,s=null,l=0;r=(i=i||{}).includeFallbackColors,a=i.level,o=i.size;for(var c=0;c<e.length;c++)(n=d.readability(t,e[c]))>l&&(l=n,s=d(e[c]));return d.isReadable(t,s,{level:a,size:o})||!r?s:(i.includeFallbackColors=!1,d.mostReadable(t,["#fff","#000"],i))};var B=d.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=d.hexNames=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[t[i]]=i);return e}(B);function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function U(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var i=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=c(e,h(0,parseFloat(t))),i&&(t=parseInt(t*e,10)/100),r.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function R(t){return c(1,h(0,t))}function D(t){return parseInt(t,16)}function P(t){return 1==t.length?"0"+t:""+t}function N(t){return t<=1&&(t=100*t+"%"),t}function z(t){return r.round(255*parseFloat(t)).toString(16)}function Q(t){return D(t)/255}var O,k,H,V=(k="[\\s|\\(]+("+(O="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+O+")[,|\\s]+("+O+")\\s*\\)?",H="[\\s|\\(]+("+O+")[,|\\s]+("+O+")[,|\\s]+("+O+")[,|\\s]+("+O+")\\s*\\)?",{CSS_UNIT:new RegExp(O),rgb:new RegExp("rgb"+k),rgba:new RegExp("rgba"+H),hsl:new RegExp("hsl"+k),hsla:new RegExp("hsla"+H),hsv:new RegExp("hsv"+k),hsva:new RegExp("hsva"+H),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function G(t){return!!V.CSS_UNIT.exec(t)}t.exports?t.exports=d:void 0===(n=function(){return d}.call(e,i,e,t))||(t.exports=n)}(Math)},function(t,e,i){t.exports=function(t){var e=i(43),u=i(44),d=i(4);if(t){if(void 0!==t.springCoeff)throw new Error("springCoeff was renamed to springCoefficient");if(void 0!==t.dragCoeff)throw new Error("dragCoeff was renamed to dragCoefficient")}t=u(t,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var p=c[t.dimensions];if(!p){var f=t.dimensions;p={Body:n(f,t.debug),createQuadTree:r(f),createBounds:a(f),createDragForce:o(f),createSpringForce:s(f),integrate:l(f)},c[f]=p}var g=p.Body,m=p.createQuadTree,y=p.createBounds,b=p.createDragForce,v=p.createSpringForce,x=p.integrate,_=i(45).random(42),A=[],w=[],C=m(t,_),M=y(A,t,_),I=v(t,_),E=b(t),S=[],T=new Map,B=0;U("nbody",(function(){if(0===A.length)return;C.insertBodies(A);var t=A.length;for(;t--;){var e=A[t];e.isPinned||(e.reset(),C.updateBodyForce(e),E.update(e))}})),U("spring",(function(){var t=w.length;for(;t--;)I.update(w[t])}));var F={bodies:A,quadTree:C,springs:w,settings:t,addForce:U,removeForce:function(t){var e=S.indexOf(T.get(t));if(e<0)return;S.splice(e,1),T.delete(t)},getForces:function(){return T},step:function(){for(var e=0;e<S.length;++e)S[e](B);var i=x(A,t.timeStep,t.adaptiveTimeStepWeight);return B+=1,i},addBody:function(t){if(!t)throw new Error("Body is required");return A.push(t),t},addBodyAt:function(t){if(!t)throw new Error("Body position is required");var e=(t=>new g(t))(t);return A.push(e),e},removeBody:function(t){if(t){var e=A.indexOf(t);if(!(e<0))return A.splice(e,1),0===A.length&&M.reset(),!0}},addSpring:function(t,i,n,r){if(!t||!i)throw new Error("Cannot add null spring to force simulator");"number"!=typeof n&&(n=-1);var a=new e(t,i,n,r>=0?r:-1);return w.push(a),a},getTotalMovement:function(){return 0},removeSpring:function(t){if(t){var e=w.indexOf(t);return e>-1?(w.splice(e,1),!0):void 0}},getBestNewBodyPosition:function(t){return M.getBestNewPosition(t)},getBBox:L,getBoundingBox:L,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(e){return void 0!==e?(t.gravity=e,C.options({gravity:e}),this):t.gravity},theta:function(e){return void 0!==e?(t.theta=e,C.options({theta:e}),this):t.theta},random:_};return function(t,e){for(var i in t)h(t,e,i)}(t,F),d(F),F;function L(){return M.update(),M.box}function U(t,e){if(T.has(t))throw new Error("Force "+t+" is already added");T.set(t,e),S.push(e)}};var n=i(37),r=i(38),a=i(39),o=i(40),s=i(41),l=i(42),c={};function h(t,e,i){if(t.hasOwnProperty(i)&&"function"!=typeof e[i]){var n=Number.isFinite(t[i]);e[i]=n?function(n){if(void 0!==n){if(!Number.isFinite(n))throw new Error("Value of "+i+" should be a valid number.");return t[i]=n,e}return t[i]}:function(n){return void 0!==n?(t[i]=n,e):t[i]}}}},function(t,e){t.exports=function(t){return 0===t?"x":1===t?"y":2===t?"z":"c"+(t+1)}},function(t,e,i){t.exports=function(t){"uniqueLinkId"in(t=t||{})&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n","\n","Note: there is also change in default behavior: From now on each graph\nis considered to be not a multigraph by default (each edge is unique)."),t.multigraph=t.uniqueLinkId);void 0===t.multigraph&&(t.multigraph=!1);if("function"!=typeof Map)throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var e=new Map,i=[],c={},h=0,u=t.multigraph?function(t,e,i){var n=l(t,e),r=c.hasOwnProperty(n);if(r||I(t,e)){r||(c[n]=0);var a="@"+ ++c[n];n=l(t+a,e+a)}return new s(t,e,i,n)}:function(t,e,i){var n=l(t,e);return new s(t,e,i,n)},d=[],p=E,f=E,g=E,m=E,y={addNode:x,addLink:function(t,e,n){g();var r=_(t)||x(t),a=_(e)||x(e),s=u(t,e,n);i.push(s),o(r,s),t!==e&&o(a,s);return p(s,"add"),m(),s},removeLink:M,removeNode:A,getNode:_,getNodeCount:w,getLinkCount:C,getLinksCount:C,getNodesCount:w,getLinks:function(t){var e=_(t);return e?e.links:null},forEachNode:B,forEachLinkedNode:function(t,i,n){var r=_(t);if(r&&r.links&&"function"==typeof i)return n?function(t,i,n){for(var r=0;r<t.length;++r){var a=t[r];if(a.fromId===i&&n(e.get(a.toId),a))return!0}}(r.links,t,i):function(t,i,n){for(var r=0;r<t.length;++r){var a=t[r],o=a.fromId===i?a.toId:a.fromId;if(n(e.get(o),a))return!0}}(r.links,t,i)},forEachLink:function(t){var e,n;if("function"==typeof t)for(e=0,n=i.length;e<n;++e)t(i[e])},beginUpdate:g,endUpdate:m,clear:function(){g(),B((function(t){A(t.id)})),m()},hasLink:I,hasNode:_,getLink:I};return n(y),function(){var t=y.on;y.on=function(){return y.beginUpdate=g=S,y.endUpdate=m=T,p=b,f=v,y.on=t,t.apply(y,arguments)}}(),y;function b(t,e){d.push({link:t,changeType:e})}function v(t,e){d.push({node:t,changeType:e})}function x(t,i){if(void 0===t)throw new Error("Invalid node identifier");g();var n=_(t);return n?(n.data=i,f(n,"update")):(n=new a(t,i),f(n,"add")),e.set(t,n),m(),n}function _(t){return e.get(t)}function A(t){var i=_(t);if(!i)return!1;g();var n=i.links;if(n){i.links=null;for(var r=0;r<n.length;++r)M(n[r])}return e.delete(t),f(i,"remove"),m(),!0}function w(){return e.size}function C(){return i.length}function M(t){if(!t)return!1;var e=r(t,i);if(e<0)return!1;g(),i.splice(e,1);var n=_(t.fromId),a=_(t.toId);return n&&(e=r(t,n.links))>=0&&n.links.splice(e,1),a&&(e=r(t,a.links))>=0&&a.links.splice(e,1),p(t,"remove"),m(),!0}function I(t,e){var i,n=_(t);if(!n||!n.links)return null;for(i=0;i<n.links.length;++i){var r=n.links[i];if(r.fromId===t&&r.toId===e)return r}return null}function E(){}function S(){h+=1}function T(){0===(h-=1)&&d.length>0&&(y.fire("changed",d),d.length=0)}function B(t){if("function"!=typeof t)throw new Error("Function is expected to iterate over graph nodes. You passed "+t);for(var i=e.values(),n=i.next();!n.done;){if(t(n.value))return!0;n=i.next()}}};var n=i(4);function r(t,e){if(!e)return-1;if(e.indexOf)return e.indexOf(t);var i,n=e.length;for(i=0;i<n;i+=1)if(e[i]===t)return i;return-1}function a(t,e){this.id=t,this.links=null,this.data=e}function o(t,e){t.links?t.links.push(e):t.links=[e]}function s(t,e,i,n){this.fromId=t,this.toId=e,this.data=i,this.id=n}function l(t,e){return t.toString()+"👉 "+e.toString()}},function(t,e,i){t.exports=function(t,e){if(!t)throw new Error("Graph structure cannot be undefined");var a=(e&&e.createSimulator||i(6))(e);if(Array.isArray(e))throw new Error("Physics settings is expected to be an object");var o=t.version>19?function(e){var i=t.getLinks(e);return i?1+i.size/3:1}:function(e){var i=t.getLinks(e);return i?1+i.length/3:1};e&&"function"==typeof e.nodeMass&&(o=e.nodeMass);var s=new Map,l={},c=0,h=a.settings.springTransform||r;c=0,t.forEachNode((function(t){m(t.id),c+=1})),t.forEachLink(b),t.on("changed",g);var u=!1,d={step:function(){if(0===c)return p(!0),!0;var t=a.step();d.lastMove=t,d.fire("step");var e=t/c<=.01;return p(e),e},getNodePosition:function(t){return _(t).pos},setNodePosition:function(t){var e=_(t);e.setPosition.apply(e,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(t){var e=l[t];if(e)return{from:e.from.pos,to:e.to.pos}},getGraphRect:function(){return a.getBBox()},forEachBody:f,pinNode:function(t,e){_(t.id).isPinned=!!e},isNodePinned:function(t){return _(t.id).isPinned},dispose:function(){t.off("changed",g),d.fire("disposed")},getBody:function(t){return s.get(t)},getSpring:function(e,i){var n;if(void 0===i)n="object"!=typeof e?e:e.id;else{var r=t.hasLink(e,i);if(!r)return;n=r.id}return l[n]},getForceVectorLength:function(){var t=0,e=0;return f((function(i){t+=Math.abs(i.force.x),e+=Math.abs(i.force.y)})),Math.sqrt(t*t+e*e)},simulator:a,graph:t,lastMove:0};return n(d),d;function p(t){var e;u!==t&&(u=t,e=t,d.fire("stable",e))}function f(t){s.forEach(t)}function g(e){for(var i=0;i<e.length;++i){var n=e[i];"add"===n.changeType?(n.node&&m(n.node.id),n.link&&b(n.link)):"remove"===n.changeType&&(n.node&&y(n.node),n.link&&v(n.link))}c=t.getNodesCount()}function m(e){var i=s.get(e);if(!i){var n=t.getNode(e);if(!n)throw new Error("initBody() was called with unknown node id");var r=n.position;if(!r){var o=function(t){var e=[];if(!t.links)return e;for(var i=Math.min(t.links.length,2),n=0;n<i;++n){var r=t.links[n],a=r.fromId!==t.id?s.get(r.fromId):s.get(r.toId);a&&a.pos&&e.push(a)}return e}(n);r=a.getBestNewBodyPosition(o)}(i=a.addBodyAt(r)).id=e,s.set(e,i),x(e),function(t){return t&&(t.isPinned||t.data&&t.data.isPinned)}(n)&&(i.isPinned=!0)}}function y(t){var e=t.id,i=s.get(e);i&&(s.delete(e),a.removeBody(i))}function b(t){x(t.fromId),x(t.toId);var e=s.get(t.fromId),i=s.get(t.toId),n=a.addSpring(e,i,t.length);h(t,n),l[t.id]=n}function v(e){var i=l[e.id];if(i){var n=t.getNode(e.fromId),r=t.getNode(e.toId);n&&x(n.id),r&&x(r.id),delete l[e.id],a.removeSpring(i)}}function x(t){var e=s.get(t);if(e.mass=o(t),Number.isNaN(e.mass))throw new Error("Node mass should be a number")}function _(t){var e=s.get(t);return e||(m(t),e=s.get(t)),e}},t.exports.simulator=i(6);var n=i(4);function r(){}},function(t,e){function i(t,e,i){var n,r,a,o,s;function l(){var c=Date.now()-o;c<e&&c>=0?n=setTimeout(l,e-c):(n=null,i||(s=t.apply(a,r),a=r=null))}null==e&&(e=100);var c=function(){a=this,r=arguments,o=Date.now();var c=i&&!n;return n||(n=setTimeout(l,e)),c&&(s=t.apply(a,r),a=r=null),s};return c.clear=function(){n&&(clearTimeout(n),n=null)},c.flush=function(){n&&(s=t.apply(a,r),a=r=null,clearTimeout(n),n=null)},c}i.debounce=i,t.exports=i},function(t,e,i){i(12),i(13),i(14),i(15),i(16),i(17),i(18),i(19),i(20),i(21),i(22),i(23),i(24),i(25),i(26),i(27),i(28),i(29),i(30),i(31),i(32),i(33),i(34),i(35),i(36),i(46),i(47),i(0),i(48),i(49),i(50),i(51),i(52),i(2),pauseButton=i(53),playButton=i(54),skipButton=i(55),rewindButton=i(56)},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-querygithub",{schema:{user:{type:"string"},token:{type:"string"},repos:{type:"array"},data:{type:"string"}},multiple:!1,init:function(){},update:function(t){let e=this.data,r=this.el,o=this;e.data&&t.data!==e.data?a(e.data,r,o):t.user===e.user&&t.repos===e.repos&&t.token===e.token||(e.user&&0===e.repos.length?n(e,r,o):e.repos.length>0&&i(e,r,o))},remove:function(){},pause:function(){},play:function(){},babiaData:void 0,babiaMetadata:{id:0},register:function(t){this.el;this.interestedElements.push(t),this.babiaData&&s(t,"babiaData")},unregister:function(t){const e=this.interestedElements.indexOf(t);e>-1&&this.interestedElements.splice(e,1)},interestedElements:[]});let i=(t,e,i)=>{let n=[];t.repos.forEach((i,r)=>{let a=new XMLHttpRequest,o="https://api.github.com/repos/"+t.user+"/"+i+"?_="+(new Date).getTime();a.open("get",o,!1),a.onload=function(){if(this.status>=200&&this.status<300){console.log("data OK in request.response",e.id);let t=JSON.parse(a.response);n.push(t)}else reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.send()}),i.babiaData=n,i.babiaMetadata={id:i.babiaMetadata.id++},o("babiaData",i)},n=(t,e,i)=>{let n=new XMLHttpRequest,a="https://api.github.com/users/"+t.user+"/repos?_="+(new Date).getTime();n.open("get",a),n.onload=function(){this.status>=200&&this.status<300?(console.log("data OK in request.response",e.id),i.babiaData=r(JSON.parse(n.response)),i.babiaMetadata={id:i.babiaMetadata.id++},o("babiaData",i)):(reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText))},n.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},n.send()},r=t=>{let e=[];return t.forEach((t,i)=>{e.push(t)}),e},a=(t,e,i)=>{let n=JSON.parse(t);i.babiaData=n,i.babiaMetadata={id:i.babiaMetadata.id++},o("babiaData",i)},o=(t,e)=>{e.interestedElements.forEach(e=>{s(e,t)})},s=(t,e)=>{t.emit("babiaQuerierDataReady",e)}},function(t,e,i){let n=i(0).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=i(2).NotiBuffer;AFRAME.registerComponent("babia-queryjson",{schema:{url:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data;if(e.data&&t.data!==e.data){let t=n(e.data);this.notiBuffer.set(t)}else t.url!==e.url&&this.getJSON(e.url)},remove:function(){},pause:function(){},play:function(){},getJSON:async function(t){let e=await fetch(t);if(200!=e.status)throw new Error(e.status);{let t=await e.json(),i=n(t);this.notiBuffer.set(i)}}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-queryes",{schema:{elasticsearch_url:{type:"string"},index:{type:"string"},query:{type:"string"},size:{type:"int",default:10},user:{type:"string"},password:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){},update:function(t){let e=this.data,r=this.el,a=this;if(e.data&&t.data!==e.data)n(e.data,r,a);else if(e.elasticsearch_url!==t.elasticsearch_url||e.index!==t.index||e.query!==t.query||e.size!==t.size){if(!e.elasticsearch_url||!e.index)return void console.error("elasicsearch_url and index must be defined");i(e,r,a)}},remove:function(){},pause:function(){},play:function(){},babiaData:void 0,babiaMetadata:{id:0},register:function(t){this.el;this.interestedElements.push(t),this.babiaData&&a(t,"babiaData")},unregister:function(t){const e=this.interestedElements.indexOf(t);e>-1&&this.interestedElements.splice(e,1)},interestedElements:[]});let i=(t,e,i)=>{let n=new XMLHttpRequest;n.open("get",`${t.elasticsearch_url}/${t.index}/_search?size=${t.size}&${t.query}`),n.onload=function(){if(this.status>=200&&this.status<300){if("string"==typeof n.response||n.response instanceof String){dataRaw=JSON.parse(n.response).hits.hits;let t=[];for(let e=0;e<dataRaw.length;e++)t[e]=dataRaw[e]._source}else{console.error("Unexpected response",n.response)}i.babiaData=dataRetrieved,i.babiaMetadata={id:i.babiaMetadata.id++},r("babiaData",i)}else reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},n.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},n.send()},n=(t,e,i)=>{let n=JSON.parse(t);i.babiaData=n,i.babiaMetadata={id:i.babiaMetadata.id++},r("babiaData",i)},r=(t,e)=>{e.interestedElements.forEach(e=>{a(e,t)})},a=(t,e)=>{t.emit("babiaQuerierDataReady",e)}},function(t,e,i){let n=i(0).findTargetComponent;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-ui",{schema:{target:{type:"string"}},multiple:!1,init:function(){console.log("WELCOME TO UI: Control your data.")},update:function(t){let e=this.data;this.targetComponent&&this.targetComponent.notiBuffer.unregister(this.notiBufferId),this.targetComponent=n(e,this),this.findQuerierComponents(this),this.targetComponent.visProperties&&(this.targetComponentVisProperties=this.targetComponent.visProperties),this.targetComponent.notiBuffer&&(this.notiBufferId=this.targetComponent.notiBuffer.register(this.updateInterfaceEventCallback.bind(this)))},targetComponent:void 0,targetComponentVisProperties:void 0,dataMetrics:void 0,interface:void 0,dataQueriers:void 0,handController:void 0,updateInterfaceEventCallback:function(t){let e=this;for(t&&a(e,t,e.targetComponentVisProperties);e.el.firstChild;)e.el.firstChild.remove();if(console.log("Generating interface..."),document.querySelector("#babia-menu-hand")){let t=document.querySelector("#babia-menu-hand");t.parentNode.removeChild(t),r(e,e.handController)}else e.interface=s(e,e.dataMetrics,e.el);document.addEventListener("controllerconnected",t=>{for(;e.el.firstChild;)e.el.firstChild.remove();controller=t.detail.name,"left"!==t.target.getAttribute(controller).hand||document.querySelector("#babia-menu-hand")||(e.handController=t.target.id,r(e,e.handController))})},findQuerierComponents:function(){this.dataQueriers=[],document.querySelectorAll("[babia-queryjson]").forEach(t=>{(t.id!=this.data.target||t.id==this.data.target&&"babia-filter"==!this.targetComponent.prodComponent.attrName)&&this.dataQueriers.push(t.id)}),document.querySelectorAll("[babia-queryes]").forEach(t=>{this.dataQueriers.push(t.id)}),document.querySelectorAll("[babia-querygithub]").forEach(t=>{this.dataQueriers.push(t.id)}),document.querySelectorAll("[babia-filter]").forEach(t=>{this.dataQueriers.push(t.id)})}});let r=(t,e)=>{let i=document.getElementById(e);t.interface=s(t,t.dataMetrics,i),t.interface.id="babia-menu-hand",t.interface.setAttribute("scale",{x:.03,y:.03,z:.03}),t.interface.setAttribute("position",{x:-.03*t.interface.width/2,y:.03*t.interface.height/2,z:-.1}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),d(t.handController,t.interface)},a=(t,e,i)=>{t.dataMetrics=[];let n,r=["height","radius","width","size","farea","fheight","area","depth"],a=[];n="babia-city"==t.targetComponent.attrName?o(e):"babia-boats"==t.targetComponent.attrName?o(e[0]):e[0],Object.keys(n).forEach(t=>{"number"==typeof n[t]&&a.push(t)}),i.forEach(i=>{r.includes(i)?t.dataMetrics.push({property:i,metrics:a}):t.dataMetrics.push({property:i,metrics:Object.keys(e[0])})})},o=t=>(t.children?child=o(t.children[0]):child=t,child),s=(t,e,i)=>{t.interface=document.createElement("a-entity"),t.interface.id="babia-menu";let n=0,r=0,a=0;if(t.dataQueriers.length>1){let e=h("Data",r,n);t.interface.appendChild(e),t.dataQueriers.forEach(e=>{r+=3.25;let i=u(t,e,r,n);i.classList.add("babiaxraycasterclass"),t.interface.appendChild(i)})}return--n,a<r&&(a=r),r=0,e.forEach(e=>{let i=h(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach(i=>{r+=3.25;let a=l(t,e.property,i,r,n);a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a)}),--n,a<r&&(a=r),r=0}),t.interface.width=a+3,t.interface.height=Math.abs(n),t.interface.setAttribute("position",{x:-t.interface.width/2,y:t.interface.height,z:0}),i.appendChild(t.interface),t.interface},l=(t,e,i,n,r)=>{let a=document.createElement("a-box");a.property=e,a.metric=i,a.classList.add("babiaxraycasterclass"),a.setAttribute("position",{x:n,y:r,z:0}),a.setAttribute("rotation",{x:0,y:0,z:0}),a.setAttribute("height",.8),a.setAttribute("width",3),a.setAttribute("depth",.01);let o=document.createElement("a-entity");return o.setAttribute("text",{value:i,align:"center",width:"10",color:"black"}),o.setAttribute("position","0 0 0.01"),a.appendChild(o),t.targetComponent.data[e]==i&&a.setAttribute("color","#555555"),c(a,t.targetComponent,!1),a},c=(t,e,i)=>{t.addEventListener("mouseenter",(function(){t.children[0].setAttribute("text",{color:"#FFFFFF"}),t.setAttribute("color","#333333")})),i?t.addEventListener("mouseleave",(function(){t.children[0].setAttribute("text",{color:"black"}),e.data.from==t.from?t.setAttribute("color","#555555"):""!=e.data.from&&e.data.from==t.from||t.setAttribute("color","#FFFFFF")})):t.addEventListener("mouseleave",(function(){t.children[0].setAttribute("text",{color:"black"}),e.data[t.property]==t.metric?t.setAttribute("color","#555555"):t.setAttribute("color","#FFFFFF")})),t.addEventListener("click",(function(){t.property&&t.metric?("babia-boats"==e.attrName&&"area"==t.property?(e.el.removeAttribute(e.attrName,"width"),e.el.removeAttribute(e.attrName,"depth")):"babia-boats"!=e.attrName||"width"!=t.property&&"depth"!=t.property||!e.el.getAttribute("babia-boats").area||(e.el.removeAttribute(e.attrName,"area"),"width"==t.property?e.el.setAttribute(e.attrName,"depth",t.metric):e.el.setAttribute(e.attrName,"width",t.metric)),e.el.setAttribute(e.attrName,t.property,t.metric)):t.from&&e.el.setAttribute(e.attrName,"from",t.from)}))},h=(t,e,i)=>{let n=document.createElement("a-plane");return n.setAttribute("position",{x:e,y:i,z:0}),n.setAttribute("rotation",{x:0,y:0,z:0}),n.setAttribute("height",.8),n.setAttribute("width",3),n.setAttribute("text",{value:t,align:"center",width:"10",color:"#FFFFFF"}),n.setAttribute("color","black"),n},u=(t,e,i,n)=>{let r=document.createElement("a-box");r.from=e,r.classList.add("babiaxraycasterclass"),r.setAttribute("position",{x:i,y:n,z:0}),r.setAttribute("rotation",{x:0,y:0,z:0}),r.setAttribute("height",.8),r.setAttribute("width",3),r.setAttribute("depth",.01);let a=document.createElement("a-entity");return a.setAttribute("text",{value:e,align:"center",width:"10",color:"black"}),a.setAttribute("position","0 0 0.01"),r.appendChild(a),t.targetComponent.prodComponent&&t.targetComponent.prodComponent.el.id==e?r.setAttribute("color","#555555"):r.setAttribute("color","#FFFFFF"),c(r,t.targetComponent,!0),r},d=(t,e)=>{let i=!0;document.getElementById(t).addEventListener("gripdown",(function(){i?(i=!1,e.setAttribute("visible",!1)):(i=!0,e.setAttribute("visible",!0))}))}},function(t,e,i){let n=i(0).findProdComponent,r=i(0).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const a=i(2).NotiBuffer;AFRAME.registerComponent("babia-filter",{schema:{from:{type:"string"},filter:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new a},update:function(t){let e=this.data,i=this.el;if(!e.data||t.data===e.data&&e.filter===t.filter)e.from===t.from&&e.filter===t.filter||(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i,"babia-filter"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));else{let t=r(e.data);this.processData(t)}},remove:function(){},pause:function(){},play:function(){},prodComponent:void 0,notiBufferId:void 0,processData:function(t){let e,i=this.data.filter.split("=");i[0]&&i[1]?(e=t.filter(t=>t[i[0]]==i[1]),this.notiBuffer.set(e)):console.error("Error on filter, please use key=value syntax")}})},function(e,i,n){let r=n(0).findProdComponent,a=n(0).parseJson;const o=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function s(e,i,n){for(t=0;t<e.length&&e[t][i]!==n;)t++;return t<e.length&&e[t]}AFRAME.registerComponent("babia-treebuilder",{schema:{from:{type:"string"},field:{type:"string"},split_by:{type:"string"},data:{type:"string"}},multiple:!1,prodComponent:void 0,notiBufferId:void 0,init:function(){this.notiBuffer=new o},update:function(t){let e=this.data,i=this.el;if(!e.data||t.data===e.data&&e.field===t.field&&e.split_by===t.split_by)e.from===t.from&&e.field===t.field&&e.split_by===t.split_by||(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=r(e,i,"babia-treebuilder"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));else{let t=a(e.data);this.processData(t)}},processData:function(t){let e=this.data,i=[];for(let n=0;n<t.length;n++){let r=t[n][e.field].split(e.split_by),a=i;for(let i=0;i<r.length;i++){if(!r[i])continue;let o=r[i],l=s(a,"name",o);if(l)a=l.children;else{let s={};i===r.length-1?(s=t[n],s.uid=o):(s.children=[],s.uid=t[n][e.field].split(o)[0]+o),s.name=o,a.push(s),a=s.children}}}this.notiBuffer.set(i)}})},function(t,e,i){let n=i(0).findProdComponent,r=i(0).findNavComponent,a=i(0).parseJson;class o{constructor(t,e){this.data={};for(let i of t){let t=i[e];this.data[t]?this.data[t].push(i):this.data[t]=[i]}this.selectors=Object.keys(this.data).sort(),this.length=this.selectors.length,this.current=0,this.step=1}next(){let t=this.data[this.selectors[this.current]];return this.current+this.step<=this.length-1?this.current+=this.step:(this.current=this.length-1,this.current=this.length),console.log("next: ",this.data),t}prev(){let t=this.data[this.selectors[this.current]];return this.current+this.step>0?this.current-=this.step:this.current=0,console.log("prev: ",this.data),t}setValue(t){let e=this.data[this.selectors[t]];return this.current=t+1,console.log("setValue: ",this.data),e}}if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const s=i(2).NotiBuffer;AFRAME.registerComponent("babia-selector",{schema:{from:{type:"string"},controller:{type:"string"},select:{type:"string",default:"date"},timeout:{type:"number",default:6e3},data:{type:"string"}},multiple:!1,isPaused:void 0,toPresent:void 0,speed:void 0,interval:void 0,init:function(){this.notiBuffer=new s,this.navNotiBuffer=new s,this.isPaused=!1,this.toPresent=!0,this.speed=1},babiaMetadata:{id:0},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from&&(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i,"babia-selector"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));e.controller&&(this.selectorController=document.querySelector("#"+e.controller),this.navComponent&&this.navComponent.notiBuffer.unregister(this.navNotiBufferId,this),this.navComponent=r(e,i),this.navComponent.notiBuffer&&(this.navNotiBufferId=this.navComponent.notiBuffer.register(this.processEvent.bind(this),this)))},nextSelect:function(){this.selectable.current>this.selectable.length-1?(this.selectable.current=this.selectable.length-1,this.isPaused=!0,this.navNotiBuffer.set("babiaStop")):(this.newData=this.selectable.next(),this.notiBuffer.set(this.newData),this.navNotiBuffer.set(this.selectable.current),this.babiaMetadata={id:this.selectable.current})},prevSelect:function(){this.selectable.current>=0?(this.newData=this.selectable.prev(),this.notiBuffer.set(this.newData),this.navNotiBuffer.set(this.selectable.current),this.babiaMetadata={id:this.selectable.current}):(this.selectable.current=0,this.isPaused=!0,this.navNotiBuffer.set("babiaStop"))},setSelect:function(t){(t!=this.selectable.current-1&&this.toPresent||t!=this.selectable.current+1&&!this.toPresent)&&(this.newData=this.selectable.setValue(t),this.toPresent?this.babiaMetadata={id:t++}:(this.babiaMetadata={id:t--},this.selectable.current-=2),this.notiBuffer.set(this.newData),this.navNotiBuffer.set(t))},loop:function(){this.isPaused||(this.toPresent?this.nextSelect():this.prevSelect())},prodComponent:void 0,navComponent:void 0,prodNotiBufferId:void 0,navNotiBufferId:void 0,newData:void 0,processData:function(t){this.selectable=new o(t,this.data.select),this.navNotiBuffer.set(this.selectable.current);let e=this;this.nextSelect(),this.interval=window.setInterval((function(){e.loop()}),e.data.timeout*e.speed)},processEvent:function(t){if(t.includes("babiaStop")?this.isPaused=!0:t.includes("babiaContinue")?this.isPaused=!1:t.includes("babiaToPresent")?(this.toPresent=!0,this.selectable.current!=this.selectable.length&&(this.selectable.current+=2)):t.includes("babiaToPast")?(this.toPresent=!1,this.selectable.current<1?this.selectable.current=0:this.selectable.current-=2):t.includes("babiaSetPosition")?(this.isPaused=!0,this.setSelect(parseInt(t.substring(16),10)),this.navNotiBuffer.set("babiaStop")):t.includes("babiaSetStep")&&(this.selectable.step=parseInt(t.substring(12),10),this.toPresent?this.current+this.selectable.step>this.selectable.length?this.current=this.selectable.length-1:this.current+=this.selectable.step-1:this.current-this.selectable.step<0?this.current=0:this.current-=this.selectable.step+1),t.includes("babiaSetSpeed")){this.speed=parseInt(t.substring(13),10);let e=this.data.timeout/this.speed,i=this;clearInterval(this.interval),this.interval=window.setInterval((function(){i.loop()}),e)}}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-interaction-mapper",{schema:{input:{type:"string"},output:{type:"string"}},multiple:!1,init:function(){let t=this.data,e=this.el;t.input&&t.output&&i(t,e)},update:function(t){let e=this.data,n=this.el;e!==t&&(e.input===t.input&&e.output===t.output||(console.log("Change event because from has changed"),n.removeEventListener(t.input,(function(t){})),i(e,n)))},remove:function(){},pause:function(){},play:function(){}});let i=(t,e)=>{e.addEventListener(t.input,(function(i){e.emit(t.output,i,!1)}))}},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-debug-data",{schema:{inputEvent:{type:"string"}},multiple:!1,init:function(){let t=this.data,e=this.el;t.input&&t.output&&i(t,e)},update:function(t){let e=this.data,n=this.el;e!==t&&e.inputEvent!==t.inputEvent&&(console.log("Change event because from has changed"),n.removeEventListener(e.inputEvent,(function(t){})),i(e,n))},remove:function(){},pause:function(){},play:function(){}});let i=(t,e)=>{e.addEventListener(t.inputEvent,(function(i){n(t,e)}))},n=(t,e)=>{if(!e.querySelector(".debug-data")){let t=function(t,e,i){let n=document.createElement("a-plane");n.setAttribute("color","white"),n.setAttribute("class","debug_data"),n.setAttribute("width",10),n.setAttribute("height",10);let r=e.getAttribute("position"),a=0,o=0;e.getAttribute("geometry")&&("box"===e.components.geometry.data.primitive?(a=e.getAttribute("geometry").width/2,o=e.getAttribute("geometry").height/2):"sphere"===e.components.geometry.data.primitive?a=e.getAttribute("geometry").radius:(a=0,o=0));n.setAttribute("position",{x:r.x+a+5,y:0-o+5,z:r.z});let s=document.createElement("a-text");return s.setAttribute("value",JSON.stringify(i)),s.setAttribute("width",10),s.setAttribute("height",10),s.setAttribute("color","black"),s.setAttribute("position",{x:0-n.getAttribute("width")/2,y:0-e.getAttribute("height")/2,z:0}),n.appendChild(s),n}(0,e,e.getAttribute("babiaData"));e.appendChild(t)}}},function(t,e,i){let n=i(0).findProdComponent,r=i(0).updateTitle,a=i(0).parseJson;const o=i(0).colors,s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function l(t,e,i,n,r){let a=o.get(n,r);console.log("Generating slice...");let s=document.createElement("a-cylinder");return s.setAttribute("color",a),s.setAttribute("theta-start",t),s.setAttribute("theta-length",e),s.setAttribute("side","double"),s.setAttribute("radius",i),s}function c(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e){let i=e[t.key]+": "+e[t.size],n=2;i.length>16&&(n=i.length/8);let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:0,z:-2}),r.setAttribute("rotation",{x:-90,y:0,z:0}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e[t.key]+": "+e[t.size],align:"center",width:6,color:"black"}),r.classList.add("babiaxrLegend"),r}(t,i),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-pie",{schema:{data:{type:"string"},size:{type:"string",default:"size"},key:{type:"string",default:"key"},from:{type:"string"},legend:{type:"boolean"},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},animation:{type:"boolean",default:!1}},visProperties:["size","key"],multiple:!1,init:function(){this.notiBuffer=new s},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from?(this.slice_array=[],this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&(this.slice_array=[],this.processData(this.newData))},tick:function(t,e){if(this.data.animation&&this.loaded){let i=document.getElementsByClassName("babiaxrChart")[0].children;for(let n in this.slice_array){let r=this.slice_array[n].delay,a=this.slice_array[n].degreeLenght,o=parseFloat(i[n].getAttribute("theta-length"));t>=r&&o<a&&(o+=360*e/this.total_duration,o>a&&(o=a),i[n].setAttribute("theta-length",o))}}},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},loaded:!1,slice_array:[],total_duration:4e3,updateTitle:function(){const t=r(this.data,{x:-90,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-pie:",t);const e=this.data,i=this.el,n=e.animation,r=e.palette;let a=0,o=0,s=0,h=0;for(let i of t)h+=i[e.size];this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl);let u=0;for(let d of t){let t;if(o=360*d[e.size]/h,n){let e=this.total_duration*o/360;this.slice_array.push({degreeLenght:o,duration:e,delay:u}),u+=e,t=l(a,.01,1,s,r)}else t=l(a,o,1,s,r);t.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(t),a+=o,e.legend&&c(e,t,d,i),s++}this.updateTitle()},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating pie..."),this.updateChart(),this.loaded=!0,this.notiBuffer.set(this.newData)}})},function(t,e,i){let n=i(0).findProdComponent,r=i(0).updateTitle,a=i(0).parseJson;const o=i(0).colors,s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-bars",{schema:{data:{type:"string"},height:{type:"string",default:"height"},x_axis:{type:"string",default:"x_axis"},from:{type:"string"},legend:{type:"boolean",default:!1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"vec3",default:{x:0,y:0,z:0}},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},uiLink:{type:"boolean",default:!1},uiLinkPosition:{type:"vec3",default:{x:-4.5,y:2,z:2.5}}},visProperties:["height","x_axis"],multiple:!1,init:function(){this.notiBuffer=new s,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){let e=this.data,i=this.el;if(e.index||(e.index=e.x_axis),console.log("Starting Bars"),this.animation=e.animation,this.bar_array=[],e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from?(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&(this.slice_array=[],this.processData(this.newData));e.uiLink&&c(i,e.uiLinkPosition)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},widthBars:1,total_duration:3e3,proportion:void 0,valueMax:void 0,xLabels:[],xTicks:[],updateTitle:function(){this.titleEl=r(this.data,{x:0,y:0,z:0})},updateAxis:function(t,e,i,n){const r=this.data;r.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:r.palette}),this.xAxisEl.setAttribute("position",{x:0,y:0,z:this.widthBars/2}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:this.widthBars/2}),r.axis_name&&(r.index?this.xAxisEl.setAttribute("babia-axis-x","name",r.index):this.xAxisEl.setAttribute("babia-axis-x","name",r.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",r.height)))},updateChart:function(){let t;t=this.currentData?this.currentData:this.newData,console.log("Data babia-bars:",t);const e=this.data,i=e.palette;this.updateTitle();let n=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*n/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=n;let r=this.chartEl,a=r.querySelectorAll("a-entity[babia-bar]"),s={};for(let t of a){s[t.getAttribute("babia-name")]={el:t,found:!1}}let l=[],c=[],h=0;for(let n=0;n<t.length;n++){let a,u=t[n],d=u[e.x_axis],p=n*this.widthBars*1.25;s[d]&&!u._not?(a=s[d].el,s[d].found=!0):(a=document.createElement("a-entity"),a.setAttribute("babia-name",d),a.id=u[e.index],a.object3D.position.x=p,r.appendChild(a)),a.setAttribute("babia-bar",{height:u[e.height]*this.lengthY/this.maxValue,width:this.widthBars,depth:this.widthBars,color:o.get(h,i),label:"events",animation:e.animation}),e.legend&&a.setAttribute("babia-bar",{labelText:d+": "+u[e.height]}),p!==a.object3D.position.x&&(e.animation?a.setAttribute("animation",{property:"object3D.position.x",to:p,dur:e.dur}):a.object3D.position.x=p),l.push(u[e.x_axis]),c.push(p),h++}for(let t in s)s[t].found||s[t].el.remove();const u=this.widthBars*(1.25*t.length);this.updateAxis(l,c,u,this.maxValue)},processData:function(t){console.log("processData",this);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.notiBuffer.set(this.newData),e.incremental)if(this.newData.forEach(t=>{let i=!1;for(let n in this.currentData)this.currentData[n][e.index]==t[e.index]&&(this.currentData[n]=t,i=!0);i||this.currentData.push(t)}),e.keepHeight)this.maxValue=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]}))),console.log("Re-draw the chart"),this.updateChart();else{this.newData.forEach(t=>{if(t._not)this.chartEl.querySelector("#"+t[e.index]).setAttribute("babia-bar","height",-.1);else if(this.chartEl.querySelector("#"+t[e.index]))this.chartEl.querySelector("#"+t[e.index]).setAttribute("babia-bar",{height:t[e.height]*e.chartHeight/this.maxValue,labelText:t[e.index]+": "+t[e.height]});else{let i=this.chartEl.querySelectorAll("[babia-bar]").length,n=this.chartEl.querySelectorAll("[babia-bar]")[i-1].getAttribute("position").x+this.widthBars+this.widthBars/4,r=l(this,e,t,i,e.palette,n);this.chartEl.appendChild(r),this.xLabels.push(r.id),this.xTicks.push(n)}});let t=this.xTicks[this.xTicks.length-1]+3*this.widthBars/4;if(!e.chartHeight||!e.keepHeight){let t=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]})));this.lengthY=t*e.chartHeight/this.maxValue,this.maxValue=t}this.updateAxis(this.xLabels,this.xTicks,t,this.maxValue)}else this.currentData=JSON.parse(JSON.stringify(this.newData)),this.updateChart()}});let l=(t,e,i,n,r,a)=>{let s=document.createElement("a-entity");return s.setAttribute("babia-bar",{height:i[t.data.height]*e.chartHeight/t.maxValue,width:t.widthBars,depth:t.widthBars,color:o.get(n,r),label:"events",animation:e.animation}),e.legend&&s.setAttribute("babia-bar",{labelText:i[t.data.x_axis]+": "+i[t.data.height]}),s.setAttribute("position",{x:a,y:0,z:0}),s.id=i[t.data.index],s},c=(t,e)=>{let i=document.createElement("a-entity");if(!t.id){let e="bars"+Math.floor(1e3*Math.random());t.id=e}console.log("id:",t.id),i.setAttribute("babia-ui-link",{viz:t.id}),i.setAttribute("position",{x:e.x,y:e.y,z:e.z}),t.appendChild(i),console.log("Create Button",t)}},function(t,e,i){var n=this;let r=i(0).findProdComponent,a=i(0).updateTitle,o=i(0).parseJson;const s=i(0).colors,l=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-barsmap",{schema:{data:{type:"string"},height:{type:"string",default:"height"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string",default:"x_axis"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3}},visProperties:["height","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new l,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){let e=this.data,i=this.el;if(e.index||(e.index=e.x_axis),console.log("Starting Barsmap"),this.animation=e.animation,this.bar_array=[],e.data&&t.data!==e.data){let t=o(e.data);this.processData(t)}else this.data.from!==t.from?(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=r(this.data,i),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&(this.slice_array=[],this.processData(this.newData))},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},widthBars:1,proportion:void 0,valueMax:void 0,xLabels:[],zLabels:[],xTicks:[],zTicks:[],total_duration:3e3,updateTitle:function(){this.titleEl=a(this.data,{x:0,y:0,z:0})},updateAxis:function(t,e,i,n,r,a,o){const s=this.data;s.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:s.palette,align:"behind"}),this.xAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:-this.widthBars/2}),this.zAxisEl||(this.zAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.zAxisEl)),this.zAxisEl.setAttribute("babia-axis-z",{labels:r,ticks:a,length:o,palette:s.palette,align:"left"}),this.zAxisEl.setAttribute("position",{x:0-this.widthBars/2,y:0,z:-this.widthBars/2}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:-this.widthBars/2}),s.axis_name&&((s.index=!1)?this.xAxisEl.setAttribute("babia-axis-x","name",s.index):this.xAxisEl.setAttribute("babia-axis-x","name",s.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",s.height),this.zAxisEl.setAttribute("babia-axis-z","name",s.z_axis)))},updateChart:function(){let t;t=this.currentData?this.currentData:this.newData,console.log("Data babia-barsmap:",t);const e=this.data,i=e.palette;this.updateTitle();let n=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*n/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=n;let r=[],a=[],o=[],l=[],c=this.chartEl;console.log(t);for(let h=0;h<t.length;h++){let u,d,p=t[h],f=p[e.x_axis],g=p[e.z_axis];r.includes(f)||(r.push(f),u=(r.length-1)*this.widthBars*1.25,a.push(u+this.widthBars/2)),u||(u=r.indexOf(f)*this.widthBars*1.25),o.includes(g)||(o.push(g),d=(o.length-1)*this.widthBars*1.25,l.push(d+this.widthBars/2)),d||(d=o.indexOf(g)*this.widthBars*1.25),console.log(f+" "+g+" "+u+" "+d);let m,y=r.indexOf(f);m||(m=document.createElement("a-entity"),m.id=f+g,m.classList.add("babiaxraycasterclass"),m.object3D.position.x=u,m.object3D.position.z=d,c.appendChild(m)),p._not?m.setAttribute("babia-bar",{height:-.1,color:s.get(y,i)}):m.setAttribute("babia-bar",{height:p[e.height]*this.lengthY/n,width:this.widthBars,depth:this.widthBars,color:s.get(y,i),label:"events",animation:e.animation}),e.legend&&m.setAttribute("babia-bar",{labelText:f+", "+g+": "+p[e.height]})}const h=this.widthBars*(1.25*r.length+.75),u=this.widthBars*(1.25*o.length+.75);this.updateAxis(r,a,h,n,o,l,u),this.xLabels=r,this.xTicks=a,this.zLabels=o,this.zTicks=l},processData:function(t){console.log("processData",this);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.notiBuffer.set(this.newData),e.incremental)if(this.newData.forEach(t=>{let i=!1;for(let n in this.currentData)this.currentData[n][e.x_axis]==t[e.x_axis]&&this.currentData[n][e.z_axis]==t[e.z_axis]&&(this.currentData[n]=t,i=!0);i||this.currentData.push(t)}),e.keepHeight)this.maxValue=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]}))),console.log("Re-draw the chart"),this.updateChart();else{console.log("Keep ---\x3e Update"),this.newData.forEach(t=>{t._not?this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis]).setAttribute("babia-bar","height",-.1):this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis])?this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis]).setAttribute("babia-bar",{height:t[e.height]*e.chartHeight/this.maxValue,labelText:t[e.x_axis]+","+t[e.z_axis]+": "+t[e.height]}):c(this,e,t,this.maxValue,s,this.xLabels,this.zLabels,this.xTicks,this.zTicks)});let t=this.xTicks[this.xTicks.length-1]+3*this.widthBars/4,i=this.zTicks[this.zTicks.length-1]+3*this.widthBars/4;if(!e.chartHeight||!e.keepHeight){let t=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]})));this.lengthY=t*e.chartHeight/this.maxValue,this.maxValue=t}this.updateAxis(this.xLabels,this.xTicks,t,this.maxValue,this.zLabels,this.zTicks,i)}else this.currentData=JSON.parse(JSON.stringify(this.newData)),this.updateChart()}});let c=(t,e,i,r,a,o,l,c,h)=>{let u,d,p=i[e.x_axis],f=i[e.z_axis];o.includes(p)||(o.push(p),u=(o.length-1)*n.widthBars*1.25,c.push(u+n.widthBars/2)),u||(u=o.indexOf(p)*n.widthBars*1.25),l.includes(f)||(l.push(f),d=(l.length-1)*n.widthBars*1.25,h.push(d+n.widthBars/2)),d||(d=l.indexOf(f)*n.widthBars*1.25);let g=o.indexOf(p),m=document.createElement("a-entity");return m.id=p+f,m.classList.add("babiaxraycasterclass"),m.setAttribute("babia-bar",{height:i[e.height]*n.lengthY/r,width:n.widthBars,depth:n.widthBars,color:s.get(g,a),label:"events",animation:e.animation}),m.object3D.position.x=u,m.object3D.position.z=d,chartEl.appendChild(m),e.legend&&m.setAttribute("babia-bar",{labelText:i[t.data.x_axis]+": "+i[t.data.height]}),n.xLabels=o,n.xTicks=c,n.zLabels=l,n.zTicks=h,bar}},function(t,e,i){let n=i(0).findProdComponent,r=i(0).updateTitle,a=i(0).parseJson;const o=i(0).colors;i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function s(t,e,i,n,r,a,s,l,c,h){let u=o.get(i,n);console.log("Generating bubble..."),l?(t/=l,e/=l):(c||h)&&(c&&(t*=c),h&&(e*=h));let d=document.createElement("a-sphere");if(d.setAttribute("color",u),d.setAttribute("radius",e),s){let i=r.toString()+" "+e.toString()+" "+a.toString(),n=r.toString()+" "+(e+t).toString()+" "+a.toString();d.setAttribute("animation__position",{property:"position",from:i,to:n,dur:"3000",easing:"linear"})}else d.setAttribute("position",{x:r,y:e+t,z:a});return d}function l(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e,i){let n=e[t.x_axis]+": \n Radius:"+e[t.radius]+"\nHeight:"+e[t.height],r=2;n.length>16&&(r=n.length/8);let a=i.getAttribute("position"),o=parseFloat(i.getAttribute("radius")),s=document.createElement("a-plane");return s.setAttribute("position",{x:a.x,y:a.y+o+1,z:a.z+.1}),s.setAttribute("rotation",{x:0,y:0,z:0}),s.setAttribute("height","1"),s.setAttribute("width",r),s.setAttribute("color","white"),s.setAttribute("text",{value:n,align:"center",width:6,color:"black"}),s.classList.add("babiaxrLegend"),s}(t,i,e),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-bubbles",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number"}},visProperties:["height","radius","x_axis","z_axis"],multiple:!1,update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from?(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&this.processData(this.newData)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){const t=r(this.data,{x:0,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-bubbles:",t);const e=this.data,i=this.el,n=e.animation,r=e.palette,a=e.scale;let o=e.heightMax,c=e.radiusMax,h=[],u=[],d=[],p=[],f=0,g=0,m=0,y=0,b=0,v=0,x={},_={},A=Math.max.apply(Math,t.map((function(t){return t[e.height]}))),w=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));a&&(A/=a,w/=a),o||(o=A),proportion=o/A,c||(c=w),radius_scale=c/w,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl),a?(b=w/a,v=w/a):(b=w*radius_scale,v=w*radius_scale);for(let o of t){let t=o[e.x_axis],c=o[e.z_axis],A=o[e.height],C=o[e.radius];x[t]?(m=x[t].posX,f=x[t].colorId):(m+=a?2*w/a+.5:2*w*radius_scale+.5,f=g,x[t]={posX:m,colorId:f},h.push(t),u.push(m),g++),_[c]?y=_[c].posZ:(y=a?v+2*w/a+.5:v+2*w*radius_scale+.5,_[c]={posZ:y},d.push(c),p.push(y)),m>b&&(b=m),y>v&&(v=y);let M=s(A,C,f,r,m,y,n,a,proportion,radius_scale);M.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(M),e.legend&&l(e,M,o,i)}if(e.axis){const t=b,e=v,i=o;this.updateAxis(h,u,t,d,p,e,A,i)}this.updateTitle()},updateAxis:function(t,e,i,n,r,a,o,s){let l=document.createElement("a-entity");this.chartEl.appendChild(l),l.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:this.data.palette}),l.setAttribute("position",{x:0,y:0,z:0});let c=document.createElement("a-entity");this.chartEl.appendChild(c),c.setAttribute("babia-axis-y",{maxValue:o,length:s}),c.setAttribute("position",{x:0,y:0,z:0});let h=document.createElement("a-entity");this.chartEl.appendChild(h),h.setAttribute("babia-axis-z",{labels:n,ticks:r,length:a}),h.setAttribute("position",{x:0,y:0,z:0}),this.data.axis_name&&(l.setAttribute("babia-axis-x","name",this.data.x_axis),c.setAttribute("babia-axis-y","name",this.data.height),h.setAttribute("babia-axis-z","name",this.data.z_axis))},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating bubbles..."),this.updateChart(),this.notiBuffer.set(this.newData)}})},function(t,e,i){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let n;AFRAME.registerComponent("babiaxr-codecity",{schema:{absolute:{type:"boolean",default:!1},width:{type:"number",default:20},depth:{type:"number",default:20},split:{type:"string",default:"naive"},data:{type:"string",default:JSON.stringify({id:"CodeCity",area:1,height:1})},farea:{type:"string",default:"area"},fmaxarea:{type:"string",default:"max_area"},fheight:{type:"string",default:"height"},titles:{type:"boolean",default:!0},building_color:{type:"color",default:"#E6B9A1"},building_model:{type:"string",default:null},base:{type:"boolean",default:!0},base_thick:{type:"number",default:.2},base_color:{type:"color",default:"#98e690"},border:{type:"number",default:1},extra:{type:"number",default:1.4},zone_elevation:{type:"number",default:1},unicolor:{type:"color",default:!1},wireframe:{type:"boolean",default:!1},colormap:{type:"array",default:["blue","green","yellow","brown","orange","magenta","grey","cyan","azure","beige","blueviolet","coral","crimson","darkblue","darkgrey","orchid","olive","navy","palegreen"]},time_evolution_delta:{type:"number",default:8e3},time_evolution_init:{type:"string",default:"data_0"},time_evolution_past_present:{type:"boolean",default:!1},time_evolution_animation:{type:"boolean",default:!0},time_evolution_color:{type:"boolean",default:!1},ui_navbar:{type:"string",default:""}},multiple:!1,init:function(){},update:function(t){this.loader=new THREE.FileLoader;let e=this.data,i=this.el;C=e.building_color,n=i,"string"==typeof e.data?e.data.endsWith("json")?raw_items=l(e):raw_items=JSON.parse(e.data):raw_items=e.data,i.emit("babiaxr-dataLoaded",{data:raw_items,codecity:!0}),m=e.time_evolution_delta,this.zone_data=raw_items;let a,s,d=new r({data:this.zone_data,extra:function(t){return t*e.extra},farea:e.farea,fheight:e.fheight,fmaxarea:e.fmaxarea});1==e.absolute?(a=Math.sqrt(d.areas.canvas)*e.width/e.depth,s=d.areas.canvas/a):(a=e.width,s=e.depth);let y=new o({width:a,depth:s,x:0,z:0});d.add_rects({rect:y,split:e.split,relative:!1});let b=document.createElement("a-entity");this.base=b;d.draw_rects({ground:y,el:b,base:e.base,level:0,elevation:0,relative:!1,base_thick:e.base_thick,wireframe:e.wireframe,building_color:e.building_color,base_color:e.base_color,model:e.building_model,visible:!0,titles:e.titles}),i.appendChild(b),c&&(time_evolution_past_present=e.time_evolution_past_present,h=e.time_evolution_animation,u=e.time_evolution_color,A(e),function(){const t=Object.keys(g).length;let e=0;p&&(document.addEventListener("babiaxrToPast",(function(){time_evolution_past_present=!1})),document.addEventListener("babiaxrToPresent",(function(){time_evolution_past_present=!0})),document.addEventListener("babiaxrStop",(function(){clearInterval(_)})),document.addEventListener("babiaxrContinue",(function(){_=setTimeout((function(){M(t,e),e<t-1&&i()}),m)})),document.addEventListener("babiaxrSkipNext",(function(){time_evolution_past_present=!1,clearInterval(_),R(t-x-1),f=t-x-1,e--,x--,I()})),document.addEventListener("babiaxrSkipPrev",(function(){time_evolution_past_present=!0,clearInterval(_),R(t-x-3),f=t-x-3,e++,x++,I()})),document.addEventListener("babiaxrShow",(function(i){clearInterval(_),eventData=i.detail.data,e=eventData.data,R(t-e-1),f=t-e-1,x=e-1,I(!0)})));let i=()=>{_=setTimeout((function(){p&&R(t-x-2),f=t-x-2,M(t,e),e<t-1&&i()}),m)};i()}())},remove:function(){},play:function(){}});let r=class{constructor({data:t,extra:e=function(t){return t},farea:i="area",fmaxarea:n="max_area",fheight:r="height"}){this.data=t,this.id=this.data.id,this.extra=e,this.farea=i,this.fmaxarea=n,this.fheight=r,this.areas=this.areas_tree(),this.el=null,this.pending_rects=0}areas_tree({data:t=this.data,level:e=0}={}){let i=t,n={data:i};if("children"in i){n.inner=0,n.area=0,n.children=[];for(const t of i.children){let i=this.areas_tree({data:t,level:e+1});n.inner+=i.canvas,n.area+=i.area,n.children.push(i)}}else n.area=i[this.farea],n.max_area=i[this.fmaxarea],n.inner=n.max_area,n.inner_real=n.area;return n.canvas=this.extra(n.inner,e),n}add_rects({rect:t,area:e=this.areas,relative:i=!0,split:n="naive"}={}){if(e.rect=t,e.rect.inner(e.canvas,e.inner,e.inner_real),"children"in e){let t,r=new a(e.children.map(t=>t.canvas),e.inner);if("naive"===n)t=e.rect.split(r,i);else{if("pivot"!==n)throw new Error("CodeCity: Unknwon split method");t=e.rect.split_pivot(r,i)}for(const r in e.children)this.add_rects({rect:t[r],area:e.children[r],relative:i,split:n})}}draw_rects({ground:t,el:e,area:i=this.areas,level:r=0,elevation:a=0,relative:o=!0,base_thick:s=.2,wireframe:l=!1,building_color:c="red",base_color:h="green",model:u=null,visible:d=!0,titles:p=!0}){0===r&&(this.el=e);this.pending_rects;if("children"in i){let t=i.rect.box({elevation:a,height:s,color:h,inner:!1,wireframe:l,visible:d,id:i.data.id,rawarea:0});if(p){let e,i;t.addEventListener("click",(function(){if(e)n.removeChild(i),n.removeChild(e),e=void 0,i=void 0;else{i=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");i.setAttribute("geometry",{height:r.height+10,depth:r.depth,width:r.width}),i.setAttribute("position",a),i.setAttribute("material",{visible:!0,opacity:.4}),e=w(this.getAttribute("id"),r.height+10,a,null,n),n.appendChild(e),n.appendChild(i)}}))}t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t);let f=t;o||(f=e);for(const t of i.children){let e=s/2;o||(e=a+s),this.draw_rects({ground:i.rect,el:f,area:t,level:r+1,elevation:e,relative:o,building_color:c,base_color:h,model:u,base_thick:s,wireframe:l,visible:d,titles:p})}}else{i.data[this.fheight];let t=i.rect.box({height:i.data[this.fheight],elevation:a,wireframe:l,color:c,model:u,visible:d,id:i.data.id,rawarea:i.data[this.farea],inner_real:!0});if(t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t),p){let e,i,r=!1;t.addEventListener("click",(function(){r?(n.removeChild(e),n.removeChild(i),e=void 0,i=void 0,r=!1):r=!0})),t.addEventListener("mouseenter",(function(){if(!r){i=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");i.setAttribute("position",a),i.setAttribute("material",{visible:!0}),i.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),e=w(this.getAttribute("id"),r.height+.1,a,null,n),n.appendChild(e),n.appendChild(i)}})),t.addEventListener("mouseleave",(function(){!r&&e&&(n.removeChild(e),n.removeChild(i),e=void 0,i=void 0)}))}}}},a=class{constructor(t,e){this.items=t,this.total=void 0!==e?e:t.reduce((t,e)=>t+e,0)}imax(){let t=this.items[0],e=0;for(let i=0;i<this.items.length;i++)t<this.items[i]&&(t=this.items[i],e=i);return e}static range(t,e){var i=[];for(let n=t;n<t+e;n++)i.push(n);return i}scaled_area(t,e){return this.items[e]*t/this.total}values_i(t){let e=[];for(const i of t)e.push(this.items[i]);return new a(e)}pivot_regions(t,e){if(this.items.length<3)throw new Error("CodeCity - Values.pivot_regions: less than three items");if(t<e)throw new Error("Codecity - Values.pivot_regions: rectangle should be laying");let i,n,r=this.imax();if(this.items.lenght==r+1)return{pivot:r,a1:a.range(0,r),a2:[],a3:[]};if(this.items.length==r+2)return{pivot:r,a1:a.range(0,r),a2:[r+1],a3:[]};let o=t*e,s=this.scaled_area(o,r),l=Math.sqrt(s)*e-s,c=0,h=c,u=r+1;for(;c<l&&u<this.items.length;)h=c,c+=this.scaled_area(o,u),u++;let d=u;return u-1>r&&Math.abs(c-l)>Math.abs(h-l)&&(d=u-1),i=d-r-1,n=this.items.length-d,{pivot:r,a1:a.range(0,r),a2:a.range(r+1,i),a3:a.range(r+1+i,n)}}pivot_region_width(t,e){let i=0;for(const e of t)i+=this.items[e];return i/this.total*e}},o=class{constructor({width:t,depth:e,x:i=0,z:n=0}){this.width=t,this.depth=e,this.x=i,this.z=n}is_ilaying(){return Math.max(this.width,this.depth)==this.width}inner(t,e,i){if(t<e)throw"Rectangle.inner: Area for inner rectangle larger than my area";if(void 0!==t){let n=Math.sqrt(e/t);if(this.iwidth=n*this.width,this.idepth=n*this.depth,i){let e=Math.sqrt(i/t);this.iwidth_real=e*this.width,this.idepth_real=e*this.depth}}else this.iwidth=this.width,this.idepth=this.depth}reflect(){[this.width,this.depth]=[this.depth,this.width],[this.x,this.z]=[this.z,this.x]}idims_as_laying(){return this.is_ilaying()?[this.iwidth,this.idepth,this.x,this.z,!1]:[this.idepth,this.iwidth,this.z,this.x,!0]}split(t,e=!0){let[i,n,r,a,s]=this.idims_as_laying(),l=i/t.total,c=-i/2,h=0;e||(c+=r,h=a);let u=[];for(const e of t.items){let t=e*l,i=new o({width:t,depth:n,x:c+t/2,z:h});s&&i.reflect(),u.push(i),c+=t}return u}split_pivot(t,e=!0){if(t.items.length<=2)return this.split(t,e);let[i,n,r,a,s]=this.idims_as_laying();e&&(r=0,a=0);let{pivot:l,a1:c,a2:h,a3:u}=t.pivot_regions(i,n),d=t.pivot_region_width(c,i),p=t.pivot_region_width(h.concat(l),i),f=t.pivot_region_width(u,i),g=r-i/2+d/2,m=r-i/2+d+p/2,y=r-i/2+d+p+f/2,b=[],v=t.scaled_area(i*n,l)/p;b[l]=new o({width:p,depth:v,x:m,z:a+n/2-v/2});let x=[[c,d,n,g,a],[h,p,n-v,m,a-v/2],[u,f,n,y,a]];for(const[e,i,n,r,a]of x)if(e.length>0){let s=new o({width:i,depth:n,x:r,z:a});s.inner();let l=t.values_i(e),c=s.split_pivot(l,!1),h=0;for(const t of e)b[t]=c[h],h++}if(s)for(const t of b)t.reflect();return b}box({height:t,elevation:e=0,color:i="red",model:n=null,inner:r=!0,wireframe:a=!1,visible:o=!0,id:s="",rawarea:l=0,inner_real:c=!1}){let h,u;[h,u]=c?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let d=document.createElement("a-entity");return d.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:h,width:u,height:t}),d.setAttribute("material",{color:i}),d.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),d.setAttribute("id",s),d.setAttribute("babiaxr-rawarea",l),d}};t.exports={Values:a,Rectangle:o,Zone:r};let s,l=t=>{let e,i=t.data,n=new XMLHttpRequest;if(n.open("get",i,!1),n.onload=function(){this.status>=200&&this.status<300?e="string"==typeof n.response||n.response instanceof String?JSON.parse(n.response):n.response:reject({status:this.status,statusText:xhr.statusText})},n.onerror=function(){reject({status:this.status,statusText:xhr.statusText})},n.send(),e.time_evolution){y=e,c=!0,d=e.time_evolution_commit_by_commit;let i=e.data_files.find(t=>"data_0_tree"===t.key_tree);e=i.data_0_tree,b=i.data_0;let n=[];for(let t=0;t<y.data_files.length;t++){g["data_"+t]=y.data_files[t],n.push({date:new Date(1e3*y.data_files[t].date).toLocaleDateString(),commit:y.data_files[t].commit_sha,data:t})}if(t.ui_navbar&&(f=t.time_evolution_past_present?parseInt(t.time_evolution_init.split("_")[1]):y.data_files.length-1,p=t.ui_navbar,document.getElementById(p).setAttribute("babiaxr-navigation-bar","commits",JSON.stringify(n.reverse()))),"data_0"!==t.time_evolution_init){let i;i=g[t.time_evolution_init][t.time_evolution_init+"_allfiles"]?t.time_evolution_init+"_allfiles":t.time_evolution_init;let n=U(e.children,{});g[t.time_evolution_init][i].forEach(t=>{n[t.id]&&(n[t.id].height=t.height,n[t.id].area=t.area,n[t.id].max_area=t.max_area)}),x=parseInt(t.time_evolution_init.split("_")[1])}}return e},c=!1,h=!0,u=!1,d=!1,p=void 0,f=void 0,g={},m=8e3,y={},b=void 0,v=[],x=0,_=void 0,A=t=>{let e;if(document.getElementById("scene"))e=document.getElementById("scene");else{e=document.getElementsByTagName("a-scene");document.getElementsByTagName("a-entity")}let i=document.createElement("a-entity");i.classList.add("babiaxrDateBar"),i.setAttribute("position",{x:-13,y:10,z:-3}),i.setAttribute("rotation",{x:0,y:0,z:0}),i.setAttribute("material",{color:"black"}),i.setAttribute("height",.5),i.setAttribute("width",2),i.setAttribute("scale",{x:1,y:1,z:1});let n="Date: "+new Date(1e3*g[t.time_evolution_init].date).toLocaleDateString();g[t.time_evolution_init].commit_sha&&(n+="\n\nCommit: "+g[t.time_evolution_init].commit_sha),i.setAttribute("text-geometry",{value:n}),s=i,e.appendChild(i)},w=(t,e,i,n,r)=>{let a=2;t.length>16&&(a=t.length/8);let o=e,s=document.createElement("a-plane");s.setAttribute("babia-lookat","[camera]"),s.setAttribute("position",{x:i.x,y:i.y+o/2+1,z:i.z}),s.setAttribute("rotation",{x:0,y:0,z:0}),s.setAttribute("height","1"),s.setAttribute("width",a),s.setAttribute("color","white"),s.setAttribute("material",{side:"double"}),s.setAttribute("text",{value:t,align:"center",width:6,color:"black"});let l=r.getAttribute("scale");return!l||l.x===l.y&&l.x===l.z||s.setAttribute("scale",{x:1/l.x,y:1/l.y,z:1/l.z}),s};let C,M=(t,e)=>{console.log("Loop number",e),I(),time_evolution_past_present?(x--,0==x&&console.log("finished"),e--):(x++,e++,x>t-1&&(x=0))},I=t=>{let e,i="data_"+(x+1);e=t?"data_"+(x+1)+"_allfiles":time_evolution_past_present?"data_reverse_"+(x+1):"data_"+(x+1);let n="Date: "+new Date(1e3*g[i].date).toLocaleDateString();g[i].commit_sha&&(n+="\n\nCommit: "+g[i].commit_sha),s.setAttribute("text-geometry","value",n),v=[],u&&(E+=5,80!==E?C=function(t,e){let i,n=parseInt(t.slice(1,3),16),r=parseInt(t.slice(3,5),16),a=parseInt(t.slice(5,7),16),o=function(t,e,i){t/=255,e/=255,i/=255;let n,r,a=Math.max(t,e,i),o=Math.min(t,e,i),s=(a+o)/2;if(a==o)n=r=0;else{let l=a-o;switch(r=s>.5?l/(2-a-o):l/(a+o),a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return[n,r,s]}(n,r,a);return i=function(t,e,i){let n,r,a;if(0==e)n=r=a=i;else{function o(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}let s=i<.5?i*(1+e):i+e-i*e,l=2*i-s;n=o(l,s,t+1/3),r=o(l,s,t),a=o(l,s,t-1/3)}return[255*n,255*r,255*a]}(o[0],o[1],e/100),t="#"+D(i[0])+D(i[1])+D(i[2])}(C,E):(T++,T>S.length-1&&(T=0),C=S[T],E=20)),g[i][e]?g[i][e].forEach(t=>{B(t)}):g[i][i].forEach(t=>{B(t)}),d||b.forEach(t=>{v.includes(t.id)||F(t.id)}),L()},E=20,S=["#000066","#006600","#666600","#660000"],T=0,B=t=>{if(null!=document.getElementById(t.id)&&0!=t.area){v.push(t.id);let e=document.getElementById(t.id).getAttribute("position"),i=document.getElementById(t.id).getAttribute("position").x,n=document.getElementById(t.id).getAttribute("position").y,r=document.getElementById(t.id).getAttribute("position").z,a=document.getElementById(t.id).getAttribute("geometry").width,o=document.getElementById(t.id).getAttribute("geometry").depth,s=document.getElementById(t.id).getAttribute("geometry").height,l=parseFloat(document.getElementById(t.id).getAttribute("babiaxr-rawarea"));if(s.toFixed(6)!==t.height.toFixed(6)||l.toFixed(6)!==t.area.toFixed(6)){u&&document.getElementById(t.id).setAttribute("material",{color:C});let c=!1,d=a/o;d<1&&(c=!0,d=o/a);let p=t.area*(o*a)/l,f=Math.sqrt(p*d),g=Math.sqrt(p/d);if(c&&(g=Math.sqrt(p*d),f=Math.sqrt(p/d)),document.getElementById(t.id).setAttribute("babiaxr-rawarea",t.area),h){let e=500;if(f>a||g>o){let i=20*(f-a)/e,n=20*(g-o)/e,r=a,s=o,l=setInterval((function(){r>=f||s>=g?(document.getElementById(t.id).setAttribute("geometry","width",f),document.getElementById(t.id).setAttribute("geometry","depth",g),clearInterval(l)):(r+=i,s+=n,document.getElementById(t.id).setAttribute("geometry","width",r),document.getElementById(t.id).setAttribute("geometry","depth",s))}),1)}else if(f<a||g<o){let i=20*(a-f)/e,n=20*(o-g)/e,r=a,s=o,l=setInterval((function(){r<=f||s<=g?(document.getElementById(t.id).setAttribute("geometry","width",f),document.getElementById(t.id).setAttribute("geometry","depth",g),clearInterval(l)):(r-=i,s-=n,document.getElementById(t.id).setAttribute("geometry","width",r),document.getElementById(t.id).setAttribute("geometry","depth",s))}),1)}if(t.height<0)F(t.id);else if(t.height>s){let a=20*(t.height-s)/e,o=s,l=setInterval((function(){o>=t.height?(document.getElementById(t.id).setAttribute("position",{x:i,y:n-s/2+t.height/2,z:r}),clearInterval(l)):(o+=a,document.getElementById(t.id).setAttribute("geometry","height",o),document.getElementById(t.id).setAttribute("position",{x:i,y:n-s/2+o/2,z:r}))}),1)}else if(t.height<s){let a=20*(s-t.height)/e,o=s,l=setInterval((function(){o<=t.height?(document.getElementById(t.id).setAttribute("position",{x:i,y:n-s/2+t.height/2,z:r}),clearInterval(l)):(o-=a,document.getElementById(t.id).setAttribute("geometry","height",o),document.getElementById(t.id).setAttribute("position",{x:i,y:n-s/2+o/2,z:r}))}),1)}}else document.getElementById(t.id).setAttribute("geometry","width",f),document.getElementById(t.id).setAttribute("geometry","depth",g),document.getElementById(t.id).setAttribute("geometry","height",t.height),document.getElementById(t.id).setAttribute("position",{x:e.x,y:e.y-s/2+t.height/2,z:e.z})}}},F=t=>{let e=document.getElementById(t).getAttribute("material").color;document.getElementById(t).setAttribute("material",{color:"black"}),document.getElementById(t).setAttribute("material",{opacity:"0.3"});let i=setInterval((function(){!function(){let n=document.getElementById(t).getAttribute("position"),r=document.getElementById(t).getAttribute("geometry").height;document.getElementById(t).setAttribute("geometry","height",-.1),document.getElementById(t).setAttribute("position",{x:n.x,y:n.y-r/2-.05,z:n.z}),document.getElementById(t).setAttribute("material",{color:e}),document.getElementById(t).setAttribute("material",{opacity:"1.0"}),clearInterval(i)}()}),1e3)},L=()=>{console.log("Changing city")},U=(t,e)=>(t.forEach(t=>{t.children?U(t.children,e):e[t.id]=t}),e),R=t=>{let e=document.getElementsByClassName("babiaxrTimeBar")[0].children;if(f||0==f){e[f].emit("removeinfo")}e[t].emit("showinfo")};function D(t){let e=Math.round(t).toString(16);return e.length>1||(e="0"+e),e}},function(t,e,i){let n=i(0).findProdComponent;const r=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-city",{schema:{from:{type:"string"},absolute:{type:"boolean",default:!1},width:{type:"number",default:20},depth:{type:"number",default:20},split:{type:"string",default:"naive"},data:{type:"string"},farea:{type:"string",default:"area"},fmaxarea:{type:"string",default:"max_area"},fheight:{type:"string",default:"height"},titles:{type:"boolean",default:!0},building_color:{type:"color",default:"#E6B9A1"},building_model:{type:"string",default:null},base:{type:"boolean",default:!0},base_thick:{type:"number",default:.2},base_color:{type:"color",default:"#98e690"},border:{type:"number",default:1},extra:{type:"number",default:1.4},zone_elevation:{type:"number",default:1},unicolor:{type:"color",default:!1},wireframe:{type:"boolean",default:!1},colormap:{type:"array",default:["blue","green","yellow","brown","orange","magenta","grey","cyan","azure","beige","blueviolet","coral","crimson","darkblue","darkgrey","orchid","olive","navy","palegreen"]},time_evolution_delta:{type:"number",default:8e3},time_evolution_init:{type:"string",default:"data_0"},time_evolution_past_present:{type:"boolean",default:!1},time_evolution_animation:{type:"boolean",default:!0},time_evolution_color:{type:"boolean",default:!1},ui_navbar:{type:"string",default:""}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=JSON.parse(e.data);this.processData(t)}else if(e.from!==t.from)this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)));else if(e!==t&&this.newData){for(console.log("Generating city...");this.el.firstChild;)this.el.firstChild.remove();this.processData(this.newData)}},dataComponent:void 0,dataComponentDataPropertyName:"babiaData",dataComponentEventName:void 0,babiaData:void 0,babiaMetadata:{id:0},visProperties:["fheight","farea"],processData:function(t){let e;console.log("processData",t),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},e=this.newData.length>0?{id:"init",children:this.newData}:this.newData.length<=0?this.newData[0]:this.newData,console.log("toSave",e),this.notiBuffer.set(e),a(this,e)}});let a=(t,e)=>{t.loader=new THREE.FileLoader;let i=t.data,n=t.el;u=i.building_color;let r=n;n.emit("babiaxr-dataLoaded",{data:e,codecity:!0}),c=i.time_evolution_delta,t.zone_data=e;let a,s,h=new o({data:t.zone_data,extra:function(t){return t*i.extra},farea:i.farea,fheight:i.fheight,fmaxarea:i.fmaxarea});1==i.absolute?(a=Math.sqrt(h.areas.canvas)*i.width/i.depth,s=h.areas.canvas/a):(a=i.width,s=i.depth);let d=new l({width:a,depth:s,x:0,z:0});h.add_rects({rect:d,split:i.split,relative:!1});let p=document.createElement("a-entity");t.base=p;h.draw_rects({ground:d,el:p,base:i.base,level:0,elevation:0,relative:!1,base_thick:i.base_thick,wireframe:i.wireframe,building_color:i.building_color,base_color:i.base_color,model:i.building_model,visible:!0,titles:i.titles,rootCodecityEntity:r}),n.appendChild(p)},o=class{constructor({data:t,extra:e=function(t){return t},farea:i="area",fmaxarea:n="max_area",fheight:r="height"}){this.data=t,this.id=this.data.id,this.extra=e,this.farea=i,this.fmaxarea=n,this.fheight=r,this.areas=this.areas_tree(),this.el=null,this.pending_rects=0}areas_tree({data:t=this.data,level:e=0}={}){let i=t,n={data:i};if("children"in i){n.inner=0,n.area=0,n.children=[];for(const t of i.children){let i=this.areas_tree({data:t,level:e+1});n.inner+=i.canvas,n.area+=i.area,n.children.push(i)}}else n.area=i[this.farea]||.5,n.max_area=i[this.fmaxarea]||.5,n.inner=n.max_area,n.inner_real=n.area;return n.canvas=this.extra(n.inner,e),n}add_rects({rect:t,area:e=this.areas,relative:i=!0,split:n="naive"}={}){if(e.rect=t,e.rect.inner(e.canvas,e.inner,e.inner_real),"children"in e){let t,r=new s(e.children.map(t=>t.canvas),e.inner);if("naive"===n)t=e.rect.split(r,i);else{if("pivot"!==n)throw new Error("CodeCity: Unknwon split method");t=e.rect.split_pivot(r,i)}for(const r in e.children)this.add_rects({rect:t[r],area:e.children[r],relative:i,split:n})}}draw_rects({ground:t,el:e,area:i=this.areas,level:n=0,elevation:r=0,relative:a=!0,base_thick:o=.2,wireframe:s=!1,building_color:l="red",base_color:c="green",model:u=null,visible:d=!0,titles:p=!0,rootCodecityEntity:f}){let g=this;0===n&&(this.el=e);this.pending_rects;if("children"in i){let t=i.rect.box({elevation:r,height:o,color:c,inner:!1,wireframe:s,visible:d,id:i.data.id,rawarea:0});if(p){let e,i;t.addEventListener("click",(function(){if(e)f.removeChild(i),f.parentElement.removeChild(e),e=void 0,i=void 0;else{i=document.createElement("a-entity");let n=t.getAttribute("geometry"),r=t.getAttribute("position"),a=f.getAttribute("scale"),o=n.height+11;a&&(o=(n.height+11)/a.y),i.setAttribute("geometry",{height:o,depth:n.depth,width:n.width}),i.setAttribute("position",r),i.setAttribute("material",{visible:!0,opacity:.4}),f.appendChild(i),e=h(this.getAttribute("id"),"black","white");let s=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),l={x:s.x,y:12,z:s.z};e.setAttribute("position",l),e.setAttribute("visible",!0),f.parentElement.appendChild(e)}}))}t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t);let g=t;a||(g=e);for(const t of i.children){let e=o/2;a||(e=r+o),this.draw_rects({ground:i.rect,el:g,area:t,level:n+1,elevation:e,relative:a,building_color:l,base_color:c,model:u,base_thick:o,wireframe:s,visible:d,titles:p,rootCodecityEntity:f})}}else{let t=i.rect.box({height:i.data[this.fheight],elevation:r,wireframe:s,color:l,model:u,visible:d,id:i.data.id,rawarea:i.data[this.farea],inner_real:!0});if(t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t),p){let e,n,r=!1;t.addEventListener("click",(function(){r?(e.setAttribute("visible",!1),n.setAttribute("visible",!1),f.parentElement.removeChild(e),f.removeChild(n),e=void 0,n=void 0,r=!1):r=!0})),t.addEventListener("mouseenter",(function(){if(!r){n=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");n.setAttribute("position",a),n.setAttribute("material",{visible:!0}),n.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),e=h(this.getAttribute("id"),"white","black",i.data,g.fheight,g.farea);let o=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),s=(new THREE.Box3).setFromObject(t.object3D),l={x:o.x,y:s.max.y+1,z:o.z};e.setAttribute("position",l),e.setAttribute("visible",!0),f.parentElement.appendChild(e),f.appendChild(n)}})),t.addEventListener("mouseleave",(function(){!r&&e&&(e.setAttribute("visible",!1),n.setAttribute("visible",!1),f.parentElement.removeChild(e),f.removeChild(n),e=void 0,n=void 0)}))}}}},s=class{constructor(t,e){this.items=t,this.total=void 0!==e?e:t.reduce((t,e)=>t+e,0)}imax(){let t=this.items[0],e=0;for(let i=0;i<this.items.length;i++)t<this.items[i]&&(t=this.items[i],e=i);return e}static range(t,e){var i=[];for(let n=t;n<t+e;n++)i.push(n);return i}scaled_area(t,e){return this.items[e]*t/this.total}values_i(t){let e=[];for(const i of t)e.push(this.items[i]);return new s(e)}pivot_regions(t,e){if(this.items.length<3)throw new Error("CodeCity - Values.pivot_regions: less than three items");if(t<e)throw new Error("Codecity - Values.pivot_regions: rectangle should be laying");let i,n,r=this.imax();if(this.items.lenght==r+1)return{pivot:r,a1:s.range(0,r),a2:[],a3:[]};if(this.items.length==r+2)return{pivot:r,a1:s.range(0,r),a2:[r+1],a3:[]};let a=t*e,o=this.scaled_area(a,r),l=Math.sqrt(o)*e-o,c=0,h=c,u=r+1;for(;c<l&&u<this.items.length;)h=c,c+=this.scaled_area(a,u),u++;let d=u;return u-1>r&&Math.abs(c-l)>Math.abs(h-l)&&(d=u-1),i=d-r-1,n=this.items.length-d,{pivot:r,a1:s.range(0,r),a2:s.range(r+1,i),a3:s.range(r+1+i,n)}}pivot_region_width(t,e){let i=0;for(const e of t)i+=this.items[e];return i/this.total*e}},l=class{constructor({width:t,depth:e,x:i=0,z:n=0}){this.width=t,this.depth=e,this.x=i,this.z=n}is_ilaying(){return Math.max(this.width,this.depth)==this.width}inner(t,e,i){if(t<e)throw"Rectangle.inner: Area for inner rectangle larger than my area";if(void 0!==t){let n=Math.sqrt(e/t);if(this.iwidth=n*this.width,this.idepth=n*this.depth,i){let e=Math.sqrt(i/t);this.iwidth_real=e*this.width,this.idepth_real=e*this.depth}}else this.iwidth=this.width,this.idepth=this.depth}reflect(){[this.width,this.depth]=[this.depth,this.width],[this.x,this.z]=[this.z,this.x]}idims_as_laying(){return this.is_ilaying()?[this.iwidth,this.idepth,this.x,this.z,!1]:[this.idepth,this.iwidth,this.z,this.x,!0]}split(t,e=!0){let[i,n,r,a,o]=this.idims_as_laying(),s=i/t.total,c=-i/2,h=0;e||(c+=r,h=a);let u=[];for(const e of t.items){let t=e*s,i=new l({width:t,depth:n,x:c+t/2,z:h});o&&i.reflect(),u.push(i),c+=t}return u}split_pivot(t,e=!0){if(t.items.length<=2)return this.split(t,e);let[i,n,r,a,o]=this.idims_as_laying();e&&(r=0,a=0);let{pivot:s,a1:c,a2:h,a3:u}=t.pivot_regions(i,n),d=t.pivot_region_width(c,i),p=t.pivot_region_width(h.concat(s),i),f=t.pivot_region_width(u,i),g=r-i/2+d/2,m=r-i/2+d+p/2,y=r-i/2+d+p+f/2,b=[],v=t.scaled_area(i*n,s)/p;b[s]=new l({width:p,depth:v,x:m,z:a+n/2-v/2});let x=[[c,d,n,g,a],[h,p,n-v,m,a-v/2],[u,f,n,y,a]];for(const[e,i,n,r,a]of x)if(e.length>0){let o=new l({width:i,depth:n,x:r,z:a});o.inner();let s=t.values_i(e),c=o.split_pivot(s,!1),h=0;for(const t of e)b[t]=c[h],h++}if(o)for(const t of b)t.reflect();return b}box({height:t,elevation:e=0,color:i="red",model:n=null,inner:r=!0,wireframe:a=!1,visible:o=!0,id:s="",rawarea:l=0,inner_real:c=!1}){let h,u;[h,u]=c?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let d=document.createElement("a-entity");return d.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:h,width:u,height:t}),d.setAttribute("material",{color:i}),d.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),d.setAttribute("id",s),d.setAttribute("babiaxr-rawarea",l),d}};t.exports={Values:s,Rectangle:l,Zone:o};let c=8e3,h=(t,e,i,n,r,a)=>{let o=2;if(t.length>16&&(o=t.length/8),n){let e="\n "+r+" (height): "+n[r];e.length>16&&(o=e.length/8),t+=e;let i="\n "+a+" (area): "+n[a];i.length>16&&i>e&&(o=i.length/8),t+=i}let s=document.createElement("a-plane");return s.setAttribute("babia-lookat","[camera]"),s.setAttribute("rotation",{x:0,y:0,z:0}),s.setAttribute("height","1"),s.setAttribute("width",o),s.setAttribute("color",e),s.setAttribute("material",{side:"double"}),s.setAttribute("text",{value:t,align:"center",width:6,color:i}),s.setAttribute("visible",!1),s};let u},function(t,e,i){let n=i(0).findProdComponent,r=i(0).updateTitle,a=i(0).parseJson;const o=i(0).colors,s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function l(t,e,i,n,r,a,s,l,c){let h=o.get(i,n),u=document.createElement("a-cylinder");if(s?(t/=s,e/=s):(l||c)&&(l&&(t*=l),c&&(e*=c)),u.setAttribute("color",h),u.setAttribute("height",0),u.setAttribute("radius",e),a){var d=20*t/4e3,p=0,f=setInterval(a,1);function a(){p>=t?clearInterval(f):(p+=d,u.setAttribute("height",p),u.setAttribute("position",{x:r,y:p/2,z:0}))}}else u.setAttribute("height",t),u.setAttribute("position",{x:r,y:t/2,z:0});return u}function c(t,e,i,n,r){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e,i,n){let r=e[t.x_axis]+": "+e[t.height],a=5;r.length>16&&(a=r.length/2);let o=i.getAttribute("position"),s=document.createElement("a-plane");return s.setAttribute("position",{x:o.x,y:2*o.y+2,z:o.z+n+.5}),s.setAttribute("rotation",{x:0,y:0,z:0}),s.setAttribute("height","1.5"),s.setAttribute("width",a),s.setAttribute("color","white"),s.setAttribute("text",{value:e[t.x_axis]+": "+e[t.height],align:"center",width:20,color:"black"}),s.classList.add("babiaxrLegend"),s}(t,i,e,r),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-cyls",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},from:{type:"string"},legend:{type:"boolean"},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number"}},visProperties:["height","radius","x_axis"],multiple:!1,init:function(){this.notiBuffer=new s},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from?(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&this.processData(this.newData)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){const t=r(this.data,{x:0,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-cyls:",t);const e=this.data,i=this.el,n=e.animation,r=e.palette,a=e.scale;let o=e.heightMax,s=e.radiusMax,h=[],u=[],d=0,p=1,f=0,g=0,m=Math.max.apply(Math,t.map((function(t){return t[e.height]}))),y=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));a&&(m/=a,y/=a),o||(o=m),proportion=o/m,s||(s=y),radius_scale=s/y,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl);for(let o of t){let s=o[e.x_axis],m=o[e.radius],b=o[e.height];o!==t[0]?p+=a?g+m/a+.5:g+m*radius_scale+.5:f=a?m/a:m*radius_scale;let v=l(b,m,d,r,p,n,a,proportion,radius_scale);v.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(v),e.legend&&c(e,v,o,i,y),g=a||radius_scale?a?m/a:radius_scale*m:m,h.push(s),u.push(f+p),d++}if(e.axis){const t=f+p+g+.5,e=o;this.updateAxis(h,u,t,f,y,m,e)}this.updateTitle()},updateAxis:function(t,e,i,n,r,a,o){let s=document.createElement("a-entity");this.chartEl.appendChild(s),s.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:this.data.palette}),s.setAttribute("position",{x:-n,y:0,z:r+1});let l=document.createElement("a-entity");this.chartEl.appendChild(l),l.setAttribute("babia-axis-y",{maxValue:a,length:o}),l.setAttribute("position",{x:-n,y:0,z:r+1}),this.data.axis_name&&(s.setAttribute("babia-axis-x","name",this.data.x_axis),l.setAttribute("babia-axis-y","name",this.data.height))},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating cyls..."),this.updateChart(),this.notiBuffer.set(this.newData)}})},function(t,e,i){let n=i(0).findProdComponent,r=i(0).updateTitle,a=i(0).parseJson;const o=i(0).colors,s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function l(t,e,i,n,r,a,s,l,c,h){let u=o.get(i,n),d=document.createElement("a-cylinder");if(l?(t/=l,e/=l):(c||h)&&(c&&(t*=c),h&&(e*=h)),d.setAttribute("color",u),d.setAttribute("height",0),d.setAttribute("radius",e),s){var p=20*t/4e3,f=0,g=setInterval(s,1);function s(){f>=t?clearInterval(g):(f+=p,d.setAttribute("height",f),d.setAttribute("position",{x:r,y:f/2,z:a}))}}else d.setAttribute("height",t),d.setAttribute("position",{x:r,y:t/2,z:a});return d}function c(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e,i,n){let r="",a=[];a.push(e[t.x_axis]+" "+e[t.z_axis]+"\n"),a.push("Height: "+e[t.height]+"\n"),a.push("Radius: "+e[t.radius]);let o=5;for(let t of a)t.length>10&&o<t.length/2&&(o=t.length/2),r+=t;let s=i.getAttribute("position"),l=document.createElement("a-plane"),c=s.z;c+=n?e[t.radius]/2*n.z:e[t.radius]/2;return l.setAttribute("position",{x:s.x,y:2*s.y+3,z:c}),l.setAttribute("rotation",{x:0,y:0,z:0}),l.setAttribute("height","4"),l.setAttribute("width",o),l.setAttribute("color","white"),l.setAttribute("text",{value:r,align:"center",width:20,color:"black"}),l.classList.add("babiaxrLegend"),l}(t,i,e,n.getAttribute("scale")),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-cylsmap",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number"}},visProperties:["height","radius","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new s},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from?(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&this.processData(this.newData)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){const t=r(this.data,{x:0,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-cylsmap:",t);const e=this.data,i=this.el,n=e.animation,r=e.palette,a=e.scale;let o=e.heightMax,s=e.radiusMax,h=[],u=[],d=[],p=[],f=0,g=0,m=0,y=0,b=0,v=0,x={},_={},A=Math.max.apply(Math,t.map((function(t){return t[e.height]}))),w=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));a&&(A/=a,w/=a),o||(o=A),proportion=o/A,s||(s=w),radius_scale=s/w,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl),a?(b=w/a,v=w/a):(b=w*radius_scale,v=w*radius_scale);for(let o of t){let t=o[e.x_axis],s=o[e.z_axis],A=o[e.height],C=o[e.radius];x[t]?(m=x[t].posX,f=x[t].colorId):(m+=a?2*w/a+.5:2*w*radius_scale+.5,f=g,x[t]={posX:m,colorId:f},h.push(t),u.push(m),g++),_[s]?y=_[s].posZ:(y=a?v+2*w/a+.5:v+2*w*radius_scale+.5,_[s]={posZ:y},d.push(s),p.push(y)),m>b&&(b=m),y>v&&(v=y);let M=l(A,C,f,r,m,y,n,a,proportion,radius_scale);M.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(M,i),e.legend&&c(e,M,o,i)}if(e.axis){const t=b,e=v,i=o;this.updateAxis(h,u,t,d,p,e,A,i)}this.updateTitle()},updateAxis:function(t,e,i,n,r,a,o,s){let l=document.createElement("a-entity");this.chartEl.appendChild(l),l.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:this.data.palette}),l.setAttribute("position",{x:0,y:0,z:0});let c=document.createElement("a-entity");this.chartEl.appendChild(c),c.setAttribute("babia-axis-y",{maxValue:o,length:s}),c.setAttribute("position",{x:0,y:0,z:0});let h=document.createElement("a-entity");this.chartEl.appendChild(h),h.setAttribute("babia-axis-z",{labels:n,ticks:r,length:a}),h.setAttribute("position",{x:0,y:0,z:0}),this.data.axis_name&&(l.setAttribute("babia-axis-x","name",this.data.x_axis),c.setAttribute("babia-axis-y","name",this.data.height),h.setAttribute("babia-axis-z","name",this.data.z_axis))},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating cylsmap..."),this.updateChart(),this.notiBuffer.set(this.newData)}})},function(t,e,i){let n=i(0).findProdComponent,r=i(0).updateTitle,a=i(0).parseJson;const o=i(0).colors,s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function l(t,e,i,n,r){let a=o.get(n,r);console.log("Generating slice...");let s=document.createElement("a-torus");return s.setAttribute("color",a),s.setAttribute("rotation",{x:90,y:0,z:t}),s.setAttribute("arc",e),s.setAttribute("side","double"),s.setAttribute("radius",i),s.setAttribute("radius-tubular",i/4),s}function c(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e){let i=e[t.key]+": "+e[t.size],n=2;i.length>16&&(n=i.length/8);let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:1,z:-2}),r.setAttribute("rotation",{x:-90,y:0,z:0}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e[t.key]+": "+e[t.size],align:"center",width:6,color:"black"}),r.classList.add("babiaxrLegend"),r}(t,i),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-doughnut",{schema:{data:{type:"string"},size:{type:"string",default:"size"},key:{type:"string",default:"key"},from:{type:"string"},legend:{type:"boolean"},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},animation:{type:"boolean",default:!1}},visProperties:["size","key"],multiple:!1,init:function(){this.notiBuffer=new s},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from?(this.slice_array=[],this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&(this.slice_array=[],this.processData(this.newData))},tick:function(t,e){if(this.data.animation&&this.loaded){let i=document.getElementsByClassName("babiaxrChart")[0].children;for(let n in this.slice_array){let r=this.slice_array[n].delay,a=this.slice_array[n].arc,o=parseFloat(i[n].getAttribute("arc"));t>=r&&o<a&&(o+=360*e/this.total_duration,o>a&&(o=a),i[n].setAttribute("arc",o))}}},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},loaded:!1,slice_array:[],total_duration:4e3,updateTitle:function(){const t=r(this.data,{x:-90,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-doughnut",t);const e=this.data,i=this.el,n=e.animation,r=e.palette;let a=0,o=0,s=0,h=0;for(let i of t)h+=i[e.size];this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.chartEl.setAttribute("rotation",{y:90}),i.appendChild(this.chartEl);let u=0;for(let d of t){let t;if(o=360*d[e.size]/h,n){let e=this.total_duration*o/360;this.slice_array.push({arc:o,duration:e,delay:u}),u+=e,t=l(a,.01,1,s,r)}else t=l(a,o,1,s,r);t.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(t),a+=o,e.legend&&c(e,t,d,i),s++}this.updateTitle()},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating doughnut..."),this.updateChart(),this.loaded=!0,this.notiBuffer.set(this.newData)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-totem",{schema:{charts_id:{type:"string"},data_list:{type:"string"}},multiple:!1,init:function(){let t=this.data,e=this.el;i=e.id,t&&(o.push({id:e.id,charts_id:JSON.parse(t.charts_id)}),t.data_list&&(n=JSON.parse(t.data_list),function(t){let e=new THREE.FileLoader;for(let i of t)if(i.from_querier){let t=document.getElementById(i.from_querier);if(t.getAttribute("babiaData")){let e=JSON.parse(t.getAttribute("babiaData"));a.push({file:e,path:i.from_querier})}else t.addEventListener("dataReady"+i.from_querier,(function(t){a.push({file:t.detail,path:i.from_querier})}))}else if(i.path){let t=i.path;e.load(t,(function(e){a.push({file:e,path:t})}),(function(e){console.log(t.toString()+": "+e.loaded/e.total*100+"% loaded")}),(function(t){console.error("An error happened")}))}}(n)))},update:function(t){let e=this.data;if(r=this.el,e!==t){for(;this.el.firstChild;)this.el.firstChild.remove();console.log("Generating totemchart..."),s(r)}},remove:function(){},pause:function(){},play:function(){}});let i,n,r,a=[],o=[],s=t=>{a&&function(t,e){console.log("Generating Totem...");let i=7.5;if(e.length%2==1){let t=Math.trunc(e.length/2);i+=t}let n=function(t){let e=5;for(let i of t)i.data&&(i=i.data),i.length>10&&e<i.length/4&&(e=i.length/4);return e}(e);document.createElement;(function(t,e,i,n,r,a,o){let s=document.createElement("a-plane");s.setAttribute("class","title"),s.setAttribute("position",{x:e,y:i,z:n}),s.setAttribute("rotation",{x:0,y:r,z:0}),s.setAttribute("height",1),s.setAttribute("width",a),s.setAttribute("color","blue"),s.setAttribute("text",{value:o,align:"center",width:"10",color:"white"}),t.appendChild(s)})(t,-3,i,6,0,n,"Select Data"),i-=1,function(t,e,i,n,r,a,o,s){for(let c of o){c.data&&(c=c.data);let h=document.createElement("a-plane");h.setAttribute("position",{x:e,y:i,z:n}),h.setAttribute("rotation",{x:0,y:r,z:0}),h.setAttribute("height",1),h.setAttribute("width",a),h.setAttribute("text",{value:c,align:"center",width:"10"}),h.setAttribute("color","white"),h.setAttribute("text",{color:"black"}),t.appendChild(h),i-=1,h.classList.add("babiaxraycasterclass"),h.addEventListener("click",(function(){let t=h.parentElement.id,e=h.parentElement.children;s=c;for(let e of o)(e.path||e.from_querier)&&s==e.data&&l(e.path||e.from_querier,t);for(let t in e)e[t]===h?(h.setAttribute("color","black"),h.setAttribute("text",{color:"white"})):e[t].id||"title"!==e[t].className&&(e[t].setAttribute("color","white"),e[t].setAttribute("text",{color:"black"}))}))}}(t,-3,i,6,0,n,e)}(t,n)};function l(t,e){!function(t){document.getElementById(t)}(e);for(let i in o)if(e==o[i].id){let e=o[i].charts_id;for(obj in e){let i,n=e[obj].type,r=e[obj].id;for(let e in a)a[e].path==t&&(i=a[e].file,"babiaxr-vismapper"===n?document.getElementById(r).setAttribute(n,"dataToShow",JSON.stringify(i)):document.getElementById(r).setAttribute(n,"data",i))}}}},function(t,e){AFRAME.registerComponent("babia-terrain",{schema:{width:{type:"number",default:1},height:{type:"number",default:1},segmentsHeight:{type:"number",default:1},segmentsWidth:{type:"number",default:1},data:{type:"array"},color:{type:"string",default:"0xdddddd"},filled:{type:"boolean",default:!1}},init:function(){var t=this.data,e=this.el,i=t.data;console.log("Vertices:"),console.log(i),this.geometry=new THREE.PlaneGeometry(t.width,t.height,t.segmentsHeight,t.segmentsWidth);for(var n=0,r=this.geometry.vertices.length;n<r;n++)this.geometry.vertices[n].z=i[n];var a=t.color;t.filled?this.material=new THREE.MeshPhongMaterial({color:a,wireframe:!1}):this.material=new THREE.MeshPhongMaterial({color:a,wireframe:!0}),this.mesh=new THREE.Mesh(this.geometry,this.material),e.setObject3D("mesh",this.mesh)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let n,r,a,o,s,l,c,h,u,d,p;function f(t){let e=document.createElement("a-sphere");var i;return e.setAttribute("radius",.05),e.setAttribute("material",{color:"#FF0000"}),function(t,e){let i,n;t.addEventListener("mouseenter",(function(){h=this.getAttribute("material").color,this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),this.setAttribute("material",{color:"#AAAA00"}),n=g(e),this.appendChild(n)})),t.addEventListener("showinfo",(function(){i=g(e),this.setAttribute("material",{color:"#00AA00"}),this.appendChild(i)})),t.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),this.setAttribute("material",{color:h}),this.removeChild(n)})),t.addEventListener("removeinfo",(function(){i&&(this.removeChild(i),this.setAttribute("material",{color:"#FF0000"}))}))}(e,t),i=t,e.addEventListener("click",(function(){this.setAttribute("material",{color:"#00AA00"}),h=this.getAttribute("material").color,l.emit("babiaxrShow",{data:i}),document.getElementsByClassName("babiaxrPause")[0]&&(s.removeChild(o),s.appendChild(a))})),e}function g(t){let e="",i=[];i.push("Date: "+t.date+"\n"),i.push("commit: "+t.commit+"\n");let n=1;for(let t of i)t.length>10&&n<t.length/2&&(n=t.length/7),e+=t;let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:.4,z:.1}),r.setAttribute("scale",{x:.5,y:.5,z:1}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e,align:"center",width:6,color:"black"}),r.setAttribute("material",{opacity:.6}),r}function m(t){let e=t.length,n=[];for(i=0;i<e;i++){let e=.11*t[i][0],r=.11*t[i][1],a=.11*t[i][2],o=new THREE.Vector3(e,r,a);n.push(o)}let r=new THREE.Shape(n),a=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,wireframe:!1}),o=new THREE.ExtrudeGeometry(r,{depth:.05,bevelEnabled:!1,bevelSegments:1,steps:1,bevelThickness:1});return new THREE.Mesh(o,a)}function y(t){t.addEventListener("mouseenter",(function(){c=Object.assign({},this.object3DMap.mesh.material.color),this.object3DMap.mesh.material.color={r:170/255,g:170/255,b:170/255}})),t.addEventListener("mouseleave",(function(){this.object3DMap.mesh.material.color=c}))}function b(t,e){t.addEventListener("click",(function(){if(t.classList.contains("babiaxrPlay"))s.removeChild(t),s.appendChild(o);else if(t.classList.contains("babiaxrPause"))s.removeChild(o),s.appendChild(a);else if(t.classList.contains("babiaxrSkipNext")||t.classList.contains("babiaxrSkipPrev"))document.getElementsByClassName("babiaxrPause")[0]&&(s.removeChild(o),s.appendChild(a));else if(t.classList.contains("babiaxrForward")){c={r:85/255,g:85/255,b:85/255},document.getElementsByClassName("babiaxrRewind")[0].object3DMap.mesh.material.color={r:1,g:1,b:1}}else if(t.classList.contains("babiaxrRewind")){c={r:85/255,g:85/255,b:85/255},document.getElementsByClassName("babiaxrForward")[0].object3DMap.mesh.material.color={r:1,g:1,b:1}}console.log("Emit..... "+e),l.emit(e)}))}AFRAME.registerComponent("babiaxr-navigation-bar",{schema:{commits:{type:"string"},size:{type:"number",default:"5"},points_by_line:{type:"number",default:"5"},to:{type:"string",default:"left"},start_point:{type:"number",default:"0"}},multiple:!1,init:function(){let t=this.data;l=this.el,n=JSON.parse(t.commits),r=t.size,u=t.to,d=t.start_point,p=t.points_by_line;let e=function(t,e,i){let n=document.createElement("a-entity");n.classList.add("babiaxrTimeBar");let r=0,a=Math.ceil(t.length/i)/5-.2,o=e/(i-1),s=0,l=1;for(let e in t){let c=f(t[e]);c.classList.add("babiaxraycasterclass"),c.setAttribute("position",{x:r,y:a,z:0}),n.appendChild(c),e%i==i-1&&e!=t.length-1?(l++,a-=.2,r=0):e!=t.length-1&&(r+=o),s=r}for(let t=0;t<l;t++){let i=document.createElement("a-entity");0!=s&&0==t||1==p||0==s&&0==t?i.setAttribute("line",{start:"0 "+a+" 0",end:s+" "+a+" 0",color:"#FF0000"}):i.setAttribute("line",{start:"0 "+a+" 0",end:e+" "+a+" 0",color:"#FF0000"}),a+=.2,n.appendChild(i)}return n}(n,r,p);this.el.appendChild(e),s=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrPlayer"),t.setAttribute("position",{x:(r-5)/2,y:0,z:0}),t.classList.add("babiaxraycasterclass"),a=function(t){let e=document.createElement("a-entity");e.classList.add("babiaxrPlay");let i=m([[0,0,0],[0,3,0],[2.5,1.5,0],[0,0,0]]);return e.setObject3D("mesh",i),b(e,"babiaxrContinue"),y(e),e}(),a.setAttribute("position",{x:2.35,y:-.65,z:0}),a.classList.add("babiaxraycasterclass"),o=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrPause");let e=function(t,e){let n=t.length,r=e.length,a=[],o=[];for(i=0;i<n;i++){let e=.11*t[i][0],n=.11*t[i][1],r=.11*t[i][2],o=new THREE.Vector3(e,n,r);a.push(o)}for(i=0;i<r;i++){let t=.11*e[i][0],n=.11*e[i][1],r=.11*e[i][2],a=new THREE.Vector3(t,n,r);o.push(a)}let s=new THREE.Shape(a),l=new THREE.Shape(o),c={depth:.05,bevelEnabled:!1,bevelSegments:1,steps:1,bevelThickness:1},h=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,wireframe:!1}),u=new THREE.ExtrudeGeometry(s,c),d=new THREE.ExtrudeGeometry(l,c),p=new THREE.Mesh(u,h);return p.updateMatrix(),d.merge(p.geometry,p.matrix),new THREE.Mesh(d,h)}([[0,0,0],[0,3,0],[1,3,0],[1,0,0],[0,0,0]],[[1.5,0,0],[1.5,3,0],[2.5,3,0],[2.5,0,0],[1.5,0,0]]);return t.setObject3D("mesh",e),b(t,"babiaxrStop"),y(t),t}(),o.setAttribute("position",{x:2.35,y:-.65,z:0}),o.classList.add("babiaxraycasterclass"),t.appendChild(o);let e=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrRewind");let e=m([[0,0,0],[0,3,0],[1.25,1.5,0],[1.25,3,0],[2.5,1.5,0],[1.25,0,0],[1.25,1.5,0],[0,0,0]]);t.setObject3D("mesh",e),t.setAttribute("rotation",{x:0,y:180,z:0}),"left"==u&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255});return b(t,"babiaxrToPast"),y(t),t}();e.setAttribute("position",{x:1.25,y:-.65,z:0}),e.classList.add("babiaxraycasterclass"),t.appendChild(e);let n=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrForward");let e=m([[0,0,0],[0,3,0],[1.25,1.5,0],[1.25,3,0],[2.5,1.5,0],[1.25,0,0],[1.25,1.5,0],[0,0,0]]);t.setObject3D("mesh",e),"right"==u&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255});return b(t,"babiaxrToPresent"),y(t),t}();n.setAttribute("position",{x:3.7,y:-.65,z:0}),n.classList.add("babiaxraycasterclass"),t.appendChild(n);let s=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrSkipPrev");let e=m([[0,0,0],[0,3,0],[1,1.5,0],[1,3,0],[2,1.5,0],[2,3,0],[2.5,3,0],[2.5,0,0],[2,0,0],[2,1.5,0],[1,0,0],[1,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),t.setAttribute("rotation",{x:0,y:180,z:0}),b(t,"babiaxrSkipPrev"),y(t),t}();s.setAttribute("position",{x:1.95,y:-.65,z:0}),s.classList.add("babiaxraycasterclass"),t.appendChild(s);let l=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrSkipNext");let e=m([[0,0,0],[0,3,0],[1,1.5,0],[1,3,0],[2,1.5,0],[2,3,0],[2.5,3,0],[2.5,0,0],[2,0,0],[2,1.5,0],[1,0,0],[1,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),b(t,"babiaxrSkipNext"),y(t),t}();return l.setAttribute("position",{x:3,y:-.65,z:0}),l.classList.add("babiaxraycasterclass"),t.appendChild(l),t}(),this.el.appendChild(s),function(){let t=document.getElementsByClassName("babiaxrTimeBar")[0].children;for(let e in t)e==d&&t[e].emit("showinfo")}()},update:function(t){},remove:function(){},pause:function(){},play:function(){}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let i,n,r;var a;AFRAME.registerComponent("babiaxr-event-controller",{schema:{navigation:{type:"string"},targets:{type:"string"}},multiple:!1,init:function(){},update:function(t){i=this.el;let e=this.data;n=e.navigation,r=JSON.parse(e.targets),function(t){let e=document.getElementById(t).getAttribute("babiaxr-navigation-bar").commits;if(e&&h){a=JSON.parse(e);for(let t in a)o.push(a[t]);if(o.reverse(),c){let t=a.length-1-0;s=o[0],l=t}else s=a[0],l=0;h=!1,function(){u(c?o:a);document.addEventListener("babiaxrShow",(function(t){!function(t){for(let e in a)if(a[e].commit==t.commit){s=a[e],f(e),l=e;break}p()}(t.detail.data),i.emit("babiaxrStop")})),document.addEventListener("babiaxrContinue",(function(){console.log("PLAY"),u(c?o:a)})),document.addEventListener("babiaxrToPresent",(function(){console.log("TO PRESENT"),c=!1,i.emit("babiaxrStop"),u(a)})),document.addEventListener("babiaxrToPast",(function(){console.log("TO PAST"),c=!0,i.emit("babiaxrStop"),u(o)})),document.addEventListener("babiaxrSkipNext",(function(){console.log("SKIP NEXT"),i.emit("babiaxrStop"),d("next")})),document.addEventListener("babiaxrSkipPrev",(function(){console.log("SKIP PREV"),i.emit("babiaxrStop"),d("prev")}))}()}}(n)},remove:function(){},pause:function(){},play:function(){}});var o=[];let s,l,c=!1,h=!0;function u(t){let e=0;for(let i in t)t[i]==s&&(e=parseInt(i)+1);let n=setInterval((function(){if(e<t.length){if(s=t[e],c){let i=t.length-1-e;f(i),l=i}else f(e),l=e;if(p(),e++,document.addEventListener("babiaxrStop",(function(){clearInterval(n)})),e==t.length){document.getElementsByClassName("babiaxrPause")[0].emit("click")}}else i.emit("babiaxrStop")}),3e3)}function d(t){for(let e in a)if(a[e]==s){"next"==t&&e<a.length-1?e++:"prev"==t&&e>=1&&e--,s=a[e],f(e),l=e;break}p()}function p(){let t=document.getElementById(s.commit).getAttribute("babiadata");for(let e in r){let i=document.getElementById(r[e].id);i&&i.setAttribute("babiaxr-vismapper","dataToShow",t)}}function f(t){let e=document.getElementsByClassName("babiaxrTimeBar")[0].children;if(l||0==l){e[l].emit("removeinfo")}e[t].emit("showinfo")}},function(t,e,n){let r=n(0).findProdComponent;const a=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-boats",{schema:{data:{type:"asset"},from:{type:"string"},border:{type:"number",default:.5},width:{type:"string",default:"width"},depth:{type:"string",default:"depth"},area:{type:"string"},color:{type:"string"},height:{type:"string",default:"height"},zone_elevation:{type:"number",default:.3},building_separation:{type:"number",default:.25},extra:{type:"number",default:1},levels:{type:"number"},building_color:{type:"string",default:"#E6B9A1"},base_color:{type:"color",default:"#98e690"},min_building_height:{type:"number",default:1},height_quarter_legend_box:{type:"number",default:11},height_quarter_legend_title:{type:"number",default:12},height_building_legend:{type:"number",default:0},legend_scale:{type:"number",default:1},field:{type:"string",default:"uid"}},entitiesWithLegend:[],dataComponent:void 0,newData:void 0,babiaMetadata:{id:0},visProperties:["height","area","width","depth"],multiple:!1,duration:2e3,figures_del:[],figures_in:[],animation:!1,init:function(){this.notiBuffer=new a},update:function(t){let e=this.data,i=this.el;if(this.figures||(this.figures=[]),e.data&&t.data!==e.data){let t=JSON.parse(e.data);this.processData(t)}else e.from!==t.from?(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=r(e,i),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&this.processData(this.newData)},tick:function(t,e){if(this.animation){let t={x:0,y:0,z:0};Date.now()-this.start_time>this.duration?(this.animation=!1,this.setFigures(this.figures,t)):this.Animation(this.el,this.figures,this.figures_old,e,t,t)}},updateChart:function(t){console.log("Data Loaded.");let e={x:0,y:0,z:0};this.animation&&(this.figures_del.forEach(t=>{let e=document.getElementById(t.id);e&&e.remove()}),this.figures_in.forEach(t=>{let e=document.getElementById(t.id);e&&s(e,1)}),this.setFigures(this.figures,e),this.animation=!1,this.figures_del=[],this.figures_in=[]),this.figures_old=this.figures,this.figures=[];let i,n=this.el,r=t;if(this.data.levels)i=this.data.border*this.data.extra*this.data.levels;else{let t=l(r,0);i=this.data.border*this.data.extra*(t+1)}if([x,y,e,this.figures]=this.generateElements(r,this.figures,e,i),e.x=0,e.z=0,0==this.figures_old.length){for(;this.el.firstChild;)this.el.firstChild.remove();this.drawElements(n,this.figures,e)}else this.figures_old!==this.figures&&(this.animation=!0,this.start_time=Date.now())},generateElements:function(t,e,i,n){var r=n,a=0,o=0,s=0,l=0,c=0,h=0,u=0,d=0,p=0,f=0,g=0,m=0,y=!1,b=!1,v=!1,x=!0;for(let i=0;i<t.length;i++){let w,C={};if(this.data.width&&(C.width=t[i][this.data.width]||.5),this.data.height&&(C.height=t[i][this.data.height]||this.data.min_building_height),this.data.depth&&(C.depth=t[i][this.data.depth]||.5),this.data.area&&(C.area=t[i][this.data.area]||.5),t[i].children){C.children=t[i].children,this.quarter=!0;var _,A=[];C.height=this.data.zone_elevation,r-=this.data.border*this.data.extra,[C.width,C.depth,_,A]=this.generateElements(C.children,A,_,r),_.y=C.height,r=n}0==i?(this.data.area&&!t[i].children?(a+=Math.sqrt(C.area)/2,o-=Math.sqrt(C.area)/2,s+=Math.sqrt(C.area)/2,l-=Math.sqrt(C.area)/2):(a+=C.depth/2,o-=C.depth/2,s+=C.width/2,l-=C.width/2),m=a+this.data.building_separation/2):C.height>0&&(y?([g,c,h,f]=this.UpSide(C,a,g,f),g>s&&(u=g+=this.data.building_separation/2,y=!1,x=!0,d<l&&(l=d),m=a+this.data.building_separation/2)):x?([m,c,h,u]=this.RightSide(C,s,m,u),m<o&&(p=m+=this.data.building_separation/2,x=!1,b=!0,f>a&&(a=f),g=s+this.data.building_separation/2)):b?([g,c,h,p]=this.DownSide(C,o,g,p),g<l&&(d=g-=this.data.building_separation/2,b=!1,v=!0,u>s&&(s=u),m=o-this.data.building_separation/2)):v&&([m,c,h,d]=this.LeftSide(C,l,m,d),m>a&&(f=m-=this.data.building_separation/2,v=!1,y=!0,p<o&&(o=p),g=l-this.data.building_separation/2))),w=t[i].children?{id:id="boat-"+t[i][this.data.field],name:t[i][this.data.field],posX:c,posY:h,width:C.width,height:C.height,depth:C.depth,children:A,translate_matrix:_}:this.data.area?{id:"boat-"+t[i][this.data.field],name:t[i][this.data.field],posX:c,posY:h,width:Math.sqrt(C.area),height:C.height,depth:Math.sqrt(C.area)}:{id:"boat-"+t[i][this.data.field],name:t[i][this.data.field],posX:c,posY:h,width:C.width,height:C.height,depth:C.depth},w.rawData=t[i],e.push(w)}p<o&&(o=p),d<l&&(l=d),f>a&&(a=f),u>s&&(s=u),g<l&&(l=g+this.data.building_separation/2),g>s&&(s=g-this.data.building_separation/2),m>a&&(a=m-this.data.building_separation/2),m<o&&(o=m+this.data.building_separation/2);var w=Math.abs(l)+Math.abs(s),C=Math.abs(o)+Math.abs(a);return[w+=2*r,C+=2*r,{x:l+w/2-r,y:0,z:o+C/2-r},e]},drawElements:function(t,e,i){for(let n in e){let r=e[n].height,a=e[n].posX,o=e[n].posY,s={x:a-i.x,y:r/2+i.y/2,z:-o+i.z},l=this.createElement(e[n],s);this.addEvents(l,e[n]),t.appendChild(l)}},RightSide:function(t,e,i,n){let r,a,o=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)+o):(r=parseFloat(t.width),a=parseFloat(t.depth)+o);let s=i-a/2,l=e+r+o;return l>n&&(n=l),[i-=a,e+r/2+o,s,n]},DownSide:function(t,e,i,n){let r,a,o=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area)+o,a=Math.sqrt(t.area)):(r=parseFloat(t.width)+o,a=parseFloat(t.depth));let s=i-r/2,l=e-a-o;return l<n&&(n=l),[i-=r,s,e-a/2-o,n]},LeftSide:function(t,e,i,n){let r,a,o=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)+o):(r=parseFloat(t.width),a=parseFloat(t.depth)+o);let s=i+a/2,l=e-r-o;return l<n&&(n=l),[i+=a,e-r/2-o,s,n]},UpSide:function(t,e,i,n){let r,a,o=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area)+o,a=Math.sqrt(t.area)):(r=parseFloat(t.width)+o,a=parseFloat(t.depth));let s=i+r/2,l=e+a+o;return l>n&&(n=l),[i+=r,s,e+a/2+o,n]},Animation:function(t,e,i,n,r,a){let o,l=this,c=Date.now();for(let u in e)if(document.getElementById(e[u].id))if(o=document.getElementById(e[u].id),e[u].inserted){let t=n/this.duration,i=parseFloat(o.getAttribute("material").opacity);i+t<1?i+=t:(i=1,e[u].inserted=!1),s(o,i);let r="id="+e[u].id;h(l.figures_in,r)<0&&l.figures_in.push(e[u])}else{let t="id="+e[u].id,s=h(i,t);s<0?(e[u].inserted=!0,o.getAttribute("width")!=e[u].width&&o.setAttribute("width",e[u].width),o.getAttribute("height")!=e[u].height&&o.setAttribute("height",e[u].height),o.getAttribute("depth")!=e[u].depth&&o.setAttribute("depth",e[u].depth)):(this.resize(o,c,n,e[u],i[s]),this.traslate(o,c,n,e[u],i[s],r,a),e[u].children&&this.Animation(o,e[u].children,i[s].children,n,e[u].translate_matrix,i[s].translate_matrix))}else{position={x:e[u].posX-r.x,y:e[u].height/2+r.y/2,z:-e[u].posY+r.z};let i=this.createElement(e[u],position);this.addEvents(i,e[u]),s(i,0),t.appendChild(i),e[u].inserted=!0}let u=n/this.duration;for(let t in i){let n=!1,r="id="+i[t].id;if(h(e,r)<0){h(l.figures_del,r)<0&&l.figures_del.push(i[t]);let e=document.getElementById(i[t].id);if(e){let r=parseFloat(e.getAttribute("material").opacity);r-u>0?r-=u:(r=0,n=!0,l.figures_del.pop(i[t])),s(e,r),n&&e.remove()}}}},setFigures:function(t,e){t.forEach(t=>{let i=document.getElementById(t.id);i&&(i.getAttribute("width")!=t.width&&i.setAttribute("width",t.width),i.getAttribute("height")!=t.height&&i.setAttribute("height",t.height),i.getAttribute("depth")!=t.depth&&i.setAttribute("depth",t.depth),i.setAttribute("position",{x:t.posX-e.x,y:(parseFloat(t.height)+e.y)/2,z:-t.posY+e.z}),t.children&&this.setFigures(t.children,t.translate_matrix))})},resize:function(t,e,i,n,r){if(e-this.start_time<this.duration&&(n.width!=r.width||n.height!=r.height||n.depth!=r.depth)){let e,a,o,s=Math.abs(n.width-r.width),l=Math.abs(n.height-r.height),c=Math.abs(n.depth-r.depth),h=i*s/this.duration,u=i*l/this.duration,d=i*c/this.duration,p=parseFloat(t.getAttribute("width")),f=parseFloat(t.getAttribute("height")),g=parseFloat(t.getAttribute("depth"));e=n.width-r.width<0?p-h:p+h,a=n.height-r.height<0?f-u:f+u,o=n.depth-r.depth<0?g-d:g+d,t.setAttribute("width",e),t.setAttribute("height",a),t.setAttribute("depth",o)}else e-this.start_time>this.duration&&(n.width!=r.width||n.height!=r.height||n.depth!=r.depth)&&(t.setAttribute("width",n.width),t.setAttribute("height",n.height),t.setAttribute("depth",n.depth),t.setAttribute("babiaRawData",JSON.stringify(n.rawData)))},traslate:function(t,e,i,n,r,a,o){let s=r.posX-o.x-(n.posX-a.x),l=n.height-r.height,c=r.posY-o.z-(n.posY-a.z);if(0!=s||0!=l||0!=c)if(e-this.start_time<this.duration){let e=i*s/this.duration,n=i*l/(2*this.duration),r=i*c/this.duration,a=parseFloat(t.getAttribute("position").x)-e,o=parseFloat(t.getAttribute("position").y)+n,h=parseFloat(t.getAttribute("position").z)+r;t.setAttribute("position",{x:a,y:o,z:h})}else e-this.start_time>this.duration&&t.setAttribute("position",{x:n.posX-a.x,y:(parseFloat(n.height)+a.y)/2,z:-n.posY+a.z})},createElement:function(t,e){let i=this,n=document.createElement("a-box");n.id=t.id,n.setAttribute("class","babiaxraycasterclass");let r=t.width,a=t.height,o=t.depth;return t.children?color=i.data.base_color:i.data.color?color=function(t,e,i){let n=[19,82,138],r=[255,94,83];var a=((((t||0)-i)/(e-i)*2-1)/1+1)/2,o=1-a,s=[Math.round(r[0]*a+n[0]*o),Math.round(r[1]*a+n[1]*o),Math.round(r[2]*a+n[2]*o)];return"rgb("+s[0]+","+s[1]+","+s[2]+")"}(t.rawData[i.data.color],i.babiaMetadata.color_max,i.babiaMetadata.color_min):color=i.data.building_color,n.setAttribute("color",color),n.setAttribute("width",r),n.setAttribute("height",a),n.setAttribute("depth",o),t.rawData&&n.setAttribute("babiaRawData",JSON.stringify(t.rawData)),n.setAttribute("position",{x:e.x,y:e.y,z:e.z}),n},processData:function(t){console.log("processData",t);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},e.color){let[t,i]=c(this.newData,e.color);this.babiaMetadata.color_max=t,this.babiaMetadata.color_min=i}this.notiBuffer.set(this.newData),this.updateChart(this.newData)},addEvents:function(t,e){let i=this;if(e.children){let n,r;t.addEventListener("click",(function(a){if(a.target===this)if(n){t.removeChild(r),i.el.parentElement.removeChild(n),n=void 0,r=void 0;const e=i.entitiesWithLegend.indexOf(t);e>-1&&i.entitiesWithLegend.splice(e,1)}else{r=document.createElement("a-entity"),r.setAttribute("class","babialegend");let a=t.getAttribute("geometry"),s=i.el.getAttribute("scale"),l=a.height+i.data.height_quarter_legend_box;s&&(l=(a.height+i.data.height_quarter_legend_box)/s.y),r.setAttribute("geometry",{height:l,depth:a.depth,width:a.width}),r.setAttribute("material",{visible:!0,opacity:.4}),t.appendChild(r),n=o(e.name,i.data.legend_scale,"black","white");let c=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),h={x:c.x,y:i.data.height_quarter_legend_title,z:c.z};n.setAttribute("position",h),n.setAttribute("visible",!0),i.el.parentElement.appendChild(n),i.entitiesWithLegend.push(t)}})),this.drawElements(t,e.children,e.translate_matrix)}else{let n,r,a=!1;t.addEventListener("click",(function(s){if(s.target===this)if(a){n.setAttribute("visible",!1),t.setAttribute("geometry",{height:r.height-.1,depth:r.depth-.1,width:r.width-.1}),t.setAttribute("material",{color:t.getAttribute("babiaxrFirstColor")}),i.el.parentElement.removeChild(n),n=void 0,a=!1;const e=i.entitiesWithLegend.indexOf(t);e>-1&&i.entitiesWithLegend.splice(e,1)}else{if(a=!0,!n){r=t.getAttribute("geometry");let a=t.getAttribute("position");t.setAttribute("position",a),t.setAttribute("babiaxrFirstColor",t.getAttribute("material").color),t.setAttribute("material",{color:"white"}),t.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),n=o(e.name,i.data.legend_scale,"white","black",JSON.parse(t.getAttribute("babiaRawData")),i.data.height,i.data.area,i.data.depth,i.data.width,i.data.color);let s=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),l=(new THREE.Box3).setFromObject(t.object3D),c={x:s.x,y:l.max.y+1+i.data.height_building_legend,z:s.z};n.setAttribute("position",c),n.setAttribute("visible",!0),i.el.parentElement.appendChild(n)}i.entitiesWithLegend.push(t)}})),t.addEventListener("mouseenter",(function(){if(!a){r=t.getAttribute("geometry");let a=t.getAttribute("position");t.setAttribute("position",a),t.setAttribute("babiaxrFirstColor",t.getAttribute("material").color),t.setAttribute("material",{color:"white"}),t.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),n=o(e.name,i.data.legend_scale,"white","black",JSON.parse(t.getAttribute("babiaRawData")),i.data.height,i.data.area,i.data.depth,i.data.width,i.data.color);let s=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),l=(new THREE.Box3).setFromObject(t.object3D),c={x:s.x,y:l.max.y+1+i.data.height_building_legend,z:s.z};n.setAttribute("position",c),n.setAttribute("visible",!0),i.el.parentElement.appendChild(n)}})),t.addEventListener("mouseleave",(function(){!a&&n&&(n.setAttribute("visible",!1),t.setAttribute("geometry",{height:r.height-.1,depth:r.depth-.1,width:r.width-.1}),t.setAttribute("material",{color:t.getAttribute("babiaxrFirstColor")}),i.el.parentElement.removeChild(n),n=void 0)}))}}});let o=(t,e,i,n,r,a,o,s,l,c)=>{let h=2,u=1;if(t.length>16&&(h=t.length/5),r){let e="\n "+a+" (height): "+Math.round(100*r[a])/100;if(e.length>16&&(h=e.length/5),t+=e,o){let i="\n "+o+" (area): "+Math.round(100*r[o])/100;i.length>16&&i>e&&(h=i.length/5),t+=i}else{let i="\n "+s+" (depth): "+Math.round(100*r[s])/100;i.length>16&&i>e&&(h=i.length/5),t+=i;let n="\n "+l+" (width): "+Math.round(100*r[l])/100;n.length>16&&n>e&&n>i&&(h=n.length/5),t+=n,u=1.5}if(c){let i="\n "+c+" (color): "+Math.round(100*r[c])/100;i.length>16&&i>e&&(h=i.length/5),t+=i,u+=.2}}let d=document.createElement("a-plane");return d.setAttribute("babia-lookat","[camera]"),d.setAttribute("rotation",{x:0,y:0,z:0}),d.setAttribute("height",u),d.setAttribute("width",h),d.setAttribute("color",i),d.setAttribute("material",{side:"double"}),d.setAttribute("text",{value:t,align:"center",width:6,color:n,alphaTest:6,opacity:6,transparent:!1}),d.setAttribute("visible",!1),d.setAttribute("class","babialegend"),d.setAttribute("scale",{x:e,y:e,z:e}),d};function s(t,e){if(t.setAttribute("material","opacity",e),t.childNodes)for(let i=0;i<t.childNodes.length;i++)s(t.childNodes[i],e)}let l=(t,e)=>{let i=e,n=e;for(let r in t)t[r].children&&(i++,n<(e=l(t[r].children,i))&&(n=e),i--);return n},c=(t,e,i,n)=>{for(let r=0;r<t.length;r++)t[r].children?[i,n]=c(t[r].children,e,i,n):(("null"!==t[r][e]&&!i||t[r][e]>i)&&(i=t[r][e]),("null"!==t[r][e]&&!n||t[r][e]<n)&&(n=t[r][e]));return[i,n]};let h=(t,e)=>{for(e=e.split("="),i=0;i<t.length;i++)if(t[i][e[0]]===e[1])return i;return-1}},function(t,e){var i,n=AFRAME.utils.debug,r=AFRAME.utils.coordinates,a=n("components:babia-lookat:warn"),o=r.isCoordinates||r.isCoordinate;delete AFRAME.components["babia-lookat"],AFRAME.registerComponent("babia-lookat",{schema:{default:"0 0 0",parse:function(t){return o(t)||"object"==typeof t?r.parse(t):t},stringify:function(t){return"object"==typeof t?r.stringify(t):t}},init:function(){this.target3D=null,this.vector=new THREE.Vector3,this.cameraListener=AFRAME.utils.bind(this.cameraListener,this),this.el.addEventListener("componentinitialized",this.cameraListener),this.el.addEventListener("componentremoved",this.cameraListener)},update:function(){var t,e=this,i=e.data;return!i||"object"==typeof i&&!Object.keys(i).length?e.remove():"object"==typeof i?this.lookAt(new THREE.Vector3(i.x,i.y,i.z)):(t=e.el.sceneEl.querySelector(i))?t.hasLoaded?e.beginTracking(t):t.addEventListener("loaded",(function(){e.beginTracking(t)})):void a('"'+i+'" does not point to a valid entity to babia-lookat')},tick:(i=new THREE.Vector3,function(t){var e=this.target3D;e&&(e.getWorldPosition(i),this.lookAt(i))}),remove:function(){this.el.removeEventListener("componentinitialized",this.cameraListener),this.el.removeEventListener("componentremoved",this.cameraListener)},beginTracking:function(t){this.target3D=t.object3D},cameraListener:function(t){t.detail&&"camera"===t.detail.name&&this.update()},lookAt:function(t){var e=this.vector,i=this.el.object3D;this.el.getObject3D("camera")?e.subVectors(i.position,t).add(i.position):e.copy(t),i.lookAt(e)}})},function(t,e,i){let n=i(0).findProdComponent,r=i(0).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let a=i(1);"default"in a&&(a=a.default);let o=i(57);"default"in o&&(o=o.default);let s=function(t){if("function"==typeof t)return t;let e=eval;try{return e("("+t+")")}catch(t){}return null},l=function(t){return isNaN(parseFloat(t))?s(t)?s(t):t:parseFloat(t)},c="";AFRAME.registerComponent("babia-network",{schema:{nodeLegend:{type:"boolean",default:!1},linkLegend:{type:"boolean",default:!1},from:{type:"string"},nodesFrom:{type:"string"},linksFrom:{type:"string"},data:{type:"string",default:""},nodes:{type:"string",default:""},links:{type:"string",default:""},nodeId:{type:"string",default:"id"},nodeLabel:{parse:l,default:"id"},linkId:{type:"string",default:""},linkSource:{type:"string",default:"source"},linkTarget:{type:"string",default:"target"},nodeVal:{type:"string",default:""},nodeRelSize:{type:"number",default:4},nodeColor:{parse:l,default:"color"},nodeAutoColorBy:{parse:l,default:""},nodeResolution:{type:"number",default:8},linkColor:{parse:l,default:"color"},linkAutoColorBy:{parse:l,default:""},linkWidth:{parse:l,default:0},linkResolution:{type:"number",default:6},linkLabel:{parse:l,default:""},nodeDesc:{parse:l,default:"desc"},linkDesc:{parse:l,default:"desc"},nodeVisibility:{parse:l,default:!0},nodeOpacity:{type:"number",default:1},linkVisibility:{parse:l,default:!0},linkOpacity:{type:"number",default:1},nodeThreeObject:{parse:l,default:null},nodeThreeObjectExtend:{parse:l,default:!1},linkCurvature:{parse:l,default:0},linkCurveRotation:{parse:l,default:0},linkMaterial:{parse:l,default:null},linkThreeObject:{parse:l,default:null},linkThreeObjectExtend:{parse:l,default:!1},linkPositionUpdate:{parse:s,default:null},linkDirectionalArrowLength:{parse:l,default:0},linkDirectionalArrowColor:{parse:l,default:null},linkDirectionalArrowRelPos:{parse:l,default:.5},linkDirectionalArrowResolution:{type:"number",default:8},linkDirectionalParticles:{parse:l,default:0},linkDirectionalParticleSpeed:{parse:l,default:.01},linkDirectionalParticleWidth:{parse:l,default:.5},linkDirectionalParticleColor:{parse:l,default:null},linkDirectionalParticleResolution:{type:"number",default:4},linkHoverPrecision:{type:"number",default:2},onNodeCenterHover:{parse:s,default:function(){}},onLinkCenterHover:{parse:s,default:function(){}},numDimensions:{type:"number",default:3},dagMode:{type:"string",default:""},dagLevelDistance:{type:"number",default:0},dagNodeFilter:{parse:s,function:()=>!0},onDagError:{parse:s,default:void 0},forceEngine:{type:"string",default:"d3"},d3AlphaMin:{type:"number",default:0},d3AlphaDecay:{type:"number",default:.0228},d3VelocityDecay:{type:"number",default:.4},ngraphPhysics:{parse:r,default:null},warmupTicks:{type:"int",default:0},cooldownTicks:{type:"int",default:1e18},cooldownTime:{type:"int",default:15e3},onEngineTick:{parse:s,default:function(){}},onEngineStop:{parse:s,default:function(){}}},getGraphBbox:function(){return this.forceGraph||(this.forceGraph=new o),this.forceGraph.getGraphBbox()},emitParticle:function(){this.forceGraph||(this.forceGraph=new o);const t=this.forceGraph,e=t.emitParticle.apply(t,arguments);return e===t?this:e},d3Force:function(){this.forceGraph||(this.forceGraph=new o);const t=this.forceGraph,e=t.d3Force.apply(t,arguments);return e===t?this:e},d3ReheatSimulation:function(){return this.forceGraph&&this.forceGraph.d3ReheatSimulation(),this},refresh:function(){return this.forceGraph&&this.forceGraph.refresh(),this},init:function(){let t=this.state={},e=document.querySelector("a-entity[camera], a-camera");t.cameraObj=e.object3D.children.filter((function(t){return"PerspectiveCamera"===t.type}))[0],this.el.sceneEl.addEventListener("camera-set-active",(function(e){t.cameraObj=e.detail.cameraEl.components.camera.camera})),this.forceGraph||(this.forceGraph=new o),this.el.object3D.add(this.forceGraph),c=document.querySelector("[cursor]"),document.addEventListener("controllerconnected",t=>{c=document.querySelector("[laser-controls]")})},update:function(t){let e=this.el,i=this.data;if(this.currentData=t,i.data&&t.data!==i.data){let t=r(i.data);this.processData(t)}else if(i.nodes){if(t.nodes!==i.nodes){let t=r(i.nodes);this.processNodes(t)}if(t.links!==i.links){let t=r(i.links);this.processLinks(t)}}else{if(i.from===t.from||i.nodesFrom){if(i.nodesFrom!==t.nodesFrom||i.linksFrom!==t.linksFrom){this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.nodesProdComponent&&this.nodesProdComponent.notiBuffer.unregister(this.notiBufferId),this.linksProdComponent&&this.linksProdComponent.notiBuffer.unregister(this.notiBufferId);let t=n(i,e);this.nodesProdComponent=t.nodes,this.nodesProdComponent.notiBuffer&&(this.notiBufferId=this.nodesProdComponent.notiBuffer.register(this.processNodes.bind(this))),this.linksProdComponent=t.links,this.linksProdComponent.notiBuffer&&(this.notiBufferId=this.linksProdComponent.notiBuffer.register(this.processLinks.bind(this)))}}else this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.nodesProdComponent&&this.nodesProdComponent.notiBuffer.unregister(this.notiBufferId),this.linksProdComponent&&this.linksProdComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(i,e),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)));if(i!==t)if(i.data){let t=r(i.data);this.processData(t)}else if(i.nodes){let t=r(i.nodes);this.processNodes(t)}}},tick:function(t,e){let i=c.components.raycaster.raycaster.intersectObjects(this.forceGraph.children).filter((function(t){return-1!==["node","link"].indexOf(t.object.__graphObjType)})).sort((function(t,e){return i(e)-i(t);function i(t){return"node"===t.object.__graphObjType}})),n=i.length?i[0].object:null;if(n!==this.state.hoverObj){const t=this.state.hoverObj?this.state.hoverObj.__graphObjType:null,e=this.state.hoverObj?this.state.hoverObj.__data:null,i=n?n.__graphObjType:null,r=n?n.__data:null;t&&t!==i&&this.data["on"+("node"===t?"Node":"Link")+"CenterHover"](null,e),(this.data.nodeLegend&&"node"===t||this.data.linkLegend&&""!=this.data.linkLabel&&"link"===t)&&this.removeLegend(this),i&&this.data["on"+("node"===i?"Node":"Link")+"CenterHover"](r,t===i?e:null),this.state.hoverObj=n,n&&(this.data.nodeLegend&&"node"===n.__graphObjType?this.showLegend(n,n.__data,this.data.nodeLabel,this.el.getAttribute("scale")):this.data.linkLegend&&"link"===n.__graphObjType&&""!=this.data.linkLabel&&this.showLinkLegend(n,n.__data,this.data.linkLabel,this.el.getAttribute("scale")))}this.forceGraph.tickFrame()},prodComponent:void 0,nodesProdComponent:void 0,linksProdComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},legend:"",updateChart:function(t,e){if(e.currentData){let i=AFRAME.utils.diff(t,e.currentData);["jsonUrl","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeVisibility","nodeColor","nodeAutoColorBy","nodeOpacity","nodeThreeObject","nodeThreeObjectExtend","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","forceEngine","d3AlphaMin","d3AphaDecay","d3VelocityDecay","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].filter((function(t){return t in i})).forEach((function(i){e.forceGraph[i](""!==t[i]?t[i]:null)})),("nodes"in i||"links"in i)&&e.forceGraph.graphData({nodes:t.nodes,links:t.links})}},processData:function(t){console.log("processData",this);let e=this.data;e.data=t,e=this.elDataFromData(e),this.data=e,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this)},processNodes:function(t){console.log("processNodes",this);let e=this.data;if(e.nodes=t,this.data.nodes=e.nodes,e=this.elDataFromNodesAndLinks(e),e)this.data=e,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this);else if(this.data.links){let t=r(this.data.links);this.processLinks(t)}else this.data.linksFrom&&(this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."))},processLinks:function(t){console.log("processLinks",this);let e=this.data;if(e.links="string"==typeof t||t instanceof String?JSON.parse(t):t,this.data.links=e.links,e=this.elDataFromNodesAndLinks(e),e)this.data=e,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this);else if(this.data.nodes){let t=r(this.data.nodes);this.processLinks(t)}else this.data.nodesFrom&&(this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."))},elDataFromData:function(t){let e=[],i=[];const n=t.data,r=t.nodeId,a=t.linkId,o=t.nodeVal,s=t.linkSource,l=t.linkTarget,c=t.linkLabel;return n.forEach(t=>{let i={};Object.keys(t).forEach((function(e){e===r?i[r]=t[e]:e===a?i.linkId=t[e]:e===o&&(i[o]=t[e])})),e.push(i)}),e.forEach(t=>{e.forEach(e=>{if(t[r]!==e[r]&&t.linkId===e.linkId)if(i.length>0){let n=!1;if(i.forEach(i=>{(i[s]===t[r]&&i[l]===e[r]||i[s]===e[r]&&i[l]===t[r])&&(n=!0)}),!n){let n={};n[c]=t[c],n[s]=t[r],n[l]=e[r],i.push(n)}}else{let n={};n[c]=t[c],n[s]=t[r],n[l]=e[r],i.push(n)}})}),t.nodes=e,t.links=i,t},elDataFromNodesAndLinks:function(t){let e=t.nodes,i=t.links;const n=t.nodeId,r=t.nodeVal,a=t.linkSource,o=t.linkTarget;return!(!Array.isArray(e)||!Array.isArray(i))&&(e.forEach(t=>{Object.keys(t).forEach((function(e){e===n?t[n]=t[e]:e===r&&(t[r]=t[e])}))}),i.map(t=>{e.forEach(e=>{t[a]===e[n]?t[a]=e[n]:t[o]===e[n]&&(t[o]=e[n])})}),t.nodes=e,t.links=i,t)},showLegend:function(t,e,i,n){let r=new THREE.Vector3;t.getWorldPosition(r);let a=t.geometry.boundingSphere.radius,o=document.querySelector("a-scene");this.legend=function(t,e,i,n,r){let a=t[e],o=2,s=3,l=3,c=3;a.length>16&&(o=a.length/8);r&&(s*=r.x,l*=r.y,c*=r.z,n=(n+3)*r.y);let h=document.createElement("a-plane");return h.setAttribute("position",{x:i.x,y:i.y+n,z:i.z}),h.setAttribute("babia-lookat","[camera]"),h.setAttribute("width",o),h.setAttribute("height","1"),h.setAttribute("color","white"),h.setAttribute("scale",{x:s,y:l,z:c}),h.setAttribute("text",{value:t[e],align:"center",width:6,color:"black"}),h.classList.add("babiaxrLegend"),h}(e,i,r,a,n),o.appendChild(this.legend)},showLinkLegend:function(t,e,i,n){let r=new THREE.Vector3,a=t.geometry.boundingSphere.radius,o=new THREE.Vector3,s=new THREE.Vector3;this.forceGraph.children.filter(t=>"node"==t.__graphObjType).forEach(t=>{t.__data[this.data.nodeId]==e.source[this.data.nodeId]&&t.getWorldPosition(o),t.__data[this.data.nodeId]==e.target[this.data.nodeId]&&t.getWorldPosition(s)}),r.x=(o.x+s.x)/2,r.y=(o.y+s.y)/2,r.z=(o.z+s.z)/2;let l=document.querySelector("a-scene");this.legend=function(t,e,i,n,r){let a=t[e],o=2,s=3,l=3,c=3;a.length>16&&(o=a.length/8);r&&(s*=r.x,l*=r.y,c*=r.z,n=(n+3)*r.y);let h=document.createElement("a-plane");return h.setAttribute("position",{x:i.x,y:i.y+n,z:i.z}),h.setAttribute("babia-lookat","[camera]"),h.setAttribute("width",o),h.setAttribute("height","1"),h.setAttribute("color","white"),h.setAttribute("scale",{x:s,y:l,z:c}),h.setAttribute("text",{value:t[e],align:"center",width:6,color:"black"}),h.classList.add("babiaxrLegend"),h}(e,i,r,a,n),l.appendChild(this.legend)},removeLegend:function(){if(this.legend){document.querySelector("a-scene").removeChild(this.legend)}}})},function(t,e,i){const n=i(3);function r(t,e){return`\n${o(t,e)}\n${a(t)}\nreturn {Body: Body, Vector: Vector};\n`}function a(t){let e=n(t),i=e("{var}",{join:", "});return`\nfunction Body(${i}) {\n this.isPinned = false;\n this.pos = new Vector(${i});\n this.force = new Vector();\n this.velocity = new Vector();\n this.mass = 1;\n\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.reset = function() {\n this.force.reset();\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.setPosition = function (${i}) {\n ${e("this.pos.{var} = {var} || 0;",{indent:2})}\n};`}function o(t,e){let i=n(t),r="";return e&&(r=""+i("\n var v{var};\nObject.defineProperty(this, '{var}', {\n set: function(v) { \n if (!Number.isFinite(v)) throw new Error('Cannot set non-numbers to {var}');\n v{var} = v; \n },\n get: function() { return v{var}; }\n});")),`function Vector(${i("{var}",{join:", "})}) {\n ${r}\n if (typeof arguments[0] === 'object') {\n // could be another vector\n let v = arguments[0];\n ${i('if (!Number.isFinite(v.{var})) throw new Error("Expected value is not a finite number at Vector constructor ({var})");',{indent:4})}\n ${i("this.{var} = v.{var};",{indent:4})}\n } else {\n ${i('this.{var} = typeof {var} === "number" ? {var} : 0;',{indent:4})}\n }\n }\n \n Vector.prototype.reset = function () {\n ${i("this.{var} = ",{join:""})}0;\n };`}t.exports=function(t,e){let i=r(t,e),{Body:n}=new Function(i)();return n},t.exports.generateCreateBodyFunctionBody=r,t.exports.getVectorCode=o,t.exports.getBodyCode=a},function(t,e,i){const n=i(3),r=i(7);function a(t){let e=n(t),i=Math.pow(2,t);return`\n${h()}\n${c(t)}\n${o(t)}\n${l(t)}\n${s(t)}\n\nfunction createQuadTree(options, random) {\n options = options || {};\n options.gravity = typeof options.gravity === 'number' ? options.gravity : -1;\n options.theta = typeof options.theta === 'number' ? options.theta : 0.8;\n\n var gravity = options.gravity;\n var updateQueue = [];\n var insertStack = new InsertStack();\n var theta = options.theta;\n\n var nodesCache = [];\n var currentInCache = 0;\n var root = newNode();\n\n return {\n insertBodies: insertBodies,\n\n /**\n * Gets root node if it is present\n */\n getRoot: function() {\n return root;\n },\n\n updateBodyForce: update,\n\n options: function(newOptions) {\n if (newOptions) {\n if (typeof newOptions.gravity === 'number') {\n gravity = newOptions.gravity;\n }\n if (typeof newOptions.theta === 'number') {\n theta = newOptions.theta;\n }\n\n return this;\n }\n\n return {\n gravity: gravity,\n theta: theta\n };\n }\n };\n\n function newNode() {\n // To avoid pressure on GC we reuse nodes.\n var node = nodesCache[currentInCache];\n if (node) {\n${function(t){let e=[];for(let n=0;n<i;++n)e.push(`${t}quad${n} = null;`);return e.join("\n")}(" node.")}\n node.body = null;\n node.mass = ${e("node.mass_{var} = ",{join:""})}0;\n ${e("node.min_{var} = node.max_{var} = ",{join:""})}0;\n } else {\n node = new QuadNode();\n nodesCache[currentInCache] = node;\n }\n\n ++currentInCache;\n return node;\n }\n\n function update(sourceBody) {\n var queue = updateQueue;\n var v;\n ${e("var d{var};",{indent:4})}\n var r; \n ${e("var f{var} = 0;",{indent:4})}\n var queueLength = 1;\n var shiftIdx = 0;\n var pushIdx = 1;\n\n queue[0] = root;\n\n while (queueLength) {\n var node = queue[shiftIdx];\n var body = node.body;\n\n queueLength -= 1;\n shiftIdx += 1;\n var differentBody = (body !== sourceBody);\n if (body && differentBody) {\n // If the current node is a leaf node (and it is not source body),\n // calculate the force exerted by the current node on body, and add this\n // amount to body's net force.\n ${e("d{var} = body.pos.{var} - sourceBody.pos.{var};",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n // Poor man's protection against zero distance.\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n\n // This is standard gravitation force calculation but we divide\n // by r^3 to save two operations when normalizing force vector.\n v = gravity * body.mass * sourceBody.mass / (r * r * r);\n ${e("f{var} += v * d{var};",{indent:8})}\n } else if (differentBody) {\n // Otherwise, calculate the ratio s / r, where s is the width of the region\n // represented by the internal node, and r is the distance between the body\n // and the node's center-of-mass\n ${e("d{var} = node.mass_{var} / node.mass - sourceBody.pos.{var};",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n // Sorry about code duplication. I don't want to create many functions\n // right away. Just want to see performance first.\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n // If s / r < θ, treat this internal node as a single body, and calculate the\n // force it exerts on sourceBody, and add this amount to sourceBody's net force.\n if ((node.max_${r(0)} - node.min_${r(0)}) / r < theta) {\n // in the if statement above we consider node's width only\n // because the region was made into square during tree creation.\n // Thus there is no difference between using width or height.\n v = gravity * node.mass * sourceBody.mass / (r * r * r);\n ${e("f{var} += v * d{var};",{indent:10})}\n } else {\n // Otherwise, run the procedure recursively on each of the current node's children.\n\n // I intentionally unfolded this loop, to save several CPU cycles.\n${function(){let t=Array(11).join(" "),e=[];for(let n=0;n<i;++n)e.push(t+`if (node.quad${n}) {`),e.push(t+` queue[pushIdx] = node.quad${n};`),e.push(t+" queueLength += 1;"),e.push(t+" pushIdx += 1;"),e.push(t+"}");return e.join("\n")}()}\n }\n }\n }\n\n ${e("sourceBody.force.{var} += f{var};",{indent:4})}\n }\n\n function insertBodies(bodies) {\n ${e("var {var}min = Number.MAX_VALUE;",{indent:4})}\n ${e("var {var}max = Number.MIN_VALUE;",{indent:4})}\n var i = bodies.length;\n\n // To reduce quad tree depth we are looking for exact bounding box of all particles.\n while (i--) {\n var pos = bodies[i].pos;\n ${e("if (pos.{var} < {var}min) {var}min = pos.{var};",{indent:6})}\n ${e("if (pos.{var} > {var}max) {var}max = pos.{var};",{indent:6})}\n }\n\n // Makes the bounds square.\n var maxSideLength = -Infinity;\n ${e("if ({var}max - {var}min > maxSideLength) maxSideLength = {var}max - {var}min ;",{indent:4})}\n\n currentInCache = 0;\n root = newNode();\n ${e("root.min_{var} = {var}min;",{indent:4})}\n ${e("root.max_{var} = {var}min + maxSideLength;",{indent:4})}\n\n i = bodies.length - 1;\n if (i >= 0) {\n root.body = bodies[i];\n }\n while (i--) {\n insert(bodies[i], root);\n }\n }\n\n function insert(newBody) {\n insertStack.reset();\n insertStack.push(root, newBody);\n\n while (!insertStack.isEmpty()) {\n var stackItem = insertStack.pop();\n var node = stackItem.node;\n var body = stackItem.body;\n\n if (!node.body) {\n // This is internal node. Update the total mass of the node and center-of-mass.\n ${e("var {var} = body.pos.{var};",{indent:8})}\n node.mass += body.mass;\n ${e("node.mass_{var} += body.mass * {var};",{indent:8})}\n\n // Recursively insert the body in the appropriate quadrant.\n // But first find the appropriate quadrant.\n var quadIdx = 0; // Assume we are in the 0's quad.\n ${e("var min_{var} = node.min_{var};",{indent:8})}\n ${e("var max_{var} = (min_{var} + node.max_{var}) / 2;",{indent:8})}\n\n${function(e){let i=[],n=Array(e+1).join(" ");for(let e=0;e<t;++e)i.push(n+`if (${r(e)} > max_${r(e)}) {`),i.push(n+` quadIdx = quadIdx + ${Math.pow(2,e)};`),i.push(n+` min_${r(e)} = max_${r(e)};`),i.push(n+` max_${r(e)} = node.max_${r(e)};`),i.push(n+"}");return i.join("\n")}(8)}\n\n var child = getChild(node, quadIdx);\n\n if (!child) {\n // The node is internal but this quadrant is not taken. Add\n // subnode to it.\n child = newNode();\n ${e("child.min_{var} = min_{var};",{indent:10})}\n ${e("child.max_{var} = max_{var};",{indent:10})}\n child.body = body;\n\n setChild(node, quadIdx, child);\n } else {\n // continue searching in this quadrant.\n insertStack.push(child, body);\n }\n } else {\n // We are trying to add to the leaf node.\n // We have to convert current leaf into internal node\n // and continue adding two nodes.\n var oldBody = node.body;\n node.body = null; // internal nodes do not cary bodies\n\n if (isSamePosition(oldBody.pos, body.pos)) {\n // Prevent infinite subdivision by bumping one node\n // anywhere in this quadrant\n var retriesCount = 3;\n do {\n var offset = random.nextDouble();\n ${e("var d{var} = (node.max_{var} - node.min_{var}) * offset;",{indent:12})}\n\n ${e("oldBody.pos.{var} = node.min_{var} + d{var};",{indent:12})}\n retriesCount -= 1;\n // Make sure we don't bump it out of the box. If we do, next iteration should fix it\n } while (retriesCount > 0 && isSamePosition(oldBody.pos, body.pos));\n\n if (retriesCount === 0 && isSamePosition(oldBody.pos, body.pos)) {\n // This is very bad, we ran out of precision.\n // if we do not return from the method we'll get into\n // infinite loop here. So we sacrifice correctness of layout, and keep the app running\n // Next layout iteration should get larger bounding box in the first step and fix this\n return;\n }\n }\n // Next iteration should subdivide node further.\n insertStack.push(node, oldBody);\n insertStack.push(node, body);\n }\n }\n }\n}\nreturn createQuadTree;\n\n`}function o(t){let e=n(t);return`\n function isSamePosition(point1, point2) {\n ${e("var d{var} = Math.abs(point1.{var} - point2.{var});",{indent:2})}\n \n return ${e("d{var} < 1e-8",{join:" && "})};\n } \n`}function s(t){var e=Math.pow(2,t);return`\nfunction setChild(node, idx, child) {\n ${function(){let t=[];for(let i=0;i<e;++i){let e=0===i?" ":" else ";t.push(`${e}if (idx === ${i}) node.quad${i} = child;`)}return t.join("\n")}()}\n}`}function l(t){return`function getChild(node, idx) {\n${function(){let e=[],i=Math.pow(2,t);for(let t=0;t<i;++t)e.push(` if (idx === ${t}) return node.quad${t};`);return e.join("\n")}()}\n return null;\n}`}function c(t){let e=n(t),i=Math.pow(2,t);return`\nfunction QuadNode() {\n // body stored inside this node. In quad tree only leaf nodes (by construction)\n // contain bodies:\n this.body = null;\n\n // Child nodes are stored in quads. Each quad is presented by number:\n // 0 | 1\n // -----\n // 2 | 3\n${function(t){let e=[];for(let n=0;n<i;++n)e.push(`${t}quad${n} = null;`);return e.join("\n")}(" this.")}\n\n // Total mass of current node\n this.mass = 0;\n\n // Center of mass coordinates\n ${e("this.mass_{var} = 0;",{indent:2})}\n\n // bounding box coordinates\n ${e("this.min_{var} = 0;",{indent:2})}\n ${e("this.max_{var} = 0;",{indent:2})}\n}\n`}function h(){return"\n/**\n * Our implementation of QuadTree is non-recursive to avoid GC hit\n * This data structure represent stack of elements\n * which we are trying to insert into quad tree.\n */\nfunction InsertStack () {\n this.stack = [];\n this.popIdx = 0;\n}\n\nInsertStack.prototype = {\n isEmpty: function() {\n return this.popIdx === 0;\n },\n push: function (node, body) {\n var item = this.stack[this.popIdx];\n if (!item) {\n // we are trying to avoid memory pressure: create new element\n // only when absolutely necessary\n this.stack[this.popIdx] = new InsertStackElement(node, body);\n } else {\n item.node = node;\n item.body = body;\n }\n ++this.popIdx;\n },\n pop: function () {\n if (this.popIdx > 0) {\n return this.stack[--this.popIdx];\n }\n },\n reset: function () {\n this.popIdx = 0;\n }\n};\n\nfunction InsertStackElement(node, body) {\n this.node = node; // QuadTree node\n this.body = body; // physical body which needs to be inserted to node\n}\n"}t.exports=function(t){let e=a(t);return new Function(e)()},t.exports.generateQuadTreeFunctionBody=a,t.exports.getInsertStackCode=h,t.exports.getQuadNodeCode=c,t.exports.isSamePosition=o,t.exports.getChildBodyCode=l,t.exports.setChildBodyCode=s},function(t,e,i){t.exports=function(t){let e=r(t);return new Function("bodies","settings","random",e)},t.exports.generateFunctionBody=r;const n=i(3);function r(t){let e=n(t);return`\n var boundingBox = {\n ${e("min_{var}: 0, max_{var}: 0,",{indent:4})}\n };\n\n return {\n box: boundingBox,\n\n update: updateBoundingBox,\n\n reset: resetBoundingBox,\n\n getBestNewPosition: function (neighbors) {\n var ${e("base_{var} = 0",{join:", "})};\n\n if (neighbors.length) {\n for (var i = 0; i < neighbors.length; ++i) {\n let neighborPos = neighbors[i].pos;\n ${e("base_{var} += neighborPos.{var};",{indent:10})}\n }\n\n ${e("base_{var} /= neighbors.length;",{indent:8})}\n } else {\n ${e("base_{var} = (boundingBox.min_{var} + boundingBox.max_{var}) / 2;",{indent:8})}\n }\n\n var springLength = settings.springLength;\n return {\n ${e("{var}: base_{var} + (random.nextDouble() - 0.5) * springLength,",{indent:8})}\n };\n }\n };\n\n function updateBoundingBox() {\n var i = bodies.length;\n if (i === 0) return; // No bodies - no borders.\n\n ${e("var max_{var} = -Infinity;",{indent:4})}\n ${e("var min_{var} = Infinity;",{indent:4})}\n\n while(i--) {\n // this is O(n), it could be done faster with quadtree, if we check the root node bounds\n var bodyPos = bodies[i].pos;\n ${e("if (bodyPos.{var} < min_{var}) min_{var} = bodyPos.{var};",{indent:6})}\n ${e("if (bodyPos.{var} > max_{var}) max_{var} = bodyPos.{var};",{indent:6})}\n }\n\n ${e("boundingBox.min_{var} = min_{var};",{indent:4})}\n ${e("boundingBox.max_{var} = max_{var};",{indent:4})}\n }\n\n function resetBoundingBox() {\n ${e("boundingBox.min_{var} = boundingBox.max_{var} = 0;",{indent:4})}\n }\n`}},function(t,e,i){const n=i(3);function r(t){return`\n if (!Number.isFinite(options.dragCoefficient)) throw new Error('dragCoefficient is not a finite number');\n\n return {\n update: function(body) {\n ${n(t)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}\n }\n };\n`}t.exports=function(t){let e=r(t);return new Function("options",e)},t.exports.generateCreateDragForceFunctionBody=r},function(t,e,i){const n=i(3);function r(t){let e=n(t);return`\n if (!Number.isFinite(options.springCoefficient)) throw new Error('Spring coefficient is not a number');\n if (!Number.isFinite(options.springLength)) throw new Error('Spring length is not a number');\n\n return {\n /**\n * Updates forces acting on a spring\n */\n update: function (spring) {\n var body1 = spring.from;\n var body2 = spring.to;\n var length = spring.length < 0 ? options.springLength : spring.length;\n ${e("var d{var} = body2.pos.{var} - body1.pos.{var};",{indent:6})}\n var r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n\n var d = r - length;\n var coefficient = ((spring.coefficient > 0) ? spring.coefficient : options.springCoefficient) * d / r;\n\n ${e("body1.force.{var} += coefficient * d{var}",{indent:6})};\n body1.springCount += 1;\n body1.springLength += r;\n\n ${e("body2.force.{var} -= coefficient * d{var}",{indent:6})};\n body2.springCount += 1;\n body2.springLength += r;\n }\n };\n`}t.exports=function(t){let e=r(t);return new Function("options","random",e)},t.exports.generateCreateSpringForceFunctionBody=r},function(t,e,i){const n=i(3);function r(t){let e=n(t);return`\n var length = bodies.length;\n if (length === 0) return 0;\n\n ${e("var d{var} = 0, t{var} = 0;",{indent:2})}\n\n for (var i = 0; i < length; ++i) {\n var body = bodies[i];\n if (body.isPinned) continue;\n\n if (adaptiveTimeStepWeight && body.springCount) {\n timeStep = (adaptiveTimeStepWeight * body.springLength/body.springCount);\n }\n\n var coeff = timeStep / body.mass;\n\n ${e("body.velocity.{var} += coeff * body.force.{var};",{indent:4})}\n ${e("var v{var} = body.velocity.{var};",{indent:4})}\n var v = Math.sqrt(${e("v{var} * v{var}",{join:" + "})});\n\n if (v > 1) {\n // We normalize it so that we move within timeStep range. \n // for the case when v <= 1 - we let velocity to fade out.\n ${e("body.velocity.{var} = v{var} / v;",{indent:6})}\n }\n\n ${e("d{var} = timeStep * body.velocity.{var};",{indent:4})}\n\n ${e("body.pos.{var} += d{var};",{indent:4})}\n\n ${e("t{var} += Math.abs(d{var});",{indent:4})}\n }\n\n return (${e("t{var} * t{var}",{join:" + "})})/length;\n`}t.exports=function(t){let e=r(t);return new Function("bodies","timeStep","adaptiveTimeStepWeight",e)},t.exports.generateIntegratorFunctionBody=r},function(t,e){t.exports=function(t,e,i,n){this.from=t,this.to=e,this.length=i,this.coefficient=n}},function(t,e){t.exports=function t(e,i){var n;e||(e={});if(i)for(n in i)if(i.hasOwnProperty(n)){var r=e.hasOwnProperty(n),a=typeof i[n];!r||typeof e[n]!==a?e[n]=i[n]:"object"===a&&(e[n]=t(e[n],i[n]))}return e}},function(t,e){function i(t){return new n("number"==typeof t?t:+new Date)}function n(t){this.seed=t}function r(t){return Math.sqrt(2*Math.PI/t)*Math.pow(1/Math.E*(t+1/(12*t-1/(10*t))),t)}function a(){var t=this.seed;return t=4294967295&(3042594569^(t=(t=4294967295&((t=(t=4294967295&(3345072700^(t=t+2127912214+(t<<12)&4294967295)^t>>>19))+374761393+(t<<5)&4294967295)+3550635116^t<<9))+4251993797+(t<<3)&4294967295)^t>>>16),this.seed=t,(268435455&t)/268435456}t.exports=i,t.exports.random=i,t.exports.randomIterator=function(t,e){var n=e||i();if("function"!=typeof n.next)throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:function(e){var i,r,a;for(i=t.length-1;i>0;--i)r=n.next(i+1),a=t[r],t[r]=t[i],t[i]=a,e(a);t.length&&e(t[0])},shuffle:function(){var e,i,r;for(e=t.length-1;e>0;--e)i=n.next(e+1),r=t[i],t[i]=t[e],t[e]=r;return t}}},n.prototype.next=function(t){return Math.floor(this.nextDouble()*t)},n.prototype.nextDouble=a,n.prototype.uniform=a,n.prototype.gaussian=function(){var t,e,i;do{e=2*this.nextDouble()-1,i=2*this.nextDouble()-1,t=e*e+i*i}while(t>=1||0===t);return e*Math.sqrt(-2*Math.log(t)/t)},n.prototype.levy=function(){var t=Math.pow(r(2.5)*Math.sin(1.5*Math.PI/2)/(1.5*r(1.25)*Math.pow(2,.25)),1/1.5);return this.gaussian()*t/Math.pow(Math.abs(this.gaussian()),1/1.5)}},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-label",{schema:{text:{type:"string"},height:{type:"number",default:1},width:{type:"number",default:3},textWidth:{type:"number",default:6},color:{type:"color",default:"white"},font:{type:"string",default:"default"},background:{type:"color",default:"black"},align:{type:"string",default:"center"}},update:function(t){console.log("Starting label..."),this.el.setAttribute("geometry",{primitive:"plane",height:this.data.height,width:this.data.width}),this.el.setAttribute("material",{color:this.data.color}),this.el.setAttribute("text",{value:this.data.text,align:this.data.align,width:this.data.textWidth,color:this.data.background}),this.el.classList.add("babiaxrLegend")}})},function(t,e,i){const n=i(0).colors;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");class r{constructor(t,e,i,n){this.el=t,this.axis=e,this.anim=i,this.dur=n}updateLine(t,e){const i=this.axis,n=this.el,r=this.anim,a=this.dur,o=`line__${i}axis`;let s=n.components[o],l={x:0,y:0,z:0};l[i]=t,r&&s?(n.setAttribute(`animation__${i}axis`,{property:o+".end",to:l,dur:a}),n.setAttribute(o,{color:e})):n.setAttribute(o,{start:{x:0,y:0,z:0},end:l,color:e})}removeLabels(){const t=this.el,e=this.anim,i=this.dur;let n=t.querySelectorAll("[text]");for(const t of n)e?(t.addEventListener("animationcomplete",(function(t){t.target.remove()})),t.setAttribute("animation",{property:"text.opacity",to:0,dur:i})):t.remove()}updateLabels(t,e,i,r,a){const o=this.axis;let s=this.el;const l=this.anim,c=this.dur;for(let h=0;h<t.length;++h){let u,d=document.createElement("a-entity"),p=i;r&&(p=n.get(h,r)),d.setAttribute("text",{value:e[h],align:"right",width:10,color:p,opacity:0}),"behind"!=a&&"right"!=a||d.setAttribute("text",{align:"left"}),"x"===o?u="behind"==a?{x:t[h],y:0,z:-5.15}:{x:t[h],y:0,z:5.25}:"y"===o?u="right"==a?{x:5.2,y:t[h],z:0}:{x:-5.2,y:t[h],z:0}:"z"===o&&(u="right"==a?{x:5.2,y:0,z:t[h]}:{x:-5.2,y:0,z:t[h]}),d.setAttribute("position",u),"x"===o?d.setAttribute("rotation",{x:-90,y:90,z:0}):"z"===o&&d.setAttribute("rotation",{x:-90,y:0,z:0}),l?d.setAttribute("animation",{property:"text.opacity",to:1,dur:c}):d.setAttribute("text",{opacity:1}),s.appendChild(d)}}updateName(t,e,i){const n=this.axis;let r=this.el;const a=this.anim,o=this.dur;let s,l=document.createElement("a-entity");l.setAttribute("text",{value:t,align:"right",width:10,color:"#000",opacity:0}),"behind"!=e&&"right"!=e||l.setAttribute("text",{align:"left"}),"x"===n?s="behind"==e?{x:i+.5,y:0,z:-5.15}:{x:i+.5,y:0,z:5.25}:"y"===n?s="right"==e?{x:5.2,y:i+.5,z:0}:{x:-5.2,y:i+.5,z:0}:"z"===n&&(s="right"==e?{x:5.2,y:0,z:i+.5}:{x:-5.2,y:0,z:i+.5}),l.setAttribute("position",s),"x"===n?l.setAttribute("rotation",{x:-90,y:90,z:0}):"z"===n&&l.setAttribute("rotation",{x:-90,y:0,z:0}),a?l.setAttribute("animation",{property:"text.opacity",to:1,dur:o}):l.setAttribute("text",{opacity:1}),r.appendChild(l)}}AFRAME.registerComponent("babia-axis-y",{schema:{maxValue:{type:"number"},length:{type:"number"},minSteps:{type:"number",default:6},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"left"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"y",this.data.animation,this.data.dur)},update:function(t){const e=this.data;let i=this.data.maxValue,n=this.data.length,r=this.data.minSteps;this.data.animation,this.data.dur;let a=0;if(console.log("Starting babia-axis-y:",i,n,this.data.color),i!=t.maxValue||n!=t.maxValue||r!=t.minSteps){let t=Math.floor(Math.log10(i));t<=0&&(a=1-t);let o=n/i,s=Math.pow(10,t),l=i/s;for(;l<=r;)s/=2,l=i/s;this.axis.updateLine(n,e.color),this.axis.removeLabels();let c=[],h=[];for(let t=1;s*t<i;t++)vtick=s*t,c.push(vtick*o),h.push(vtick.toFixed(a));this.axis.updateLabels(c,h,e.color,e.palette,e.align)}e.name&&this.axis.updateName(e.name,e.align,e.length)}}),AFRAME.registerComponent("babia-axis-x",{schema:{labels:{type:"array"},ticks:{type:"array"},length:{type:"number"},color:{type:"color",default:"#000"},palette:{type:"string",default:""},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"front"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"x",this.data.animation,this.data.dur)},update:function(t){const e=this.data;console.log("Starting babia-axis-x:",e.ticks.length,e.length,this.data.color),this.axis.updateLine(e.length,e.color),this.axis.removeLabels(),this.axis.updateLabels(e.ticks,e.labels,e.color,e.palette,e.align),e.name&&this.axis.updateName(e.name,e.align,e.length)}}),AFRAME.registerComponent("babia-axis-z",{schema:{labels:{type:"array"},ticks:{type:"array"},length:{type:"number"},color:{type:"color",default:"#000"},palette:{type:"string",default:""},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"left"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"z",this.data.animation,this.data.dur)},update:function(t){const e=this.data;console.log("Starting babia-axis-z:",e.ticks.length,e.length,this.data.color),this.axis.updateLine(e.length,e.color),this.axis.removeLabels(),this.axis.updateLabels(e.ticks,e.labels,e.color,e.palette,e.align),e.name&&this.axis.updateName(e.name,e.align,e.length)}})},function(t,e,i){i(0).colors;AFRAME.registerComponent("babia-bar",{schema:{height:{type:"number"},width:{type:"number"},depth:{type:"number"},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},label:{type:"string",default:""},labelText:{type:"string",default:""}},init:function(){console.log("Starting bar:",this.data.height,this.data.color);let t=this.data;this.box=document.createElement("a-entity"),this.box.classList.add("babiaxraycasterclass"),this.el.appendChild(this.box);let e={};e=t.animation?{height:0,width:t.width,depth:t.depth}:{height:t.height,width:t.width,depth:t.depth},this.box.setAttribute("geometry",{primitive:"box",height:e.height,width:e.width,depth:e.depth}),this.box.setAttribute("material",{color:t.color})},update:function(t){let e=this.data,i=this.box;this.updateProperty(i,"geometry","height",e.animation,e.height,t.height),e.height!=t.height&&(e.animation?(i.setAttribute("animation__pos",{property:"position",to:{x:0,y:e.height/2,z:0},dur:e.dur}),e.height<=0&&t.height>0?i.setAttribute("animation__opacity",{property:"material.opacity",to:0,dur:e.dur}):t.height<=0&&e.height>0&&i.setAttribute("animation__opacity",{property:"material.opacity",to:100,dur:e.dur})):(i.setAttribute("position",{x:0,y:e.height/2,z:0}),e.height<=0&&t.height>0?i.setAttribute("material","opacity",0):t.height<=0&&e.height>0&&i.setAttribute("material","opacity",100))),this.updateProperty(i,"geometry","width",e.animation,e.width,t.width),this.updateProperty(i,"geometry","depth",e.animation,e.depth,t.depth),this.updateProperty(i,"material","color",e.animation,e.color,t.color),"events"===this.data.label?(i.addEventListener("mouseenter",this.showLabel.bind(this)),i.addEventListener("mouseleave",this.hideLabel.bind(this))):"fixed"===this.data.label&&this.showLabel(t)},updateProperty:function(t,e,i,n,r,a){let o=this.data;if(r!==a)if(n){let n=e;i&&(n=n+"."+i),t.setAttribute("animation__"+e+"_"+i,{property:n,to:r,dur:o.dur})}else i?t.setAttribute(e,{[i]:r}):t.setAttribute(e,r)},showLabel:function(t){let e=this.data;"events"===e.label&&this.el.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),text=e.labelText;let i=2;text.length>16&&(i=text.length/8);oldHeight=t.height||0,oldDepth=t.depth||0;let n={x:0,y:oldHeight+.6,z:0};this.labelEl||(this.labelEl=document.createElement("a-entity"),this.labelEl.setAttribute("babia-label",{width:i,textWidth:6}),e.animation&&"fixed"===e.label&&this.labelEl.setAttribute("position",n),this.el.appendChild(this.labelEl));let r={x:0,y:e.height+.6,z:.7*e.depth},a=e.animation&&"fixed"===e.label;this.updateProperty(this.labelEl,"position","",a,r,n),this.labelEl.setAttribute("rotation",{x:0,y:0,z:0}),text!=t.labelText&&this.labelEl.setAttribute("babia-label",{text:e.labelText})},hideLabel:function(){"events"===this.data.label&&this.el.setAttribute("scale",{x:1,y:1,z:1}),this.labelEl&&(this.el.removeChild(this.labelEl),this.labelEl=null)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function i(t,e){t.getObject3D("mesh")?n(t,e):t.addEventListener("model-loaded",(function(){t.color=e,n(t,e)}))}function n(t,e){t.object3D.traverse((function(t){last_material=t.material,last_material&&(t.material=new THREE.MeshBasicMaterial({color:e}))}))}AFRAME.registerComponent("babia-controls",{schema:{},multiple:!1,init:function(){this.createPlayer()},update:function(t){},player:void 0,createPlayer:function(){this.player=document.createElement("a-entity"),this.player.classList.add("babiaxrPlayer"),this.player.classList.add("babiaxraycasterclass"),this.el.appendChild(this.player),this.createButton("rewind","white"),this.createButton("skipPrev","white"),this.createButton("pause","white"),this.createButton("skipNext","white"),this.createButton("forward","grey")},createButton:function(t,e){let n,r,a,o,s=!1;if("play"===t)n=playButton.default,r=.2,a="babiaPlay",o="babiaContinue";else if("pause"===t)n=pauseButton.default,r=0,a="babiaPause",o="babiaStop";else if("skipNext"===t)n=skipButton.default,r=3,a="babiaSkipNext",o=a,s=!0;else if("skipPrev"===t)n=skipButton.default,r=-3,a="babiaSkipPrev",o=a;else if("rewind"===t)n=rewindButton.default,r=-6,a="babiaRewind",o="babiaToPast";else{if("forward"!==t)throw new Error("That button type doesn't exist.");n=rewindButton.default,r=6,a="babiaForward",o="babiaToPresent",s=!0}let l=document.createElement("a-entity");l.setAttribute("gltf-model","url("+n+")"),l.classList.add("babiaxraycasterclass"),l.classList.add(a),l.setAttribute("position",{x:r,y:0,z:0}),i(l,e),s&&l.setAttribute("rotation",{x:0,y:180,z:0}),this.player.appendChild(l),this.emitEvents(l,o),this.mouseOver(l)},mouseOver:function(t){t.addEventListener("mouseenter",(function(){i(t,"grey")})),t.addEventListener("mouseleave",(function(){i(t,t.color)}))},emitEvents:function(t,e){let n=this;t.addEventListener("click",(function(){if(t.classList.contains("babiaPlay"))this.parentEl.removeChild(this),n.createButton("pause","white");else if(t.classList.contains("babiaPause"))this.parentEl.removeChild(this),n.createButton("play","white");else if(t.classList.contains("babiaSkipNext")||t.classList.contains("babiaSkipPrev")){let t=document.getElementsByClassName("babiaPause")[0];t&&(n.player.removeChild(t),n.createButton("play","white"))}else if(t.classList.contains("babiaForward")){this.color="grey",i(this,this.color);let t=document.getElementsByClassName("babiaRewind")[0];t.color="white",i(t,t.color)}else if(t.classList.contains("babiaRewind")){this.color="grey",i(this,this.color);let t=document.getElementsByClassName("babiaForward")[0];t.color="white",i(t,t.color)}n.el.parentEl.components["babia-navigator"].controlNavigator(e)}))}})},function(t,e,i){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const n=i(2).NotiBuffer;AFRAME.registerComponent("babia-navigator",{schema:{},multiple:!1,isPaused:void 0,sliderEl:void 0,toPresent:void 0,init:function(){this.notiBuffer=new n(this.registerBack.bind(this),this.unregisterBack.bind(this)),this.toPresent=!0,this.isPaused=!1},update:function(t){},initializeControls:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.min=0,this.sliderEl.max=this.selector.selectable.length-1,this.current=this.selector.selectable.current,this.sliderEl.setAttribute("babia-slider",{size:1.5,min:this.sliderEl.min,max:this.sliderEl.max,value:this.current}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="timeline",this.sliderEl.setAttribute("scale",{x:2.3,y:2.3,z:2.3}),this.el.appendChild(this.sliderEl),this.controlsEl=document.createElement("a-entity"),this.controlsEl.setAttribute("babia-controls",""),this.controlsEl.classList.add("babiaxraycasterclass"),this.controlsEl.setAttribute("scale",{x:.15,y:.15,z:.3}),this.controlsEl.object3D.position.y=-.5,this.el.appendChild(this.controlsEl),this.stepControllerEl=document.createElement("a-entity"),this.stepControllerEl.setAttribute("babia-step-controller",""),this.stepControllerEl.classList.add("babiaxraycasterclass"),this.stepControllerEl.object3D.position.x=2.5,this.el.appendChild(this.stepControllerEl),this.speedControllerEl=document.createElement("a-entity"),this.speedControllerEl.setAttribute("babia-speed-controller",""),this.speedControllerEl.classList.add("babiaxraycasterclass"),this.speedControllerEl.object3D.position.x=3,this.el.appendChild(this.speedControllerEl)},updateSlider:function(t){let e=this.sliderEl.getAttribute("babia-slider").value;"babiaSkipNext"===t?e++:"babiaSkipPrev"===t&&e--,e>=0&&e<=this.sliderEl.max?(this.sliderEl.setAttribute("babia-slider","value",e),this.notiBuffer.set("babiaSetPosition"+e)):this.controlsEl.querySelector(".babiaPause")&&(this.notiBuffer.set("babiaSetPosition"+e),this.el.querySelector(".babiaPause").emit("click"))},registerBack:function(t){this.selector=t,this.prodComponent=t,this.prodComponent.navNotiBuffer&&(this.navNotiBufferId=this.prodComponent.navNotiBuffer.register(this.processData.bind(this)))},unregisterBack:function(t){t.navNotiBuffer.unregister(this.navNotiBufferId)},processData:function(t){"babiaStop"==t?(this.isPaused=!0,this.controlsEl.querySelector(".babiaPause")&&this.controlsEl.querySelector(".babiaPause").emit("click")):(this.sliderEl||this.initializeControls(),this.toPresent?this.current=t-1:this.current=t+1,this.current>=this.sliderEl.min&&this.current<=this.sliderEl.max&&this.sliderEl.setAttribute("babia-slider","value",this.current))},prodComponent:void 0,navNotiBufferId:void 0,sliderComp:void 0,controlsComp:void 0,stepComp:void 0,speedComp:void 0,controlNavigator:function(t,e){console.log("Navigator control: ",t),"babiaSkipNext"==t||"babiaSkipPrev"==t?(this.isPaused=!0,this.updateSlider(t)):(this.notiBuffer.set(t+e),"babiaContinue"===t?this.isPaused=!1:"babiaStop"===t?(this.isPaused=!0,this.controlsEl.querySelector(".babiaPause")&&this.controlsEl.querySelector(".babiaPause").emit("click")):"babiaToPresent"===t?this.toPresent=!0:"babiaToPast"===t&&(this.toPresent=!1))}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-slider",{schema:{color:{type:"color",default:"#fff"},size:{type:"number",default:.5},min:{type:"number",default:-6},max:{type:"number",default:-4},value:{type:"number",default:-5},innerSize:{type:"number",default:.8},precision:{type:"number",default:2},vertical:{type:"boolean",default:!1}},multiple:!0,init:function(){this.loader=new THREE.FontLoader;let t=new THREE.MeshBasicMaterial({color:this.data.color});this.material=t;let e=new THREE.Mesh(new THREE.BoxGeometry(.05,.15,.05),t),i=new THREE.Mesh(new THREE.CylinderGeometry(.015,.015,this.data.size,12),t);i.rotateZ(Math.PI/2);let n=new THREE.Group;this.lever=e,n.add(i),n.add(e),this.data.vertical&&n.rotateZ(Math.PI/2),this.el.setObject3D("mesh",n),this.el.classList.add("babiaxraycasterclass"),this.controllers=Array.prototype.slice.call(document.querySelectorAll("a-entity[hand-controls]")),this.fontURL="https://threejsfundamentals.org/threejs/resources/threejs/fonts/helvetiker_regular.typeface.json",this.loader.load(this.fontURL,t=>{this.font=t;let e=this.createTextGeometry(this.data.min,-this.data.size/2-.15,-.025),i=this.createTextGeometry(this.data.max,this.data.size/2+.08,-.025);n.add(e),n.add(i)})},createTextGeometry:function(t,e,i){let n=new THREE.TextGeometry(t.toString(),{font:this.font,size:.07,height:.01,curveSegments:12,bevelEnabled:!1}),r=new THREE.Mesh(n,this.material);return r.position.x=e,r.position.y=i,this.data.vertical&&(r.rotation.z=-Math.PI/2,r.position.y+=.05),r},setTextGeometry:function(t){this.textmesh&&(this.lever.children=[]),this.loader.load(this.fontURL,e=>{this.font=e,this.data.vertical?this.textmesh=this.createTextGeometry(t,-.025,-.2):this.textmesh=this.createTextGeometry(t,-.025,.15),this.lever.add(this.textmesh)})},play:function(){this.grabbed=!1,this.el.addEventListener("rangeout",this.onTriggerUp.bind(this)),this.controllers.forEach(function(t){t.addEventListener("triggerdown",this.onTriggerDown.bind(this)),t.addEventListener("triggerup",this.onTriggerUp.bind(this))}.bind(this))},pause:function(){this.el.removeEventListener("rangeout",this.onTriggerUp.bind(this)),this.controllers.forEach(function(t){t.removeEventListener("triggerdown",this.onTriggerDown.bind(this)),t.removeEventListener("triggerup",this.onTriggerUp.bind(this))}.bind(this))},onTriggerDown:function(t){var e=t.target.object3D,i=this.lever,n=(new THREE.Box3).setFromObject(e),r=(new THREE.Box3).setFromObject(i);if(n.intersectsBox(r)){let t=new THREE.Vector3;e.getWorldPosition(t);let n=new THREE.Vector3;i.getWorldPosition(n),t.distanceTo(n)<.1&&(this.grabbed=e,this.grabbed.visible=!1,this.knob.material=this.knobGrabbedMaterial)}},onTriggerUp:function(){this.grabbed&&(this.grabbed.visible=!0,this.grabbed=!1,this.knob.material=this.knobMaterial)},setValue:function(t){var e=this.lever;t<this.data.min?t=this.data.min:t>this.data.max&&(t=this.data.max),this.value=t,e.position.x=this.valueToLeverPosition(t),this.setTextGeometry(t)},valueToLeverPosition:function(t){var e=this.data.size*this.data.innerSize,i=Math.abs(this.data.max-this.data.min);let n=-1*e/2;return(t-this.data.min)*e/i+n},leverPositionToValue:function(t){var e=this.data.size*this.data.innerSize;return(t- -1*e/2)*Math.abs(this.data.max-this.data.min)/e+this.data.min},tick:function(){if(this.grabbed){var t=this.grabbed,e=this.lever,i=this.data.size*this.data.innerSize,n=(new THREE.Vector3).setFromMatrixPosition(t.matrixWorld);e.parent.worldToLocal(n),Math.abs(n.x)>i/2?e.position.x=i/2*Math.sign(e.position.x):e.position.x=n.x;var r=this.leverPositionToValue(e.position.x);Math.abs(this.value-r)>=Math.pow(10,-this.data.precision)&&(r=Math.round(r),this.value=r,this.setTextGeometry(r),this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetPosition",this.value))}},mousexPositionToValue:function(t){let e=this.el.object3D.getWorldPosition().x,i=this.data.size*this.data.innerSize*this.el.object3D.getWorldScale().x,n=(t-(e-i/2))*Math.abs(this.data.max-this.data.min)/i+this.data.min;return n<this.data.min?this.data.min:n>this.data.max?this.data.max:n},mouseyPositionToValue:function(t){let e=this.el.object3D.getWorldPosition().y,i=this.data.size*this.data.innerSize*this.el.object3D.getWorldScale().y,n=(t-(e-i/2))*Math.abs(this.data.max-this.data.min)/i+this.data.min;return n<this.data.min?this.data.min:n>this.data.max?this.data.max:n},update:function(t){this.data.value!==t.value&&this.setValue(this.data.value),this.el.addEventListener("click",_listener=t=>{let e,i=t.detail.intersection.point;e=this.data.vertical?this.mouseyPositionToValue(i.y):this.mousexPositionToValue(i.x),this.setValue(Math.round(e)),this.el.parentEl.components["babia-navigator"]?this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetPosition",Math.round(e)):this.el.parentEl.components["babia-step-controller"]?this.el.parentEl.components["babia-step-controller"].controlStep(Math.round(e)):this.el.parentEl.components["babia-speed-controller"]&&this.el.parentEl.components["babia-speed-controller"].controlSpeed(Math.round(e))})}}),AFRAME.registerComponent("babia-step-controller",{schema:{},multiple:!0,sliderEl:void 0,step:void 0,init:function(){this.createSlider()},createSlider:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.setAttribute("babia-slider",{size:1,min:1,max:10,value:1,vertical:!0}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="step-controller",this.el.appendChild(this.sliderEl)},controlStep:function(t){this.step=t,this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetStep",this.step)}}),AFRAME.registerComponent("babia-speed-controller",{schema:{},multiple:!0,sliderEl:void 0,speed:void 0,init:function(){this.createSlider()},createSlider:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.setAttribute("babia-slider",{size:1,min:1,max:3,value:1,vertical:!0}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="speed-controller",this.el.appendChild(this.sliderEl)},controlSpeed:function(t){this.speed=t,this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetSpeed",this.speed)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-ui-link",{schema:{viz:{type:"string"},ui:{type:"string"}},linked_viz:void 0,ui_target:void 0,init:function(){this.createButton()},update:function(t){let e=this.data;n(e,this.el,this),i(e,this.el,this),console.log("VIZ",this.linked_viz)},createButton:function(){this.button=document.createElement("a-entity"),this.button.classList.add("babiaxraycasterclass"),this.button.setAttribute("geometry",{primitive:"plane",height:1,width:3}),this.button.setAttribute("material",{color:"#FFF"}),this.button.setAttribute("text",{value:"Manage me",align:"center",width:8,color:"#000"}),this.button.setAttribute("position",{x:0,y:-1,z:0}),this.addListeners(this.button,this),this.el.appendChild(this.button)},addListeners:function(t,e){t.addEventListener("mouseenter",(function(){t.setAttribute("text",{color:"#FFF"}),t.setAttribute("material",{color:"#333"})})),t.addEventListener("mouseleave",(function(){t.setAttribute("text",{color:"#000"}),t.setAttribute("material",{color:"#FFF"})})),t.addEventListener("click",(function(){let t=document.querySelector("#"+e.ui_target);console.log(e.linked_viz),t.setAttribute("babia-ui","target",e.linked_viz)}))}});let i=(t,e,i)=>t.ui?void(i.ui_target=t.ui):e.components["babia-ui"]?void(i.ui_target=e.components["babia-ui"]):document.querySelectorAll("[babia-ui]").length>0?void(i.ui_target=document.querySelectorAll("[babia-ui]")[0].id):void console.error("UI Component not found."),n=(t,e,i)=>{if(!t.viz)return e.components["babia-bars"]||e.components["babia-barsmap"]||e.components["babia-boats"]||e.components["babia-bubbles"]||e.components["babia-city"]||e.components["babia-cyls"]||e.components["babia-cylsmap"]||e.components["babia-doughnut"]||e.components["babia-network"]||e.components["babia-pie"]?void(i.linked_viz=e.id):void console.error("Visuzlizer not found.");i.linked_viz=t.viz}},function(t,e,i){"use strict";i.r(e),e.default="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInBhdXNlIiwKICAgICAgICAgICAgInJvdGF0aW9uIiA6IFsKICAgICAgICAgICAgICAgIDAuNzA3MTA2NzY5MDg0OTMwNCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgIm1lc2hlcyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAibmFtZSIgOiAiUGxhbmUiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNTYsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMC44MDk2NzM1NDc3NDQ3NTEsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMQogICAgICAgICAgICBdLAogICAgICAgICAgICAibWluIiA6IFsKICAgICAgICAgICAgICAgIC0wLjc5NjU0NzUzMjA4MTYwNCwKICAgICAgICAgICAgICAgIC0wLjE5Njg4OTQ2MDA4NjgyMjUsCiAgICAgICAgICAgICAgICAtMQogICAgICAgICAgICBdLAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMyIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMSwKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyNiwKICAgICAgICAgICAgImNvdW50IiA6IDU2LAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMyIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMiwKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyNiwKICAgICAgICAgICAgImNvdW50IiA6IDU2LAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMiIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMywKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyMywKICAgICAgICAgICAgImNvdW50IiA6IDcyLAogICAgICAgICAgICAidHlwZSIgOiAiU0NBTEFSIgogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVyVmlld3MiIDogWwogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA2NzIsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDAKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA2NzIsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDY3MgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDQ0OCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTM0NAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDE0NCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTc5MgogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAxOTM2LAogICAgICAgICAgICAidXJpIiA6ICJkYXRhOmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTtiYXNlNjQsaXVwTHZ3QUFBQUFBQUlBL2l1cEx2d0FBQUFBQUFJQy82RlZRdmdBQUFBQUFBSUMvNkZWUXZnQUFBQUFBQUlBL3hFWlBQMlNkU2I0QUFJQS94RVpQUDJTZFNiNEFBSUMvYkoxSlBtU2RTYjRBQUlDL2NKMUpQbVNkU2I0QUFJQS82RlZRdm1TZFNiNEFBSUEvNkZWUXZtU2RTYjRBQUlDL2l1cEx2MlNkU2I0QUFJQy9pdXBMdjJTZFNiNEFBSUEvY0oxSlBnQUFBQUFBQUlBL2JKMUpQZ0FBQUFBQUFJQy94RVpQUHdBQUFBQUFBSUMveEVaUFB3QUFBQUFBQUlBLzZGVlF2Z0FBQUFBQUFJQy82RlZRdm1TZFNiNEFBSUMvNkZWUXZtU2RTYjRBQUlBLzZGVlF2Z0FBQUFBQUFJQS94RVpQUHdBQUFBQUFBSUMveEVaUFAyU2RTYjRBQUlDL3hFWlBQMlNkU2I0QUFJQS94RVpQUHdBQUFBQUFBSUEvaXVwTHZ3QUFBQUFBQUlBL2l1cEx2MlNkU2I0QUFJQS9pdXBMdjJTZFNiNEFBSUMvaXVwTHZ3QUFBQUFBQUlDL2NKMUpQZ0FBQUFBQUFJQS9jSjFKUG1TZFNiNEFBSUEvYkoxSlBtU2RTYjRBQUlDL2NKMUpQZ0FBQUFBQUFJQS9iSjFKUG1TZFNiNEFBSUMvYkoxSlBnQUFBQUFBQUlDLzZGVlF2Z0FBQUFBQUFJQS82RlZRdm1TZFNiNEFBSUEvaXVwTHYyU2RTYjRBQUlBLzZGVlF2Z0FBQUFBQUFJQS9pdXBMdjJTZFNiNEFBSUEvaXVwTHZ3QUFBQUFBQUlBL2l1cEx2d0FBQUFBQUFJQy9pdXBMdjJTZFNiNEFBSUMvNkZWUXZtU2RTYjRBQUlDL2l1cEx2d0FBQUFBQUFJQy82RlZRdm1TZFNiNEFBSUMvNkZWUXZnQUFBQUFBQUlDL3hFWlBQd0FBQUFBQUFJQS94RVpQUDJTZFNiNEFBSUEvY0oxSlBtU2RTYjRBQUlBL3hFWlBQd0FBQUFBQUFJQS9jSjFKUG1TZFNiNEFBSUEvY0oxSlBnQUFBQUFBQUlBL2JKMUpQZ0FBQUFBQUFJQy9iSjFKUG1TZFNiNEFBSUMveEVaUFAyU2RTYjRBQUlDL3hFWlBQd0FBQUFBQUFJQy9BQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFBQUFDQUFBQ0FQd0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFhaDZLeUFBQ0FQd0FBQUFBYWg2S3lBQUNBUHdBQUFBQWFoNkt5QUFDQVB3QUFBQUFhaHlLekFBQ0FQd0FBQUFBYWh5S3pBQUNBUHdBQUFBQWFoeUt6QUFBQUFBQUFBQUFBQUlDL0FBQUFBQUFBQUFBQUFJQy9BQUFBQUFBQUFBQUFBSUMvQUFBQUFBQUFBQUQvLzMrL0FBQUFBQUFBQUFELy8zKy9BQUFBQUFBQUFBRC8vMysvQUFBQUFBQUFBQUQvLzM4L0FBQUFBQUFBQUFELy8zOC9BQUFBQUFBQUFBRC8vMzgvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlDL0FBQUFBQUFBQUFBQUFJQy9BQUFBQUFBQUFBQUFBSUMvQUFBQUFBQUFBQUQvLzMrL0FBQUFBQUFBQUFELy8zKy9BQUFBQUFBQUFBRC8vMysvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBZ0Q4QUFBQUFBQUFBQUJEVmx6NEFBQUFBRU5XWFBnQUFnRDhBQUlBL0FBQ0FQd0FBZ0Q4QUFBQUFUSkF4UHdBQUFBQk1rREUvQUFDQVB4RFZsejRBQUlBL0VOV1hQZ0FBQUFBQUFBQUFBQUFBQUFBQUFBQUFBSUEvVEpBeFB3QUFnRDlNa0RFL0FBQUFBQUFBZ0Q4QUFBQUFBQUNBUHdBQWdEOFExWmMrQUFBQUFCRFZsejRBQUFBQUVOV1hQZ0FBZ0Q4UTFaYytBQUNBUHdBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUlBL0FBQ0FQd0FBZ0Q4QUFJQS9BQUFBQUFBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUFBQUFBQUFBQUFBQUFCTWtERS9BQUNBUDB5UU1UOEFBSUEvVEpBeFB3QUFBQUJNa0RFL0FBQ0FQMHlRTVQ4QUFBQUFUSkF4UHdBQUFBQVExWmMrQUFDQVB4RFZsejRBQUlBL0FBQUFBQUFBZ0Q4UTFaYytBQUNBUHdBQUFBQUFBSUEvQUFBQUFBQUFnRDhBQUFBQUFBQUFBQUFBQUFBQUFBQUFFTldYUGdBQUFBQUFBQUFBQUFBQUFCRFZsejRBQUFBQUVOV1hQZ0FBQUFBQUFJQS9BQUNBUHdBQWdEOEFBSUEvVEpBeFB3QUFnRDhBQUlBL0FBQ0FQMHlRTVQ4QUFJQS9USkF4UHdBQWdEOU1rREUvQUFBQUFFeVFNVDhBQUFBQUFBQ0FQd0FBQUFBQUFJQS9BQUFBQUFBQUFRQUNBQUFBQWdBREFBUUFCUUFHQUFRQUJnQUhBQWdBQ1FBS0FBZ0FDZ0FMQUF3QURRQU9BQXdBRGdBUEFCQUFFUUFTQUJBQUVnQVRBQlFBRlFBV0FCUUFGZ0FYQUJnQUdRQWFBQmdBR2dBYkFCd0FIUUFlQUI4QUlBQWhBQ0lBSXdBa0FDVUFKZ0FuQUNnQUtRQXFBQ3NBTEFBdEFDNEFMd0F3QURFQU1nQXpBRFFBTlFBMkFEUUFOZ0EzQUE9PSIKICAgICAgICB9CiAgICBdCn0K"},function(t,e,i){"use strict";i.r(e),e.default="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogIlBsYXkiLAogICAgICAgICAgICAicm90YXRpb24iIDogWwogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0LAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibWVzaGVzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJuYW1lIiA6ICJQbGFuZS4wMDEiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJtaW4iIDogWwogICAgICAgICAgICAgICAgLTEsCiAgICAgICAgICAgICAgICAtMC4xOTY4ODk0NzQ5ODc5ODM3LAogICAgICAgICAgICAgICAgLTAuOTk0OTY1NjcyNDkyOTgxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAxLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAyLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMyIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAzLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTIzLAogICAgICAgICAgICAiY291bnQiIDogMjQsCiAgICAgICAgICAgICJ0eXBlIiA6ICJTQ0FMQVIiCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJWaWV3cyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDIxNiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDIxNiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMjE2CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMTQ0LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiA0MzIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA0OCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogNTc2CiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDYyNCwKICAgICAgICAgICAgInVyaSIgOiAiZGF0YTphcHBsaWNhdGlvbi9vY3RldC1zdHJlYW07YmFzZTY0LEFBQ0F2MldkU2I0U3RuNi9BQUNBdjJXZFNiNEFBSUEvQUFDQVAyV2RTYjRBR2txOEFBQ0FQd0FBQUFBQUdrcThBQUNBUDJXZFNiNEFHa3E4QUFDQXYyV2RTYjRBQUlBL0FBQ0F2d0FBQUFBQUFJQS9BQUNBdndBQUFBQVN0bjYvQUFDQVB3QUFBQUFBR2txOEFBQ0F2d0FBQUFBQUFJQS9BQUNBdndBQUFBQVN0bjYvQUFDQXYyV2RTYjRTdG42L0FBQ0FQMldkU2I0QUdrcThBQUNBUHdBQUFBQUFHa3E4QUFDQXZ3QUFBQUFBQUlBL0FBQ0F2MldkU2I0QUFJQS9BQUNBdjJXZFNiNFN0bjYvQUFDQXZ3QUFBQUFTdG42L0FBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQWZqbm52Z0FBQUFBNGFHUy9mam5udmdBQUFBQTRhR1MvZmpubnZnQUFBQUE0YUdTL2Zqbm52Z0FBQUFBNGFHUy9BQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FhY2JodmdBQUFBQVh4R1UvYWNiaHZnQUFBQUFYeEdVL2FjYmh2Z0FBQUFBWHhHVS9hY2JodmdBQUFBQVh4R1UvQUFDQVB3QUFBQUFBQUFDQUFBQ0FQd0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFBQUFDQUFBQUFBQUQzSkRzQUFBQUFBQUNBUHdBQWdEK1kxL3crQUFDQVA1algvRDRBQUlBL21OZjhQZ0FBQUFBQUFJQS9BQUFBQUFBQWdEOEFBQUFBQVBja093QUFnRCtZMS93K0FBQUFBQUFBZ0Q4QUFBQUFBUGNrT3dBQUFBQUE5eVE3QUFDQVA1algvRDRBQUlBL21OZjhQZ0FBQUFBQUFJQS9BQUFBQUFBQWdEOEFBQUFBQVBja093QUFBQUFBOXlRN0FBQUJBQUlBQXdBRUFBVUFBd0FGQUFZQUJ3QUlBQWtBQ2dBTEFBd0FDZ0FNQUEwQURnQVBBQkFBRGdBUUFCRUEiCiAgICAgICAgfQogICAgXQp9Cg=="},function(t,e,i){"use strict";i.r(e),e.default="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInNraXAiLAogICAgICAgICAgICAicm90YXRpb24iIDogWwogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0LAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibWVzaGVzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJuYW1lIiA6ICJQbGFuZS4wMDIiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJtaW4iIDogWwogICAgICAgICAgICAgICAgLTEsCiAgICAgICAgICAgICAgICAtMC4yMDIzNTg2MDM0Nzc0NzgwMywKICAgICAgICAgICAgICAgIC0xCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAxLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAyLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMyIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAzLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTIzLAogICAgICAgICAgICAiY291bnQiIDogNzIsCiAgICAgICAgICAgICJ0eXBlIiA6ICJTQ0FMQVIiCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJWaWV3cyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDU1MiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDU1MiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogNTUyCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMzY4LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAxMTA0CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMTQ0LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAxNDcyCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDE2MTYsCiAgICAgICAgICAgICJ1cmkiIDogImRhdGE6YXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtO2Jhc2U2NCxBQUNBdndBQUFBQUFBSUEvQUFDQXZ3QUFBQUFBQUlDLzVBSWF2d0FBQUFBQUFJQy81QUlhdndBQUFBQUFOck83NUFJYXZ3QUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQS9BQUNBUHhnM1Q3NEFBSUEvNUFJYXZ4ZzNUNzRBTnJPNzVBSWF2d0FBQUFBQU5yTzdBQUNBUHhnM1Q3NEFBSUMvNUFJYXZ4ZzNUNzRBTnJPN0FBQ0FQeGczVDc0QUFJQS9BQUNBUHdBQUFBQUFBSUMvQUFDQVB3QUFBQUFBQUlBLzVBSWF2d0FBQUFBQU5yTzc1QUlhdnhnM1Q3NEFOck83NUFJYXZ4ZzNUNzRBQUlDL0FBQ0F2eGczVDc0QUFJQy9BQUNBdnhnM1Q3NEFBSUEvNUFJYXZ4ZzNUNzRBQUlBLzVBSWF2d0FBQUFBQUFJQy81QUlhdnhnM1Q3NEFBSUMvNUFJYXZ4ZzNUNzRBTnJPNzVBSWF2d0FBQUFBQU5yTzdBQUNBdndBQUFBQUFBSUMvQUFDQXZ4ZzNUNzRBQUlDLzVBSWF2eGczVDc0QUFJQy81QUlhdndBQUFBQUFBSUMvNUFJYXZ3QUFBQUFBTnJPNzVBSWF2eGczVDc0QU5yTzdBQUNBUHhnM1Q3NEFBSUMvQUFDQVB3QUFBQUFBQUlDLzVBSWF2eGczVDc0QUFJQS81QUlhdndBQUFBQUFBSUEvNUFJYXZ3QUFBQUFBQUlBLzVBSWF2eGczVDc0QUFJQS9BQUNBdnhnM1Q3NEFBSUEvQUFDQXZ3QUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQy9BQUNBUHhnM1Q3NEFBSUMvQUFDQVB4ZzNUNzRBQUlBL0FBQ0FQd0FBQUFBQUFJQS9BQUNBdndBQUFBQUFBSUEvQUFDQXZ4ZzNUNzRBQUlBL0FBQ0F2eGczVDc0QUFJQy9BQUNBdndBQUFBQUFBSUMvQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FOUjBJUHdBQUFBREQwRmkvTlIwSVB3QUFBQUREMEZpL05SMElQd0FBQUFERDBGaS9OUjBJUHdBQUFBREQwRmkvQUFBQUFQLy9mejhBQUFBQUFBQUFBUC8vZno4QUFBQUFBQUFBQVAvL2Z6OEFBQUFBQUFBQUFQLy9mNzhBQUFDQUFBQUFBUC8vZjc4QUFBQ0FBQUFBQVAvL2Y3OEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlBL0RRd0hQd0FBQUFCUmUxay9EUXdIUHdBQUFBQlJlMWsvRFF3SFB3QUFBQUJSZTFrL0RRd0hQd0FBQUFCUmUxay9BQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQUFBQUFBQUlBQUFJQy9BQUFBQUFBQUFJQUFBSUMvQUFBQUFBQUFBSUFBQUlDL0FBQUFBQUFBQUlBQUFJQy9BQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQVB3QUFBSUFBQUFDQUFBQ0FQd0FBQUlBQUFBQ0FBQUNBUHdBQUFJQUFBQUNBQUFDQVB3QUFBSUFBQUFDQUFBQUFBQUFBZ0Q4QUFBQUFBQUFBQURqNlN6NEFBQUFBT1BwTFBwU1ovajQ0K2tzK0FBQ0FQd0FBZ0Q4QUFJQS9BQUNBUHdBQWdEODQra3MrbEpuK1BqajZTejZVbWY0K0FBQ0FQd0FBQUFBNCtrcytsSm4rUGdBQWdEOEFBSUEvQUFDQVB3QUFBQUFBQUlBL0FBQ0FQemo2U3o2VW1mNCtPUHBMUHBTWi9qNDQra3MrQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBZ0Q4NCtrcytBQUNBUHpqNlN6NEFBQUFBT1BwTFBnQUFBQUE0K2tzK2xKbitQamo2U3o2VW1mNCtBQUFBQUFBQUFBQUFBQUFBQUFBQUFEajZTejRBQUFBQU9QcExQZ0FBQUFBNCtrcytsSm4rUGpqNlN6NlVtZjQrQUFDQVB3QUFBQUFBQUlBL0FBQUFBRGo2U3o0QUFJQS9PUHBMUGdBQWdEODQra3MrQUFDQVB6ajZTejRBQUlBL0FBQUFBQUFBZ0Q4QUFBQUFBQUNBUHdBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUlBL0FBQ0FQd0FBZ0Q4QUFJQS9BQUFBQUFBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBRUFBZ0FBQUFJQUF3QUFBQU1BQkFBRkFBWUFCd0FGQUFjQUNBQUpBQW9BQ3dBTUFBMEFEZ0FQQUJBQUVRQVBBQkVBRWdBVEFBOEFFZ0FVQUJVQUZnQVVBQllBRndBWUFCa0FHZ0FZQUJvQUd3QWNBQjBBSGdBY0FCNEFId0FYQUJZQUlBQVhBQ0FBSVFBaUFDTUFKQUFpQUNRQUpRQW1BQ2NBS0FBbUFDZ0FLUUFxQUNzQUxBQXFBQ3dBTFFBPSIKICAgICAgICB9CiAgICBdCn0K"},function(t,e,i){"use strict";i.r(e),e.default="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInJld2luZCIsCiAgICAgICAgICAgICJyb3RhdGlvbiIgOiBbCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAuNzA3MTA2NzY5MDg0OTMwNAogICAgICAgICAgICBdCiAgICAgICAgfQogICAgXSwKICAgICJtZXNoZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlBsYW5lLjAwMyIsCiAgICAgICAgICAgICJwcmltaXRpdmVzIiA6IFsKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAiYXR0cmlidXRlcyIgOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICJQT1NJVElPTiIgOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAiTk9STUFMIiA6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICJURVhDT09SRF8wIiA6IDIKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICJpbmRpY2VzIiA6IDMKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAiYWNjZXNzb3JzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDAsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgIm1heCIgOiBbCiAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgXSwKICAgICAgICAgICAgIm1pbiIgOiBbCiAgICAgICAgICAgICAgICAtMSwKICAgICAgICAgICAgICAgIC0wLjE5NzQ5NzA4NDczNjgyNDA0LAogICAgICAgICAgICAgICAgLTEKICAgICAgICAgICAgXSwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzMiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDEsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzMiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDIsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzIiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDMsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjMsCiAgICAgICAgICAgICJjb3VudCIgOiA2MCwKICAgICAgICAgICAgInR5cGUiIDogIlNDQUxBUiIKICAgICAgICB9CiAgICBdLAogICAgImJ1ZmZlclZpZXdzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogNDgwLAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAwCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogNDgwLAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiA0ODAKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAzMjAsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDk2MAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDEyMCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTI4MAogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAxNDAwLAogICAgICAgICAgICAidXJpIiA6ICJkYXRhOmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTtiYXNlNjQsQUFDQVB3QUFBQUFBQUlBL0FBQ0FQNjA4U3I0QUFJQS9KeFk3dTYwOFNyNEFLbmc3SnhZN3V3QUFBQUFBS25nN0FBQ0FQNjA4U3I0QUFJQy9KeFk3dTYwOFNyNEFLbmc3QUFDQVA2MDhTcjRBQUlBL0FBQ0F2d0FBQUFBQTZQaTdBQUNBdjYwOFNyNEE2UGk3QUNDcnU2MDhTcjRBQUlDL0FDQ3J1d0FBQUFBQUFJQy9BQUNBdndBQUFBQUE2UGk3QUNDcnV3QUFBQUFBQUlDL0p4WTd1d0FBQUFBQUtuZzdBR0FFdWdBQUFBQUFBSUEvQUNDcnV3QUFBQUFBQUlDL0FDQ3J1NjA4U3I0QUFJQy9KeFk3dTYwOFNyNEFLbmc3SnhZN3V3QUFBQUFBS25nN0FBQ0FQd0FBQUFBQUFJQy9BQUNBUHdBQUFBQUFBSUEvQUNDcnU2MDhTcjRBQUlDL0FBQ0F2NjA4U3I0QTZQaTdBR0FFdXEwOFNyNEFBSUEvSnhZN3V3QUFBQUFBS25nN0p4WTd1NjA4U3I0QUtuZzdBR0FFdXEwOFNyNEFBSUEvQUdBRXVnQUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQy9BQUNBUDYwOFNyNEFBSUMvQUFDQVA2MDhTcjRBQUlBL0FBQ0FQd0FBQUFBQUFJQS9KeFk3dXdBQUFBQUFLbmc3SnhZN3U2MDhTcjRBS25nN0FBQ0FQNjA4U3I0QUFJQy9BQUNBUHdBQUFBQUFBSUMvQUdBRXVnQUFBQUFBQUlBL0FHQUV1cTA4U3I0QUFJQS9BQUNBdjYwOFNyNEE2UGk3QUFDQXZ3QUFBQUFBNlBpN3ZXbzBQd0FBQUFDbm5qVy92V28wUHdBQUFBQ25ualcvdldvMFB3QUFBQUNubmpXL3ZXbzBQd0FBQUFDbm5qVy9BQUFBQUFBQWdEOEFBQUFBQUFBQUFBQUFnRDhBQUFBQUFBQUFBQUFBZ0Q4QUFBQUFrTTAwUHdBQUFBQkZQRFUva00wMFB3QUFBQUJGUERVL2tNMDBQd0FBQUFCRlBEVS9rTTAwUHdBQUFBQkZQRFUvQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQTB2OS92d0FBQUFEbGt4bzcwdjkvdndBQUFBRGxreG83MHY5L3Z3QUFBQURsa3hvNzB2OS92d0FBQUFEbGt4bzdBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQTBQOS92d0FBQUFEamt4bzcwUDkvdndBQUFBRGpreG83MFA5L3Z3QUFBQURqa3hvNzBQOS92d0FBQUFEamt4bzdBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBZHhvMVB3QUFBQUJyN3pRL2R4bzFQd0FBQUFCcjd6US9keG8xUHdBQUFBQnI3elEvZHhvMVB3QUFBQUJyN3pRL25iODFQd0FBQUFDSlNUUy9uYjgxUHdBQUFBQ0pTVFMvbmI4MVB3QUFBQUNKU1RTL25iODFQd0FBQUFDSlNUUy9BQUNBUHdBQWdEOEFBSUEvQUFDQVArcEUvejRWZkFBLzZrVC9QaFY4QUQ4QUFJQS9BQUFBQU9wRS96NFZmQUEvQUFDQVB3QUFnRDhBQUFBQU1BNytQZ0FBQUFBd0R2NCt3S24rUGdBQUFBREFxZjQrQUFBQUFBQUFBQUF3RHY0K3dLbitQZ0FBQUFEcVJQOCtGWHdBUCtqZS96NEFBSUEvd0tuK1BnQUFBQURBcWY0K0FBQUFBT3BFL3o0VmZBQS82a1QvUGhWOEFEOEFBSUEvQUFBQUFBQUFnRDhBQUlBL3dLbitQZ0FBQUFBQUFBQUFNQTcrUHVqZS96NEFBSUEvNmtUL1BoVjhBRC9xUlA4K0ZYd0FQK2plL3o0QUFJQS82TjcvUGdBQWdEOEFBSUEvQUFBQUFBQUFnRDhBQUFBQUFBQ0FQd0FBZ0Q4QUFJQS9BQUNBUCtwRS96NFZmQUEvNmtUL1BoVjhBRDhBQUlBL0FBQUFBQUFBZ0Q4QUFBQUE2TjcvUGdBQWdEL28zdjgrQUFDQVB3QUFBQUF3RHY0K0FBQUFBREFPL2o0QUFBRUFBZ0FBQUFJQUF3QUVBQVVBQmdBSEFBZ0FDUUFIQUFrQUNnQUxBQXdBRFFBT0FBc0FEUUFQQUJBQUVRQVBBQkVBRWdBVEFCUUFEUUFGQUJVQUZnQUZBQllBRndBWUFCa0FHZ0FZQUJvQUd3QWNBQjBBSGdBY0FCNEFId0FnQUNFQUlnQWdBQ0lBSXdBa0FDVUFKZ0FrQUNZQUp3QT0iCiAgICAgICAgfQogICAgXQp9Cg=="},function(t,e,i){"use strict";i.r(e);function n(){}Object.assign(n.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)},removeEventListener:function(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}},dispatchEvent:function(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t)}}});const r=[];for(let t=0;t<256;t++)r[t]=(t<16?"0":"")+t.toString(16);let a=1234567;const o={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(r[255&t]+r[t>>8&255]+r[t>>16&255]+r[t>>24&255]+"-"+r[255&e]+r[e>>8&255]+"-"+r[e>>16&15|64]+r[e>>24&255]+"-"+r[63&i|128]+r[i>>8&255]+"-"+r[i>>16&255]+r[i>>24&255]+r[255&n]+r[n>>8&255]+r[n>>16&255]+r[n>>24&255]).toUpperCase()},clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},damp:function(t,e,i,n){return o.lerp(t,e,1-Math.exp(-i*n))},pingpong:function(t,e=1){return e-Math.abs(o.euclideanModulo(t,2*e)-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(a=t%2147483647),a=16807*a%2147483647,(a-1)/2147483646},degToRad:function(t){return t*o.DEG2RAD},radToDeg:function(t){return t*o.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,i,n,r){const a=Math.cos,o=Math.sin,s=a(i/2),l=o(i/2),c=a((e+n)/2),h=o((e+n)/2),u=a((e-n)/2),d=o((e-n)/2),p=a((n-e)/2),f=o((n-e)/2);switch(r){case"XYX":t.set(s*h,l*u,l*d,s*c);break;case"YZY":t.set(l*d,s*h,l*u,s*c);break;case"ZXZ":t.set(l*u,l*d,s*h,s*c);break;case"XZX":t.set(s*h,l*f,l*p,s*c);break;case"YXY":t.set(l*p,s*h,l*f,s*c);break;case"ZYZ":t.set(l*f,l*p,s*h,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};class s{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}s.prototype.isVector2=!0;class l{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,a,o,s,l){const c=this.elements;return c[0]=t,c[1]=n,c[2]=o,c[3]=e,c[4]=r,c[5]=s,c[6]=i,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[3],s=i[6],l=i[1],c=i[4],h=i[7],u=i[2],d=i[5],p=i[8],f=n[0],g=n[3],m=n[6],y=n[1],b=n[4],v=n[7],x=n[2],_=n[5],A=n[8];return r[0]=a*f+o*y+s*x,r[3]=a*g+o*b+s*_,r[6]=a*m+o*v+s*A,r[1]=l*f+c*y+h*x,r[4]=l*g+c*b+h*_,r[7]=l*m+c*v+h*A,r[2]=u*f+d*y+p*x,r[5]=u*g+d*b+p*_,r[8]=u*m+d*v+p*A,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8];return e*a*c-e*o*l-i*r*c+i*o*s+n*r*l-n*a*s}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8],h=c*a-o*l,u=o*s-c*r,d=l*r-a*s,p=e*h+i*u+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(n*l-c*i)*f,t[2]=(o*i-n*a)*f,t[3]=u*f,t[4]=(c*e-n*s)*f,t[5]=(n*r-o*e)*f,t[6]=d*f,t[7]=(i*s-l*e)*f,t[8]=(a*e-i*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,a,o){const s=Math.cos(r),l=Math.sin(r);return this.set(i*s,i*l,-i*(s*a+l*o)+a+t,-n*l,n*s,-n*(-l*a+s*o)+o+e,0,0,1),this}scale(t,e){const i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],a=n[3],o=n[6],s=n[1],l=n[4],c=n[7];return n[0]=e*r+i*s,n[3]=e*a+i*l,n[6]=e*o+i*c,n[1]=-i*r+e*s,n[4]=-i*a+e*l,n[7]=-i*o+e*c,this}translate(t,e){const i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let c;l.prototype.isMatrix3=!0;const h={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===c&&(c=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),c.width=t.width,c.height=t.height;const i=c.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=c}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}};let u=0;class d extends n{constructor(t=d.DEFAULT_IMAGE,e=d.DEFAULT_MAPPING,i=1001,n=1001,r=1006,a=1008,c=1023,h=1009,p=1,f=3e3){super(),Object.defineProperty(this,"id",{value:u++}),this.uuid=o.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=a,this.anisotropy=p,this.format=c,this.internalFormat=null,this.type=h,this.offset=new s(0,0),this.repeat=new s(1,1),this.center=new s(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new l,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=f,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const n=this.image;if(void 0===n.uuid&&(n.uuid=o.generateUUID()),!e&&void 0===t.images[n.uuid]){let e;if(Array.isArray(n)){e=[];for(let t=0,i=n.length;t<i;t++)n[t].isDataTexture?e.push(p(n[t].image)):e.push(p(n[t]))}else e=p(n);t.images[n.uuid]={uuid:n.uuid,url:e}}i.image=n.uuid}return e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function p(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?h.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}d.DEFAULT_IMAGE=void 0,d.DEFAULT_MAPPING=300,d.prototype.isTexture=!0;class f{constructor(t=0,e=0,i=0,n=1){this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*e+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*e+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*e+a[7]*i+a[11]*n+a[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r;const a=t.elements,o=a[0],s=a[4],l=a[8],c=a[1],h=a[5],u=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-c)<.01&&Math.abs(l-d)<.01&&Math.abs(u-p)<.01){if(Math.abs(s+c)<.1&&Math.abs(l+d)<.1&&Math.abs(u+p)<.1&&Math.abs(o+h+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(o+1)/2,a=(h+1)/2,g=(f+1)/2,m=(s+c)/4,y=(l+d)/4,b=(u+p)/4;return t>a&&t>g?t<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(t),n=m/i,r=y/i):a>g?a<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(a),i=m/n,r=b/n):g<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(g),i=y/r,n=b/r),this.set(i,n,r,e),this}let g=Math.sqrt((p-u)*(p-u)+(l-d)*(l-d)+(c-s)*(c-s));return Math.abs(g)<.001&&(g=1),this.x=(p-u)/g,this.y=(l-d)/g,this.z=(c-s)/g,this.w=Math.acos((o+h+f-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}f.prototype.isVector4=!0;class g extends n{constructor(t,e,i){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new f(0,0,t,e),this.scissorTest=!1,this.viewport=new f(0,0,t,e),i=i||{},this.texture=new d(void 0,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=1,this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:1006,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,i=1){this.width===t&&this.height===e&&this.depth===i||(this.width=t,this.height=e,this.depth=i,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}g.prototype.isWebGLRenderTarget=!0;(class extends g{constructor(t,e,i){super(t,e,i),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}).prototype.isWebGLMultisampleRenderTarget=!0;class m{constructor(t=0,e=0,i=0,n=1){this._x=t,this._y=e,this._z=i,this._w=n}static slerp(t,e,i,n){return i.copy(t).slerp(e,n)}static slerpFlat(t,e,i,n,r,a,o){let s=i[n+0],l=i[n+1],c=i[n+2],h=i[n+3];const u=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(0===o)return t[e+0]=s,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===o)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(h!==f||s!==u||l!==d||c!==p){let t=1-o;const e=s*u+l*d+c*p+h*f,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const r=Math.sqrt(n),a=Math.atan2(r,e*i);t=Math.sin(t*a)/r,o=Math.sin(o*a)/r}const r=o*i;if(s=s*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+f*r,t===1-o){const t=1/Math.sqrt(s*s+l*l+c*c+h*h);s*=t,l*=t,c*=t,h*=t}}t[e]=s,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,i,n,r,a){const o=i[n],s=i[n+1],l=i[n+2],c=i[n+3],h=r[a],u=r[a+1],d=r[a+2],p=r[a+3];return t[e]=o*p+c*h+s*d-l*u,t[e+1]=s*p+c*u+l*h-o*d,t[e+2]=l*p+c*d+o*u-s*h,t[e+3]=c*p-o*h-s*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=t._x,n=t._y,r=t._z,a=t._order,o=Math.cos,s=Math.sin,l=o(i/2),c=o(n/2),h=o(r/2),u=s(i/2),d=s(n/2),p=s(r/2);switch(a){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],a=e[1],o=e[5],s=e[9],l=e[2],c=e[6],h=e[10],u=i+o+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-s)*t,this._y=(r-l)*t,this._z=(a-n)*t}else if(i>o&&i>h){const t=2*Math.sqrt(1+i-o-h);this._w=(c-s)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(r+l)/t}else if(o>h){const t=2*Math.sqrt(1+o-i-h);this._w=(r-l)/t,this._x=(n+a)/t,this._y=.25*t,this._z=(s+c)/t}else{const t=2*Math.sqrt(1+h-i-o);this._w=(a-n)/t,this._x=(r+l)/t,this._y=(s+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-6?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(o.clamp(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,a=t._w,o=e._x,s=e._y,l=e._z,c=e._w;return this._x=i*c+a*o+n*l-r*s,this._y=n*c+a*s+r*o-i*l,this._z=r*c+a*l+i*s-n*o,this._w=a*c-i*o-n*s-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,r=this._z,a=this._w;let o=a*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;const s=1-o*o;if(s<=Number.EPSILON){const t=1-e;return this._w=t*a+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(s),c=Math.atan2(l,o),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=a*h+this._w*u,this._x=i*h+this._x*u,this._y=n*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}m.prototype.isQuaternion=!0;class y{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(v.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(v.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*a,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,o=t.z,s=t.w,l=s*e+a*n-o*i,c=s*i+o*e-r*n,h=s*n+r*i-a*e,u=-r*e-a*i-o*n;return this.x=l*s+u*-r+c*-o-h*-a,this.y=c*s+u*-a+h*-r-l*-o,this.z=h*s+u*-o+l*-a-c*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=n*s-r*o,this.y=r*a-i*s,this.z=i*o-n*a,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return b.copy(this).projectOnVector(t),this.sub(b)}reflect(t){return this.sub(b.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(o.clamp(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}y.prototype.isVector3=!0;const b=new y,v=new m;class x{constructor(t=new y(1/0,1/0,1/0),e=new y(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0;for(let s=0,l=t.length;s<l;s+=3){const l=t[s],c=t[s+1],h=t[s+2];l<e&&(e=l),c<i&&(i=c),h<n&&(n=h),l>r&&(r=l),c>a&&(a=c),h>o&&(o=h)}return this.min.set(e,i,n),this.max.set(r,a,o),this}setFromBufferAttribute(t){let e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0;for(let s=0,l=t.count;s<l;s++){const l=t.getX(s),c=t.getY(s),h=t.getZ(s);l<e&&(e=l),c<i&&(i=c),h<n&&(n=h),l>r&&(r=l),c>a&&(a=c),h>o&&(o=h)}return this.min.set(e,i,n),this.max.set(r,a,o),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=A.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new y),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new y),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),w.copy(e.boundingBox),w.applyMatrix4(t.matrixWorld),this.union(w));const i=t.children;for(let t=0,e=i.length;t<e;t++)this.expandByObject(i[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new y),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,A),A.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(B),F.subVectors(this.max,B),C.subVectors(t.a,B),M.subVectors(t.b,B),I.subVectors(t.c,B),E.subVectors(M,C),S.subVectors(I,M),T.subVectors(C,I);let e=[0,-E.z,E.y,0,-S.z,S.y,0,-T.z,T.y,E.z,0,-E.x,S.z,0,-S.x,T.z,0,-T.x,-E.y,E.x,0,-S.y,S.x,0,-T.y,T.x,0];return!!R(e,C,M,I,F)&&(e=[1,0,0,0,1,0,0,0,1],!!R(e,C,M,I,F)&&(L.crossVectors(E,S),e=[L.x,L.y,L.z],R(e,C,M,I,F)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new y),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return A.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(A).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(_[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),_[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),_[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),_[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),_[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),_[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),_[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),_[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(_)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}x.prototype.isBox3=!0;const _=[new y,new y,new y,new y,new y,new y,new y,new y],A=new y,w=new x,C=new y,M=new y,I=new y,E=new y,S=new y,T=new y,B=new y,F=new y,L=new y,U=new y;function R(t,e,i,n,r){for(let a=0,o=t.length-3;a<=o;a+=3){U.fromArray(t,a);const o=r.x*Math.abs(U.x)+r.y*Math.abs(U.y)+r.z*Math.abs(U.z),s=e.dot(U),l=i.dot(U),c=n.dot(U);if(Math.max(-Math.max(s,l,c),Math.min(s,l,c))>o)return!1}return!0}const D=new x;class P{constructor(t=new y,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):D.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;e<r;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new y),e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new x),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const N=new y,z=new y,Q=new y,O=new y,k=new y,H=new y,V=new y;class G{constructor(t=new y,e=new y(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new y),e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,N)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new y),e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=N.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(N.copy(this.direction).multiplyScalar(e).add(this.origin),N.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){z.copy(t).add(e).multiplyScalar(.5),Q.copy(e).sub(t).normalize(),O.copy(this.origin).sub(z);const r=.5*t.distanceTo(e),a=-this.direction.dot(Q),o=O.dot(this.direction),s=-O.dot(Q),l=O.lengthSq(),c=Math.abs(1-a*a);let h,u,d,p;if(c>0)if(h=a*s-o,u=a*o-s,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+a*u+2*o)+u*(a*h+u+2*s)+l}else u=r,h=Math.max(0,-(a*u+o)),d=-h*h+u*(u+2*s)+l;else u=-r,h=Math.max(0,-(a*u+o)),d=-h*h+u*(u+2*s)+l;else u<=-p?(h=Math.max(0,-(-a*r+o)),u=h>0?-r:Math.min(Math.max(-r,-s),r),d=-h*h+u*(u+2*s)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-s),r),d=u*(u+2*s)+l):(h=Math.max(0,-(a*r+o)),u=h>0?r:Math.min(Math.max(-r,-s),r),d=-h*h+u*(u+2*s)+l);else u=a>0?-r:r,h=Math.max(0,-(a*u+o)),d=-h*h+u*(u+2*s)+l;return i&&i.copy(this.direction).multiplyScalar(h).add(this.origin),n&&n.copy(Q).multiplyScalar(u).add(z),d}intersectSphere(t,e){N.subVectors(t.center,this.origin);const i=N.dot(this.direction),n=N.dot(N)-i*i,r=t.radius*t.radius;if(n>r)return null;const a=Math.sqrt(r-n),o=i-a,s=i+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,a,o,s;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(i=(t.min.x-u.x)*l,n=(t.max.x-u.x)*l):(i=(t.max.x-u.x)*l,n=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,a=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,a=(t.min.y-u.y)*c),i>a||r>n?null:((r>i||i!=i)&&(i=r),(a<n||n!=n)&&(n=a),h>=0?(o=(t.min.z-u.z)*h,s=(t.max.z-u.z)*h):(o=(t.max.z-u.z)*h,s=(t.min.z-u.z)*h),i>s||o>n?null:((o>i||i!=i)&&(i=o),(s<n||n!=n)&&(n=s),n<0?null:this.at(i>=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,N)}intersectTriangle(t,e,i,n,r){k.subVectors(e,t),H.subVectors(i,t),V.crossVectors(k,H);let a,o=this.direction.dot(V);if(o>0){if(n)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}O.subVectors(this.origin,t);const s=a*this.direction.dot(H.crossVectors(O,H));if(s<0)return null;const l=a*this.direction.dot(k.cross(O));if(l<0)return null;if(s+l>o)return null;const c=-a*O.dot(V);return c<0?null:this.at(c/o,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class j{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,a,o,s,l,c,h,u,d,p,f,g){const m=this.elements;return m[0]=t,m[4]=e,m[8]=i,m[12]=n,m[1]=r,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=c,m[10]=h,m[14]=u,m[3]=d,m[7]=p,m[11]=f,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new j).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/W.setFromMatrixColumn(t,0).length(),r=1/W.setFromMatrixColumn(t,1).length(),a=1/W.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*a,e[9]=i[9]*a,e[10]=i[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,i=t.x,n=t.y,r=t.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=a*c,i=a*h,n=o*c,r=o*h;e[0]=s*c,e[4]=-s*h,e[8]=l,e[1]=i+n*l,e[5]=t-r*l,e[9]=-o*s,e[2]=r-t*l,e[6]=n+i*l,e[10]=a*s}else if("YXZ"===t.order){const t=s*c,i=s*h,n=l*c,r=l*h;e[0]=t+r*o,e[4]=n*o-i,e[8]=a*l,e[1]=a*h,e[5]=a*c,e[9]=-o,e[2]=i*o-n,e[6]=r+t*o,e[10]=a*s}else if("ZXY"===t.order){const t=s*c,i=s*h,n=l*c,r=l*h;e[0]=t-r*o,e[4]=-a*h,e[8]=n+i*o,e[1]=i+n*o,e[5]=a*c,e[9]=r-t*o,e[2]=-a*l,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){const t=a*c,i=a*h,n=o*c,r=o*h;e[0]=s*c,e[4]=n*l-i,e[8]=t*l+r,e[1]=s*h,e[5]=r*l+t,e[9]=i*l-n,e[2]=-l,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){const t=a*s,i=a*l,n=o*s,r=o*l;e[0]=s*c,e[4]=r-t*h,e[8]=n*h+i,e[1]=h,e[5]=a*c,e[9]=-o*c,e[2]=-l*c,e[6]=i*h+n,e[10]=t-r*h}else if("XZY"===t.order){const t=a*s,i=a*l,n=o*s,r=o*l;e[0]=s*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=a*c,e[9]=i*h-n,e[2]=n*h-i,e[6]=o*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Z,t,J)}lookAt(t,e,i){const n=this.elements;return K.subVectors(t,e),0===K.lengthSq()&&(K.z=1),K.normalize(),X.crossVectors(i,K),0===X.lengthSq()&&(1===Math.abs(i.z)?K.x+=1e-4:K.z+=1e-4,K.normalize(),X.crossVectors(i,K)),X.normalize(),Y.crossVectors(K,X),n[0]=X.x,n[4]=Y.x,n[8]=K.x,n[1]=X.y,n[5]=Y.y,n[9]=K.y,n[2]=X.z,n[6]=Y.z,n[10]=K.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[4],s=i[8],l=i[12],c=i[1],h=i[5],u=i[9],d=i[13],p=i[2],f=i[6],g=i[10],m=i[14],y=i[3],b=i[7],v=i[11],x=i[15],_=n[0],A=n[4],w=n[8],C=n[12],M=n[1],I=n[5],E=n[9],S=n[13],T=n[2],B=n[6],F=n[10],L=n[14],U=n[3],R=n[7],D=n[11],P=n[15];return r[0]=a*_+o*M+s*T+l*U,r[4]=a*A+o*I+s*B+l*R,r[8]=a*w+o*E+s*F+l*D,r[12]=a*C+o*S+s*L+l*P,r[1]=c*_+h*M+u*T+d*U,r[5]=c*A+h*I+u*B+d*R,r[9]=c*w+h*E+u*F+d*D,r[13]=c*C+h*S+u*L+d*P,r[2]=p*_+f*M+g*T+m*U,r[6]=p*A+f*I+g*B+m*R,r[10]=p*w+f*E+g*F+m*D,r[14]=p*C+f*S+g*L+m*P,r[3]=y*_+b*M+v*T+x*U,r[7]=y*A+b*I+v*B+x*R,r[11]=y*w+b*E+v*F+x*D,r[15]=y*C+b*S+v*L+x*P,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],a=t[1],o=t[5],s=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*s*h-n*l*h-r*o*u+i*l*u+n*o*d-i*s*d)+t[7]*(+e*s*d-e*l*u+r*a*u-n*a*d+n*l*c-r*s*c)+t[11]*(+e*l*h-e*o*d-r*a*h+i*a*d+r*o*c-i*l*c)+t[15]*(-n*o*c-e*s*h+e*o*u+n*a*h-i*a*u+i*s*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],f=t[13],g=t[14],m=t[15],y=h*g*l-f*u*l+f*s*d-o*g*d-h*s*m+o*u*m,b=p*u*l-c*g*l-p*s*d+a*g*d+c*s*m-a*u*m,v=c*f*l-p*h*l+p*o*d-a*f*d-c*o*m+a*h*m,x=p*h*s-c*f*s-p*o*u+a*f*u+c*o*g-a*h*g,_=e*y+i*b+n*v+r*x;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/_;return t[0]=y*A,t[1]=(f*u*r-h*g*r-f*n*d+i*g*d+h*n*m-i*u*m)*A,t[2]=(o*g*r-f*s*r+f*n*l-i*g*l-o*n*m+i*s*m)*A,t[3]=(h*s*r-o*u*r-h*n*l+i*u*l+o*n*d-i*s*d)*A,t[4]=b*A,t[5]=(c*g*r-p*u*r+p*n*d-e*g*d-c*n*m+e*u*m)*A,t[6]=(p*s*r-a*g*r-p*n*l+e*g*l+a*n*m-e*s*m)*A,t[7]=(a*u*r-c*s*r+c*n*l-e*u*l-a*n*d+e*s*d)*A,t[8]=v*A,t[9]=(p*h*r-c*f*r-p*i*d+e*f*d+c*i*m-e*h*m)*A,t[10]=(a*f*r-p*o*r+p*i*l-e*f*l-a*i*m+e*o*m)*A,t[11]=(c*o*r-a*h*r-c*i*l+e*h*l+a*i*d-e*o*d)*A,t[12]=x*A,t[13]=(c*f*n-p*h*n+p*i*u-e*f*u-c*i*g+e*h*g)*A,t[14]=(p*o*n-a*f*n-p*i*s+e*f*s+a*i*g-e*o*g)*A,t[15]=(a*h*n-c*o*n+c*i*s-e*h*s-a*i*u+e*o*u)*A,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,a=t.x,o=t.y,s=t.z,l=r*a,c=r*o;return this.set(l*a+i,l*o-n*s,l*s+n*o,0,l*o+n*s,c*o+i,c*s-n*a,0,l*s-n*o,c*s+n*a,r*s*s+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i){return this.set(1,e,i,0,t,1,i,0,t,e,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,a=e._y,o=e._z,s=e._w,l=r+r,c=a+a,h=o+o,u=r*l,d=r*c,p=r*h,f=a*c,g=a*h,m=o*h,y=s*l,b=s*c,v=s*h,x=i.x,_=i.y,A=i.z;return n[0]=(1-(f+m))*x,n[1]=(d+v)*x,n[2]=(p-b)*x,n[3]=0,n[4]=(d-v)*_,n[5]=(1-(u+m))*_,n[6]=(g+y)*_,n[7]=0,n[8]=(p+b)*A,n[9]=(g-y)*A,n[10]=(1-(u+f))*A,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=W.set(n[0],n[1],n[2]).length();const a=W.set(n[4],n[5],n[6]).length(),o=W.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],q.copy(this);const s=1/r,l=1/a,c=1/o;return q.elements[0]*=s,q.elements[1]*=s,q.elements[2]*=s,q.elements[4]*=l,q.elements[5]*=l,q.elements[6]*=l,q.elements[8]*=c,q.elements[9]*=c,q.elements[10]*=c,e.setFromRotationMatrix(q),i.x=r,i.y=a,i.z=o,this}makePerspective(t,e,i,n,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,s=2*r/(e-t),l=2*r/(i-n),c=(e+t)/(e-t),h=(i+n)/(i-n),u=-(a+r)/(a-r),d=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,i,n,r,a){const o=this.elements,s=1/(e-t),l=1/(i-n),c=1/(a-r),h=(e+t)*s,u=(i+n)*l,d=(a+r)*c;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}j.prototype.isMatrix4=!0;const W=new y,q=new j,Z=new y(0,0,0),J=new y(1,1,1),X=new y,Y=new y,K=new y,$=new j,tt=new m;class et{constructor(t=0,e=0,i=0,n=et.DefaultOrder){this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._order=n||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,i){const n=o.clamp,r=t.elements,a=r[0],s=r[4],l=r[8],c=r[1],h=r[5],u=r[9],d=r[2],p=r[6],f=r[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(n(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(p,h),this._z=0);break;case"YXZ":this._x=Math.asin(-n(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(l,f),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-d,a),this._z=0);break;case"ZXY":this._x=Math.asin(n(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-s,h)):(this._y=0,this._z=Math.atan2(c,a));break;case"ZYX":this._y=Math.asin(-n(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(p,f),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-s,h));break;case"YZX":this._z=Math.asin(n(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,h),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(l,f));break;case"XZY":this._z=Math.asin(-n(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,h),this._y=Math.atan2(l,a)):(this._x=Math.atan2(-u,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return $.makeRotationFromQuaternion(t),this.setFromRotationMatrix($,e,i)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return tt.setFromEuler(this),this.setFromQuaternion(tt,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new y(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}et.prototype.isEuler=!0,et.DefaultOrder="XYZ",et.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class it{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}let nt=0;const rt=new y,at=new m,ot=new j,st=new y,lt=new y,ct=new y,ht=new m,ut=new y(1,0,0),dt=new y(0,1,0),pt=new y(0,0,1),ft={type:"added"},gt={type:"removed"};function mt(){Object.defineProperty(this,"id",{value:nt++}),this.uuid=o.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=mt.DefaultUp.clone();const t=new y,e=new et,i=new m,n=new y(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new j},normalMatrix:{value:new l}}),this.matrix=new j,this.matrixWorld=new j,this.matrixAutoUpdate=mt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new it,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}mt.DefaultUp=new y(0,1,0),mt.DefaultMatrixAutoUpdate=!0,mt.prototype=Object.assign(Object.create(n.prototype),{constructor:mt,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,e){return at.setFromAxisAngle(t,e),this.quaternion.multiply(at),this},rotateOnWorldAxis:function(t,e){return at.setFromAxisAngle(t,e),this.quaternion.premultiply(at),this},rotateX:function(t){return this.rotateOnAxis(ut,t)},rotateY:function(t){return this.rotateOnAxis(dt,t)},rotateZ:function(t){return this.rotateOnAxis(pt,t)},translateOnAxis:function(t,e){return rt.copy(t).applyQuaternion(this.quaternion),this.position.add(rt.multiplyScalar(e)),this},translateX:function(t){return this.translateOnAxis(ut,t)},translateY:function(t){return this.translateOnAxis(dt,t)},translateZ:function(t){return this.translateOnAxis(pt,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(ot.copy(this.matrixWorld).invert())},lookAt:function(t,e,i){t.isVector3?st.copy(t):st.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),lt.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ot.lookAt(lt,st,this.up):ot.lookAt(st,lt,this.up),this.quaternion.setFromRotationMatrix(ot),n&&(ot.extractRotation(n.matrixWorld),at.setFromRotationMatrix(ot),this.quaternion.premultiply(at.invert()))},add:function(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(ft)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(gt)),this},clear:function(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(gt)}return this.children.length=0,this},attach:function(t){return this.updateWorldMatrix(!0,!1),ot.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),ot.multiply(t.parent.matrixWorld)),t.applyMatrix4(ot),this.add(t),t.updateWorldMatrix(!1,!0),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new y),this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new m),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(lt,t,ct),t},getWorldScale:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new y),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(lt,ht,t),t},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new y),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)},traverseVisible:function(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)},traverseAncestors:function(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++)t[e].updateWorldMatrix(!1,!0)}},toJSON:function(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];r(t.shapes,n)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(r(t.materials,this.material[i]));n.material=e}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(r(t.animations,i))}}if(e){const e=a(t.geometries),n=a(t.materials),r=a(t.textures),o=a(t.images),s=a(t.shapes),l=a(t.skeletons),c=a(t.animations);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),o.length>0&&(i.images=o),s.length>0&&(i.shapes=s),l.length>0&&(i.skeletons=l),c.length>0&&(i.animations=c)}return i.object=n,i;function a(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}});const yt=new y,bt=new y,vt=new l;class xt{constructor(t=new y(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=yt.subVectors(i,e).cross(bt.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new y),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new y);const i=t.delta(yt),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):void 0;const r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?void 0:e.copy(i).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new y),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||vt.getNormalMatrix(t),n=this.coplanarPoint(yt).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}xt.prototype.isPlane=!0;const _t=new y,At=new y,wt=new y,Ct=new y,Mt=new y,It=new y,Et=new y,St=new y,Tt=new y,Bt=new y;class Ft{constructor(t=new y,e=new y,i=new y){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){void 0===n&&(console.warn("THREE.Triangle: .getNormal() target is now required"),n=new y),n.subVectors(i,e),_t.subVectors(t,e),n.cross(_t);const r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){_t.subVectors(n,e),At.subVectors(i,e),wt.subVectors(t,e);const a=_t.dot(_t),o=_t.dot(At),s=_t.dot(wt),l=At.dot(At),c=At.dot(wt),h=a*l-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new y),0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*s-o*c)*u,p=(a*c-o*s)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,Ct),Ct.x>=0&&Ct.y>=0&&Ct.x+Ct.y<=1}static getUV(t,e,i,n,r,a,o,s){return this.getBarycoord(t,e,i,n,Ct),s.set(0,0),s.addScaledVector(r,Ct.x),s.addScaledVector(a,Ct.y),s.addScaledVector(o,Ct.z),s}static isFrontFacing(t,e,i,n){return _t.subVectors(i,e),At.subVectors(t,e),_t.cross(At).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return _t.subVectors(this.c,this.b),At.subVectors(this.a,this.b),.5*_t.cross(At).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new y),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Ft.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new xt),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Ft.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return Ft.getUV(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return Ft.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Ft.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new y);const i=this.a,n=this.b,r=this.c;let a,o;Mt.subVectors(n,i),It.subVectors(r,i),St.subVectors(t,i);const s=Mt.dot(St),l=It.dot(St);if(s<=0&&l<=0)return e.copy(i);Tt.subVectors(t,n);const c=Mt.dot(Tt),h=It.dot(Tt);if(c>=0&&h<=c)return e.copy(n);const u=s*h-c*l;if(u<=0&&s>=0&&c<=0)return a=s/(s-c),e.copy(i).addScaledVector(Mt,a);Bt.subVectors(t,r);const d=Mt.dot(Bt),p=It.dot(Bt);if(p>=0&&d<=p)return e.copy(r);const f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return o=l/(l-p),e.copy(i).addScaledVector(It,o);const g=c*p-d*h;if(g<=0&&h-c>=0&&d-p>=0)return Et.subVectors(r,n),o=(h-c)/(h-c+(d-p)),e.copy(n).addScaledVector(Et,o);const m=1/(g+f+u);return a=f*m,o=u*m,e.copy(i).addScaledVector(Mt,a).addScaledVector(It,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Lt=0;function Ut(){Object.defineProperty(this,"id",{value:Lt++}),this.uuid=o.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}Ut.prototype=Object.assign(Object.create(n.prototype),{constructor:Ut,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i;continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}},toJSON:function(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(i.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity,i.refractionRatio=this.refractionRatio,void 0!==this.combine&&(i.combine=this.combine),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.morphNormals&&(i.morphNormals=!0),!0===this.skinning&&(i.skinning=!0),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Ut.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});const Rt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Dt={h:0,s:0,l:0},Pt={h:0,s:0,l:0};function Nt(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function zt(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Qt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Ot{constructor(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,i){return this.r=t,this.g=e,this.b=i,this}setHSL(t,e,i){if(t=o.euclideanModulo(t,1),e=o.clamp(e,0,1),i=o.clamp(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Nt(r,n,t+1/3),this.g=Nt(r,n,t),this.b=Nt(r,n,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const n=i[1],r=i[2];switch(n){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const i=parseFloat(t[1])/360,n=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(i,n,r)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=Rt[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=zt(t.r),this.g=zt(t.g),this.b=zt(t.b),this}copyLinearToSRGB(t){return this.r=Qt(t.r),this.g=Qt(t.g),this.b=Qt(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,i=this.g,n=this.b,r=Math.max(e,i,n),a=Math.min(e,i,n);let o,s;const l=(a+r)/2;if(a===r)o=0,s=0;else{const t=r-a;switch(s=l<=.5?t/(r+a):t/(2-r-a),r){case e:o=(i-n)/t+(i<n?6:0);break;case i:o=(n-e)/t+2;break;case n:o=(e-i)/t+4}o/=6}return t.h=o,t.s=s,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,i){return this.getHSL(Dt),Dt.h+=t,Dt.s+=e,Dt.l+=i,this.setHSL(Dt.h,Dt.s,Dt.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Dt),t.getHSL(Pt);const i=o.lerp(Dt.h,Pt.h,e),n=o.lerp(Dt.s,Pt.s,e),r=o.lerp(Dt.l,Pt.l,e);return this.setHSL(i,n,r),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Ot.NAMES=Rt,Ot.prototype.isColor=!0,Ot.prototype.r=1,Ot.prototype.g=1,Ot.prototype.b=1;class kt extends Ut{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new Ot(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this}}kt.prototype.isMeshBasicMaterial=!0;const Ht=new y,Vt=new s;function Gt(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function jt(t,e,i){Gt.call(this,new Int8Array(t),e,i)}function Wt(t,e,i){Gt.call(this,new Uint8Array(t),e,i)}function qt(t,e,i){Gt.call(this,new Uint8ClampedArray(t),e,i)}function Zt(t,e,i){Gt.call(this,new Int16Array(t),e,i)}function Jt(t,e,i){Gt.call(this,new Uint16Array(t),e,i)}function Xt(t,e,i){Gt.call(this,new Int32Array(t),e,i)}function Yt(t,e,i){Gt.call(this,new Uint32Array(t),e,i)}function Kt(t,e,i){Gt.call(this,new Uint16Array(t),e,i)}function $t(t,e,i){Gt.call(this,new Float32Array(t),e,i)}function te(t,e,i){Gt.call(this,new Float64Array(t),e,i)}function ee(t){if(0===t.length)return-1/0;let e=t[0];for(let i=1,n=t.length;i<n;++i)t[i]>e&&(e=t[i]);return e}Object.defineProperty(Gt.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Gt.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),r=new Ot),e[i++]=r.r,e[i++]=r.g,e[i++]=r.b}return this},copyVector2sArray:function(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),r=new s),e[i++]=r.x,e[i++]=r.y}return this},copyVector3sArray:function(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),r=new y),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z}return this},copyVector4sArray:function(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),r=new f),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z,e[i++]=r.w}return this},applyMatrix3:function(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Vt.fromBufferAttribute(this,e),Vt.applyMatrix3(t),this.setXY(e,Vt.x,Vt.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Ht.fromBufferAttribute(this,e),Ht.applyMatrix3(t),this.setXYZ(e,Ht.x,Ht.y,Ht.z);return this},applyMatrix4:function(t){for(let e=0,i=this.count;e<i;e++)Ht.x=this.getX(e),Ht.y=this.getY(e),Ht.z=this.getZ(e),Ht.applyMatrix4(t),this.setXYZ(e,Ht.x,Ht.y,Ht.z);return this},applyNormalMatrix:function(t){for(let e=0,i=this.count;e<i;e++)Ht.x=this.getX(e),Ht.y=this.getY(e),Ht.z=this.getZ(e),Ht.applyNormalMatrix(t),this.setXYZ(e,Ht.x,Ht.y,Ht.z);return this},transformDirection:function(t){for(let e=0,i=this.count;e<i;e++)Ht.x=this.getX(e),Ht.y=this.getY(e),Ht.z=this.getZ(e),Ht.transformDirection(t),this.setXYZ(e,Ht.x,Ht.y,Ht.z);return this},set:function(t,e=0){return this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),jt.prototype=Object.create(Gt.prototype),jt.prototype.constructor=jt,Wt.prototype=Object.create(Gt.prototype),Wt.prototype.constructor=Wt,qt.prototype=Object.create(Gt.prototype),qt.prototype.constructor=qt,Zt.prototype=Object.create(Gt.prototype),Zt.prototype.constructor=Zt,Jt.prototype=Object.create(Gt.prototype),Jt.prototype.constructor=Jt,Xt.prototype=Object.create(Gt.prototype),Xt.prototype.constructor=Xt,Yt.prototype=Object.create(Gt.prototype),Yt.prototype.constructor=Yt,Kt.prototype=Object.create(Gt.prototype),Kt.prototype.constructor=Kt,Kt.prototype.isFloat16BufferAttribute=!0,$t.prototype=Object.create(Gt.prototype),$t.prototype.constructor=$t,te.prototype=Object.create(Gt.prototype),te.prototype.constructor=te;Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let ie=0;const ne=new j,re=new mt,ae=new y,oe=new x,se=new x,le=new y;function ce(){Object.defineProperty(this,"id",{value:ie++}),this.uuid=o.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}ce.prototype=Object.assign(Object.create(n.prototype),{constructor:ce,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){return Array.isArray(t)?this.index=new(ee(t)>65535?Yt:Jt)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new l).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return ne.makeRotationX(t),this.applyMatrix4(ne),this},rotateY:function(t){return ne.makeRotationY(t),this.applyMatrix4(ne),this},rotateZ:function(t){return ne.makeRotationZ(t),this.applyMatrix4(ne),this},translate:function(t,e,i){return ne.makeTranslation(t,e,i),this.applyMatrix4(ne),this},scale:function(t,e,i){return ne.makeScale(t,e,i),this.applyMatrix4(ne),this},lookAt:function(t){return re.lookAt(t),re.updateMatrix(),this.applyMatrix4(re.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(ae).negate(),this.translate(ae.x,ae.y,ae.z),this},setFromPoints:function(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new $t(e,3)),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new x);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new y(-1/0,-1/0,-1/0),new y(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];oe.setFromBufferAttribute(i),this.morphTargetsRelative?(le.addVectors(this.boundingBox.min,oe.min),this.boundingBox.expandByPoint(le),le.addVectors(this.boundingBox.max,oe.max),this.boundingBox.expandByPoint(le)):(this.boundingBox.expandByPoint(oe.min),this.boundingBox.expandByPoint(oe.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new P);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new y,1/0);if(t){const i=this.boundingSphere.center;if(oe.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];se.setFromBufferAttribute(i),this.morphTargetsRelative?(le.addVectors(oe.min,se.min),oe.expandByPoint(le),le.addVectors(oe.max,se.max),oe.expandByPoint(le)):(oe.expandByPoint(se.min),oe.expandByPoint(se.max))}oe.getCenter(i);let n=0;for(let e=0,r=t.count;e<r;e++)le.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(le));if(e)for(let r=0,a=e.length;r<a;r++){const a=e[r],o=this.morphTargetsRelative;for(let e=0,r=a.count;e<r;e++)le.fromBufferAttribute(a,e),o&&(ae.fromBufferAttribute(t,e),le.add(ae)),n=Math.max(n,i.distanceToSquared(le))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeTangents:function(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=t.array,n=e.position.array,r=e.normal.array,a=e.uv.array,o=n.length/3;void 0===e.tangent&&this.setAttribute("tangent",new Gt(new Float32Array(4*o),4));const l=e.tangent.array,c=[],h=[];for(let t=0;t<o;t++)c[t]=new y,h[t]=new y;const u=new y,d=new y,p=new y,f=new s,g=new s,m=new s,b=new y,v=new y;function x(t,e,i){u.fromArray(n,3*t),d.fromArray(n,3*e),p.fromArray(n,3*i),f.fromArray(a,2*t),g.fromArray(a,2*e),m.fromArray(a,2*i),d.sub(u),p.sub(u),g.sub(f),m.sub(f);const r=1/(g.x*m.y-m.x*g.y);isFinite(r)&&(b.copy(d).multiplyScalar(m.y).addScaledVector(p,-g.y).multiplyScalar(r),v.copy(p).multiplyScalar(g.x).addScaledVector(d,-m.x).multiplyScalar(r),c[t].add(b),c[e].add(b),c[i].add(b),h[t].add(v),h[e].add(v),h[i].add(v))}let _=this.groups;0===_.length&&(_=[{start:0,count:i.length}]);for(let t=0,e=_.length;t<e;++t){const e=_[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)x(i[t+0],i[t+1],i[t+2])}const A=new y,w=new y,C=new y,M=new y;function I(t){C.fromArray(r,3*t),M.copy(C);const e=c[t];A.copy(e),A.sub(C.multiplyScalar(C.dot(e))).normalize(),w.crossVectors(M,e);const i=w.dot(h[t])<0?-1:1;l[4*t]=A.x,l[4*t+1]=A.y,l[4*t+2]=A.z,l[4*t+3]=i}for(let t=0,e=_.length;t<e;++t){const e=_[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)I(i[t+0]),I(i[t+1]),I(i[t+2])}},computeVertexNormals:function(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new Gt(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new y,r=new y,a=new y,o=new y,s=new y,l=new y,c=new y,h=new y;if(t)for(let u=0,d=t.count;u<d;u+=3){const d=t.getX(u+0),p=t.getX(u+1),f=t.getX(u+2);n.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),a.fromBufferAttribute(e,f),c.subVectors(a,r),h.subVectors(n,r),c.cross(h),o.fromBufferAttribute(i,d),s.fromBufferAttribute(i,p),l.fromBufferAttribute(i,f),o.add(c),s.add(c),l.add(c),i.setXYZ(d,o.x,o.y,o.z),i.setXYZ(p,s.x,s.y,s.z),i.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,o=e.count;t<o;t+=3)n.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),a.fromBufferAttribute(e,t+2),c.subVectors(a,r),h.subVectors(n,r),c.cross(h),i.setXYZ(t+0,c.x,c.y,c.z),i.setXYZ(t+1,c.x,c.y,c.z),i.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}},merge:function(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const i=this.attributes;for(const n in i){if(void 0===t.attributes[n])continue;const r=i[n].array,a=t.attributes[n],o=a.array,s=a.itemSize*e,l=Math.min(o.length,r.length-s);for(let t=0,e=s;t<l;t++,e++)r[e]=o[t]}return this},normalizeNormals:function(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)le.fromBufferAttribute(t,e),le.normalize(),t.setXYZ(e,le.x,le.y,le.z)},toNonIndexed:function(){function t(t,e){const i=t.array,n=t.itemSize,r=t.normalized,a=new i.constructor(e.length*n);let o=0,s=0;for(let t=0,r=e.length;t<r;t++){o=e[t]*n;for(let t=0;t<n;t++)a[s++]=i[o++]}return new Gt(a,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new ce,i=this.index.array,n=this.attributes;for(const r in n){const a=t(n[r],i);e.setAttribute(r,a)}const r=this.morphAttributes;for(const n in r){const a=[],o=r[n];for(let e=0,n=o.length;e<n;e++){const n=t(o[e],i);a.push(n)}e.morphAttributes[n]=a}e.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let t=0,i=a.length;t<i;t++){const i=a[t];e.addGroup(i.start,i.count,i.materialIndex)}return e},toJSON:function(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e],r=n.toJSON(t.data);""!==n.name&&(r.name=n.name),t.data.attributes[e]=r}const n={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],a=[];for(let e=0,n=i.length;e<n;e++){const n=i[e],r=n.toJSON(t.data);""!==n.name&&(r.name=n.name),a.push(r)}a.length>0&&(n[e]=a,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t},clone:function(){return(new ce).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],n=r[t];for(let t=0,r=n.length;t<r;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const a=t.groups;for(let t=0,e=a.length;t<e;t++){const e=a[t];this.addGroup(e.start,e.count,e.materialIndex)}const o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const s=t.boundingSphere;return null!==s&&(this.boundingSphere=s.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});const he=new j,ue=new G,de=new P,pe=new y,fe=new y,ge=new y,me=new y,ye=new y,be=new y,ve=new y,xe=new y,_e=new y,Ae=new s,we=new s,Ce=new s,Me=new y,Ie=new y;function Ee(t=new ce,e=new kt){mt.call(this),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}function Se(t,e,i,n,r,a,o,l,c,h,u,d){pe.fromBufferAttribute(r,h),fe.fromBufferAttribute(r,u),ge.fromBufferAttribute(r,d);const p=t.morphTargetInfluences;if(e.morphTargets&&a&&p){ve.set(0,0,0),xe.set(0,0,0),_e.set(0,0,0);for(let t=0,e=a.length;t<e;t++){const e=p[t],i=a[t];0!==e&&(me.fromBufferAttribute(i,h),ye.fromBufferAttribute(i,u),be.fromBufferAttribute(i,d),o?(ve.addScaledVector(me,e),xe.addScaledVector(ye,e),_e.addScaledVector(be,e)):(ve.addScaledVector(me.sub(pe),e),xe.addScaledVector(ye.sub(fe),e),_e.addScaledVector(be.sub(ge),e)))}pe.add(ve),fe.add(xe),ge.add(_e)}t.isSkinnedMesh&&e.skinning&&(t.boneTransform(h,pe),t.boneTransform(u,fe),t.boneTransform(d,ge));const f=function(t,e,i,n,r,a,o,s){let l;if(l=1===e.side?n.intersectTriangle(o,a,r,!0,s):n.intersectTriangle(r,a,o,2!==e.side,s),null===l)return null;Ie.copy(s),Ie.applyMatrix4(t.matrixWorld);const c=i.ray.origin.distanceTo(Ie);return c<i.near||c>i.far?null:{distance:c,point:Ie.clone(),object:t}}(t,e,i,n,pe,fe,ge,Me);if(f){l&&(Ae.fromBufferAttribute(l,h),we.fromBufferAttribute(l,u),Ce.fromBufferAttribute(l,d),f.uv=Ft.getUV(Me,pe,fe,ge,Ae,we,Ce,new s)),c&&(Ae.fromBufferAttribute(c,h),we.fromBufferAttribute(c,u),Ce.fromBufferAttribute(c,d),f.uv2=Ft.getUV(Me,pe,fe,ge,Ae,we,Ce,new s));const t={a:h,b:u,c:d,normal:new y,materialIndex:0};Ft.getNormal(pe,fe,ge,t.normal),f.face=t}return f}Ee.prototype=Object.assign(Object.create(mt.prototype),{constructor:Ee,isMesh:!0,copy:function(t){return mt.prototype.copy.call(this,t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0===n)return;if(null===i.boundingSphere&&i.computeBoundingSphere(),de.copy(i.boundingSphere),de.applyMatrix4(r),!1===t.ray.intersectsSphere(de))return;if(he.copy(r).invert(),ue.copy(t.ray).applyMatrix4(he),null!==i.boundingBox&&!1===ue.intersectsBox(i.boundingBox))return;let a;if(i.isBufferGeometry){const r=i.index,o=i.attributes.position,s=i.morphAttributes.position,l=i.morphTargetsRelative,c=i.attributes.uv,h=i.attributes.uv2,u=i.groups,d=i.drawRange;if(null!==r)if(Array.isArray(n))for(let i=0,p=u.length;i<p;i++){const p=u[i],f=n[p.materialIndex];for(let i=Math.max(p.start,d.start),n=Math.min(p.start+p.count,d.start+d.count);i<n;i+=3){const n=r.getX(i),u=r.getX(i+1),d=r.getX(i+2);a=Se(this,f,t,ue,o,s,l,c,h,n,u,d),a&&(a.faceIndex=Math.floor(i/3),a.face.materialIndex=p.materialIndex,e.push(a))}}else{for(let i=Math.max(0,d.start),u=Math.min(r.count,d.start+d.count);i<u;i+=3){const u=r.getX(i),d=r.getX(i+1),p=r.getX(i+2);a=Se(this,n,t,ue,o,s,l,c,h,u,d,p),a&&(a.faceIndex=Math.floor(i/3),e.push(a))}}else if(void 0!==o)if(Array.isArray(n))for(let i=0,r=u.length;i<r;i++){const r=u[i],p=n[r.materialIndex];for(let i=Math.max(r.start,d.start),n=Math.min(r.start+r.count,d.start+d.count);i<n;i+=3){a=Se(this,p,t,ue,o,s,l,c,h,i,i+1,i+2),a&&(a.faceIndex=Math.floor(i/3),a.face.materialIndex=r.materialIndex,e.push(a))}}else{for(let i=Math.max(0,d.start),r=Math.min(o.count,d.start+d.count);i<r;i+=3){a=Se(this,n,t,ue,o,s,l,c,h,i,i+1,i+2),a&&(a.faceIndex=Math.floor(i/3),e.push(a))}}}else i.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}});class Te extends ce{constructor(t=1,e=1,i=1,n=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};const o=this;n=Math.floor(n),r=Math.floor(r),a=Math.floor(a);const s=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,i,n,r,a,p,f,g,m,b){const v=a/g,x=p/m,_=a/2,A=p/2,w=f/2,C=g+1,M=m+1;let I=0,E=0;const S=new y;for(let a=0;a<M;a++){const o=a*x-A;for(let s=0;s<C;s++){const u=s*v-_;S[t]=u*n,S[e]=o*r,S[i]=w,l.push(S.x,S.y,S.z),S[t]=0,S[e]=0,S[i]=f>0?1:-1,c.push(S.x,S.y,S.z),h.push(s/g),h.push(1-a/m),I+=1}}for(let t=0;t<m;t++)for(let e=0;e<g;e++){const i=u+e+C*t,n=u+e+C*(t+1),r=u+(e+1)+C*(t+1),a=u+(e+1)+C*t;s.push(i,n,a),s.push(n,r,a),E+=6}o.addGroup(d,E,b),d+=E,u+=I}p("z","y","x",-1,-1,i,e,t,a,r,0),p("z","y","x",1,-1,i,e,-t,a,r,1),p("x","z","y",1,1,t,i,e,n,a,2),p("x","z","y",1,-1,t,i,-e,n,a,3),p("x","y","z",1,-1,t,e,i,n,r,4),p("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(s),this.setAttribute("position",new $t(l,3)),this.setAttribute("normal",new $t(c,3)),this.setAttribute("uv",new $t(h,2))}}function Be(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function Fe(t){const e={};for(let i=0;i<t.length;i++){const n=Be(t[i]);for(const t in n)e[t]=n[t]}return e}const Le={clone:Be,merge:Fe};function Ue(t){Ut.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function Re(){mt.call(this),this.type="Camera",this.matrixWorldInverse=new j,this.projectionMatrix=new j,this.projectionMatrixInverse=new j}function De(t=50,e=1,i=.1,n=2e3){Re.call(this),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}Ue.prototype=Object.create(Ut.prototype),Ue.prototype.constructor=Ue,Ue.prototype.isShaderMaterial=!0,Ue.prototype.copy=function(t){return Ut.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Be(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this},Ue.prototype.toJSON=function(t){const e=Ut.prototype.toJSON.call(this,t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e},Re.prototype=Object.assign(Object.create(mt.prototype),{constructor:Re,isCamera:!0,copy:function(t,e){return mt.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new y),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){mt.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){mt.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),De.prototype=Object.assign(Object.create(Re.prototype),{constructor:De,isPerspectiveCamera:!0,copy:function(t,e){return Re.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=2*o.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*o.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*o.RAD2DEG*Math.atan(Math.tan(.5*o.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,i,n,r,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*o.DEG2RAD*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n;const a=this.view;if(null!==this.view&&this.view.enabled){const t=a.fullWidth,o=a.fullHeight;r+=a.offsetX*n/t,e-=a.offsetY*i/o,n*=a.width/t,i*=a.height/o}const s=this.filmOffset;0!==s&&(r+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=mt.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});class Pe extends mt{constructor(t,e,i){if(super(),this.type="CubeCamera",!0!==i.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=i;const n=new De(90,1,t,e);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new y(1,0,0)),this.add(n);const r=new De(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new y(-1,0,0)),this.add(r);const a=new De(90,1,t,e);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new y(0,1,0)),this.add(a);const o=new De(90,1,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new y(0,-1,0)),this.add(o);const s=new De(90,1,t,e);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new y(0,0,1)),this.add(s);const l=new De(90,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new y(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const i=this.renderTarget,[n,r,a,o,s,l]=this.children,c=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const u=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0),t.render(e,n),t.setRenderTarget(i,1),t.render(e,r),t.setRenderTarget(i,2),t.render(e,a),t.setRenderTarget(i,3),t.render(e,o),t.setRenderTarget(i,4),t.render(e,s),i.texture.generateMipmaps=u,t.setRenderTarget(i,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c}}class Ne extends d{constructor(t,e,i,n,r,a,o,s,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:301,i,n,r,a,o=void 0!==o?o:1022,s,l,c),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}Ne.prototype.isCubeTexture=!0;class ze extends g{constructor(t,e,i){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=i),super(t,t,e),e=e||{},this.texture=new Ne(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:1006,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=1023,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},n=new Te(5,5,5),r=new Ue({name:"CubemapFromEquirect",uniforms:Be(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const a=new Ee(n,r),o=e.minFilter;1008===e.minFilter&&(e.minFilter=1006);return new Pe(1,10,this).update(t,a),e.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(t,e,i,n){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,n);t.setRenderTarget(r)}}ze.prototype.isWebGLCubeRenderTarget=!0;class Qe extends d{constructor(t,e,i,n,r,a,o,s,l,c,h,u){super(null,a,o,s,l,c,n,r,h,u),this.image={data:t||null,width:e||1,height:i||1},this.magFilter=void 0!==l?l:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Qe.prototype.isDataTexture=!0;const Oe=new P,ke=new y;class He{constructor(t=new xt,e=new xt,i=new xt,n=new xt,r=new xt,a=new xt){this.planes=[t,e,i,n,r,a]}set(t,e,i,n,r,a){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(a),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t){const e=this.planes,i=t.elements,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],l=i[5],c=i[6],h=i[7],u=i[8],d=i[9],p=i[10],f=i[11],g=i[12],m=i[13],y=i[14],b=i[15];return e[0].setComponents(o-n,h-s,f-u,b-g).normalize(),e[1].setComponents(o+n,h+s,f+u,b+g).normalize(),e[2].setComponents(o+r,h+l,f+d,b+m).normalize(),e[3].setComponents(o-r,h-l,f-d,b-m).normalize(),e[4].setComponents(o-a,h-c,f-p,b-y).normalize(),e[5].setComponents(o+a,h+c,f+p,b+y).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Oe.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Oe)}intersectsSprite(t){return Oe.center.set(0,0,0),Oe.radius=.7071067811865476,Oe.applyMatrix4(t.matrixWorld),this.intersectsSphere(Oe)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(i)<n)return!1}return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const n=e[i];if(ke.x=n.normal.x>0?t.max.x:t.min.x,ke.y=n.normal.y>0?t.max.y:t.min.y,ke.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(ke)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Ve(){let t=null,e=!1,i=null,n=null;function r(e,a){i(e,a),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Ge(t,e){const i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=n.get(e);return void((!t||t.version<e.version)&&n.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const a=n.get(e);void 0===a?n.set(e,function(e,n){const r=e.array,a=e.usage,o=t.createBuffer();t.bindBuffer(n,o),t.bufferData(n,r,a),e.onUploadCallback();let s=5126;return r instanceof Float32Array?s=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?e.isFloat16BufferAttribute?i?s=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):s=5123:r instanceof Int16Array?s=5122:r instanceof Uint32Array?s=5125:r instanceof Int32Array?s=5124:r instanceof Int8Array?s=5120:r instanceof Uint8Array&&(s=5121),{buffer:o,type:s,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):a.version<e.version&&(!function(e,n,r){const a=n.array,o=n.updateRange;t.bindBuffer(r,e),-1===o.count?t.bufferSubData(r,0,a):(i?t.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):t.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(a.buffer,e,r),a.version=e.version)}}}class je extends ce{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};const r=t/2,a=e/2,o=Math.floor(i),s=Math.floor(n),l=o+1,c=s+1,h=t/o,u=e/s,d=[],p=[],f=[],g=[];for(let t=0;t<c;t++){const e=t*u-a;for(let i=0;i<l;i++){const n=i*h-r;p.push(n,-e,0),f.push(0,0,1),g.push(i/o),g.push(1-t/s)}}for(let t=0;t<s;t++)for(let e=0;e<o;e++){const i=e+l*t,n=e+l*(t+1),r=e+1+l*(t+1),a=e+1+l*t;d.push(i,n,a),d.push(n,r,a)}this.setIndex(d),this.setAttribute("position",new $t(p,3)),this.setAttribute("normal",new $t(f,3)),this.setAttribute("uv",new $t(g,2))}}const We={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\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 <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\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 <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\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 <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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 <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\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 <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\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 <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <transmissionmap_pars_fragment>\n#include <bsdfs>\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 <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <transmissionmap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\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 <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},qe={common:{diffuse:{value:new Ot(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new l},uv2Transform:{value:new l},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new s(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ot(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ot(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new l}},sprite:{diffuse:{value:new Ot(15658734)},opacity:{value:1},center:{value:new s(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new l}}},Ze={basic:{uniforms:Fe([qe.common,qe.specularmap,qe.envmap,qe.aomap,qe.lightmap,qe.fog]),vertexShader:We.meshbasic_vert,fragmentShader:We.meshbasic_frag},lambert:{uniforms:Fe([qe.common,qe.specularmap,qe.envmap,qe.aomap,qe.lightmap,qe.emissivemap,qe.fog,qe.lights,{emissive:{value:new Ot(0)}}]),vertexShader:We.meshlambert_vert,fragmentShader:We.meshlambert_frag},phong:{uniforms:Fe([qe.common,qe.specularmap,qe.envmap,qe.aomap,qe.lightmap,qe.emissivemap,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.fog,qe.lights,{emissive:{value:new Ot(0)},specular:{value:new Ot(1118481)},shininess:{value:30}}]),vertexShader:We.meshphong_vert,fragmentShader:We.meshphong_frag},standard:{uniforms:Fe([qe.common,qe.envmap,qe.aomap,qe.lightmap,qe.emissivemap,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.roughnessmap,qe.metalnessmap,qe.fog,qe.lights,{emissive:{value:new Ot(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:We.meshphysical_vert,fragmentShader:We.meshphysical_frag},toon:{uniforms:Fe([qe.common,qe.aomap,qe.lightmap,qe.emissivemap,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.gradientmap,qe.fog,qe.lights,{emissive:{value:new Ot(0)}}]),vertexShader:We.meshtoon_vert,fragmentShader:We.meshtoon_frag},matcap:{uniforms:Fe([qe.common,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.fog,{matcap:{value:null}}]),vertexShader:We.meshmatcap_vert,fragmentShader:We.meshmatcap_frag},points:{uniforms:Fe([qe.points,qe.fog]),vertexShader:We.points_vert,fragmentShader:We.points_frag},dashed:{uniforms:Fe([qe.common,qe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:We.linedashed_vert,fragmentShader:We.linedashed_frag},depth:{uniforms:Fe([qe.common,qe.displacementmap]),vertexShader:We.depth_vert,fragmentShader:We.depth_frag},normal:{uniforms:Fe([qe.common,qe.bumpmap,qe.normalmap,qe.displacementmap,{opacity:{value:1}}]),vertexShader:We.normal_vert,fragmentShader:We.normal_frag},sprite:{uniforms:Fe([qe.sprite,qe.fog]),vertexShader:We.sprite_vert,fragmentShader:We.sprite_frag},background:{uniforms:{uvTransform:{value:new l},t2D:{value:null}},vertexShader:We.background_vert,fragmentShader:We.background_frag},cube:{uniforms:Fe([qe.envmap,{opacity:{value:1}}]),vertexShader:We.cube_vert,fragmentShader:We.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:We.equirect_vert,fragmentShader:We.equirect_frag},distanceRGBA:{uniforms:Fe([qe.common,qe.displacementmap,{referencePosition:{value:new y},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:We.distanceRGBA_vert,fragmentShader:We.distanceRGBA_frag},shadow:{uniforms:Fe([qe.lights,qe.fog,{color:{value:new Ot(0)},opacity:{value:1}}]),vertexShader:We.shadow_vert,fragmentShader:We.shadow_frag}};function Je(t,e,i,n,r){const a=new Ot(0);let o,s,l=0,c=null,h=0,u=null;function d(t,e){i.buffers.color.setClear(t.r,t.g,t.b,e,r)}return{getClearColor:function(){return a},setClearColor:function(t,e=1){a.set(t),l=e,d(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,d(a,l)},render:function(i,r,p,f){let g=!0===r.isScene?r.background:null;g&&g.isTexture&&(g=e.get(g));const m=t.xr,y=m.getSession&&m.getSession();y&&"additive"===y.environmentBlendMode&&(g=null),null===g?d(a,l):g&&g.isColor&&(d(g,1),f=!0),(t.autoClear||f)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),g&&(g.isCubeTexture||g.isWebGLCubeRenderTarget||306===g.mapping)?(void 0===s&&(s=new Ee(new Te(1,1,1),new Ue({name:"BackgroundCubeMaterial",uniforms:Be(Ze.cube.uniforms),vertexShader:Ze.cube.vertexShader,fragmentShader:Ze.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(s)),g.isWebGLCubeRenderTarget&&(g=g.texture),s.material.uniforms.envMap.value=g,s.material.uniforms.flipEnvMap.value=g.isCubeTexture&&g._needsFlipEnvMap?-1:1,c===g&&h===g.version&&u===t.toneMapping||(s.material.needsUpdate=!0,c=g,h=g.version,u=t.toneMapping),i.unshift(s,s.geometry,s.material,0,0,null)):g&&g.isTexture&&(void 0===o&&(o=new Ee(new je(2,2),new Ue({name:"BackgroundMaterial",uniforms:Be(Ze.background.uniforms),vertexShader:Ze.background.vertexShader,fragmentShader:Ze.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=g,!0===g.matrixAutoUpdate&&g.updateMatrix(),o.material.uniforms.uvTransform.value.copy(g.matrix),c===g&&h===g.version&&u===t.toneMapping||(o.material.needsUpdate=!0,c=g,h=g.version,u=t.toneMapping),i.unshift(o,o.geometry,o.material,0,0,null))}}}function Xe(t,e,i,n){const r=t.getParameter(34921),a=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||null!==a,s={},l=d(null);let c=l;function h(e){return n.isWebGL2?t.bindVertexArray(e):a.bindVertexArrayOES(e)}function u(e){return n.isWebGL2?t.deleteVertexArray(e):a.deleteVertexArrayOES(e)}function d(t){const e=[],i=[],n=[];for(let t=0;t<r;t++)e[t]=0,i[t]=0,n[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:n,object:t,attributes:{},index:null}}function p(){const t=c.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function f(t){g(t,0)}function g(i,r){const a=c.newAttributes,o=c.enabledAttributes,s=c.attributeDivisors;if(a[i]=1,0===o[i]&&(t.enableVertexAttribArray(i),o[i]=1),s[i]!==r){(n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),s[i]=r}}function m(){const e=c.newAttributes,i=c.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function y(e,i,r,a,o,s){!0!==n.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,i,r,a,o,s):t.vertexAttribIPointer(e,i,r,o,s)}function b(){v(),c!==l&&(c=l,h(c.object))}function v(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,u,b,v){let x=!1;if(o){const e=function(e,i,r){const o=!0===r.wireframe;let l=s[e.id];void 0===l&&(l={},s[e.id]=l);let c=l[i.id];void 0===c&&(c={},l[i.id]=c);let h=c[o];void 0===h&&(h=d(n.isWebGL2?t.createVertexArray():a.createVertexArrayOES()),c[o]=h);return h}(b,u,l);c!==e&&(c=e,h(c.object)),x=function(t,e){const i=c.attributes,n=t.attributes;let r=0;for(const t in n){const e=i[t],a=n[t];if(void 0===e)return!0;if(e.attribute!==a)return!0;if(e.data!==a.data)return!0;r++}return c.attributesNum!==r||c.index!==e}(b,v),x&&function(t,e){const i={},n=t.attributes;let r=0;for(const t in n){const e=n[t],a={};a.attribute=e,e.data&&(a.data=e.data),i[t]=a,r++}c.attributes=i,c.attributesNum=r,c.index=e}(b,v)}else{const t=!0===l.wireframe;c.geometry===b.id&&c.program===u.id&&c.wireframe===t||(c.geometry=b.id,c.program=u.id,c.wireframe=t,x=!0)}!0===r.isInstancedMesh&&(x=!0),null!==v&&i.update(v,34963),x&&(!function(r,a,o,s){if(!1===n.isWebGL2&&(r.isInstancedMesh||s.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=s.attributes,c=o.getAttributes(),h=a.defaultAttributeValues;for(const e in c){const n=c[e];if(n>=0){const a=l[e];if(void 0!==a){const e=a.normalized,r=a.itemSize,o=i.get(a);if(void 0===o)continue;const l=o.buffer,c=o.type,h=o.bytesPerElement;if(a.isInterleavedBufferAttribute){const i=a.data,o=i.stride,u=a.offset;i&&i.isInstancedInterleavedBuffer?(g(n,i.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=i.meshPerAttribute*i.count)):f(n),t.bindBuffer(34962,l),y(n,r,c,e,o*h,u*h)}else a.isInstancedBufferAttribute?(g(n,a.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=a.meshPerAttribute*a.count)):f(n),t.bindBuffer(34962,l),y(n,r,c,e,0,0)}else if("instanceMatrix"===e){const e=i.get(r.instanceMatrix);if(void 0===e)continue;const a=e.buffer,o=e.type;g(n+0,1),g(n+1,1),g(n+2,1),g(n+3,1),t.bindBuffer(34962,a),t.vertexAttribPointer(n+0,4,o,!1,64,0),t.vertexAttribPointer(n+1,4,o,!1,64,16),t.vertexAttribPointer(n+2,4,o,!1,64,32),t.vertexAttribPointer(n+3,4,o,!1,64,48)}else if("instanceColor"===e){const e=i.get(r.instanceColor);if(void 0===e)continue;const a=e.buffer,o=e.type;g(n,1),t.bindBuffer(34962,a),t.vertexAttribPointer(n,3,o,!1,12,0)}else if(void 0!==h){const i=h[e];if(void 0!==i)switch(i.length){case 2:t.vertexAttrib2fv(n,i);break;case 3:t.vertexAttrib3fv(n,i);break;case 4:t.vertexAttrib4fv(n,i);break;default:t.vertexAttrib1fv(n,i)}}}}m()}(r,l,u,b),null!==v&&t.bindBuffer(34963,i.get(v).buffer))},reset:b,resetDefaultState:v,dispose:function(){b();for(const t in s){const e=s[t];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete s[t]}},releaseStatesOfGeometry:function(t){if(void 0===s[t.id])return;const e=s[t.id];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete s[t.id]},releaseStatesOfProgram:function(t){for(const e in s){const i=s[e];if(void 0===i[t.id])continue;const n=i[t.id];for(const t in n)u(n[t].object),delete n[t];delete i[t.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:m}}function Ye(t,e,i,n){const r=n.isWebGL2;let a;this.setMode=function(t){a=t},this.render=function(e,n){t.drawArrays(a,e,n),i.update(n,a,1)},this.renderInstances=function(n,o,s){if(0===s)return;let l,c;if(r)l=t,c="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](a,n,o,s),i.update(o,a,s)}}function Ke(t,e,i){let n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==i.precision?i.precision:"highp";const s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);const l=!0===i.logarithmicDepthBuffer,c=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),f=t.getParameter(36347),g=t.getParameter(36348),m=t.getParameter(36349),y=h>0,b=a||e.has("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");n=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:g,maxFragmentUniforms:m,vertexTextures:y,floatFragmentTextures:b,floatVertexTextures:y&&b,maxSamples:a?t.getParameter(36183):0}}function $e(t){const e=this;let i=null,n=0,r=!1,a=!1;const o=new xt,s=new l,c={value:null,needsUpdate:!1};function h(){c.value!==i&&(c.value=i,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(t,i,n,r){const a=null!==t?t.length:0;let l=null;if(0!==a){if(l=c.value,!0!==r||null===l){const e=n+4*a,r=i.matrixWorldInverse;s.getNormalMatrix(r),(null===l||l.length<e)&&(l=new Float32Array(e));for(let e=0,i=n;e!==a;++e,i+=4)o.copy(t[e]).applyMatrix4(r,s),o.normal.toArray(l,i),l[i+3]=o.constant}c.value=l,c.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,l}this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,a){const o=0!==t.length||e||0!==n||r;return r=e,i=u(t,a,0),n=t.length,o},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1,h()},this.setState=function(e,o,s){const l=e.clippingPlanes,d=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!r||null===l||0===l.length||a&&!p)a?u(null):h();else{const t=a?0:n,e=4*t;let r=f.clippingState||null;c.value=r,r=u(l,o,e,s);for(let t=0;t!==e;++t)r[t]=i[t];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function ti(t){let e=new WeakMap;function i(t,e){return 303===e?t.mapping=301:304===e&&(t.mapping=302),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping;if(303===a||304===a){if(e.has(r)){return i(e.get(r).texture,r.mapping)}{const a=r.image;if(a&&a.height>0){const o=t.getRenderTarget(),s=new ze(a.height/2);return s.fromEquirectangularTexture(t,r),e.set(r,s),t.setRenderTarget(o),r.addEventListener("dispose",n),i(s.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}function ei(t){const e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(t){t.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float")},get:function(t){const e=i(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function ii(t,e,i,n){const r={},a=new WeakMap;function o(t){const s=t.target;null!==s.index&&e.remove(s.index);for(const t in s.attributes)e.remove(s.attributes[t]);s.removeEventListener("dispose",o),delete r[s.id];const l=a.get(s);l&&(e.remove(l),a.delete(s)),n.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,i.memory.geometries--}function s(t){const i=[],n=t.index,r=t.attributes.position;let o=0;if(null!==n){const t=n.array;o=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],r=t[e+1],a=t[e+2];i.push(n,r,r,a,a,n)}}else{const t=r.array;o=r.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,r=e+2;i.push(t,n,n,r,r,t)}}const s=new(ee(i)>65535?Yt:Jt)(i,1);s.version=o;const l=a.get(t);l&&e.remove(l),a.set(t,s)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",o),r[e.id]=!0,i.memory.geometries++),e},update:function(t){const i=t.attributes;for(const t in i)e.update(i[t],34962);const n=t.morphAttributes;for(const t in n){const i=n[t];for(let t=0,n=i.length;t<n;t++)e.update(i[t],34962)}},getWireframeAttribute:function(t){const e=a.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&s(t)}else s(t);return a.get(t)}}}function ni(t,e,i,n){const r=n.isWebGL2;let a,o,s;this.setMode=function(t){a=t},this.setIndex=function(t){o=t.type,s=t.bytesPerElement},this.render=function(e,n){t.drawElements(a,n,o,e*s),i.update(n,a,1)},this.renderInstances=function(n,l,c){if(0===c)return;let h,u;if(r)h=t,u="drawElementsInstanced";else if(h=e.get("ANGLE_instanced_arrays"),u="drawElementsInstancedANGLE",null===h)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[u](a,l,o,n*s,c),i.update(l,a,c)}}function ri(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function ai(t,e){return t[0]-e[0]}function oi(t,e){return Math.abs(e[1])-Math.abs(t[1])}function si(t){const e={},i=new Float32Array(8),n=[];for(let t=0;t<8;t++)n[t]=[t,0];return{update:function(r,a,o,s){const l=r.morphTargetInfluences,c=void 0===l?0:l.length;let h=e[a.id];if(void 0===h){h=[];for(let t=0;t<c;t++)h[t]=[t,0];e[a.id]=h}for(let t=0;t<c;t++){const e=h[t];e[0]=t,e[1]=l[t]}h.sort(oi);for(let t=0;t<8;t++)t<c&&h[t][1]?(n[t][0]=h[t][0],n[t][1]=h[t][1]):(n[t][0]=Number.MAX_SAFE_INTEGER,n[t][1]=0);n.sort(ai);const u=o.morphTargets&&a.morphAttributes.position,d=o.morphNormals&&a.morphAttributes.normal;let p=0;for(let t=0;t<8;t++){const e=n[t],r=e[0],o=e[1];r!==Number.MAX_SAFE_INTEGER&&o?(u&&a.getAttribute("morphTarget"+t)!==u[r]&&a.setAttribute("morphTarget"+t,u[r]),d&&a.getAttribute("morphNormal"+t)!==d[r]&&a.setAttribute("morphNormal"+t,d[r]),i[t]=o,p+=o):(u&&!0===a.hasAttribute("morphTarget"+t)&&a.deleteAttribute("morphTarget"+t),d&&!0===a.hasAttribute("morphNormal"+t)&&a.deleteAttribute("morphNormal"+t),i[t]=0)}const f=a.morphTargetsRelative?1:1-p;s.getUniforms().setValue(t,"morphTargetBaseInfluence",f),s.getUniforms().setValue(t,"morphTargetInfluences",i)}}}function li(t,e,i,n){let r=new WeakMap;function a(t){const e=t.target;e.removeEventListener("dispose",a),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(t){const o=n.render.frame,s=t.geometry,l=e.get(t,s);return r.get(l)!==o&&(e.update(l),r.set(l,o)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",a)&&t.addEventListener("dispose",a),i.update(t.instanceMatrix,34962),null!==t.instanceColor&&i.update(t.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}Ze.physical={uniforms:Fe([Ze.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new s(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Ot(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:We.meshphysical_vert,fragmentShader:We.meshphysical_frag};class ci extends d{constructor(t=null,e=1,i=1,n=1){super(null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}}ci.prototype.isDataTexture2DArray=!0;class hi extends d{constructor(t=null,e=1,i=1,n=1){super(null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}}hi.prototype.isDataTexture3D=!0;const ui=new d,di=new ci,pi=new hi,fi=new Ne,gi=[],mi=[],yi=new Float32Array(16),bi=new Float32Array(9),vi=new Float32Array(4);function xi(t,e,i){const n=t[0];if(n<=0||n>0)return t;const r=e*i;let a=gi[r];if(void 0===a&&(a=new Float32Array(r),gi[r]=a),0!==e){n.toArray(a,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(a,r)}return a}function _i(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function Ai(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function wi(t,e){let i=mi[e];void 0===i&&(i=new Int32Array(e),mi[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function Ci(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Mi(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(_i(i,e))return;t.uniform2fv(this.addr,e),Ai(i,e)}}function Ii(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(_i(i,e))return;t.uniform3fv(this.addr,e),Ai(i,e)}}function Ei(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(_i(i,e))return;t.uniform4fv(this.addr,e),Ai(i,e)}}function Si(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(_i(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Ai(i,e)}else{if(_i(i,n))return;vi.set(n),t.uniformMatrix2fv(this.addr,!1,vi),Ai(i,n)}}function Ti(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(_i(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Ai(i,e)}else{if(_i(i,n))return;bi.set(n),t.uniformMatrix3fv(this.addr,!1,bi),Ai(i,n)}}function Bi(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(_i(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Ai(i,e)}else{if(_i(i,n))return;yi.set(n),t.uniformMatrix4fv(this.addr,!1,yi),Ai(i,n)}}function Fi(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTexture2D(e||ui,r)}function Li(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||di,r)}function Ui(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||pi,r)}function Ri(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTextureCube(e||fi,r)}function Di(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function Pi(t,e){const i=this.cache;_i(i,e)||(t.uniform2iv(this.addr,e),Ai(i,e))}function Ni(t,e){const i=this.cache;_i(i,e)||(t.uniform3iv(this.addr,e),Ai(i,e))}function zi(t,e){const i=this.cache;_i(i,e)||(t.uniform4iv(this.addr,e),Ai(i,e))}function Qi(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function Oi(t,e){t.uniform1fv(this.addr,e)}function ki(t,e){t.uniform1iv(this.addr,e)}function Hi(t,e){t.uniform2iv(this.addr,e)}function Vi(t,e){t.uniform3iv(this.addr,e)}function Gi(t,e){t.uniform4iv(this.addr,e)}function ji(t,e){const i=xi(e,this.size,2);t.uniform2fv(this.addr,i)}function Wi(t,e){const i=xi(e,this.size,3);t.uniform3fv(this.addr,i)}function qi(t,e){const i=xi(e,this.size,4);t.uniform4fv(this.addr,i)}function Zi(t,e){const i=xi(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function Ji(t,e){const i=xi(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function Xi(t,e){const i=xi(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function Yi(t,e,i){const n=e.length,r=wi(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTexture2D(e[t]||ui,r[t])}function Ki(t,e,i){const n=e.length,r=wi(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTextureCube(e[t]||fi,r[t])}function $i(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Ci;case 35664:return Mi;case 35665:return Ii;case 35666:return Ei;case 35674:return Si;case 35675:return Ti;case 35676:return Bi;case 5124:case 35670:return Di;case 35667:case 35671:return Pi;case 35668:case 35672:return Ni;case 35669:case 35673:return zi;case 5125:return Qi;case 35678:case 36198:case 36298:case 36306:case 35682:return Fi;case 35679:case 36299:case 36307:return Ui;case 35680:case 36300:case 36308:case 36293:return Ri;case 36289:case 36303:case 36311:case 36292:return Li}}(e.type)}function tn(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Oi;case 35664:return ji;case 35665:return Wi;case 35666:return qi;case 35674:return Zi;case 35675:return Ji;case 35676:return Xi;case 5124:case 35670:return ki;case 35667:case 35671:return Hi;case 35668:case 35672:return Vi;case 35669:case 35673:return Gi;case 35678:case 36198:case 36298:case 36306:case 35682:return Yi;case 35680:case 36300:case 36308:case 36293:return Ki}}(e.type)}function en(t){this.id=t,this.seq=[],this.map={}}tn.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Ai(e,t)},en.prototype.setValue=function(t,e,i){const n=this.seq;for(let r=0,a=n.length;r!==a;++r){const a=n[r];a.setValue(t,e[a.id],i)}};const nn=/(\w+)(\])?(\[|\.)?/g;function rn(t,e){t.seq.push(e),t.map[e.id]=e}function an(t,e,i){const n=t.name,r=n.length;for(nn.lastIndex=0;;){const a=nn.exec(n),o=nn.lastIndex;let s=a[1];const l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===r){rn(i,void 0===c?new $i(s,t,e):new tn(s,t,e));break}{let t=i.map[s];void 0===t&&(t=new en(s),rn(i,t)),i=t}}}function on(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,35718);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);an(i,t.getUniformLocation(e,i.name),this)}}function sn(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}on.prototype.setValue=function(t,e,i,n){const r=this.map[e];void 0!==r&&r.setValue(t,i,n)},on.prototype.setOptional=function(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)},on.upload=function(t,e,i,n){for(let r=0,a=e.length;r!==a;++r){const a=e[r],o=i[a.id];!1!==o.needsUpdate&&a.setValue(t,o.value,n)}},on.seqWithValue=function(t,e){const i=[];for(let n=0,r=t.length;n!==r;++n){const r=t[n];r.id in e&&i.push(r)}return i};let ln=0;function cn(t){switch(t){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function hn(t,e,i){const n=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();if(n&&""===r)return"";return"THREE.WebGLShader: gl.getShaderInfoLog() "+i+"\n"+r+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function un(t,e){const i=cn(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function dn(t,e){const i=cn(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function pn(t,e){let i;switch(e){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function fn(t){return""!==t}function gn(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function mn(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const yn=/^[ \t]*#include +<([\w\d./]+)>/gm;function bn(t){return t.replace(yn,vn)}function vn(t,e){const i=We[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return bn(i)}const xn=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,_n=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function An(t){return t.replace(_n,Cn).replace(xn,wn)}function wn(t,e,i,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Cn(t,e,i,n)}function Cn(t,e,i,n){let r="";for(let t=parseInt(e);t<parseInt(i);t++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function Mn(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function In(t,e,i,n){const r=t.getContext(),a=i.defines;let o=i.vertexShader,s=i.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(i),c=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case 301:case 302:e="ENVMAP_TYPE_CUBE";break;case 306:case 307:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),h=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case 302:case 307:e="ENVMAP_MODE_REFRACTION"}return e}(i),u=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(i),d=t.gammaFactor>0?t.gammaFactor:1,p=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(fn).join("\n")}(i),f=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(a),g=r.createProgram();let m,y,b=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(m=[f].filter(fn).join("\n"),m.length>0&&(m+="\n"),y=[p,f].filter(fn).join("\n"),y.length>0&&(y+="\n")):(m=[Mn(i),"#define SHADER_NAME "+i.shaderName,f,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(fn).join("\n"),y=[p,Mn(i),"#define SHADER_NAME "+i.shaderName,f,i.alphaTest?"#define ALPHATEST "+i.alphaTest+(i.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+d,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.envMap?"#define "+h:"",i.envMap?"#define "+u:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.sheen?"#define USE_SHEEN":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(i.extensionShaderTextureLOD||i.envMap)&&i.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?We.tonemapping_pars_fragment:"",0!==i.toneMapping?pn("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",We.encodings_pars_fragment,i.map?un("mapTexelToLinear",i.mapEncoding):"",i.matcap?un("matcapTexelToLinear",i.matcapEncoding):"",i.envMap?un("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMap?un("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.lightMap?un("lightMapTexelToLinear",i.lightMapEncoding):"",dn("linearToOutputTexel",i.outputEncoding),i.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(fn).join("\n")),o=bn(o),o=gn(o,i),o=mn(o,i),s=bn(s),s=gn(s,i),s=mn(s,i),o=An(o),s=An(s),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(b="#version 300 es\n",m=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,y=["#define varying in","300 es"===i.glslVersion?"":"out highp vec4 pc_fragColor;","300 es"===i.glslVersion?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+y);const v=b+y+s,x=sn(r,35633,b+m+o),_=sn(r,35632,v);if(r.attachShader(g,x),r.attachShader(g,_),void 0!==i.index0AttributeName?r.bindAttribLocation(g,0,i.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(g,0,"position"),r.linkProgram(g),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(g).trim(),e=r.getShaderInfoLog(x).trim(),i=r.getShaderInfoLog(_).trim();let n=!0,a=!0;if(!1===r.getProgramParameter(g,35714)){n=!1;const e=hn(r,x,"vertex"),i=hn(r,_,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(g,35715),"gl.getProgramInfoLog",t,e,i)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==i||(a=!1);a&&(this.diagnostics={runnable:n,programLog:t,vertexShader:{log:e,prefix:m},fragmentShader:{log:i,prefix:y}})}let A,w;return r.deleteShader(x),r.deleteShader(_),this.getUniforms=function(){return void 0===A&&(A=new on(r,g)),A},this.getAttributes=function(){return void 0===w&&(w=function(t,e){const i={},n=t.getProgramParameter(e,35721);for(let r=0;r<n;r++){const n=t.getActiveAttrib(e,r).name;i[n]=t.getAttribLocation(e,n)}return i}(r,g)),w},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(g),this.program=void 0},this.name=i.shaderName,this.id=ln++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=x,this.fragmentShader=_,this}function En(t,e,i,n,r,a){const o=[],s=n.isWebGL2,l=n.logarithmicDepthBuffer,c=n.floatVertexTextures,h=n.maxVertexUniforms,u=n.vertexTextures;let d=n.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},f=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function g(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=3e3,e}return{getParameters:function(r,o,f,m,y){const b=m.fog,v=r.isMeshStandardMaterial?m.environment:null,x=e.get(r.envMap||v),_=p[r.type],A=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(c)return 1024;{const t=h,i=Math.floor((t-20)/4),n=Math.min(i,e.length);return n<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+n+"."),0):n}}(y):0;let w,C;if(null!==r.precision&&(d=n.getMaxPrecision(r.precision),d!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",d,"instead.")),_){const t=Ze[_];w=t.vertexShader,C=t.fragmentShader}else w=r.vertexShader,C=r.fragmentShader;const M=t.getRenderTarget();return{isWebGL2:s,shaderID:_,shaderName:r.type,vertexShader:w,fragmentShader:C,defines:r.defines,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:d,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:u,outputEncoding:null!==M?g(M.texture):t.outputEncoding,map:!!r.map,mapEncoding:g(r.map),matcap:!!r.matcap,matcapEncoding:g(r.matcap),envMap:!!x,envMapMode:x&&x.mapping,envMapEncoding:g(x),envMapCubeUV:!!x&&(306===x.mapping||307===x.mapping),lightMap:!!r.lightMap,lightMapEncoding:g(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:g(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:1===r.normalMapType,tangentSpaceNormalMap:0===r.normalMapType,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,transmissionMap:!!r.transmissionMap,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap||r.transmissionMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||r.transmissionMap||!r.displacementMap),fog:!!b,useFog:r.fog,fogExp2:b&&b.isFogExp2,flatShading:!!r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:l,skinning:r.skinning&&A>0,maxBones:A,useVertexTexture:c,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&f.length>0,shadowMapType:t.shadowMap.type,toneMapping:r.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:2===r.side,flipSided:1===r.side,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:s||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:s||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:s||i.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<f.length;t++)i.push(e[f[t]]);i.push(t.outputEncoding),i.push(t.gammaFactor)}return i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=p[t.type];let i;if(e){const t=Ze[e];i=Le.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=o.length;t<e;t++){const e=o[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new In(t,i,e,r),o.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=o.indexOf(t);o[e]=o[o.length-1],o.pop(),t.destroy()}},programs:o}}function Sn(){let t=new WeakMap;return{get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function Tn(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Bn(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Fn(t){const e=[];let i=0;const n=[],r=[],a={id:-1};function o(n,r,o,s,l,c){let h=e[i];const u=t.get(o);return void 0===h?(h={id:n.id,object:n,geometry:r,material:o,program:u.program||a,groupOrder:s,renderOrder:n.renderOrder,z:l,group:c},e[i]=h):(h.id=n.id,h.object=n,h.geometry=r,h.material=o,h.program=u.program||a,h.groupOrder=s,h.renderOrder=n.renderOrder,h.z=l,h.group=c),i++,h}return{opaque:n,transparent:r,init:function(){i=0,n.length=0,r.length=0},push:function(t,e,i,a,s,l){const c=o(t,e,i,a,s,l);(!0===i.transparent?r:n).push(c)},unshift:function(t,e,i,a,s,l){const c=o(t,e,i,a,s,l);(!0===i.transparent?r:n).unshift(c)},finish:function(){for(let t=i,n=e.length;t<n;t++){const i=e[t];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}},sort:function(t,e){n.length>1&&n.sort(t||Tn),r.length>1&&r.sort(e||Bn)}}}function Ln(t){let e=new WeakMap;return{get:function(i,n){let r;return!1===e.has(i)?(r=new Fn(t),e.set(i,[r])):n>=e.get(i).length?(r=new Fn(t),e.get(i).push(r)):r=e.get(i)[n],r},dispose:function(){e=new WeakMap}}}function Un(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new y,color:new Ot};break;case"SpotLight":i={position:new y,direction:new y,color:new Ot,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new y,color:new Ot,distance:0,decay:0};break;case"HemisphereLight":i={direction:new y,skyColor:new Ot,groundColor:new Ot};break;case"RectAreaLight":i={color:new Ot,position:new y,halfWidth:new y,halfHeight:new y}}return t[e.id]=i,i}}}let Rn=0;function Dn(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Pn(t,e){const i=new Un,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new s};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new s,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new y);const a=new y,o=new j,l=new j;return{setup:function(a){let o=0,s=0,l=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let c=0,h=0,u=0,d=0,p=0,f=0,g=0,m=0;a.sort(Dn);for(let t=0,e=a.length;t<e;t++){const e=a[t],y=e.color,b=e.intensity,v=e.distance,x=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)o+=y.r*b,s+=y.g*b,l+=y.b*b;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],b);else if(e.isDirectionalLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.directionalShadow[c]=i,r.directionalShadowMap[c]=x,r.directionalShadowMatrix[c]=e.shadow.matrix,f++}r.directional[c]=t,c++}else if(e.isSpotLight){const t=i.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(y).multiplyScalar(b),t.distance=v,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.spotShadow[u]=i,r.spotShadowMap[u]=x,r.spotShadowMatrix[u]=e.shadow.matrix,m++}r.spot[u]=t,u++}else if(e.isRectAreaLight){const t=i.get(e);t.color.copy(y).multiplyScalar(b),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[d]=t,d++}else if(e.isPointLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,i.shadowCameraNear=t.camera.near,i.shadowCameraFar=t.camera.far,r.pointShadow[h]=i,r.pointShadowMap[h]=x,r.pointShadowMatrix[h]=e.shadow.matrix,g++}r.point[h]=t,h++}else if(e.isHemisphereLight){const t=i.get(e);t.skyColor.copy(e.color).multiplyScalar(b),t.groundColor.copy(e.groundColor).multiplyScalar(b),r.hemi[p]=t,p++}}d>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=qe.LTC_FLOAT_1,r.rectAreaLTC2=qe.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=qe.LTC_HALF_1,r.rectAreaLTC2=qe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=s,r.ambient[2]=l;const y=r.hash;y.directionalLength===c&&y.pointLength===h&&y.spotLength===u&&y.rectAreaLength===d&&y.hemiLength===p&&y.numDirectionalShadows===f&&y.numPointShadows===g&&y.numSpotShadows===m||(r.directional.length=c,r.spot.length=u,r.rectArea.length=d,r.point.length=h,r.hemi.length=p,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=m,r.spotShadowMap.length=m,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=m,y.directionalLength=c,y.pointLength=h,y.spotLength=u,y.rectAreaLength=d,y.hemiLength=p,y.numDirectionalShadows=f,y.numPointShadows=g,y.numSpotShadows=m,r.version=Rn++)},setupView:function(t,e){let i=0,n=0,s=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=r.directional[i];t.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(u),i++}else if(d.isSpotLight){const t=r.spot[s];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(u),s++}else if(d.isRectAreaLight){const t=r.rectArea[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),l.identity(),o.copy(d.matrixWorld),o.premultiply(u),l.extractRotation(o),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(l),t.halfHeight.applyMatrix4(l),c++}else if(d.isPointLight){const t=r.point[n];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),n++}else if(d.isHemisphereLight){const t=r.hemi[h];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),t.direction.normalize(),h++}}},state:r}}function Nn(t,e){const i=new Pn(t,e),n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:i},setupLights:function(){i.setup(n)},setupLightsView:function(t){i.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){r.push(t)}}}function zn(t,e){let i=new WeakMap;return{get:function(n,r=0){let a;return!1===i.has(n)?(a=new Nn(t,e),i.set(n,[a])):r>=i.get(n).length?(a=new Nn(t,e),i.get(n).push(a)):a=i.get(n)[r],a},dispose:function(){i=new WeakMap}}}class Qn extends Ut{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}Qn.prototype.isMeshDepthMaterial=!0;class On extends Ut{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new y,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}On.prototype.isMeshDistanceMaterial=!0;function kn(t,e,i){let n=new He;const r=new s,a=new s,o=new f,l=[],c=[],h={},u={0:1,1:0,2:2},d=new Ue({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new s},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const m=new ce;m.setAttribute("position",new Gt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new Ee(m,d),b=this;function v(i,n){const r=e.update(y);d.uniforms.shadow_pass.value=i.map.texture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,d,y,null),p.uniforms.shadow_pass.value=i.mapPass.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,p,y,null)}function x(t,e,i){const n=t<<0|e<<1|i<<2;let r=l[n];return void 0===r&&(r=new Qn({depthPacking:3201,morphTargets:t,skinning:e}),l[n]=r),r}function _(t,e,i){const n=t<<0|e<<1|i<<2;let r=c[n];return void 0===r&&(r=new On({morphTargets:t,skinning:e}),c[n]=r),r}function A(e,i,n,r,a,o,s){let l=null,c=x,d=e.customDepthMaterial;if(!0===r.isPointLight&&(c=_,d=e.customDistanceMaterial),void 0===d){let t=!1;!0===n.morphTargets&&(t=i.morphAttributes&&i.morphAttributes.position&&i.morphAttributes.position.length>0);let r=!1;!0===e.isSkinnedMesh&&(!0===n.skinning?r=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e));l=c(t,r,!0===e.isInstancedMesh)}else l=d;if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){const t=l.uuid,e=n.uuid;let i=h[t];void 0===i&&(i={},h[t]=i);let r=i[e];void 0===r&&(r=l.clone(),i[e]=r),l=r}return l.visible=n.visible,l.wireframe=n.wireframe,l.side=3===s?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:u[n.side],l.clipShadows=n.clipShadows,l.clippingPlanes=n.clippingPlanes,l.clipIntersection=n.clipIntersection,l.wireframeLinewidth=n.wireframeLinewidth,l.linewidth=n.linewidth,!0===r.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(r.matrixWorld),l.nearDistance=a,l.farDistance=o),l}function w(i,r,a,o,s){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===s)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,i.matrixWorld);const n=e.update(i),r=i.material;if(Array.isArray(r)){const e=n.groups;for(let l=0,c=e.length;l<c;l++){const c=e[l],h=r[c.materialIndex];if(h&&h.visible){const e=A(i,n,h,o,a.near,a.far,s);t.renderBufferDirect(a,null,n,e,i,c)}}}else if(r.visible){const e=A(i,n,r,o,a.near,a.far,s);t.renderBufferDirect(a,null,n,e,i,null)}}const l=i.children;for(let t=0,e=l.length;t<e;t++)w(l[t],r,a,o,s)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,s,l){if(!1===b.enabled)return;if(!1===b.autoUpdate&&!1===b.needsUpdate)return;if(0===e.length)return;const c=t.getRenderTarget(),h=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let c=0,h=e.length;c<h;c++){const h=e[c],u=h.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",h,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const p=u.getFrameExtents();if(r.multiply(p),a.copy(u.mapSize),(r.x>i||r.y>i)&&(r.x>i&&(a.x=Math.floor(i/p.x),r.x=a.x*p.x,u.mapSize.x=a.x),r.y>i&&(a.y=Math.floor(i/p.y),r.y=a.y*p.y,u.mapSize.y=a.y)),null===u.map&&!u.isPointLightShadow&&3===this.type){const t={minFilter:1006,magFilter:1006,format:1023};u.map=new g(r.x,r.y,t),u.map.texture.name=h.name+".shadowMap",u.mapPass=new g(r.x,r.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:1003,magFilter:1003,format:1023};u.map=new g(r.x,r.y,t),u.map.texture.name=h.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const f=u.getViewportCount();for(let t=0;t<f;t++){const e=u.getViewport(t);o.set(a.x*e.x,a.y*e.y,a.x*e.z,a.y*e.w),d.viewport(o),u.updateMatrices(h,t),n=u.getFrustum(),w(s,l,u.camera,h,this.type)}u.isPointLightShadow||3!==this.type||v(u,l),u.needsUpdate=!1}b.needsUpdate=!1,t.setRenderTarget(c,h,u)}}function Hn(t,e,i){const n=i.isWebGL2;const r=new function(){let e=!1;const i=new f;let n=null;const r=new f(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,a,o,s){!0===s&&(e*=o,n*=o,a*=o),i.set(e,n,a,o),!1===r.equals(i)&&(t.clearColor(e,n,a,o),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},a=new function(){let e=!1,i=null,n=null,r=null;return{setTest:function(t){t?R(2929):D(2929)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},o=new function(){let e=!1,i=null,n=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(t){e||(t?R(2960):D(2960))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,o){n===e&&r===i&&a===o||(t.stencilFunc(e,i,o),n=e,r=i,a=o)},setOp:function(e,i,n){o===e&&s===i&&l===n||(t.stencilOp(e,i,n),o=e,s=i,l=n)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,i=null,n=null,r=null,a=null,o=null,s=null,l=null,c=null}}};let s={},l=null,c=!1,h=null,u=null,d=null,p=null,g=null,m=null,y=null,b=!1,v=null,x=null,_=null,A=null,w=null;const C=t.getParameter(35661);let M=!1,I=0;const E=t.getParameter(7938);-1!==E.indexOf("WebGL")?(I=parseFloat(/^WebGL (\d)/.exec(E)[1]),M=I>=1):-1!==E.indexOf("OpenGL ES")&&(I=parseFloat(/^OpenGL ES (\d)/.exec(E)[1]),M=I>=2);let S=null,T={};const B=new f,F=new f;function L(e,i,n){const r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<n;e++)t.texImage2D(i+e,0,6408,1,1,0,6408,5121,r);return a}const U={};function R(e){!0!==s[e]&&(t.enable(e),s[e]=!0)}function D(e){!1!==s[e]&&(t.disable(e),s[e]=!1)}U[3553]=L(3553,3553,1),U[34067]=L(34067,34069,6),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),R(2929),a.setFunc(3),Q(!1),O(1),R(2884),z(0);const P={100:32774,101:32778,102:32779};if(n)P[103]=32775,P[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(P[103]=t.MIN_EXT,P[104]=t.MAX_EXT)}const N={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function z(e,i,n,r,a,o,s,l){if(0!==e){if(!1===c&&(R(3042),c=!0),5===e)a=a||i,o=o||n,s=s||r,i===u&&a===g||(t.blendEquationSeparate(P[i],P[a]),u=i,g=a),n===d&&r===p&&o===m&&s===y||(t.blendFuncSeparate(N[n],N[r],N[o],N[s]),d=n,p=r,m=o,y=s),h=e,b=null;else if(e!==h||l!==b){if(100===u&&100===g||(t.blendEquation(32774),u=100,g=100),l)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,0,769,771);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFunc(0,769);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}d=null,p=null,m=null,y=null,h=e,b=l}}else!0===c&&(D(3042),c=!1)}function Q(e){v!==e&&(e?t.frontFace(2304):t.frontFace(2305),v=e)}function O(e){0!==e?(R(2884),e!==x&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):D(2884),x=e}function k(e,i,n){e?(R(32823),A===i&&w===n||(t.polygonOffset(i,n),A=i,w=n)):D(32823)}function H(e){void 0===e&&(e=33984+C-1),S!==e&&(t.activeTexture(e),S=e)}return{buffers:{color:r,depth:a,stencil:o},enable:R,disable:D,useProgram:function(e){return l!==e&&(t.useProgram(e),l=e,!0)},setBlending:z,setMaterial:function(t,e){2===t.side?D(2884):R(2884);let i=1===t.side;e&&(i=!i),Q(i),1===t.blending&&!1===t.transparent?z(0):z(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),a.setFunc(t.depthFunc),a.setTest(t.depthTest),a.setMask(t.depthWrite),r.setMask(t.colorWrite);const n=t.stencilWrite;o.setTest(n),n&&(o.setMask(t.stencilWriteMask),o.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),o.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),k(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:Q,setCullFace:O,setLineWidth:function(e){e!==_&&(M&&t.lineWidth(e),_=e)},setPolygonOffset:k,setScissorTest:function(t){t?R(3089):D(3089)},activeTexture:H,bindTexture:function(e,i){null===S&&H();let n=T[S];void 0===n&&(n={type:void 0,texture:void 0},T[S]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||U[e]),n.type=e,n.texture=i)},unbindTexture:function(){const e=T[S];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===B.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),B.copy(e))},viewport:function(e){!1===F.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),F.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),s={},S=null,T={},l=null,c=!1,h=null,u=null,d=null,p=null,g=null,m=null,y=null,b=!1,v=null,x=null,_=null,A=null,w=null,r.reset(),a.reset(),o.reset()}}}function Vn(t,e,i,n,r,a,s){const l=r.isWebGL2,c=r.maxTextures,h=r.maxCubemapSize,u=r.maxTextureSize,d=r.maxSamples,p=new WeakMap;let f,g=!1;try{g="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function m(t,e){return g?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function y(t,e,i,n){let r=1;if((t.width>n||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=e?o.floorPowerOfTwo:Math.floor,a=n(r*t.width),s=n(r*t.height);void 0===f&&(f=m(a,s));const l=i?m(a,s):f;l.width=a,l.height=s;return l.getContext("2d").drawImage(t,0,0,a,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+a+"x"+s+")."),l}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function b(t){return o.isPowerOfTwo(t.width)&&o.isPowerOfTwo(t.height)}function v(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function x(e,i,r,a){t.generateMipmap(e);n.get(i).__maxMipLevel=Math.log2(Math.max(r,a))}function _(i,n,r){if(!1===l)return n;if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let a=n;return 6403===n&&(5126===r&&(a=33326),5131===r&&(a=33325),5121===r&&(a=33321)),6407===n&&(5126===r&&(a=34837),5131===r&&(a=34843),5121===r&&(a=32849)),6408===n&&(5126===r&&(a=34836),5131===r&&(a=34842),5121===r&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||e.get("EXT_color_buffer_float"),a}function A(t){return 1003===t||1004===t||1005===t?9728:9729}function w(e){const i=e.target;i.removeEventListener("dispose",w),function(e){const i=n.get(e);if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture),n.remove(e)}(i),i.isVideoTexture&&p.delete(i),s.memory.textures--}function C(e){const i=e.target;i.removeEventListener("dispose",C),function(e){const i=e.texture,r=n.get(e),a=n.get(i);if(!e)return;void 0!==a.__webglTexture&&t.deleteTexture(a.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);n.remove(i),n.remove(e)}(i),s.memory.textures--}let M=0;function I(t,e){const r=n.get(t);if(t.isVideoTexture&&function(t){const e=s.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){const i=t.image;if(void 0===i)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==i.complete)return void L(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+e),i.bindTexture(3553,r.__webglTexture)}function E(e,r){const o=n.get(e);e.version>0&&o.__version!==e.version?function(e,n,r){if(6!==n.image.length)return;F(e,n),i.activeTexture(33984+r),i.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const o=n&&(n.isCompressedTexture||n.image[0].isCompressedTexture),s=n.image[0]&&n.image[0].isDataTexture,c=[];for(let t=0;t<6;t++)c[t]=o||s?s?n.image[t].image:n.image[t]:y(n.image[t],!1,!0,h);const u=c[0],d=b(u)||l,p=a.convert(n.format),f=a.convert(n.type),g=_(n.internalFormat,p,f);let m;if(B(34067,n,d),o){for(let t=0;t<6;t++){m=c[t].mipmaps;for(let e=0;e<m.length;e++){const r=m[e];1023!==n.format&&1022!==n.format?null!==p?i.compressedTexImage2D(34069+t,e,g,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(34069+t,e,g,r.width,r.height,0,p,f,r.data)}}e.__maxMipLevel=m.length-1}else{m=n.mipmaps;for(let t=0;t<6;t++)if(s){i.texImage2D(34069+t,0,g,c[t].width,c[t].height,0,p,f,c[t].data);for(let e=0;e<m.length;e++){const n=m[e].image[t].image;i.texImage2D(34069+t,e+1,g,n.width,n.height,0,p,f,n.data)}}else{i.texImage2D(34069+t,0,g,p,f,c[t]);for(let e=0;e<m.length;e++){const n=m[e];i.texImage2D(34069+t,e+1,g,p,f,n.image[t])}}e.__maxMipLevel=m.length}v(n,d)&&x(34067,n,u.width,u.height);e.__version=n.version,n.onUpdate&&n.onUpdate(n)}(o,e,r):(i.activeTexture(33984+r),i.bindTexture(34067,o.__webglTexture))}const S={1e3:10497,1001:33071,1002:33648},T={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function B(i,a,o){if(o?(t.texParameteri(i,10242,S[a.wrapS]),t.texParameteri(i,10243,S[a.wrapT]),32879!==i&&35866!==i||t.texParameteri(i,32882,S[a.wrapR]),t.texParameteri(i,10240,T[a.magFilter]),t.texParameteri(i,10241,T[a.minFilter])):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879!==i&&35866!==i||t.texParameteri(i,32882,33071),1001===a.wrapS&&1001===a.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,10240,A(a.magFilter)),t.texParameteri(i,10241,A(a.minFilter)),1003!==a.minFilter&&1006!==a.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const o=e.get("EXT_texture_filter_anisotropic");if(1015===a.type&&!1===e.has("OES_texture_float_linear"))return;if(!1===l&&1016===a.type&&!1===e.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||n.get(a).__currentAnisotropy)&&(t.texParameterf(i,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}}function F(e,i){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),s.memory.textures++)}function L(e,n,r){let o=3553;n.isDataTexture2DArray&&(o=35866),n.isDataTexture3D&&(o=32879),F(e,n),i.activeTexture(33984+r),i.bindTexture(o,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const s=function(t){return!l&&(1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.minFilter)}(n)&&!1===b(n.image),c=y(n.image,s,!1,u),h=b(c)||l,d=a.convert(n.format);let p,f=a.convert(n.type),g=_(n.internalFormat,d,f);B(o,n,h);const m=n.mipmaps;if(n.isDepthTexture)g=6402,l?g=1015===n.type?36012:1014===n.type?33190:1020===n.type?35056:33189:1015===n.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===n.format&&6402===g&&1012!==n.type&&1014!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=1012,f=a.convert(n.type)),1027===n.format&&6402===g&&(g=34041,1020!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=1020,f=a.convert(n.type))),i.texImage2D(3553,0,g,c.width,c.height,0,d,f,null);else if(n.isDataTexture)if(m.length>0&&h){for(let t=0,e=m.length;t<e;t++)p=m[t],i.texImage2D(3553,t,g,p.width,p.height,0,d,f,p.data);n.generateMipmaps=!1,e.__maxMipLevel=m.length-1}else i.texImage2D(3553,0,g,c.width,c.height,0,d,f,c.data),e.__maxMipLevel=0;else if(n.isCompressedTexture){for(let t=0,e=m.length;t<e;t++)p=m[t],1023!==n.format&&1022!==n.format?null!==d?i.compressedTexImage2D(3553,t,g,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(3553,t,g,p.width,p.height,0,d,f,p.data);e.__maxMipLevel=m.length-1}else if(n.isDataTexture2DArray)i.texImage3D(35866,0,g,c.width,c.height,c.depth,0,d,f,c.data),e.__maxMipLevel=0;else if(n.isDataTexture3D)i.texImage3D(32879,0,g,c.width,c.height,c.depth,0,d,f,c.data),e.__maxMipLevel=0;else if(m.length>0&&h){for(let t=0,e=m.length;t<e;t++)p=m[t],i.texImage2D(3553,t,g,d,f,p);n.generateMipmaps=!1,e.__maxMipLevel=m.length-1}else i.texImage2D(3553,0,g,d,f,c),e.__maxMipLevel=0;v(n,h)&&x(o,n,c.width,c.height),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function U(e,r,o,s){const l=r.texture,c=a.convert(l.format),h=a.convert(l.type),u=_(l.internalFormat,c,h);32879===s||35866===s?i.texImage3D(s,0,u,r.width,r.height,r.depth,0,c,h,null):i.texImage2D(s,0,u,r.width,r.height,0,c,h,null),t.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,o,s,n.get(l).__webglTexture,0),t.bindFramebuffer(36160,null)}function R(e,i,n){if(t.bindRenderbuffer(36161,e),i.depthBuffer&&!i.stencilBuffer){let r=33189;if(n){const e=i.depthTexture;e&&e.isDepthTexture&&(1015===e.type?r=36012:1014===e.type&&(r=33190));const n=P(i);t.renderbufferStorageMultisample(36161,n,r,i.width,i.height)}else t.renderbufferStorage(36161,r,i.width,i.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(i.depthBuffer&&i.stencilBuffer){if(n){const e=P(i);t.renderbufferStorageMultisample(36161,e,35056,i.width,i.height)}else t.renderbufferStorage(36161,34041,i.width,i.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=i.texture,r=a.convert(e.format),o=a.convert(e.type),s=_(e.internalFormat,r,o);if(n){const e=P(i);t.renderbufferStorageMultisample(36161,e,s,i.width,i.height)}else t.renderbufferStorage(36161,s,i.width,i.height)}t.bindRenderbuffer(36161,null)}function D(e){const i=n.get(e),r=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),I(i.depthTexture,0);const r=n.get(i.depthTexture).__webglTexture;if(1026===i.depthTexture.format)t.framebufferTexture2D(36160,36096,3553,r,0);else{if(1027!==i.depthTexture.format)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,r,0)}}(i.__webglFramebuffer,e)}else if(r){i.__webglDepthbuffer=[];for(let n=0;n<6;n++)t.bindFramebuffer(36160,i.__webglFramebuffer[n]),i.__webglDepthbuffer[n]=t.createRenderbuffer(),R(i.__webglDepthbuffer[n],e,!1)}else t.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),R(i.__webglDepthbuffer,e,!1);t.bindFramebuffer(36160,null)}function P(t){return l&&t.isWebGLMultisampleRenderTarget?Math.min(d,t.samples):0}let N=!1,z=!1;this.allocateTextureUnit=function(){const t=M;return t>=c&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+c),M+=1,t},this.resetTextureUnits=function(){M=0},this.setTexture2D=I,this.setTexture2DArray=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?L(r,t,e):(i.activeTexture(33984+e),i.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?L(r,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,r.__webglTexture))},this.setTextureCube=E,this.setupRenderTarget=function(e){const r=e.texture,o=n.get(e),c=n.get(r);e.addEventListener("dispose",C),c.__webglTexture=t.createTexture(),s.memory.textures++;const h=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultisampleRenderTarget,d=r.isDataTexture3D||r.isDataTexture2DArray,p=b(e)||l;if(!l||1022!==r.format||1015!==r.type&&1016!==r.type||(r.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),h){o.__webglFramebuffer=[];for(let e=0;e<6;e++)o.__webglFramebuffer[e]=t.createFramebuffer()}else if(o.__webglFramebuffer=t.createFramebuffer(),u)if(l){o.__webglMultisampledFramebuffer=t.createFramebuffer(),o.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,o.__webglColorRenderbuffer);const i=a.convert(r.format),n=a.convert(r.type),s=_(r.internalFormat,i,n),l=P(e);t.renderbufferStorageMultisample(36161,l,s,e.width,e.height),t.bindFramebuffer(36160,o.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,o.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(o.__webglDepthRenderbuffer=t.createRenderbuffer(),R(o.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(h){i.bindTexture(34067,c.__webglTexture),B(34067,r,p);for(let t=0;t<6;t++)U(o.__webglFramebuffer[t],e,36064,34069+t);v(r,p)&&x(34067,r,e.width,e.height),i.bindTexture(34067,null)}else{let t=3553;if(d)if(l){t=r.isDataTexture3D?32879:35866}else console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.");i.bindTexture(t,c.__webglTexture),B(t,r,p),U(o.__webglFramebuffer,e,36064,t),v(r,p)&&x(3553,r,e.width,e.height),i.bindTexture(3553,null)}e.depthBuffer&&D(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(v(e,b(t)||l)){const r=t.isWebGLCubeRenderTarget?34067:3553,a=n.get(e).__webglTexture;i.bindTexture(r,a),x(r,e,t.width,t.height),i.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(l){const i=n.get(e);t.bindFramebuffer(36008,i.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,i.__webglFramebuffer);const r=e.width,a=e.height;let o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,r,a,0,0,r,a,o,9728),t.bindFramebuffer(36160,i.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===N&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),N=!0),t=t.texture),I(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===z&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),z=!0),t=t.texture),E(t,e)}}function Gn(t,e,i){const n=i.isWebGL2;return{convert:function(t){let i;if(1009===t)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(1012===t)return 5123;if(1013===t)return 5124;if(1014===t)return 5125;if(1015===t)return 5126;if(1016===t)return n?5131:(i=e.get("OES_texture_half_float"),null!==i?i.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(1022===t)return 6407;if(1023===t)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(1026===t)return 6402;if(1027===t)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(33776===t||33777===t||33778===t||33779===t){if(i=e.get("WEBGL_compressed_texture_s3tc"),null===i)return null;if(33776===t)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===t)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===t)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===t)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===t||35841===t||35842===t||35843===t){if(i=e.get("WEBGL_compressed_texture_pvrtc"),null===i)return null;if(35840===t)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===t)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===t)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===t)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return i=e.get("WEBGL_compressed_texture_etc1"),null!==i?i.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===t||37496===t)&&(i=e.get("WEBGL_compressed_texture_etc"),null!==i)){if(37492===t)return i.COMPRESSED_RGB8_ETC2;if(37496===t)return i.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?(i=e.get("WEBGL_compressed_texture_astc"),null!==i?t:null):36492===t?(i=e.get("EXT_texture_compression_bptc"),null!==i?t:null):1020===t?n?34042:(i=e.get("WEBGL_depth_texture"),null!==i?i.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}function jn(t=[]){De.call(this),this.cameras=t}jn.prototype=Object.assign(Object.create(De.prototype),{constructor:jn,isArrayCamera:!0});class Wn extends mt{constructor(){super(),this.type="Group"}}function qn(){this._targetRay=null,this._grip=null,this._hand=null}function Zn(t,e){const i=this;let n=null,r=1,a=null,o="local-floor",s=null;const l=[],c=new Map,h=new De;h.layers.enable(1),h.viewport=new f;const u=new De;u.layers.enable(2),u.viewport=new f;const d=[h,u],p=new jn;p.layers.enable(1),p.layers.enable(2);let g=null,m=null;function b(t){const e=c.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function v(){c.forEach((function(t,e){t.disconnect(e)})),c.clear(),g=null,m=null,t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),M.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function x(t){const e=n.inputSources;for(let t=0;t<l.length;t++)c.set(e[t],l[t]);for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=c.get(i);n&&(n.dispatchEvent({type:"disconnected",data:i}),c.delete(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e],n=c.get(i);n&&n.dispatchEvent({type:"connected",data:i})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=l[t];return void 0===e&&(e=new qn,l[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=l[t];return void 0===e&&(e=new qn,l[t]=e),e.getGripSpace()},this.getHand=function(t){let e=l[t];return void 0===e&&(e=new qn,l[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getSession=function(){return n},this.setSession=async function(t){if(n=t,null!==n){n.addEventListener("select",b),n.addEventListener("selectstart",b),n.addEventListener("selectend",b),n.addEventListener("squeeze",b),n.addEventListener("squeezestart",b),n.addEventListener("squeezeend",b),n.addEventListener("end",v),n.addEventListener("inputsourceschange",x);const t=e.getContextAttributes();!0!==t.xrCompatible&&await e.makeXRCompatible();const s={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:r},l=new XRWebGLLayer(n,e,s);n.updateRenderState({baseLayer:l}),a=await n.requestReferenceSpace(o),M.setContext(n),M.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};const _=new y,A=new y;function w(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.getCamera=function(t){p.near=u.near=h.near=t.near,p.far=u.far=h.far=t.far,g===p.near&&m===p.far||(n.updateRenderState({depthNear:p.near,depthFar:p.far}),g=p.near,m=p.far);const e=t.parent,i=p.cameras;w(p,e);for(let t=0;t<i.length;t++)w(i[t],e);t.matrixWorld.copy(p.matrixWorld),t.matrix.copy(p.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale);const r=t.children;for(let t=0,e=r.length;t<e;t++)r[t].updateMatrixWorld(!0);return 2===i.length?function(t,e,i){_.setFromMatrixPosition(e.matrixWorld),A.setFromMatrixPosition(i.matrixWorld);const n=_.distanceTo(A),r=e.projectionMatrix.elements,a=i.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(a[8]+1)/a[0],d=o*h,p=o*u,f=n/(-h+u),g=f*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(g),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const m=o+f,y=s+f,b=d-g,v=p+(n-g),x=l*s/y*m,w=c*s/y*m;t.projectionMatrix.makePerspective(b,v,x,w,m,y)}(p,h,u):p.projectionMatrix.copy(h.projectionMatrix),p};let C=null;const M=new Ve;M.setAnimationLoop((function(e,i){if(s=i.getViewerPose(a),null!==s){const e=s.views,i=n.renderState.baseLayer;t.setFramebuffer(i.framebuffer);let r=!1;e.length!==p.cameras.length&&(p.cameras.length=0,r=!0);for(let t=0;t<e.length;t++){const n=e[t],a=i.getViewport(n),o=d[t];o.matrix.fromArray(n.transform.matrix),o.projectionMatrix.fromArray(n.projectionMatrix),o.viewport.set(a.x,a.y,a.width,a.height),0===t&&p.matrix.copy(o.matrix),!0===r&&p.cameras.push(o)}}const r=n.inputSources;for(let t=0;t<l.length;t++){const e=l[t],n=r[t];e.update(n,i,a)}C&&C(e,i)})),this.setAnimationLoop=function(t){C=t},this.dispose=function(){}}function Jn(t){function e(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map),i.alphaMap&&(e.alphaMap.value=i.alphaMap),i.specularMap&&(e.specularMap.value=i.specularMap);const n=t.get(i).envMap;if(n){e.envMap.value=n,e.flipEnvMap.value=n.isCubeTexture&&n._needsFlipEnvMap?-1:1,e.reflectivity.value=i.reflectivity,e.refractionRatio.value=i.refractionRatio;const r=t.get(n).__maxMipLevel;void 0!==r&&(e.maxMipLevel.value=r)}let r,a;i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity),i.map?r=i.map:i.specularMap?r=i.specularMap:i.displacementMap?r=i.displacementMap:i.normalMap?r=i.normalMap:i.bumpMap?r=i.bumpMap:i.roughnessMap?r=i.roughnessMap:i.metalnessMap?r=i.metalnessMap:i.alphaMap?r=i.alphaMap:i.emissiveMap?r=i.emissiveMap:i.clearcoatMap?r=i.clearcoatMap:i.clearcoatNormalMap?r=i.clearcoatNormalMap:i.clearcoatRoughnessMap&&(r=i.clearcoatRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),i.aoMap?a=i.aoMap:i.lightMap&&(a=i.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),e.uv2Transform.value.copy(a.matrix))}function i(e,i){e.roughness.value=i.roughness,e.metalness.value=i.metalness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap),i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap),i.bumpMap&&(e.bumpMap.value=i.bumpMap,e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias);t.get(i).envMap&&(e.envMapIntensity.value=i.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,n,r,a){n.isMeshBasicMaterial?e(t,n):n.isMeshLambertMaterial?(e(t,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,n)):n.isMeshToonMaterial?(e(t,n),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshPhongMaterial?(e(t,n),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshStandardMaterial?(e(t,n),n.isMeshPhysicalMaterial?function(t,e){i(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen);e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap);e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap);e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate());t.transmission.value=e.transmission,e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap)}(t,n):i(t,n)):n.isMeshMatcapMaterial?(e(t,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDepthMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDistanceMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,n)):n.isMeshNormalMaterial?(e(t,n),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,n)):n.isPointsMaterial?function(t,e,i,n){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*n,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,n,r,a):n.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);let i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,n):n.isShadowMaterial?(t.color.value.copy(n.color),t.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function Xn(t){const e=void 0!==(t=t||{}).canvas?t.canvas:function(){const t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}(),i=void 0!==t.context?t.context:null,n=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,l=void 0!==t.antialias&&t.antialias,c=void 0===t.premultipliedAlpha||t.premultipliedAlpha,h=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,u=void 0!==t.powerPreference?t.powerPreference:"default",d=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let p=null,g=null;const m=[],b=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.maxMorphTargets=8,this.maxMorphNormals=4;const v=this;let x=!1,_=null,A=0,w=0,C=null,M=null,I=-1,E=null;const S=new f,T=new f;let B=null,F=e.width,L=e.height,U=1,R=null,D=null;const P=new f(0,0,F,L),N=new f(0,0,F,L);let z=!1;const Q=new He;let O=!1,k=!1;const H=new j,V=new y,G={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function W(){return null===C?U:1}let q,Z,J,X,Y,K,$,tt,et,it,nt,rt,at,ot,st,lt,ct,ht,ut,dt,pt,ft=i;function gt(t,i){for(let n=0;n<t.length;n++){const r=t[n],a=e.getContext(r,i);if(null!==a)return a}return null}try{const t={alpha:n,depth:r,stencil:a,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:h,powerPreference:u,failIfMajorPerformanceCaveat:d};if(e.addEventListener("webglcontextlost",vt,!1),e.addEventListener("webglcontextrestored",xt,!1),null===ft){const e=["webgl2","webgl","experimental-webgl"];if(!0===v.isWebGL1Renderer&&e.shift(),ft=gt(e,t),null===ft)throw gt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===ft.getShaderPrecisionFormat&&(ft.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function mt(){q=new ei(ft),Z=new Ke(ft,q,t),q.init(Z),dt=new Gn(ft,q,Z),J=new Hn(ft,q,Z),J.scissor(T.copy(N).multiplyScalar(U).floor()),J.viewport(S.copy(P).multiplyScalar(U).floor()),X=new ri(ft),Y=new Sn,K=new Vn(ft,q,J,Y,Z,dt,X),$=new ti(v),tt=new Ge(ft,Z),pt=new Xe(ft,q,tt,Z),et=new ii(ft,tt,X,pt),it=new li(ft,et,tt,X),ct=new si(ft),st=new $e(Y),nt=new En(v,$,q,Z,pt,st),rt=new Jn(Y),at=new Ln(Y),ot=new zn(q,Z),lt=new Je(v,$,J,it,c),ht=new Ye(ft,q,X,Z),ut=new ni(ft,q,X,Z),X.programs=nt.programs,v.capabilities=Z,v.extensions=q,v.properties=Y,v.renderLists=at,v.state=J,v.info=X}mt();const yt=new Zn(v,ft);this.xr=yt;const bt=new kn(v,it,Z.maxTextureSize);function vt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function xt(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1,mt()}function _t(t){const e=t.target;e.removeEventListener("dispose",_t),function(t){At(t),Y.remove(t)}(e)}function At(t){const e=Y.get(t).program;void 0!==e&&nt.releaseProgram(e)}this.shadowMap=bt,this.getContext=function(){return ft},this.getContextAttributes=function(){return ft.getContextAttributes()},this.forceContextLoss=function(){const t=q.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=q.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return U},this.setPixelRatio=function(t){void 0!==t&&(U=t,this.setSize(F,L,!1))},this.getSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),t=new s),t.set(F,L)},this.setSize=function(t,i,n){yt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(F=t,L=i,e.width=Math.floor(t*U),e.height=Math.floor(i*U),!1!==n&&(e.style.width=t+"px",e.style.height=i+"px"),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),t=new s),t.set(F*U,L*U).floor()},this.setDrawingBufferSize=function(t,i,n){F=t,L=i,U=n,e.width=Math.floor(t*n),e.height=Math.floor(i*n),this.setViewport(0,0,t,i)},this.getCurrentViewport=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),t=new f),t.copy(S)},this.getViewport=function(t){return t.copy(P)},this.setViewport=function(t,e,i,n){t.isVector4?P.set(t.x,t.y,t.z,t.w):P.set(t,e,i,n),J.viewport(S.copy(P).multiplyScalar(U).floor())},this.getScissor=function(t){return t.copy(N)},this.setScissor=function(t,e,i,n){t.isVector4?N.set(t.x,t.y,t.z,t.w):N.set(t,e,i,n),J.scissor(T.copy(N).multiplyScalar(U).floor())},this.getScissorTest=function(){return z},this.setScissorTest=function(t){J.setScissorTest(z=t)},this.setOpaqueSort=function(t){R=t},this.setTransparentSort=function(t){D=t},this.getClearColor=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),t=new Ot),t.copy(lt.getClearColor())},this.setClearColor=function(){lt.setClearColor.apply(lt,arguments)},this.getClearAlpha=function(){return lt.getClearAlpha()},this.setClearAlpha=function(){lt.setClearAlpha.apply(lt,arguments)},this.clear=function(t,e,i){let n=0;(void 0===t||t)&&(n|=16384),(void 0===e||e)&&(n|=256),(void 0===i||i)&&(n|=1024),ft.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",vt,!1),e.removeEventListener("webglcontextrestored",xt,!1),at.dispose(),ot.dispose(),Y.dispose(),$.dispose(),it.dispose(),pt.dispose(),yt.dispose(),Ct.stop()},this.renderBufferImmediate=function(t,e){pt.initAttributes();const i=Y.get(t);t.hasPositions&&!i.position&&(i.position=ft.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=ft.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=ft.createBuffer()),t.hasColors&&!i.color&&(i.color=ft.createBuffer());const n=e.getAttributes();t.hasPositions&&(ft.bindBuffer(34962,i.position),ft.bufferData(34962,t.positionArray,35048),pt.enableAttribute(n.position),ft.vertexAttribPointer(n.position,3,5126,!1,0,0)),t.hasNormals&&(ft.bindBuffer(34962,i.normal),ft.bufferData(34962,t.normalArray,35048),pt.enableAttribute(n.normal),ft.vertexAttribPointer(n.normal,3,5126,!1,0,0)),t.hasUvs&&(ft.bindBuffer(34962,i.uv),ft.bufferData(34962,t.uvArray,35048),pt.enableAttribute(n.uv),ft.vertexAttribPointer(n.uv,2,5126,!1,0,0)),t.hasColors&&(ft.bindBuffer(34962,i.color),ft.bufferData(34962,t.colorArray,35048),pt.enableAttribute(n.color),ft.vertexAttribPointer(n.color,3,5126,!1,0,0)),pt.disableUnusedAttributes(),ft.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,i,n,r,a){null===e&&(e=G);const o=r.isMesh&&r.matrixWorld.determinant()<0,s=Tt(t,e,n,r);J.setMaterial(n,o);let l=i.index;const c=i.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;let h,u=1;!0===n.wireframe&&(l=et.getWireframeAttribute(i),u=2),(n.morphTargets||n.morphNormals)&&ct.update(r,i,n,s),pt.setup(r,n,s,i,l);let d=ht;null!==l&&(h=tt.get(l),d=ut,d.setIndex(h));const p=null!==l?l.count:c.count,f=i.drawRange.start*u,g=i.drawRange.count*u,m=null!==a?a.start*u:0,y=null!==a?a.count*u:1/0,b=Math.max(f,m),v=Math.min(p,f+g,m+y)-1,x=Math.max(0,v-b+1);if(0!==x){if(r.isMesh)!0===n.wireframe?(J.setLineWidth(n.wireframeLinewidth*W()),d.setMode(1)):d.setMode(4);else if(r.isLine){let t=n.linewidth;void 0===t&&(t=1),J.setLineWidth(t*W()),r.isLineSegments?d.setMode(1):r.isLineLoop?d.setMode(2):d.setMode(3)}else r.isPoints?d.setMode(0):r.isSprite&&d.setMode(4);if(r.isInstancedMesh)d.renderInstances(b,x,r.count);else if(i.isInstancedBufferGeometry){const t=Math.min(i.instanceCount,i._maxInstanceCount);d.renderInstances(b,x,t)}else d.render(b,x)}},this.compile=function(t,e){g=ot.get(t),g.init(),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(g.pushLight(t),t.castShadow&&g.pushShadow(t))})),g.setupLights();const i=new WeakMap;t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++){const a=n[r];!1===i.has(a)&&(St(a,t,e),i.set(a))}else!1===i.has(n)&&(St(n,t,e),i.set(n))}))};let wt=null;const Ct=new Ve;function Mt(t,e,i,n){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)g.pushLight(t),t.castShadow&&g.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||Q.intersectsSprite(t)){n&&V.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H);const e=it.update(t),r=t.material;r.visible&&p.push(t,e,r,i,V.z,null)}}else if(t.isImmediateRenderObject)n&&V.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H),p.push(t,null,t.material,i,V.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==X.render.frame&&(t.skeleton.update(),t.skeleton.frame=X.render.frame),!t.frustumCulled||Q.intersectsObject(t))){n&&V.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H);const e=it.update(t),r=t.material;if(Array.isArray(r)){const n=e.groups;for(let a=0,o=n.length;a<o;a++){const o=n[a],s=r[o.materialIndex];s&&s.visible&&p.push(t,e,s,i,V.z,o)}}else r.visible&&p.push(t,e,r,i,V.z,null)}const r=t.children;for(let t=0,a=r.length;t<a;t++)Mt(r[t],e,i,n)}function It(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,a=t.length;r<a;r++){const a=t[r],o=a.object,s=a.geometry,l=null===n?a.material:n,c=a.group;if(i.isArrayCamera){const t=i.cameras;for(let i=0,n=t.length;i<n;i++){const n=t[i];o.layers.test(n.layers)&&(J.viewport(S.copy(n.viewport)),g.setupLightsView(n),Et(o,e,n,s,l,c))}}else Et(o,e,i,s,l,c)}}function Et(t,e,i,n,r,a){if(t.onBeforeRender(v,e,i,n,r,a),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){const n=Tt(i,e,r,t);J.setMaterial(r),pt.reset(),function(t,e){t.render((function(t){v.renderBufferImmediate(t,e)}))}(t,n)}else v.renderBufferDirect(i,e,n,r,t,a);t.onAfterRender(v,e,i,n,r,a)}function St(t,e,i){!0!==e.isScene&&(e=G);const n=Y.get(t),r=g.state.lights,a=g.state.shadowsArray,o=r.state.version,s=nt.getParameters(t,r.state,a,e,i),l=nt.getProgramCacheKey(s);let c=n.program,h=!0;if(n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=$.get(t.envMap||n.environment),void 0===c)t.addEventListener("dispose",_t);else if(c.cacheKey!==l)At(t);else if(n.lightsStateVersion!==o)h=!1;else{if(void 0!==s.shaderID)return;h=!1}h&&(s.uniforms=nt.getUniforms(t),t.onBeforeCompile(s,v),c=nt.acquireProgram(s,l),n.program=c,n.uniforms=s.uniforms,n.outputEncoding=s.outputEncoding);const u=n.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(n.numClippingPlanes=st.numPlanes,n.numIntersection=st.numIntersection,u.clippingPlanes=st.uniform),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=o,n.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotShadowMatrix.value=r.state.spotShadowMatrix,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix);const d=n.program.getUniforms(),p=on.seqWithValue(d.seq,u);n.uniformsList=p}function Tt(t,e,i,n){!0!==e.isScene&&(e=G),K.resetTextureUnits();const r=e.fog,a=i.isMeshStandardMaterial?e.environment:null,s=null===C?v.outputEncoding:C.texture.encoding,l=$.get(i.envMap||a),c=Y.get(i),h=g.state.lights;if(!0===O&&(!0===k||t!==E)){const e=t===E&&i.id===I;st.setState(i,t,e)}i.version===c.__version?i.fog&&c.fog!==r||c.environment!==a||c.needsLights&&c.lightsStateVersion!==h.state.version?St(i,e,n):void 0===c.numClippingPlanes||c.numClippingPlanes===st.numPlanes&&c.numIntersection===st.numIntersection?(c.outputEncoding!==s||c.envMap!==l)&&St(i,e,n):St(i,e,n):(St(i,e,n),c.__version=i.version);let u=!1,d=!1,p=!1;const f=c.program,m=f.getUniforms(),y=c.uniforms;if(J.useProgram(f.program)&&(u=!0,d=!0,p=!0),i.id!==I&&(I=i.id,d=!0),u||E!==t){if(m.setValue(ft,"projectionMatrix",t.projectionMatrix),Z.logarithmicDepthBuffer&&m.setValue(ft,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),E!==t&&(E=t,d=!0,p=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){const e=m.map.cameraPosition;void 0!==e&&e.setValue(ft,V.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&m.setValue(ft,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||i.skinning)&&m.setValue(ft,"viewMatrix",t.matrixWorldInverse)}if(i.skinning){m.setOptional(ft,n,"bindMatrix"),m.setOptional(ft,n,"bindMatrixInverse");const t=n.skeleton;if(t){const e=t.bones;if(Z.floatVertexTextures){if(null===t.boneTexture){let i=Math.sqrt(4*e.length);i=o.ceilPowerOfTwo(i),i=Math.max(i,4);const n=new Float32Array(i*i*4);n.set(t.boneMatrices);const r=new Qe(n,i,i,1023,1015);t.boneMatrices=n,t.boneTexture=r,t.boneTextureSize=i}m.setValue(ft,"boneTexture",t.boneTexture,K),m.setValue(ft,"boneTextureSize",t.boneTextureSize)}else m.setOptional(ft,t,"boneMatrices")}}var b,x;return(d||c.receiveShadow!==n.receiveShadow)&&(c.receiveShadow=n.receiveShadow,m.setValue(ft,"receiveShadow",n.receiveShadow)),d&&(m.setValue(ft,"toneMappingExposure",v.toneMappingExposure),c.needsLights&&(x=p,(b=y).ambientLightColor.needsUpdate=x,b.lightProbe.needsUpdate=x,b.directionalLights.needsUpdate=x,b.directionalLightShadows.needsUpdate=x,b.pointLights.needsUpdate=x,b.pointLightShadows.needsUpdate=x,b.spotLights.needsUpdate=x,b.spotLightShadows.needsUpdate=x,b.rectAreaLights.needsUpdate=x,b.hemisphereLights.needsUpdate=x),r&&i.fog&&rt.refreshFogUniforms(y,r),rt.refreshMaterialUniforms(y,i,U,L),on.upload(ft,c.uniformsList,y,K)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(on.upload(ft,c.uniformsList,y,K),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&m.setValue(ft,"center",n.center),m.setValue(ft,"modelViewMatrix",n.modelViewMatrix),m.setValue(ft,"normalMatrix",n.normalMatrix),m.setValue(ft,"modelMatrix",n.matrixWorld),f}Ct.setAnimationLoop((function(t){yt.isPresenting||wt&&wt(t)})),"undefined"!=typeof window&&Ct.setContext(window),this.setAnimationLoop=function(t){wt=t,yt.setAnimationLoop(t),null===t?Ct.stop():Ct.start()},this.render=function(t,e){let i,n;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),i=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),n=arguments[3]),void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===x)return;pt.resetDefaultState(),I=-1,E=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===yt.enabled&&!0===yt.isPresenting&&(e=yt.getCamera(e)),!0===t.isScene&&t.onBeforeRender(v,t,e,i||C),g=ot.get(t,b.length),g.init(),b.push(g),H.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Q.setFromProjectionMatrix(H),k=this.localClippingEnabled,O=st.init(this.clippingPlanes,k,e),p=at.get(t,m.length),p.init(),m.push(p),Mt(t,e,0,v.sortObjects),p.finish(),!0===v.sortObjects&&p.sort(R,D),!0===O&&st.beginShadows();const r=g.state.shadowsArray;bt.render(r,t,e),g.setupLights(),g.setupLightsView(e),!0===O&&st.endShadows(),!0===this.info.autoReset&&this.info.reset(),void 0!==i&&this.setRenderTarget(i),lt.render(p,t,e,n);const a=p.opaque,o=p.transparent;a.length>0&&It(a,t,e),o.length>0&&It(o,t,e),!0===t.isScene&&t.onAfterRender(v,t,e),null!==C&&(K.updateRenderTargetMipmap(C),K.updateMultisampleRenderTarget(C)),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1),b.pop(),g=b.length>0?b[b.length-1]:null,m.pop(),p=m.length>0?m[m.length-1]:null},this.setFramebuffer=function(t){_!==t&&null===C&&ft.bindFramebuffer(36160,t),_=t},this.getActiveCubeFace=function(){return A},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return C},this.setRenderTarget=function(t,e=0,i=0){C=t,A=e,w=i,t&&void 0===Y.get(t).__webglFramebuffer&&K.setupRenderTarget(t);let n=_,r=!1,a=!1;if(t){const i=t.texture;(i.isDataTexture3D||i.isDataTexture2DArray)&&(a=!0);const o=Y.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(n=o[e],r=!0):n=t.isWebGLMultisampleRenderTarget?Y.get(t).__webglMultisampledFramebuffer:o,S.copy(t.viewport),T.copy(t.scissor),B=t.scissorTest}else S.copy(P).multiplyScalar(U).floor(),T.copy(N).multiplyScalar(U).floor(),B=z;if(M!==n&&(ft.bindFramebuffer(36160,n),M=n),J.viewport(S),J.scissor(T),J.setScissorTest(B),r){const n=Y.get(t.texture);ft.framebufferTexture2D(36160,36064,34069+e,n.__webglTexture,i)}else if(a){const n=Y.get(t.texture),r=e||0;ft.framebufferTextureLayer(36160,36064,n.__webglTexture,i||0,r)}},this.readRenderTargetPixels=function(t,e,i,n,r,a,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=Y.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){let o=!1;s!==M&&(ft.bindFramebuffer(36160,s),o=!0);try{const s=t.texture,l=s.format,c=s.type;if(1023!==l&&dt.convert(l)!==ft.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=1016===c&&(q.has("EXT_color_buffer_half_float")||Z.isWebGL2&&q.has("EXT_color_buffer_float"));if(!(1009===c||dt.convert(c)===ft.getParameter(35738)||1015===c&&(Z.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ft.checkFramebufferStatus(36160)?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&ft.readPixels(e,i,n,r,dt.convert(l),dt.convert(c),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{o&&ft.bindFramebuffer(36160,M)}}},this.copyFramebufferToTexture=function(t,e,i=0){const n=Math.pow(2,-i),r=Math.floor(e.image.width*n),a=Math.floor(e.image.height*n),o=dt.convert(e.format);K.setTexture2D(e,0),ft.copyTexImage2D(3553,i,o,t.x,t.y,r,a,0),J.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const r=e.image.width,a=e.image.height,o=dt.convert(i.format),s=dt.convert(i.type);K.setTexture2D(i,0),ft.pixelStorei(37440,i.flipY),ft.pixelStorei(37441,i.premultiplyAlpha),ft.pixelStorei(3317,i.unpackAlignment),e.isDataTexture?ft.texSubImage2D(3553,n,t.x,t.y,r,a,o,s,e.image.data):e.isCompressedTexture?ft.compressedTexSubImage2D(3553,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):ft.texSubImage2D(3553,n,t.x,t.y,o,s,e.image),0===n&&i.generateMipmaps&&ft.generateMipmap(3553),J.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,r=0){if(v.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const{width:a,height:o,data:s}=i.image,l=dt.convert(n.format),c=dt.convert(n.type);let h;if(n.isDataTexture3D)K.setTexture3D(n,0),h=32879;else{if(!n.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(n,0),h=35866}ft.pixelStorei(37440,n.flipY),ft.pixelStorei(37441,n.premultiplyAlpha),ft.pixelStorei(3317,n.unpackAlignment);const u=ft.getParameter(3314),d=ft.getParameter(32878),p=ft.getParameter(3316),f=ft.getParameter(3315),g=ft.getParameter(32877);ft.pixelStorei(3314,a),ft.pixelStorei(32878,o),ft.pixelStorei(3316,t.min.x),ft.pixelStorei(3315,t.min.y),ft.pixelStorei(32877,t.min.z),ft.texSubImage3D(h,r,e.x,e.y,e.z,t.max.x-t.min.x+1,t.max.y-t.min.y+1,t.max.z-t.min.z+1,l,c,s),ft.pixelStorei(3314,u),ft.pixelStorei(32878,d),ft.pixelStorei(3316,p),ft.pixelStorei(3315,f),ft.pixelStorei(32877,g),0===r&&n.generateMipmaps&&ft.generateMipmap(h),J.unbindTexture()},this.initTexture=function(t){K.setTexture2D(t,0),J.unbindTexture()},this.resetState=function(){J.reset(),pt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Wn.prototype.isGroup=!0,Object.assign(qn.prototype,{constructor:qn,getHandSpace:function(){return null===this._hand&&(this._hand=new Wn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new Wn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Wn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,i){let n=null,r=null,a=null;const o=this._targetRay,s=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(l&&t.hand){a=!0;for(const n of t.hand.values()){const t=e.getJointPose(n,i);if(void 0===l.joints[n.jointName]){const t=new Wn;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[n.jointName]=t,l.add(t)}const r=l.joints[n.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=n.position.distanceTo(r.position),s=.02,c=.005;l.inputState.pinching&&o>s+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=s-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&(n=e.getPose(t.targetRaySpace,i),null!==n&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale))),null!==s&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale)));return null!==o&&(o.visible=null!==n),null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==a),this}}),Object.assign(Zn.prototype,n.prototype);(class extends Xn{}).prototype.isWebGL1Renderer=!0;class Yn{constructor(t,e){this.name="",this.color=new Ot(t),this.density=void 0!==e?e:25e-5}clone(){return new Yn(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Yn.prototype.isFogExp2=!0;class Kn{constructor(t,e,i){this.name="",this.color=new Ot(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}clone(){return new Kn(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}Kn.prototype.isFog=!0;class $n extends mt{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}function tr(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=o.generateUUID()}$n.prototype.isScene=!0,Object.defineProperty(tr.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(tr.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,i){t*=this.stride,i*=e.stride;for(let n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this},set:function(t,e=0){return this.array.set(t,e),this},clone:function(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=o.generateUUID()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new tr(new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),this.stride);return e.setUsage(this.usage),e},onUpload:function(t){return this.onUploadCallback=t,this},toJSON:function(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=o.generateUUID()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}});const er=new y;function ir(t,e,i,n){this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=!0===n}Object.defineProperties(ir.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}},needsUpdate:{set:function(t){this.data.needsUpdate=t}}}),Object.assign(ir.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(t){for(let e=0,i=this.data.count;e<i;e++)er.x=this.getX(e),er.y=this.getY(e),er.z=this.getZ(e),er.applyMatrix4(t),this.setXYZ(e,er.x,er.y,er.z);return this},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this},clone:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return new Gt(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new ir(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)},toJSON:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}});class nr extends Ut{constructor(t){super(),this.type="SpriteMaterial",this.color=new Ot(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let rr;nr.prototype.isSpriteMaterial=!0;const ar=new y,or=new y,sr=new y,lr=new s,cr=new s,hr=new j,ur=new y,dr=new y,pr=new y,fr=new s,gr=new s,mr=new s;class yr extends mt{constructor(t){if(super(),this.type="Sprite",void 0===rr){rr=new ce;const t=new tr(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);rr.setIndex([0,1,2,0,2,3]),rr.setAttribute("position",new ir(t,3,0,!1)),rr.setAttribute("uv",new ir(t,2,3,!1))}this.geometry=rr,this.material=void 0!==t?t:new nr,this.center=new s(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),or.setFromMatrixScale(this.matrixWorld),hr.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),sr.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&or.multiplyScalar(-sr.z);const i=this.material.rotation;let n,r;0!==i&&(r=Math.cos(i),n=Math.sin(i));const a=this.center;br(ur.set(-.5,-.5,0),sr,a,or,n,r),br(dr.set(.5,-.5,0),sr,a,or,n,r),br(pr.set(.5,.5,0),sr,a,or,n,r),fr.set(0,0),gr.set(1,0),mr.set(1,1);let o=t.ray.intersectTriangle(ur,dr,pr,!1,ar);if(null===o&&(br(dr.set(-.5,.5,0),sr,a,or,n,r),gr.set(0,1),o=t.ray.intersectTriangle(ur,pr,dr,!1,ar),null===o))return;const l=t.ray.origin.distanceTo(ar);l<t.near||l>t.far||e.push({distance:l,point:ar.clone(),uv:Ft.getUV(ar,ur,dr,pr,fr,gr,mr,new s),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function br(t,e,i,n,r,a){lr.subVectors(t,i).addScalar(.5).multiply(n),void 0!==r?(cr.x=a*lr.x-r*lr.y,cr.y=r*lr.x+a*lr.y):cr.copy(lr),t.copy(e),t.x+=cr.x,t.y+=cr.y,t.applyMatrix4(hr)}yr.prototype.isSprite=!0;const vr=new y,xr=new y;class _r extends mt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,i=e.length;t<i;t++){const i=e[t];this.addLevel(i.object.clone(),i.distance)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0){e=Math.abs(e);const i=this.levels;let n;for(n=0;n<i.length&&!(e<i[n].distance);n++);return i.splice(n,0,{distance:e,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let i,n;for(i=1,n=e.length;i<n&&!(t<e[i].distance);i++);return e[i-1].object}return null}raycast(t,e){if(this.levels.length>0){vr.setFromMatrixPosition(this.matrixWorld);const i=t.ray.origin.distanceTo(vr);this.getObjectForDistance(i).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){vr.setFromMatrixPosition(t.matrixWorld),xr.setFromMatrixPosition(this.matrixWorld);const i=vr.distanceTo(xr)/t.zoom;let n,r;for(e[0].object.visible=!0,n=1,r=e.length;n<r&&i>=e[n].distance;n++)e[n-1].object.visible=!1,e[n].object.visible=!0;for(this._currentLevel=n-1;n<r;n++)e[n].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const i=this.levels;for(let t=0,n=i.length;t<n;t++){const n=i[t];e.object.levels.push({object:n.object.uuid,distance:n.distance})}return e}}const Ar=new y,wr=new f,Cr=new f,Mr=new y,Ir=new j;function Er(t,e){Ee.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new j,this.bindMatrixInverse=new j}function Sr(){mt.call(this),this.type="Bone"}Er.prototype=Object.assign(Object.create(Ee.prototype),{constructor:Er,isSkinnedMesh:!0,copy:function(t){return Ee.prototype.copy.call(this,t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){const t=new f,e=this.geometry.attributes.skinWeight;for(let i=0,n=e.count;i<n;i++){t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.w=e.getW(i);const n=1/t.manhattanLength();n!==1/0?t.multiplyScalar(n):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}},updateMatrixWorld:function(t){Ee.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},boneTransform:function(t,e){const i=this.skeleton,n=this.geometry;wr.fromBufferAttribute(n.attributes.skinIndex,t),Cr.fromBufferAttribute(n.attributes.skinWeight,t),Ar.fromBufferAttribute(n.attributes.position,t).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const n=Cr.getComponent(t);if(0!==n){const r=wr.getComponent(t);Ir.multiplyMatrices(i.bones[r].matrixWorld,i.boneInverses[r]),e.addScaledVector(Mr.copy(Ar).applyMatrix4(Ir),n)}}return e.applyMatrix4(this.bindMatrixInverse)}}),Sr.prototype=Object.assign(Object.create(mt.prototype),{constructor:Sr,isBone:!0});const Tr=new j,Br=new j;class Fr{constructor(t=[],e=[]){this.uuid=o.generateUUID(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new j)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new j;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,i=this.boneMatrices,n=this.boneTexture;for(let n=0,r=t.length;n<r;n++){const r=t[n]?t[n].matrixWorld:Br;Tr.multiplyMatrices(r,e[n]),Tr.toArray(i,16*n)}null!==n&&(n.needsUpdate=!0)}clone(){return new Fr(this.bones,this.boneInverses)}getBoneByName(t){for(let e=0,i=this.bones.length;e<i;e++){const i=this.bones[e];if(i.name===t)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let i=0,n=t.bones.length;i<n;i++){const n=t.bones[i];let r=e[n];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",n),r=new Sr),this.bones.push(r),this.boneInverses.push((new j).fromArray(t.boneInverses[i]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,i=this.boneInverses;for(let n=0,r=e.length;n<r;n++){const r=e[n];t.bones.push(r.uuid);const a=i[n];t.boneInverses.push(a.toArray())}return t}}const Lr=new j,Ur=new j,Rr=[],Dr=new Ee;function Pr(t,e,i){Ee.call(this,t,e),this.instanceMatrix=new Gt(new Float32Array(16*i),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1}Pr.prototype=Object.assign(Object.create(Ee.prototype),{constructor:Pr,isInstancedMesh:!0,copy:function(t){return Ee.prototype.copy.call(this,t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this},getColorAt:function(t,e){e.fromArray(this.instanceColor.array,3*t)},getMatrixAt:function(t,e){e.fromArray(this.instanceMatrix.array,16*t)},raycast:function(t,e){const i=this.matrixWorld,n=this.count;if(Dr.geometry=this.geometry,Dr.material=this.material,void 0!==Dr.material)for(let r=0;r<n;r++){this.getMatrixAt(r,Lr),Ur.multiplyMatrices(i,Lr),Dr.matrixWorld=Ur,Dr.raycast(t,Rr);for(let t=0,i=Rr.length;t<i;t++){const i=Rr[t];i.instanceId=r,i.object=this,e.push(i)}Rr.length=0}},setColorAt:function(t,e){null===this.instanceColor&&(this.instanceColor=new Gt(new Float32Array(3*this.count),3)),e.toArray(this.instanceColor.array,3*t)},setMatrixAt:function(t,e){e.toArray(this.instanceMatrix.array,16*t)},updateMorphTargets:function(){},dispose:function(){this.dispatchEvent({type:"dispose"})}});class Nr extends Ut{constructor(t){super(),this.type="LineBasicMaterial",this.color=new Ot(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this}}Nr.prototype.isLineBasicMaterial=!0;const zr=new y,Qr=new y,Or=new j,kr=new G,Hr=new P;function Vr(t=new ce,e=new Nr){mt.call(this),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}Vr.prototype=Object.assign(Object.create(mt.prototype),{constructor:Vr,isLine:!0,copy:function(t){return mt.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)zr.fromBufferAttribute(e,t-1),Qr.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=zr.distanceTo(Qr);t.setAttribute("lineDistance",new $t(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this},raycast:function(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold;if(null===i.boundingSphere&&i.computeBoundingSphere(),Hr.copy(i.boundingSphere),Hr.applyMatrix4(n),Hr.radius+=r,!1===t.ray.intersectsSphere(Hr))return;Or.copy(n).invert(),kr.copy(t.ray).applyMatrix4(Or);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new y,l=new y,c=new y,h=new y,u=this.isLineSegments?2:1;if(i.isBufferGeometry){const n=i.index,r=i.attributes.position;if(null!==n){const i=n.array;for(let n=0,a=i.length-1;n<a;n+=u){const a=i[n],u=i[n+1];s.fromBufferAttribute(r,a),l.fromBufferAttribute(r,u);if(kr.distanceSqToSegment(s,l,h,c)>o)continue;h.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(h);d<t.near||d>t.far||e.push({distance:d,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else for(let i=0,n=r.count-1;i<n;i+=u){s.fromBufferAttribute(r,i),l.fromBufferAttribute(r,i+1);if(kr.distanceSqToSegment(s,l,h,c)>o)continue;h.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(h);n<t.near||n>t.far||e.push({distance:n,point:c.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else i.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const Gr=new y,jr=new y;function Wr(t,e){Vr.call(this,t,e),this.type="LineSegments"}Wr.prototype=Object.assign(Object.create(Vr.prototype),{constructor:Wr,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,n=e.count;t<n;t+=2)Gr.fromBufferAttribute(e,t),jr.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+Gr.distanceTo(jr);t.setAttribute("lineDistance",new $t(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}});class qr extends Vr{constructor(t,e){super(t,e),this.type="LineLoop"}}qr.prototype.isLineLoop=!0;class Zr extends Ut{constructor(t){super(),this.type="PointsMaterial",this.color=new Ot(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this}}Zr.prototype.isPointsMaterial=!0;const Jr=new j,Xr=new G,Yr=new P,Kr=new y;function $r(t=new ce,e=new Zr){mt.call(this),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}function ta(t,e,i,n,r,a,o){const s=Xr.distanceSqToPoint(t);if(s<i){const i=new y;Xr.closestPointToPoint(t,i),i.applyMatrix4(n);const l=r.ray.origin.distanceTo(i);if(l<r.near||l>r.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:i,index:e,face:null,object:o})}}$r.prototype=Object.assign(Object.create(mt.prototype),{constructor:$r,isPoints:!0,copy:function(t){return mt.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Points.threshold;if(null===i.boundingSphere&&i.computeBoundingSphere(),Yr.copy(i.boundingSphere),Yr.applyMatrix4(n),Yr.radius+=r,!1===t.ray.intersectsSphere(Yr))return;Jr.copy(n).invert(),Xr.copy(t.ray).applyMatrix4(Jr);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(i.isBufferGeometry){const r=i.index,a=i.attributes.position;if(null!==r){const i=r.array;for(let r=0,s=i.length;r<s;r++){const s=i[r];Kr.fromBufferAttribute(a,s),ta(Kr,s,o,n,t,e,this)}}else for(let i=0,r=a.count;i<r;i++)Kr.fromBufferAttribute(a,i),ta(Kr,i,o,n,t,e,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});(class extends d{constructor(t,e,i,n,r,a,o,s,l){super(t,e,i,n,r,a,o,s,l),this.format=void 0!==o?o:1022,this.minFilter=void 0!==a?a:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}).prototype.isVideoTexture=!0;class ea extends d{constructor(t,e,i,n,r,a,o,s,l,c,h,u){super(null,a,o,s,l,c,n,r,h,u),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}ea.prototype.isCompressedTexture=!0;(class extends d{constructor(t,e,i,n,r,a,o,s,l){super(t,e,i,n,r,a,o,s,l),this.needsUpdate=!0}}).prototype.isCanvasTexture=!0;(class extends d{constructor(t,e,i,n,r,a,o,s,l,c){if(1026!==(c=void 0!==c?c:1026)&&1027!==c)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===c&&(i=1012),void 0===i&&1027===c&&(i=1020),super(null,n,r,a,o,s,c,i,l),this.image={width:t,height:e},this.magFilter=void 0!==o?o:1003,this.minFilter=void 0!==s?s:1003,this.flipY=!1,this.generateMipmaps=!1}}).prototype.isDepthTexture=!0;class ia extends ce{constructor(t=1,e=1,i=1,n=8,r=1,a=!1,o=0,l=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:l};const c=this;n=Math.floor(n),r=Math.floor(r);const h=[],u=[],d=[],p=[];let f=0;const g=[],m=i/2;let b=0;function v(i){const r=f,a=new s,g=new y;let v=0;const x=!0===i?t:e,_=!0===i?1:-1;for(let t=1;t<=n;t++)u.push(0,m*_,0),d.push(0,_,0),p.push(.5,.5),f++;const A=f;for(let t=0;t<=n;t++){const e=t/n*l+o,i=Math.cos(e),r=Math.sin(e);g.x=x*r,g.y=m*_,g.z=x*i,u.push(g.x,g.y,g.z),d.push(0,_,0),a.x=.5*i+.5,a.y=.5*r*_+.5,p.push(a.x,a.y),f++}for(let t=0;t<n;t++){const e=r+t,n=A+t;!0===i?h.push(n,n+1,e):h.push(n+1,n,e),v+=3}c.addGroup(b,v,!0===i?1:2),b+=v}!function(){const a=new y,s=new y;let v=0;const x=(e-t)/i;for(let c=0;c<=r;c++){const h=[],y=c/r,b=y*(e-t)+t;for(let t=0;t<=n;t++){const e=t/n,r=e*l+o,c=Math.sin(r),g=Math.cos(r);s.x=b*c,s.y=-y*i+m,s.z=b*g,u.push(s.x,s.y,s.z),a.set(c,x,g).normalize(),d.push(a.x,a.y,a.z),p.push(e,1-y),h.push(f++)}g.push(h)}for(let t=0;t<n;t++)for(let e=0;e<r;e++){const i=g[e][t],n=g[e+1][t],r=g[e+1][t+1],a=g[e][t+1];h.push(i,n,a),h.push(n,r,a),v+=6}c.addGroup(b,v,0),b+=v}(),!1===a&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(h),this.setAttribute("position",new $t(u,3)),this.setAttribute("normal",new $t(d,3)),this.setAttribute("uv",new $t(p,2))}}class na extends ia{constructor(t=1,e=1,i=8,n=1,r=!1,a=0,o=2*Math.PI){super(0,t,e,i,n,r,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}}new y,new y,new y,new Ft;const ra=function(t,e,i){i=i||2;const n=e&&e.length,r=n?e[0]*i:t.length;let a=aa(t,0,r,i,!0);const o=[];if(!a||a.next===a.prev)return o;let s,l,c,h,u,d,p;if(n&&(a=function(t,e,i,n){const r=[];let a,o,s,l,c;for(a=0,o=e.length;a<o;a++)s=e[a]*n,l=a<o-1?e[a+1]*n:t.length,c=aa(t,s,l,n,!1),c===c.next&&(c.steiner=!0),r.push(ma(c));for(r.sort(da),a=0;a<r.length;a++)pa(r[a],i),i=oa(i,i.next);return i}(t,e,a,i)),t.length>80*i){s=c=t[0],l=h=t[1];for(let e=i;e<r;e+=i)u=t[e],d=t[e+1],u<s&&(s=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);p=Math.max(c-s,h-l),p=0!==p?1/p:0}return sa(a,o,i,s,l,p),o};function aa(t,e,i,n,r){let a,o;if(r===function(t,e,i,n){let r=0;for(let a=e,o=i-n;a<i;a+=n)r+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return r}(t,e,i,n)>0)for(a=e;a<i;a+=n)o=Ia(a,t[a],t[a+1],o);else for(a=i-n;a>=e;a-=n)o=Ia(a,t[a],t[a+1],o);return o&&xa(o,o.next)&&(Ea(o),o=o.next),o}function oa(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!xa(n,n.next)&&0!==va(n.prev,n,n.next))n=n.next;else{if(Ea(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function sa(t,e,i,n,r,a,o){if(!t)return;!o&&a&&function(t,e,i,n){let r=t;do{null===r.z&&(r.z=ga(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i,n,r,a,o,s,l,c=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,n=i,s=0,e=0;e<c&&(s++,n=n.nextZ,n);e++);for(l=c;s>0||l>0&&n;)0!==s&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,s--):(r=n,n=n.nextZ,l--),a?a.nextZ=r:t=r,r.prevZ=a,a=r;i=n}a.nextZ=null,c*=2}while(o>1)}(r)}(t,n,r,a);let s,l,c=t;for(;t.prev!==t.next;)if(s=t.prev,l=t.next,a?ca(t,n,r,a):la(t))e.push(s.i/i),e.push(t.i/i),e.push(l.i/i),Ea(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?sa(t=ha(oa(t),e,i),e,i,n,r,a,2):2===o&&ua(t,e,i,n,r,a):sa(oa(t),e,i,n,r,a,1);break}}function la(t){const e=t.prev,i=t,n=t.next;if(va(e,i,n)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(ya(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&va(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ca(t,e,i,n){const r=t.prev,a=t,o=t.next;if(va(r,a,o)>=0)return!1;const s=r.x<a.x?r.x<o.x?r.x:o.x:a.x<o.x?a.x:o.x,l=r.y<a.y?r.y<o.y?r.y:o.y:a.y<o.y?a.y:o.y,c=r.x>a.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,h=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,u=ga(s,l,e,i,n),d=ga(c,h,e,i,n);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&ya(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&va(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&ya(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&va(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&ya(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&va(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&ya(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&va(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ha(t,e,i){let n=t;do{const r=n.prev,a=n.next.next;!xa(r,a)&&_a(r,n,n.next,a)&&Ca(r,a)&&Ca(a,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(a.i/i),Ea(n),Ea(n.next),n=t=a),n=n.next}while(n!==t);return oa(n)}function ua(t,e,i,n,r,a){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&ba(o,t)){let s=Ma(o,t);return o=oa(o,o.next),s=oa(s,s.next),sa(o,e,i,n,r,a),void sa(s,e,i,n,r,a)}t=t.next}o=o.next}while(o!==t)}function da(t,e){return t.x-e.x}function pa(t,e){if(e=function(t,e){let i=e;const n=t.x,r=t.y;let a,o=-1/0;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>o){if(o=t,t===n){if(r===i.y)return i;if(r===i.next.y)return i.next}a=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!a)return null;if(n===o)return a;const s=a,l=a.x,c=a.y;let h,u=1/0;i=a;do{n>=i.x&&i.x>=l&&n!==i.x&&ya(r<c?n:o,r,l,c,r<c?o:n,r,i.x,i.y)&&(h=Math.abs(r-i.y)/(n-i.x),Ca(i,t)&&(h<u||h===u&&(i.x>a.x||i.x===a.x&&fa(a,i)))&&(a=i,u=h)),i=i.next}while(i!==s);return a}(t,e)){const i=Ma(e,t);oa(e,e.next),oa(i,i.next)}}function fa(t,e){return va(t.prev,t,e.prev)<0&&va(e.next,t,t.next)<0}function ga(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ma(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function ya(t,e,i,n,r,a,o,s){return(r-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(n-s)-(i-o)*(e-s)>=0&&(i-o)*(a-s)-(r-o)*(n-s)>=0}function ba(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&_a(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Ca(t,e)&&Ca(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&r<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(va(t.prev,t,e.prev)||va(t,e.prev,e))||xa(t,e)&&va(t.prev,t,t.next)>0&&va(e.prev,e,e.next)>0)}function va(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function xa(t,e){return t.x===e.x&&t.y===e.y}function _a(t,e,i,n){const r=wa(va(t,e,i)),a=wa(va(t,e,n)),o=wa(va(i,n,t)),s=wa(va(i,n,e));return r!==a&&o!==s||(!(0!==r||!Aa(t,i,e))||(!(0!==a||!Aa(t,n,e))||(!(0!==o||!Aa(i,t,n))||!(0!==s||!Aa(i,e,n)))))}function Aa(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function wa(t){return t>0?1:t<0?-1:0}function Ca(t,e){return va(t.prev,t,t.next)<0?va(t,e,t.next)>=0&&va(t,t.prev,e)>=0:va(t,e,t.prev)<0||va(t,t.next,e)<0}function Ma(t,e){const i=new Sa(t.i,t.x,t.y),n=new Sa(e.i,e.x,e.y),r=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,a.next=n,n.prev=a,n}function Ia(t,e,i,n){const r=new Sa(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Ea(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Sa(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}const Ta={area:function(t){const e=t.length;let i=0;for(let n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i},isClockWise:function(t){return Ta.area(t)<0},triangulateShape:function(t,e){const i=[],n=[],r=[];Ba(t),Fa(i,t);let a=t.length;e.forEach(Ba);for(let t=0;t<e.length;t++)n.push(a),a+=e[t].length,Fa(i,e[t]);const o=ra(i,n);for(let t=0;t<o.length;t+=3)r.push(o.slice(t,t+3));return r}};function Ba(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Fa(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class La extends ce{constructor(t,e){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,n=[],r=[];for(let e=0,i=t.length;e<i;e++){a(t[e])}function a(t){const a=[],o=void 0!==e.curveSegments?e.curveSegments:12,l=void 0!==e.steps?e.steps:1;let c=void 0!==e.depth?e.depth:100,h=void 0===e.bevelEnabled||e.bevelEnabled,u=void 0!==e.bevelThickness?e.bevelThickness:6,d=void 0!==e.bevelSize?e.bevelSize:u-2,p=void 0!==e.bevelOffset?e.bevelOffset:0,f=void 0!==e.bevelSegments?e.bevelSegments:3;const g=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:Ua;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=e.amount);let b,v,x,_,A,w=!1;g&&(b=g.getSpacedPoints(l),w=!0,h=!1,v=g.computeFrenetFrames(l,!1),x=new y,_=new y,A=new y),h||(f=0,u=0,d=0,p=0);const C=t.extractPoints(o);let M=C.shape;const I=C.holes;if(!Ta.isClockWise(M)){M=M.reverse();for(let t=0,e=I.length;t<e;t++){const e=I[t];Ta.isClockWise(e)&&(I[t]=e.reverse())}}const E=Ta.triangulateShape(M,I),S=M;for(let t=0,e=I.length;t<e;t++){const e=I[t];M=M.concat(e)}function T(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(i).add(t)}const B=M.length,F=E.length;function L(t,e,i){let n,r,a;const o=t.x-e.x,l=t.y-e.y,c=i.x-t.x,h=i.y-t.y,u=o*o+l*l,d=o*h-l*c;if(Math.abs(d)>Number.EPSILON){const d=Math.sqrt(u),p=Math.sqrt(c*c+h*h),f=e.x-l/d,g=e.y+o/d,m=((i.x-h/p-f)*h-(i.y+c/p-g)*c)/(o*h-l*c);n=f+o*m-t.x,r=g+l*m-t.y;const y=n*n+r*r;if(y<=2)return new s(n,r);a=Math.sqrt(y/2)}else{let t=!1;o>Number.EPSILON?c>Number.EPSILON&&(t=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(t=!0):Math.sign(l)===Math.sign(h)&&(t=!0),t?(n=-l,r=o,a=Math.sqrt(u)):(n=o,r=l,a=Math.sqrt(u/2))}return new s(n/a,r/a)}const U=[];for(let t=0,e=S.length,i=e-1,n=t+1;t<e;t++,i++,n++)i===e&&(i=0),n===e&&(n=0),U[t]=L(S[t],S[i],S[n]);const R=[];let D,P=U.concat();for(let t=0,e=I.length;t<e;t++){const e=I[t];D=[];for(let t=0,i=e.length,n=i-1,r=t+1;t<i;t++,n++,r++)n===i&&(n=0),r===i&&(r=0),D[t]=L(e[t],e[n],e[r]);R.push(D),P=P.concat(D)}for(let t=0;t<f;t++){const e=t/f,i=u*Math.cos(e*Math.PI/2),n=d*Math.sin(e*Math.PI/2)+p;for(let t=0,e=S.length;t<e;t++){const e=T(S[t],U[t],n);Q(e.x,e.y,-i)}for(let t=0,e=I.length;t<e;t++){const e=I[t];D=R[t];for(let t=0,r=e.length;t<r;t++){const r=T(e[t],D[t],n);Q(r.x,r.y,-i)}}}const N=d+p;for(let t=0;t<B;t++){const e=h?T(M[t],P[t],N):M[t];w?(_.copy(v.normals[0]).multiplyScalar(e.x),x.copy(v.binormals[0]).multiplyScalar(e.y),A.copy(b[0]).add(_).add(x),Q(A.x,A.y,A.z)):Q(e.x,e.y,0)}for(let t=1;t<=l;t++)for(let e=0;e<B;e++){const i=h?T(M[e],P[e],N):M[e];w?(_.copy(v.normals[t]).multiplyScalar(i.x),x.copy(v.binormals[t]).multiplyScalar(i.y),A.copy(b[t]).add(_).add(x),Q(A.x,A.y,A.z)):Q(i.x,i.y,c/l*t)}for(let t=f-1;t>=0;t--){const e=t/f,i=u*Math.cos(e*Math.PI/2),n=d*Math.sin(e*Math.PI/2)+p;for(let t=0,e=S.length;t<e;t++){const e=T(S[t],U[t],n);Q(e.x,e.y,c+i)}for(let t=0,e=I.length;t<e;t++){const e=I[t];D=R[t];for(let t=0,r=e.length;t<r;t++){const r=T(e[t],D[t],n);w?Q(r.x,r.y+b[l-1].y,b[l-1].x+i):Q(r.x,r.y,c+i)}}}function z(t,e){let i=t.length;for(;--i>=0;){const n=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=l+2*f;t<i;t++){const i=B*t,a=B*(t+1);k(e+n+i,e+r+i,e+r+a,e+n+a)}}}function Q(t,e,i){a.push(t),a.push(e),a.push(i)}function O(t,e,r){H(t),H(e),H(r);const a=n.length/3,o=m.generateTopUV(i,n,a-3,a-2,a-1);V(o[0]),V(o[1]),V(o[2])}function k(t,e,r,a){H(t),H(e),H(a),H(e),H(r),H(a);const o=n.length/3,s=m.generateSideWallUV(i,n,o-6,o-3,o-2,o-1);V(s[0]),V(s[1]),V(s[3]),V(s[1]),V(s[2]),V(s[3])}function H(t){n.push(a[3*t+0]),n.push(a[3*t+1]),n.push(a[3*t+2])}function V(t){r.push(t.x),r.push(t.y)}!function(){const t=n.length/3;if(h){let t=0,e=B*t;for(let t=0;t<F;t++){const i=E[t];O(i[2]+e,i[1]+e,i[0]+e)}t=l+2*f,e=B*t;for(let t=0;t<F;t++){const i=E[t];O(i[0]+e,i[1]+e,i[2]+e)}}else{for(let t=0;t<F;t++){const e=E[t];O(e[2],e[1],e[0])}for(let t=0;t<F;t++){const e=E[t];O(e[0]+B*l,e[1]+B*l,e[2]+B*l)}}i.addGroup(t,n.length/3-t,0)}(),function(){const t=n.length/3;let e=0;z(S,e),e+=S.length;for(let t=0,i=I.length;t<i;t++){const i=I[t];z(i,e),e+=i.length}i.addGroup(t,n.length/3-t,1)}()}this.setAttribute("position",new $t(n,3)),this.setAttribute("uv",new $t(r,2)),this.computeVertexNormals()}toJSON(){const t=ce.prototype.toJSON.call(this);return function(t,e,i){if(i.shapes=[],Array.isArray(t))for(let e=0,n=t.length;e<n;e++){const n=t[e];i.shapes.push(n.uuid)}else i.shapes.push(t.uuid);void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON());return i}(this.parameters.shapes,this.parameters.options,t)}}const Ua={generateTopUV:function(t,e,i,n,r){const a=e[3*i],o=e[3*i+1],l=e[3*n],c=e[3*n+1],h=e[3*r],u=e[3*r+1];return[new s(a,o),new s(l,c),new s(h,u)]},generateSideWallUV:function(t,e,i,n,r,a){const o=e[3*i],l=e[3*i+1],c=e[3*i+2],h=e[3*n],u=e[3*n+1],d=e[3*n+2],p=e[3*r],f=e[3*r+1],g=e[3*r+2],m=e[3*a],y=e[3*a+1],b=e[3*a+2];return Math.abs(l-u)<.01?[new s(o,1-c),new s(h,1-d),new s(p,1-g),new s(m,1-b)]:[new s(l,1-c),new s(u,1-d),new s(f,1-g),new s(y,1-b)]}};function Ra(t,e,i){ce.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:i};const n=[],r=[],a=[],o=[],s=1e-5,l=new y,c=new y,h=new y,u=new y,d=new y;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const p=e+1;for(let n=0;n<=i;n++){const p=n/i;for(let i=0;i<=e;i++){const n=i/e;t(n,p,c),r.push(c.x,c.y,c.z),n-s>=0?(t(n-s,p,h),u.subVectors(c,h)):(t(n+s,p,h),u.subVectors(h,c)),p-s>=0?(t(n,p-s,h),d.subVectors(c,h)):(t(n,p+s,h),d.subVectors(h,c)),l.crossVectors(u,d).normalize(),a.push(l.x,l.y,l.z),o.push(n,p)}}for(let t=0;t<i;t++)for(let i=0;i<e;i++){const e=t*p+i,r=t*p+i+1,a=(t+1)*p+i+1,o=(t+1)*p+i;n.push(e,r,o),n.push(r,a,o)}this.setIndex(n),this.setAttribute("position",new $t(r,3)),this.setAttribute("normal",new $t(a,3)),this.setAttribute("uv",new $t(o,2))}Ra.prototype=Object.create(ce.prototype),Ra.prototype.constructor=Ra;class Da extends ce{constructor(t,e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const i=[],n=[],r=[],a=[];let o=0,s=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(o,s,e),o+=s,s=0;function l(t){const o=n.length/3,l=t.extractPoints(e);let c=l.shape;const h=l.holes;!1===Ta.isClockWise(c)&&(c=c.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===Ta.isClockWise(e)&&(h[t]=e.reverse())}const u=Ta.triangulateShape(c,h);for(let t=0,e=h.length;t<e;t++){const e=h[t];c=c.concat(e)}for(let t=0,e=c.length;t<e;t++){const e=c[t];n.push(e.x,e.y,0),r.push(0,0,1),a.push(e.x,e.y)}for(let t=0,e=u.length;t<e;t++){const e=u[t],n=e[0]+o,r=e[1]+o,a=e[2]+o;i.push(n,r,a),s+=3}}this.setIndex(i),this.setAttribute("position",new $t(n,3)),this.setAttribute("normal",new $t(r,3)),this.setAttribute("uv",new $t(a,2))}toJSON(){const t=ce.prototype.toJSON.call(this);return function(t,e){if(e.shapes=[],Array.isArray(t))for(let i=0,n=t.length;i<n;i++){const n=t[i];e.shapes.push(n.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}}class Pa extends ce{constructor(t=1,e=8,i=6,n=0,r=2*Math.PI,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const s=Math.min(a+o,Math.PI);let l=0;const c=[],h=new y,u=new y,d=[],p=[],f=[],g=[];for(let d=0;d<=i;d++){const m=[],y=d/i;let b=0;0==d&&0==a?b=.5/e:d==i&&s==Math.PI&&(b=-.5/e);for(let i=0;i<=e;i++){const s=i/e;h.x=-t*Math.cos(n+s*r)*Math.sin(a+y*o),h.y=t*Math.cos(a+y*o),h.z=t*Math.sin(n+s*r)*Math.sin(a+y*o),p.push(h.x,h.y,h.z),u.copy(h).normalize(),f.push(u.x,u.y,u.z),g.push(s+b,1-y),m.push(l++)}c.push(m)}for(let t=0;t<i;t++)for(let n=0;n<e;n++){const e=c[t][n+1],r=c[t][n],o=c[t+1][n],l=c[t+1][n+1];(0!==t||a>0)&&d.push(e,r,l),(t!==i-1||s<Math.PI)&&d.push(r,o,l)}this.setIndex(d),this.setAttribute("position",new $t(p,3)),this.setAttribute("normal",new $t(f,3)),this.setAttribute("uv",new $t(g,2))}}class Na extends ce{constructor(t,e=64,i=1,n=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r};const a=t.computeFrenetFrames(e,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new y,l=new y,c=new s;let h=new y;const u=[],d=[],p=[],f=[];function g(r){h=t.getPointAt(r/e,h);const s=a.normals[r],c=a.binormals[r];for(let t=0;t<=n;t++){const e=t/n*Math.PI*2,r=Math.sin(e),a=-Math.cos(e);l.x=a*s.x+r*c.x,l.y=a*s.y+r*c.y,l.z=a*s.z+r*c.z,l.normalize(),d.push(l.x,l.y,l.z),o.x=h.x+i*l.x,o.y=h.y+i*l.y,o.z=h.z+i*l.z,u.push(o.x,o.y,o.z)}}!function(){for(let t=0;t<e;t++)g(t);g(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let i=0;i<=n;i++)c.x=t/e,c.y=i/n,p.push(c.x,c.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=n;e++){const i=(n+1)*(t-1)+(e-1),r=(n+1)*t+(e-1),a=(n+1)*t+e,o=(n+1)*(t-1)+e;f.push(i,r,o),f.push(r,a,o)}}()}(),this.setIndex(f),this.setAttribute("position",new $t(u,3)),this.setAttribute("normal",new $t(d,3)),this.setAttribute("uv",new $t(p,2))}toJSON(){const t=ce.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t}}class za extends Ut{constructor(t){super(),this.type="ShadowMaterial",this.color=new Ot(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}za.prototype.isShadowMaterial=!0;class Qa extends Ue{constructor(t){super(t),this.type="RawShaderMaterial"}}function Oa(t){Ut.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ot(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,this.setValues(t)}function ka(t){Oa.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new s(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=o.clamp(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(t)}Qa.prototype.isRawShaderMaterial=!0,Oa.prototype=Object.create(Ut.prototype),Oa.prototype.constructor=Oa,Oa.prototype.isMeshStandardMaterial=!0,Oa.prototype.copy=function(t){return Ut.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this.vertexTangents=t.vertexTangents,this},ka.prototype=Object.create(Oa.prototype),ka.prototype.constructor=ka,ka.prototype.isMeshPhysicalMaterial=!0,ka.prototype.copy=function(t){return Oa.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new Ot).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this};class Ha extends Ut{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new Ot(16777215),this.specular=new Ot(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Ha.prototype.isMeshPhongMaterial=!0;class Va extends Ut{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ot(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}Va.prototype.isMeshToonMaterial=!0;class Ga extends Ut{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Ga.prototype.isMeshNormalMaterial=!0;class ja extends Ut{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new Ot(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}ja.prototype.isMeshLambertMaterial=!0;class Wa extends Ut{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ot(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Wa.prototype.isMeshMatcapMaterial=!0;class qa extends Nr{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}qa.prototype.isLineDashedMaterial=!0;const Za={arraySlice:function(t,e,i){return Za.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort((function(e,i){return t[e]-t[i]})),i},sortedArray:function(t,e,i){const n=t.length,r=new t.constructor(n);for(let a=0,o=0;o!==n;++a){const n=i[a]*e;for(let i=0;i!==e;++i)r[o++]=t[n+i]}return r},flattenJSON:function(t,e,i,n){let r=1,a=t[0];for(;void 0!==a&&void 0===a[n];)a=t[r++];if(void 0===a)return;let o=a[n];if(void 0!==o)if(Array.isArray(o))do{o=a[n],void 0!==o&&(e.push(a.time),i.push.apply(i,o)),a=t[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{o=a[n],void 0!==o&&(e.push(a.time),o.toArray(i,i.length)),a=t[r++]}while(void 0!==a);else do{o=a[n],void 0!==o&&(e.push(a.time),i.push(o)),a=t[r++]}while(void 0!==a)},subclip:function(t,e,i,n,r=30){const a=t.clone();a.name=e;const o=[];for(let t=0;t<a.tracks.length;++t){const e=a.tracks[t],s=e.getValueSize(),l=[],c=[];for(let t=0;t<e.times.length;++t){const a=e.times[t]*r;if(!(a<i||a>=n)){l.push(e.times[t]);for(let i=0;i<s;++i)c.push(e.values[t*s+i])}}0!==l.length&&(e.times=Za.convertArray(l,e.times.constructor),e.values=Za.convertArray(c,e.values.constructor),o.push(e))}a.tracks=o;let s=1/0;for(let t=0;t<a.tracks.length;++t)s>a.tracks[t].times[0]&&(s=a.tracks[t].times[0]);for(let t=0;t<a.tracks.length;++t)a.tracks[t].shift(-1*s);return a.resetDuration(),a},makeClipAdditive:function(t,e=0,i=t,n=30){n<=0&&(n=30);const r=i.tracks.length,a=e/n;for(let e=0;e<r;++e){const n=i.tracks[e],r=n.ValueTypeName;if("bool"===r||"string"===r)continue;const o=t.tracks.find((function(t){return t.name===n.name&&t.ValueTypeName===r}));if(void 0===o)continue;let s=0;const l=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);let c=0;const h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);const u=n.times.length-1;let d;if(a<=n.times[0]){const t=s,e=l-s;d=Za.arraySlice(n.values,t,e)}else if(a>=n.times[u]){const t=u*l+s,e=t+l-s;d=Za.arraySlice(n.values,t,e)}else{const t=n.createInterpolant(),e=s,i=l-s;t.evaluate(a),d=Za.arraySlice(t.resultBuffer,e,i)}if("quaternion"===r){(new m).fromArray(d).normalize().conjugate().toArray(d)}const p=o.times.length;for(let t=0;t<p;++t){const e=t*h+c;if("quaternion"===r)m.multiplyQuaternionsFlat(o.values,e,d,0,o.values,e);else{const t=h-2*c;for(let i=0;i<t;++i)o.values[e+i]-=d[i]}}}return t.blendMode=2501,t}};function Ja(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i}function Xa(t,e,i,n){Ja.call(this,t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ya(t,e,i,n){Ja.call(this,t,e,i,n)}function Ka(t,e,i,n){Ja.call(this,t,e,i,n)}Object.assign(Ja.prototype,{evaluate:function(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{let a;i:{n:if(!(t<n)){for(let a=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===a)break;if(r=n,n=e[++i],t<n)break e}a=e.length;break i}if(t>=r)break t;{const o=e[1];t<o&&(i=2,r=o);for(let a=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===a)break;if(n=r,r=e[--i-1],t>=r)break e}a=i,i=0}}for(;i<a;){const n=i+a>>>1;t<e[n]?a=n:i=n+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n;for(let t=0;t!==n;++t)e[t]=i[r+t];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Ja.prototype,{beforeStart_:Ja.prototype.copySampleValue_,afterEnd_:Ja.prototype.copySampleValue_}),Xa.prototype=Object.assign(Object.create(Ja.prototype),{constructor:Xa,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(t,e,i){const n=this.parameterPositions;let r=t-2,a=t+1,o=n[r],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=t,o=2*e-i;break;case 2402:r=n.length-2,o=e+n[r]-n[r+1];break;default:r=t,o=i}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=t,s=2*i-e;break;case 2402:a=1,s=i+n[1]-n[0];break;default:a=t-1,s=e}const l=.5*(i-e),c=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(s-i),this._offsetPrev=r*c,this._offsetNext=a*c},interpolate_:function(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,l=s-o,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),f=p*p,g=f*p,m=-u*g+2*u*f-u*p,y=(1+u)*g+(-1.5-2*u)*f+(-.5+u)*p+1,b=(-1-d)*g+(1.5+d)*f+.5*p,v=d*g-d*f;for(let t=0;t!==o;++t)r[t]=m*a[c+t]+y*a[l+t]+b*a[s+t]+v*a[h+t];return r}}),Ya.prototype=Object.assign(Object.create(Ja.prototype),{constructor:Ya,interpolate_:function(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,l=s-o,c=(i-e)/(n-e),h=1-c;for(let t=0;t!==o;++t)r[t]=a[l+t]*h+a[s+t]*c;return r}}),Ka.prototype=Object.assign(Object.create(Ja.prototype),{constructor:Ka,interpolate_:function(t){return this.copySampleValue_(t-1)}});class $a{constructor(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Za.convertArray(e,this.TimeBufferType),this.values=Za.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Za.convertArray(t.times,Array),values:Za.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Ka(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Ya(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Xa(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let r=0,a=n-1;for(;r!==n&&i[r]<t;)++r;for(;-1!==a&&i[a]>e;)--a;if(++a,0!==r||a!==n){r>=a&&(a=Math.max(a,1),r=a-1);const t=this.getValueSize();this.times=Za.arraySlice(i,r,a),this.values=Za.arraySlice(this.values,r*t,a*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let e=0;e!==r;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,n),t=!1;break}if(null!==a&&a>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,n,a),t=!1;break}a=n}if(void 0!==n&&Za.isTypedArray(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){const t=Za.arraySlice(this.times),e=Za.arraySlice(this.values),i=this.getValueSize(),n=2302===this.getInterpolation(),r=t.length-1;let a=1;for(let o=1;o<r;++o){let r=!1;const s=t[o];if(s!==t[o+1]&&(1!==o||s!==t[0]))if(n)r=!0;else{const t=o*i,n=t-i,a=t+i;for(let o=0;o!==i;++o){const i=e[t+o];if(i!==e[n+o]||i!==e[a+o]){r=!0;break}}}if(r){if(o!==a){t[a]=t[o];const n=o*i,r=a*i;for(let t=0;t!==i;++t)e[r+t]=e[n+t]}++a}}if(r>0){t[a]=t[r];for(let t=r*i,n=a*i,o=0;o!==i;++o)e[n+o]=e[t+o];++a}return a!==t.length?(this.times=Za.arraySlice(t,0,a),this.values=Za.arraySlice(e,0,a*i)):(this.times=t,this.values=e),this}clone(){const t=Za.arraySlice(this.times,0),e=Za.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}$a.prototype.TimeBufferType=Float32Array,$a.prototype.ValueBufferType=Float32Array,$a.prototype.DefaultInterpolation=2301;class to extends $a{}to.prototype.ValueTypeName="bool",to.prototype.ValueBufferType=Array,to.prototype.DefaultInterpolation=2300,to.prototype.InterpolantFactoryMethodLinear=void 0,to.prototype.InterpolantFactoryMethodSmooth=void 0;class eo extends $a{}eo.prototype.ValueTypeName="color";class io extends $a{}function no(t,e,i,n){Ja.call(this,t,e,i,n)}io.prototype.ValueTypeName="number",no.prototype=Object.assign(Object.create(Ja.prototype),{constructor:no,interpolate_:function(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(i-e)/(n-e);let l=t*o;for(let t=l+o;l!==t;l+=4)m.slerpFlat(r,0,a,l-o,a,l,s);return r}});class ro extends $a{InterpolantFactoryMethodLinear(t){return new no(this.times,this.values,this.getValueSize(),t)}}ro.prototype.ValueTypeName="quaternion",ro.prototype.DefaultInterpolation=2301,ro.prototype.InterpolantFactoryMethodSmooth=void 0;class ao extends $a{}ao.prototype.ValueTypeName="string",ao.prototype.ValueBufferType=Array,ao.prototype.DefaultInterpolation=2300,ao.prototype.InterpolantFactoryMethodLinear=void 0,ao.prototype.InterpolantFactoryMethodSmooth=void 0;class oo extends $a{}oo.prototype.ValueTypeName="vector";class so{constructor(t,e=-1,i,n=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=n,this.uuid=o.generateUUID(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push(lo(i[t]).scale(n));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push($a.toJSON(i[t]));return n}static CreateFromMorphTargetSequence(t,e,i,n){const r=e.length,a=[];for(let t=0;t<r;t++){let o=[],s=[];o.push((t+r-1)%r,t,(t+1)%r),s.push(0,1,0);const l=Za.getKeyframeOrder(o);o=Za.sortedArray(o,1,l),s=Za.sortedArray(s,1,l),n||0!==o[0]||(o.push(r),s.push(s[0])),a.push(new io(".morphTargetInfluences["+e[t].name+"]",o,s).scale(1/i))}return new this(t,-1,a)}static findByName(t,e){let i=t;if(!Array.isArray(t)){const e=t;i=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<i.length;t++)if(i[t].name===e)return i[t];return null}static CreateClipsFromMorphTargetSequences(t,e,i){const n={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,i=t.length;e<i;e++){const i=t[e],a=i.name.match(r);if(a&&a.length>1){const t=a[1];let e=n[t];e||(n[t]=e=[]),e.push(i)}}const a=[];for(const t in n)a.push(this.CreateFromMorphTargetSequence(t,n[t],e,i));return a}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(t,e,i,n,r){if(0!==i.length){const a=[],o=[];Za.flattenJSON(i,a,o,n),0!==a.length&&r.push(new t(e,a,o))}},n=[],r=t.name||"default",a=t.fps||30,o=t.blendMode;let s=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let i=0;i<r[e].morphTargets.length;i++)t[r[e].morphTargets[i]]=-1;for(const i in t){const t=[],a=[];for(let n=0;n!==r[e].morphTargets.length;++n){const n=r[e];t.push(n.time),a.push(n.morphTarget===i?1:0)}n.push(new io(".morphTargetInfluence["+i+"]",t,a))}s=t.length*(a||1)}else{const a=".bones["+e[t].name+"]";i(oo,a+".position",r,"pos",n),i(ro,a+".quaternion",r,"rot",n),i(oo,a+".scale",r,"scl",n)}}if(0===n.length)return null;return new this(r,s,n,o)}resetDuration(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function lo(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return io;case"vector":case"vector2":case"vector3":case"vector4":return oo;case"color":return eo;case"quaternion":return ro;case"bool":case"boolean":return to;case"string":return ao}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];Za.flattenJSON(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const co={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function ho(t,e,i){const n=this;let r=!1,a=0,o=0,s=void 0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===r&&void 0!==n.onStart&&n.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=l.length;e<i;e+=2){const i=l[e],n=l[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}const uo=new ho;function po(t){this.manager=void 0!==t?t:uo,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(po.prototype,{load:function(){},loadAsync:function(t,e){const i=this;return new Promise((function(n,r){i.load(t,n,e,r)}))},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}});const fo={};function go(t){po.call(this,t)}go.prototype=Object.assign(Object.create(po.prototype),{constructor:go,load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=co.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;if(void 0!==fo[t])return void fo[t].push({onLoad:e,onProgress:i,onError:n});const o=t.match(/^data:(.*?)(;base64)?,(.*)$/);let s;if(o){const i=o[1],a=!!o[2];let s=o[3];s=decodeURIComponent(s),a&&(s=atob(s));try{let n;const a=(this.responseType||"").toLowerCase();switch(a){case"arraybuffer":case"blob":const t=new Uint8Array(s.length);for(let e=0;e<s.length;e++)t[e]=s.charCodeAt(e);n="blob"===a?new Blob([t.buffer],{type:i}):t.buffer;break;case"document":const e=new DOMParser;n=e.parseFromString(s,i);break;case"json":n=JSON.parse(s);break;default:n=s}setTimeout((function(){e&&e(n),r.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}),0)}}else{fo[t]=[],fo[t].push({onLoad:e,onProgress:i,onError:n}),s=new XMLHttpRequest,s.open("GET",t,!0),s.addEventListener("load",(function(e){const i=this.response,n=fo[t];if(delete fo[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),co.add(t,i);for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onLoad&&e.onLoad(i)}r.manager.itemEnd(t)}else{for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}}),!1),s.addEventListener("progress",(function(e){const i=fo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onProgress&&n.onProgress(e)}}),!1),s.addEventListener("error",(function(e){const i=fo[t];delete fo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),s.addEventListener("abort",(function(e){const i=fo[t];delete fo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.overrideMimeType&&s.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)s.setRequestHeader(t,this.requestHeader[t]);s.send(null)}return r.manager.itemStart(t),s},setResponseType:function(t){return this.responseType=t,this},setMimeType:function(t){return this.mimeType=t,this}});function mo(t){po.call(this,t)}mo.prototype=Object.assign(Object.create(po.prototype),{constructor:mo,load:function(t,e,i,n){const r=this,a=[],o=new ea,s=new go(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(r.withCredentials);let l=0;function c(c){s.load(t[c],(function(t){const i=r.parse(t,!0);a[c]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},l+=1,6===l&&(1===i.mipmapCount&&(o.minFilter=1006),o.image=a,o.format=i.format,o.needsUpdate=!0,e&&e(o))}),i,n)}if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)c(e);else s.load(t,(function(t){const i=r.parse(t,!0);if(i.isCubemap){const t=i.mipmaps.length/i.mipmapCount;for(let e=0;e<t;e++){a[e]={mipmaps:[]};for(let t=0;t<i.mipmapCount;t++)a[e].mipmaps.push(i.mipmaps[e*i.mipmapCount+t]),a[e].format=i.format,a[e].width=i.width,a[e].height=i.height}o.image=a}else o.image.width=i.width,o.image.height=i.height,o.mipmaps=i.mipmaps;1===i.mipmapCount&&(o.minFilter=1006),o.format=i.format,o.needsUpdate=!0,e&&e(o)}),i,n);return o}});class yo extends po{constructor(t){super(t)}load(t,e,i,n){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=co.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;const o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),co.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o}}class bo extends po{constructor(t){super(t)}load(t,e,i,n){const r=new Ne,a=new yo(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function s(i){a.load(t[i],(function(t){r.images[i]=t,o++,6===o&&(r.needsUpdate=!0,e&&e(r))}),void 0,n)}for(let e=0;e<t.length;++e)s(e);return r}}function vo(t){po.call(this,t)}function xo(t){po.call(this,t)}function _o(){this.type="Curve",this.arcLengthDivisions=200}vo.prototype=Object.assign(Object.create(po.prototype),{constructor:vo,load:function(t,e,i,n){const r=this,a=new Qe,o=new go(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(t,(function(t){const i=r.parse(t);i&&(void 0!==i.image?a.image=i.image:void 0!==i.data&&(a.image.width=i.width,a.image.height=i.height,a.image.data=i.data),a.wrapS=void 0!==i.wrapS?i.wrapS:1001,a.wrapT=void 0!==i.wrapT?i.wrapT:1001,a.magFilter=void 0!==i.magFilter?i.magFilter:1006,a.minFilter=void 0!==i.minFilter?i.minFilter:1006,a.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.encoding&&(a.encoding=i.encoding),void 0!==i.flipY&&(a.flipY=i.flipY),void 0!==i.format&&(a.format=i.format),void 0!==i.type&&(a.type=i.type),void 0!==i.mipmaps&&(a.mipmaps=i.mipmaps,a.minFilter=1008),1===i.mipmapCount&&(a.minFilter=1006),a.needsUpdate=!0,e&&e(a,i))}),i,n),a}}),xo.prototype=Object.assign(Object.create(po.prototype),{constructor:xo,load:function(t,e,i,n){const r=new d,a=new yo(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(i){r.image=i;const n=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);r.format=n?1022:1023,r.needsUpdate=!0,void 0!==e&&e(r)}),i,n),r}}),Object.assign(_o.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),r=0;e.push(0);for(let a=1;a<=t;a++)i=this.getPoint(a/t),r+=i.distanceTo(n),e.push(r),n=i;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const i=this.getLengths();let n=0;const r=i.length;let a;a=e||t*i[r-1];let o,s=0,l=r-1;for(;s<=l;)if(n=Math.floor(s+(l-s)/2),o=i[n]-a,o<0)s=n+1;else{if(!(o>0)){l=n;break}l=n-1}if(n=l,i[n]===a)return n/(r-1);const c=i[n];return(n+(a-c)/(i[n+1]-c))/(r-1)},getTangent:function(t,e){let i=t-1e-4,n=t+1e-4;i<0&&(i=0),n>1&&(n=1);const r=this.getPoint(i),a=this.getPoint(n),o=e||(r.isVector2?new s:new y);return o.copy(a).sub(r).normalize(),o},getTangentAt:function(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)},computeFrenetFrames:function(t,e){const i=new y,n=[],r=[],a=[],s=new y,l=new j;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new y),n[e].normalize()}r[0]=new y,a[0]=new y;let c=Number.MAX_VALUE;const h=Math.abs(n[0].x),u=Math.abs(n[0].y),d=Math.abs(n[0].z);h<=c&&(c=h,i.set(1,0,0)),u<=c&&(c=u,i.set(0,1,0)),d<=c&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],s),a[0].crossVectors(n[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),a[e]=a[e-1].clone(),s.crossVectors(n[e-1],n[e]),s.length()>Number.EPSILON){s.normalize();const t=Math.acos(o.clamp(n[e-1].dot(n[e]),-1,1));r[e].applyMatrix4(l.makeRotationAxis(s,t))}a[e].crossVectors(n[e],r[e])}if(!0===e){let e=Math.acos(o.clamp(r[0].dot(r[t]),-1,1));e/=t,n[0].dot(s.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(l.makeRotationAxis(n[i],e*i)),a[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:a}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}});class Ao extends _o{constructor(t=0,e=0,i=1,n=1,r=0,a=2*Math.PI,o=!1,s=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(t,e){const i=e||new s,n=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=a?0:n),!0!==this.aClockwise||a||(r===n?r=-n:r-=n);const o=this.aStartAngle+t*r;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=l-this.aX,n=c-this.aY;l=i*t-n*e+this.aX,c=i*e+n*t+this.aY}return i.set(l,c)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}Ao.prototype.isEllipseCurve=!0;class wo extends Ao{constructor(t,e,i,n,r,a){super(t,e,i,i,n,r,a),this.type="ArcCurve"}}function Co(){let t=0,e=0,i=0,n=0;function r(r,a,o,s){t=r,e=o,i=-3*r+3*a-2*o-s,n=2*r-2*a+o+s}return{initCatmullRom:function(t,e,i,n,a){r(e,i,a*(i-t),a*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,a,o,s){let l=(e-t)/a-(i-t)/(a+o)+(i-e)/o,c=(i-e)/o-(n-e)/(o+s)+(n-i)/s;l*=o,c*=o,r(e,i,l,c)},calc:function(r){const a=r*r;return t+e*r+i*a+n*(a*r)}}}wo.prototype.isArcCurve=!0;const Mo=new y,Io=new Co,Eo=new Co,So=new Co;class To extends _o{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new y){const i=e,n=this.points,r=n.length,a=(r-(this.closed?0:1))*t;let o,s,l=Math.floor(a),c=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=n[(l-1)%r]:(Mo.subVectors(n[0],n[1]).add(n[0]),o=Mo);const h=n[l%r],u=n[(l+1)%r];if(this.closed||l+2<r?s=n[(l+2)%r]:(Mo.subVectors(n[r-1],n[r-2]).add(n[r-1]),s=Mo),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(h),t),i=Math.pow(h.distanceToSquared(u),t),n=Math.pow(u.distanceToSquared(s),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),Io.initNonuniformCatmullRom(o.x,h.x,u.x,s.x,e,i,n),Eo.initNonuniformCatmullRom(o.y,h.y,u.y,s.y,e,i,n),So.initNonuniformCatmullRom(o.z,h.z,u.z,s.z,e,i,n)}else"catmullrom"===this.curveType&&(Io.initCatmullRom(o.x,h.x,u.x,s.x,this.tension),Eo.initCatmullRom(o.y,h.y,u.y,s.y,this.tension),So.initCatmullRom(o.z,h.z,u.z,s.z,this.tension));return i.set(Io.calc(c),Eo.calc(c),So.calc(c)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new y).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Bo(t,e,i,n,r){const a=.5*(n-e),o=.5*(r-i),s=t*t;return(2*i-2*n+a+o)*(t*s)+(-3*i+3*n-2*a-o)*s+a*t+i}function Fo(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function Lo(t,e,i,n,r){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}To.prototype.isCatmullRomCurve3=!0;class Uo extends _o{constructor(t=new s,e=new s,i=new s,n=new s){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new s){const i=e,n=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(Lo(t,n.x,r.x,a.x,o.x),Lo(t,n.y,r.y,a.y,o.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Uo.prototype.isCubicBezierCurve=!0;class Ro extends _o{constructor(t=new y,e=new y,i=new y,n=new y){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new y){const i=e,n=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(Lo(t,n.x,r.x,a.x,o.x),Lo(t,n.y,r.y,a.y,o.y),Lo(t,n.z,r.z,a.z,o.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Ro.prototype.isCubicBezierCurve3=!0;class Do extends _o{constructor(t=new s,e=new s){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new s){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const i=e||new s;return i.copy(this.v2).sub(this.v1).normalize(),i}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Do.prototype.isLineCurve=!0;class Po extends _o{constructor(t=new s,e=new s,i=new s){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new s){const i=e,n=this.v0,r=this.v1,a=this.v2;return i.set(Fo(t,n.x,r.x,a.x),Fo(t,n.y,r.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Po.prototype.isQuadraticBezierCurve=!0;class No extends _o{constructor(t=new y,e=new y,i=new y){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new y){const i=e,n=this.v0,r=this.v1,a=this.v2;return i.set(Fo(t,n.x,r.x,a.x),Fo(t,n.y,r.y,a.y),Fo(t,n.z,r.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}No.prototype.isQuadraticBezierCurve3=!0;class zo extends _o{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new s){const i=e,n=this.points,r=(n.length-1)*t,a=Math.floor(r),o=r-a,l=n[0===a?a:a-1],c=n[a],h=n[a>n.length-2?n.length-1:a+1],u=n[a>n.length-3?n.length-1:a+2];return i.set(Bo(o,l.x,c.x,h.x,u.x),Bo(o,l.y,c.y,h.y,u.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new s).fromArray(i))}return this}}zo.prototype.isSplineCurve=!0;var Qo=Object.freeze({__proto__:null,ArcCurve:wo,CatmullRomCurve3:To,CubicBezierCurve:Uo,CubicBezierCurve3:Ro,EllipseCurve:Ao,LineCurve:Do,LineCurve3:class extends _o{constructor(t=new y,e=new y){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new y){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:Po,QuadraticBezierCurve3:No,SplineCurve:zo});class Oo extends _o{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Do(e,t))}getPoint(t){const e=t*this.getLength(),i=this.getCurveLengths();let n=0;for(;n<i.length;){if(i[n]>=e){const t=i[n]-e,r=this.curves[n],a=r.getLength(),o=0===a?0:1-t/a;return r.getPointAt(o)}n++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let n=0,r=this.curves;n<r.length;n++){const a=r[n],o=a&&a.isEllipseCurve?2*t:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o);for(let t=0;t<s.length;t++){const n=s[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new Qo[i.type]).fromJSON(i))}return this}}class ko extends Oo{constructor(t){super(),this.type="Path",this.currentPoint=new s,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new Do(this.currentPoint.clone(),new s(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const r=new Po(this.currentPoint.clone(),new s(t,e),new s(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,r,a){const o=new Uo(this.currentPoint.clone(),new s(t,e),new s(i,n),new s(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new zo(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,r,a){const o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+o,e+s,i,n,r,a),this}absarc(t,e,i,n,r,a){return this.absellipse(t,e,i,i,n,r,a),this}ellipse(t,e,i,n,r,a,o,s){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,i,n,r,a,o,s),this}absellipse(t,e,i,n,r,a,o,s){const l=new Ao(t,e,i,n,r,a,o,s);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Ho extends ko{constructor(t){super(t),this.uuid=o.generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new ko).fromJSON(i))}return this}}class Vo extends mt{constructor(t,e=1){super(),this.type="Light",this.color=new Ot(t),this.intensity=e}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}Vo.prototype.isLight=!0;class Go extends Vo{constructor(t,e,i){super(t,i),this.type="HemisphereLight",this.position.copy(mt.DefaultUp),this.updateMatrix(),this.groundColor=new Ot(e)}copy(t){return Vo.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}Go.prototype.isHemisphereLight=!0;const jo=new j,Wo=new y,qo=new y;class Zo{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new s(512,512),this.map=null,this.mapPass=null,this.matrix=new j,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new He,this._frameExtents=new s(1,1),this._viewportCount=1,this._viewports=[new f(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;Wo.setFromMatrixPosition(t.matrixWorld),e.position.copy(Wo),qo.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(qo),e.updateMatrixWorld(),jo.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jo),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(e.projectionMatrix),i.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Jo extends Zo{constructor(){super(new De(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,i=2*o.RAD2DEG*t.angle*this.focus,n=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;i===e.fov&&n===e.aspect&&r===e.far||(e.fov=i,e.aspect=n,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}}Jo.prototype.isSpotLightShadow=!0;class Xo extends Vo{constructor(t,e,i=0,n=Math.PI/3,r=0,a=1){super(t,e),this.type="SpotLight",this.position.copy(mt.DefaultUp),this.updateMatrix(),this.target=new mt,this.distance=i,this.angle=n,this.penumbra=r,this.decay=a,this.shadow=new Jo}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Xo.prototype.isSpotLight=!0;const Yo=new j,Ko=new y,$o=new y;class ts extends Zo{constructor(){super(new De(90,1,.5,500)),this._frameExtents=new s(4,2),this._viewportCount=6,this._viewports=[new f(2,1,1,1),new f(0,1,1,1),new f(3,1,1,1),new f(1,1,1,1),new f(3,0,1,1),new f(1,0,1,1)],this._cubeDirections=[new y(1,0,0),new y(-1,0,0),new y(0,0,1),new y(0,0,-1),new y(0,1,0),new y(0,-1,0)],this._cubeUps=[new y(0,1,0),new y(0,1,0),new y(0,1,0),new y(0,1,0),new y(0,0,1),new y(0,0,-1)]}updateMatrices(t,e=0){const i=this.camera,n=this.matrix;Ko.setFromMatrixPosition(t.matrixWorld),i.position.copy(Ko),$o.copy(i.position),$o.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt($o),i.updateMatrixWorld(),n.makeTranslation(-Ko.x,-Ko.y,-Ko.z),Yo.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Yo)}}ts.prototype.isPointLightShadow=!0;class es extends Vo{constructor(t,e,i=0,n=1){super(t,e),this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new ts}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}es.prototype.isPointLight=!0;class is extends Re{constructor(t=-1,e=1,i=1,n=-1,r=.1,a=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,n,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let r=i-t,a=i+t,o=n+e,s=n-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,a=r+t*this.view.width,o-=e*this.view.offsetY,s=o-e*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=mt.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}is.prototype.isOrthographicCamera=!0;class ns extends Zo{constructor(){super(new is(-5,5,5,-5,.5,500))}}ns.prototype.isDirectionalLightShadow=!0;class rs extends Vo{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(mt.DefaultUp),this.updateMatrix(),this.target=new mt,this.shadow=new ns}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}rs.prototype.isDirectionalLight=!0;class as extends Vo{constructor(t,e){super(t,e),this.type="AmbientLight"}}as.prototype.isAmbientLight=!0;class os extends Vo{constructor(t,e,i=10,n=10){super(t,e),this.type="RectAreaLight",this.width=i,this.height=n}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}os.prototype.isRectAreaLight=!0;class ss{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new y)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const i=t.x,n=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.282095),e.addScaledVector(a[1],.488603*n),e.addScaledVector(a[2],.488603*r),e.addScaledVector(a[3],.488603*i),e.addScaledVector(a[4],i*n*1.092548),e.addScaledVector(a[5],n*r*1.092548),e.addScaledVector(a[6],.315392*(3*r*r-1)),e.addScaledVector(a[7],i*r*1.092548),e.addScaledVector(a[8],.546274*(i*i-n*n)),e}getIrradianceAt(t,e){const i=t.x,n=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.886227),e.addScaledVector(a[1],1.023328*n),e.addScaledVector(a[2],1.023328*r),e.addScaledVector(a[3],1.023328*i),e.addScaledVector(a[4],.858086*i*n),e.addScaledVector(a[5],.858086*n*r),e.addScaledVector(a[6],.743125*r*r-.247708),e.addScaledVector(a[7],.858086*i*r),e.addScaledVector(a[8],.429043*(i*i-n*n)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(t.coefficients[i],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let i=0;i<9;i++)this.coefficients[i].lerp(t.coefficients[i],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].fromArray(t,e+3*n);return this}toArray(t=[],e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].toArray(t,e+3*n);return t}static getBasisAt(t,e){const i=t.x,n=t.y,r=t.z;e[0]=.282095,e[1]=.488603*n,e[2]=.488603*r,e[3]=.488603*i,e[4]=1.092548*i*n,e[5]=1.092548*n*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*i*r,e[8]=.546274*(i*i-n*n)}}ss.prototype.isSphericalHarmonics3=!0;class ls extends Vo{constructor(t=new ss,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}ls.prototype.isLightProbe=!0;const cs=function(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)};function hs(){ce.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function us(t,e,i,n){"number"==typeof i&&(n=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),Gt.call(this,t,e,i),this.meshPerAttribute=n||1}hs.prototype=Object.assign(Object.create(ce.prototype),{constructor:hs,isInstancedBufferGeometry:!0,copy:function(t){return ce.prototype.copy.call(this,t),this.instanceCount=t.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){const t=ce.prototype.toJSON.call(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}),us.prototype=Object.assign(Object.create(Gt.prototype),{constructor:us,isInstancedBufferAttribute:!0,copy:function(t){return Gt.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},toJSON:function(){const t=Gt.prototype.toJSON.call(this);return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}});function ds(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),po.call(this,t),this.options={premultiplyAlpha:"none"}}ds.prototype=Object.assign(Object.create(po.prototype),{constructor:ds,isImageBitmapLoader:!0,setOptions:function(t){return this.options=t,this},load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=co.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(t,o).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(i){co.add(t,i),e&&e(i),r.manager.itemEnd(t)})).catch((function(e){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)}});class ps{constructor(){this.type="ShapePath",this.color=new Ot,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new ko,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,a){return this.currentPath.bezierCurveTo(t,e,i,n,r,a),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function i(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i],r=new Ho;r.curves=n.curves,e.push(r)}return e}function n(t,e){const i=e.length;let n=!1;for(let r=i-1,a=0;a<i;r=a++){let i=e[r],o=e[a],s=o.x-i.x,l=o.y-i.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(i=e[a],s=-s,o=e[r],l=-l),t.y<i.y||t.y>o.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=l*(t.x-i.x)-s*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(o.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=o.x)return!0}}return n}const r=Ta.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===e)return i(a);let o,s,l;const c=[];if(1===a.length)return s=a[0],l=new Ho,l.curves=s.curves,c.push(l),c;let h=!r(a[0].getPoints());h=t?!h:h;const u=[],d=[];let p,f,g=[],m=0;d[m]=void 0,g[m]=[];for(let e=0,i=a.length;e<i;e++)s=a[e],p=s.getPoints(),o=r(p),o=t?!o:o,o?(!h&&d[m]&&m++,d[m]={s:new Ho,p:p},d[m].s.curves=s.curves,h&&m++,g[m]=[]):g[m].push({h:s,p:p[0]});if(!d[0])return i(a);if(d.length>1){let t=!1;const e=[];for(let t=0,e=d.length;t<e;t++)u[t]=[];for(let i=0,r=d.length;i<r;i++){const r=g[i];for(let a=0;a<r.length;a++){const o=r[a];let s=!0;for(let r=0;r<d.length;r++)n(o.p,d[r].p)&&(i!==r&&e.push({froms:i,tos:r,hole:a}),s?(s=!1,u[r].push(o)):t=!0);s&&u[i].push(o)}}e.length>0&&(t||(g=u))}for(let t=0,e=d.length;t<e;t++){l=d[t].s,c.push(l),f=g[t];for(let t=0,e=f.length;t<e;t++)l.holes.push(f[t].h)}return c}}class fs{constructor(t){this.type="Font",this.data=t}generateShapes(t,e=100){const i=[],n=function(t,e,i){const n=Array.from(t),r=e/i.resolution,a=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*r,o=[];let s=0,l=0;for(let t=0;t<n.length;t++){const e=n[t];if("\n"===e)s=0,l-=a;else{const t=gs(e,r,s,l,i);s+=t.offsetX,o.push(t.path)}}return o}(t,e,this.data);for(let t=0,e=n.length;t<e;t++)Array.prototype.push.apply(i,n[t].toShapes());return i}}function gs(t,e,i,n,r){const a=r.glyphs[t]||r.glyphs["?"];if(!a)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+r.familyName+".");const o=new ps;let s,l,c,h,u,d,p,f;if(a.o){const t=a._cachedOutline||(a._cachedOutline=a.o.split(" "));for(let r=0,a=t.length;r<a;){switch(t[r++]){case"m":s=t[r++]*e+i,l=t[r++]*e+n,o.moveTo(s,l);break;case"l":s=t[r++]*e+i,l=t[r++]*e+n,o.lineTo(s,l);break;case"q":c=t[r++]*e+i,h=t[r++]*e+n,u=t[r++]*e+i,d=t[r++]*e+n,o.quadraticCurveTo(u,d,c,h);break;case"b":c=t[r++]*e+i,h=t[r++]*e+n,u=t[r++]*e+i,d=t[r++]*e+n,p=t[r++]*e+i,f=t[r++]*e+n,o.bezierCurveTo(u,d,p,f,c,h)}}}return{offsetX:a.ha*e,path:o}}fs.prototype.isFont=!0;let ms;const ys=function(){return void 0===ms&&(ms=new(window.AudioContext||window.webkitAudioContext)),ms};class bs extends po{constructor(t){super(t)}load(t,e,i,n){const r=this,a=new go(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(i){try{const t=i.slice(0);ys().decodeAudioData(t,(function(t){e(t)}))}catch(e){n?n(e):console.error(e),r.manager.itemError(t)}}),i,n)}}(class extends ls{constructor(t,e,i=1){super(void 0,i);const n=(new Ot).set(t),r=(new Ot).set(e),a=new y(n.r,n.g,n.b),o=new y(r.r,r.g,r.b),s=Math.sqrt(Math.PI),l=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(l)}}).prototype.isHemisphereLightProbe=!0;(class extends ls{constructor(t,e=1){super(void 0,e);const i=(new Ot).set(t);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}).prototype.isAmbientLightProbe=!0;new j,new j;class vs extends mt{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}class xs{constructor(t,e,i){let n,r,a;switch(this.binding=t,this.valueSize=i,e){case"quaternion":n=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":n=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const i=this.buffer,n=this.valueSize,r=t*n+n;let a=this.cumulativeWeight;if(0===a){for(let t=0;t!==n;++t)i[r+t]=i[t];a=e}else{a+=e;const t=e/a;this._mixBufferRegion(i,r,0,t,n)}this.cumulativeWeight=a}accumulateAdditive(t){const e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(i,n,t,1-r,e)}a>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){o.setValue(i,n);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let t=i,r=n;t!==r;++t)e[t]=e[n+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,n,r){if(n>=.5)for(let n=0;n!==r;++n)t[e+n]=t[i+n]}_slerp(t,e,i,n){m.slerpFlat(t,e,t,e,t,i,n)}_slerpAdditive(t,e,i,n,r){const a=this._workIndex*r;m.multiplyQuaternionsFlat(t,a,t,e,t,i),m.slerpFlat(t,e,t,e,t,a,n)}_lerp(t,e,i,n,r){const a=1-n;for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]*a+t[i+o]*n}}_lerpAdditive(t,e,i,n,r){for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]+t[i+a]*n}}}const _s=new RegExp("[\\[\\]\\.:\\/]","g"),As="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",ws=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Cs=/(WCOD+)?/.source.replace("WCOD",As),Ms=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Is=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Es=new RegExp("^"+ws+Cs+Ms+Is+"$"),Ss=["material","materials","bones"];function Ts(t,e,i){const n=i||Bs.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function Bs(t,e,i){this.path=e,this.parsedPath=i||Bs.parseTrackName(e),this.node=Bs.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(Ts.prototype,{getValue:function(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}),Object.assign(Bs,{Composite:Ts,create:function(t,e,i){return t&&t.isAnimationObjectGroup?new Bs.Composite(t,e,i):new Bs(t,e,i)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(_s,"")},parseTrackName:function(t){const e=Es.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==Ss.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.name===e||r.uuid===e)return r;const a=i(r.children);if(a)return a}return null},n=i(t.children);if(n)return n}return null}}),Object.assign(Bs.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)t[e++]=i[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++]},function(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let r=e.propertyIndex;if(t||(t=Bs.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(i){let n=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==n){if(void 0===t[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[n]}}const a=t[n];if(void 0===a){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+n+" but it wasn't found.",t)}let o=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let s=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}s=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(s=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(s=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=n;this.getValue=this.GetterByBindingType[s],this.setValue=this.SetterByBindingTypeAndVersioning[s][o]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Bs.prototype,{_getValue_unbound:Bs.prototype.getValue,_setValue_unbound:Bs.prototype.setValue});(class{constructor(){this.uuid=o.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,i=this._paths,n=this._parsedPaths,r=this._bindings,a=r.length;let o=void 0,s=t.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],u=h.uuid;let d=e[u];if(void 0===d){d=s++,e[u]=d,t.push(h);for(let t=0,e=a;t!==e;++t)r[t].push(new Bs(h,i[t],n[t]))}else if(d<l){o=t[d];const s=--l,c=t[s];e[c.uuid]=d,t[d]=c,e[u]=s,t[s]=h;for(let t=0,e=a;t!==e;++t){const e=r[t],a=e[s];let o=e[d];e[d]=a,void 0===o&&(o=new Bs(h,i[t],n[t])),e[s]=o}}else t[d]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let r=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a],s=o.uuid,l=e[s];if(void 0!==l&&l>=r){const a=r++,c=t[a];e[c.uuid]=l,t[l]=c,e[s]=a,t[a]=o;for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[a],r=e[l];e[l]=n,e[a]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let r=this.nCachedObjects_,a=t.length;for(let o=0,s=arguments.length;o!==s;++o){const s=arguments[o].uuid,l=e[s];if(void 0!==l)if(delete e[s],l<r){const o=--r,s=t[o],c=--a,h=t[c];e[s.uuid]=l,t[l]=s,e[h.uuid]=o,t[o]=h,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[o],r=e[c];e[l]=n,e[o]=r,e.pop()}}else{const r=--a,o=t[r];r>0&&(e[o.uuid]=l),t[l]=o,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const i=this._bindingsIndicesByPath;let n=i[t];const r=this._bindings;if(void 0!==n)return r[n];const a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,h=new Array(l);n=r.length,i[t]=n,a.push(t),o.push(e),r.push(h);for(let i=c,n=s.length;i!==n;++i){const n=s[i];h[i]=new Bs(n,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){const n=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];e[t[o]]=i,a[i]=s,a.pop(),r[i]=r[o],r.pop(),n[i]=n[o],n.pop()}}}).prototype.isAnimationObjectGroup=!0;class Fs{constructor(t,e,i=null,n=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;const r=e.tracks,a=r.length,o=new Array(a),s={endingStart:2400,endingEnd:2400};for(let t=0;t!==a;++t){const e=r[t].createInterpolant(null);o[t]=e,e.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){const i=this._clip.duration,n=t._clip.duration,r=n/i,a=i/n;t.warp(1,r,e),this.warp(a,1,e)}return this}crossFadeTo(t,e,i){return t.crossFadeFrom(this,e,i)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){const n=this._mixer,r=n.time,a=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=n._lendControlInterpolant(),this._timeScaleInterpolant=o);const s=o.parameterPositions,l=o.sampleValues;return s[0]=r,s[1]=r+i,l[0]=t/a,l[1]=e/a,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const n=(t-r)*i;if(n<0||0===i)return;this._startTime=null,e=i*n}e*=this._updateTimeScale(t);const a=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case 2501:for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(a),e[i].accumulateAdditive(o);break;case 2500:default:for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(a),e[i].accumulate(n,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(null!==i){const n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let n=this.time+t,r=this._loopCount;const a=2202===i;if(0===t)return-1===r?n:a&&1==(1&r)?e-n:n;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),n>=e||n<0){const i=Math.floor(n/e);n-=e*i,r+=Math.abs(i);const o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===o){const e=t<0;this._setEndings(e,!e,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=n;if(a&&1==(1&r))return e-n}return n}_setEndings(t,e,i){const n=this._interpolantSettings;i?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)}_scheduleFading(t,e,i){const n=this._mixer,r=n.time;let a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=e,o[1]=r+t,s[1]=i,this}}(class extends n{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,a=t._propertyBindings,o=t._interpolants,s=i.uuid,l=this._bindingsByRootAndName;let c=l[s];void 0===c&&(c={},l[s]=c);for(let t=0;t!==r;++t){const r=n[t],l=r.name;let h=c[l];if(void 0!==h)a[t]=h;else{if(h=a[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,s,l));continue}const n=e&&e._propertyBindings[t].binding.parsedPath;h=new xs(Bs.create(i,l,n),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,s,l),a[t]=h}o[t].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){const n=this._actions,r=this._actionsByClip;let a=r[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=a;else{const e=a.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=n.length,n.push(t),a.actionByRoot[i]=t}_removeInactiveAction(t){const e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,l=s[s.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),t._byClipCacheIndex=null;delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(t){const e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackAction(t){const e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_addInactiveBinding(t,e,i){const n=this._bindingsByRootAndName,r=this._bindings;let a=n[e];void 0===a&&(a={},n[e]=a),a[i]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,a=this._bindingsByRootAndName,o=a[n],s=e[e.length-1],l=t._cacheIndex;s._cacheIndex=l,e[l]=s,e.pop(),delete o[r],0===Object.keys(o).length&&delete a[n]}_lendBinding(t){const e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackBinding(t){const e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=t[e];return void 0===i&&(i=new Ya(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){const e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r}clipAction(t,e,i){const n=e||this._root,r=n.uuid;let a="string"==typeof t?so.findByName(n,t):t;const o=null!==a?a.uuid:t,s=this._actionsByClip[o];let l=null;if(void 0===i&&(i=null!==a?a.blendMode:2500),void 0!==s){const t=s.actionByRoot[r];if(void 0!==t&&t.blendMode===i)return t;l=s.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;const c=new Fs(this,a,e,i);return this._bindAction(c,l),this._addInactiveAction(c,o,r),c}existingAction(t,e){const i=e||this._root,n=i.uuid,r="string"==typeof t?so.findByName(i,t):t,a=r?r.uuid:t,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[n]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1;for(let o=0;o!==i;++o){e[o]._update(n,t,r,a)}const o=this._bindings,s=this._nActiveBindings;for(let t=0;t!==s;++t)o[t].apply(a);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){const t=r.knownActions;for(let i=0,n=t.length;i!==n;++i){const n=t[i];this._deactivateAction(n);const r=n._cacheIndex,a=e[e.length-1];n._cacheIndex=null,n._byClipCacheIndex=null,a._cacheIndex=r,e[r]=a,e.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(t){const e=t.uuid,i=this._actionsByClip;for(const t in i){const n=i[t].actionByRoot[e];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}const n=this._bindingsByRootAndName[e];if(void 0!==n)for(const t in n){const e=n[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}).prototype._controlInterpolantsResultBuffer=new Float32Array(1);class Ls{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new Ls(void 0===this.value.clone?this.value:this.value.clone())}}function Us(t,e,i){tr.call(this,t,e),this.meshPerAttribute=i||1}function Rs(t,e,i,n,r){this.buffer=t,this.type=e,this.itemSize=i,this.elementSize=n,this.count=r,this.version=0}function Ds(t,e,i=0,n=1/0){this.ray=new G(t,e),this.near=i,this.far=n,this.camera=null,this.layers=new it,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Ps(t,e){return t.distance-e.distance}function Ns(t,e,i,n){if(t.layers.test(e.layers)&&t.raycast(e,i),!0===n){const n=t.children;for(let t=0,r=n.length;t<r;t++)Ns(n[t],e,i,!0)}}Us.prototype=Object.assign(Object.create(tr.prototype),{constructor:Us,isInstancedInterleavedBuffer:!0,copy:function(t){return tr.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},clone:function(t){const e=tr.prototype.clone.call(this,t);return e.meshPerAttribute=this.meshPerAttribute,e},toJSON:function(t){const e=tr.prototype.toJSON.call(this,t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}),Object.defineProperty(Rs.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Rs.prototype,{isGLBufferAttribute:!0,setBuffer:function(t){return this.buffer=t,this},setType:function(t,e){return this.type=t,this.elementSize=e,this},setItemSize:function(t){return this.itemSize=t,this},setCount:function(t){return this.count=t,this}}),Object.assign(Ds.prototype,{set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)},intersectObject:function(t,e=!1,i=[]){return Ns(t,this,i,e),i.sort(Ps),i},intersectObjects:function(t,e=!1,i=[]){for(let n=0,r=t.length;n<r;n++)Ns(t[n],this,i,e);return i.sort(Ps),i}});const zs=new s;class Qs{constructor(t=new s(1/0,1/0),e=new s(-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=zs.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return void 0===t&&(console.warn("THREE.Box2: .getCenter() target is now required"),t=new s),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return void 0===t&&(console.warn("THREE.Box2: .getSize() target is now required"),t=new s),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new s),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new s),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return zs.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}Qs.prototype.isBox2=!0;const Os=new y,ks=new y;function Hs(t){mt.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}Hs.prototype=Object.create(mt.prototype),Hs.prototype.constructor=Hs,Hs.prototype.isImmediateRenderObject=!0;const Vs=new y,Gs=new j,js=new j;const Ws=new Float32Array(1),qs=(new Int32Array(Ws.buffer),Math.pow(2,8),[.125,.215,.35,.446,.526,.582]),Zs=5+qs.length,Js=new kt({side:1,depthWrite:!1,depthTest:!1}),{_lodPlanes:Xs,_sizeLods:Ys,_sigmas:Ks}=(new Ee(new Te,Js),$s());Math.sqrt(5);function $s(){const t=[],e=[],i=[];let n=8;for(let r=0;r<Zs;r++){const a=Math.pow(2,n);e.push(a);let o=1/a;r>4?o=qs[r-8+4-1]:0==r&&(o=0),i.push(o);const s=1/(a-1),l=-s/2,c=1+s/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,d=6,p=3,f=2,g=1,m=new Float32Array(p*d*u),y=new Float32Array(f*d*u),b=new Float32Array(g*d*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];m.set(n,p*d*t),y.set(h,f*d*t);const r=[t,t,t,t,t,t];b.set(r,g*d*t)}const v=new ce;v.setAttribute("position",new Gt(m,p)),v.setAttribute("uv",new Gt(y,f)),v.setAttribute("faceIndex",new Gt(b,g)),t.push(v),n>4&&n--}return{_lodPlanes:t,_sizeLods:e,_sigmas:i}}_o.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(_o.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},ko.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},class extends Wr{constructor(t=10,e=10,i=4473924,n=8947848){i=new Ot(i),n=new Ot(n);const r=e/2,a=t/e,o=t/2,s=[],l=[];for(let t=0,c=0,h=-o;t<=e;t++,h+=a){s.push(-o,0,h,o,0,h),s.push(h,0,-o,h,0,o);const e=t===r?i:n;e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3}const c=new ce;c.setAttribute("position",new $t(s,3)),c.setAttribute("color",new $t(l,3));super(c,new Nr({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},class extends Wr{constructor(t){const e=function t(e){const i=[];e&&e.isBone&&i.push(e);for(let n=0;n<e.children.length;n++)i.push.apply(i,t(e.children[n]));return i}(t),i=new ce,n=[],r=[],a=new Ot(0,0,1),o=new Ot(0,1,0);for(let t=0;t<e.length;t++){const i=e[t];i.parent&&i.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}i.setAttribute("position",new $t(n,3)),i.setAttribute("color",new $t(r,3));super(i,new Nr({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,i=this.geometry,n=i.getAttribute("position");js.copy(this.root.matrixWorld).invert();for(let t=0,i=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(Gs.multiplyMatrices(js,r.matrixWorld),Vs.setFromMatrixPosition(Gs),n.setXYZ(i,Vs.x,Vs.y,Vs.z),Gs.multiplyMatrices(js,r.parent.matrixWorld),Vs.setFromMatrixPosition(Gs),n.setXYZ(i+1,Vs.x,Vs.y,Vs.z),i+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},po.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),cs(t)},po.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Qs.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Qs.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Qs.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Qs.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},x.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},x.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},x.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},x.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},x.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},P.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},He.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},class{constructor(t=new y,e=new y){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new y),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new y),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new y),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Os.subVectors(t,this.start),ks.subVectors(this.end,this.start);const i=ks.dot(ks);let n=ks.dot(Os)/i;return e&&(n=o.clamp(n,0,1)),n}closestPointToPoint(t,e,i){const n=this.closestPointToPointParameter(t,e);return void 0===i&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),i=new y),this.delta(i).multiplyScalar(n).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},o.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},o.nearestPowerOfTwo=function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),o.floorPowerOfTwo(t)},o.nextPowerOfTwo=function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),o.ceilPowerOfTwo(t)},l.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},l.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},l.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},l.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},l.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},l.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},j.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},j.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},j.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new y).setFromMatrixColumn(this,3)},j.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},j.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},j.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},j.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},j.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},j.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},j.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},j.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},j.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},j.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},j.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},j.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},j.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},j.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},j.prototype.makeFrustum=function(t,e,i,n,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,i,r,a)},j.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},xt.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},m.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},m.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},G.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},G.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},G.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Ft.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Ft.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},Ft.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},Ft.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},Ft.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},Ft.barycoordFromPoint=function(t,e,i,n,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Ft.getBarycoord(t,e,i,n,r)},Ft.normal=function(t,e,i,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Ft.getNormal(t,e,i,n)},Ho.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Ho.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new La(this,t)},Ho.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Da(this,t)},s.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},s.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},s.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},y.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},y.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},y.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},y.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},y.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},y.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},y.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},y.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},y.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},f.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},f.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},mt.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},mt.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},mt.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},mt.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},mt.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(mt.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Ee.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Ee.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(_r.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Fr.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Er.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(_o.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),De.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Vo.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(Gt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(35048)}}}),Gt.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},Gt.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Gt.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ce.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},ce.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new Gt(arguments[1],arguments[2])))},ce.prototype.addDrawCall=function(t,e,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},ce.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ce.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ce.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},ce.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(ce.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(hs.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(Ds.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(tr.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),35048===this.usage},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),tr.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},tr.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},La.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},La.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},La.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},$n.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(Ls.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(Ut.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Ot}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(Ha.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(ka.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}}),Object.defineProperties(Ue.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Xn.prototype.clearTarget=function(t,e,i,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,i,n)},Xn.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},Xn.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Xn.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Xn.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Xn.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Xn.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Xn.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Xn.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Xn.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Xn.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Xn.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Xn.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Xn.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Xn.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},Xn.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Xn.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Xn.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Xn.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Xn.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Xn.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Xn.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Xn.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Xn.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Xn.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Xn.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?3001:3e3}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(kn.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(g.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(vs.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new bs).load(t,(function(t){e.setBuffer(t)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let i=0;i<e.length;i++)t+=e[i];return t/e.length}}.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Pe.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},Pe.prototype.clear=function(t,e,i,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,i,n)},h.crossOrigin=void 0,h.loadTexture=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new xo;r.setCrossOrigin(this.crossOrigin);const a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},h.loadTextureCube=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new bo;r.setCrossOrigin(this.crossOrigin);const a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},h.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},h.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"126"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="126");var tl={value:()=>{}};function el(){for(var t,e=0,i=arguments.length,n={};e<i;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new il(n)}function il(t){this._=t}function nl(t,e){return t.trim().split(/^|\s+/).map((function(t){var i="",n=t.indexOf(".");if(n>=0&&(i=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:i}}))}function rl(t,e){for(var i,n=0,r=t.length;n<r;++n)if((i=t[n]).name===e)return i.value}function al(t,e,i){for(var n=0,r=t.length;n<r;++n)if(t[n].name===e){t[n]=tl,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=i&&t.push({name:e,value:i}),t}il.prototype=el.prototype={constructor:il,on:function(t,e){var i,n=this._,r=nl(t+"",n),a=-1,o=r.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<o;)if(i=(t=r[a]).type)n[i]=al(n[i],t.name,e);else if(null==e)for(i in n)n[i]=al(n[i],t.name,null);return this}for(;++a<o;)if((i=(t=r[a]).type)&&(i=rl(n[i],t.name)))return i},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new il(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var i,n,r=new Array(i),a=0;a<i;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,i=(n=this._[t]).length;a<i;++a)n[a].value.apply(e,r)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],r=0,a=n.length;r<a;++r)n[r].value.apply(e,i)}};var ol,sl,ll=el,cl=0,hl=0,ul=0,dl=0,pl=0,fl=0,gl="object"==typeof performance&&performance.now?performance:Date,ml="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function yl(){return pl||(ml(bl),pl=gl.now()+fl)}function bl(){pl=0}function vl(){this._call=this._time=this._next=null}function xl(t,e,i){var n=new vl;return n.restart(t,e,i),n}function _l(){pl=(dl=gl.now())+fl,cl=hl=0;try{!function(){yl(),++cl;for(var t,e=ol;e;)(t=pl-e._time)>=0&&e._call.call(null,t),e=e._next;--cl}()}finally{cl=0,function(){var t,e,i=ol,n=1/0;for(;i;)i._call?(n>i._time&&(n=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:ol=e);sl=t,wl(n)}(),pl=0}}function Al(){var t=gl.now(),e=t-dl;e>1e3&&(fl-=e,dl=t)}function wl(t){cl||(hl&&(hl=clearTimeout(hl)),t-pl>24?(t<1/0&&(hl=setTimeout(_l,t-gl.now()-fl)),ul&&(ul=clearInterval(ul))):(ul||(dl=gl.now(),ul=setInterval(Al,1e3)),cl=1,ml(_l)))}vl.prototype=xl.prototype={constructor:vl,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?yl():+i)+(null==e?0:+e),this._next||sl===this||(sl?sl._next=this:ol=this,sl=this),this._call=t,this._time=i,wl()},stop:function(){this._call&&(this._call=null,this._time=1/0,wl())}};const Cl=4294967296;function Ml(t){return t.x}function Il(t){return t.y}function El(t){return t.z}var Sl=Math.PI*(3-Math.sqrt(5)),Tl=20*Math.PI/(9+Math.sqrt(221)),Bl=function(t,e){e=e||2;var i,n=Math.min(3,Math.max(1,Math.round(e))),r=1,a=.001,o=1-Math.pow(a,1/300),s=0,l=.6,c=new Map,h=xl(p),u=ll("tick","end"),d=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Cl)/Cl}();function p(){f(),u.call("tick",i),r<a&&(h.stop(),u.call("end",i))}function f(e){var a,h,u=t.length;void 0===e&&(e=1);for(var d=0;d<e;++d)for(r+=(s-r)*o,c.forEach((function(t){t(r)})),a=0;a<u;++a)null==(h=t[a]).fx?h.x+=h.vx*=l:(h.x=h.fx,h.vx=0),n>1&&(null==h.fy?h.y+=h.vy*=l:(h.y=h.fy,h.vy=0)),n>2&&(null==h.fz?h.z+=h.vz*=l:(h.z=h.fz,h.vz=0));return i}function g(){for(var e,i=0,r=t.length;i<r;++i){if((e=t[i]).index=i,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var a=10*(n>2?Math.cbrt(.5+i):n>1?Math.sqrt(.5+i):i),o=i*Sl,s=i*Tl;1===n?e.x=a:2===n?(e.x=a*Math.cos(o),e.y=a*Math.sin(o)):(e.x=a*Math.sin(o)*Math.cos(s),e.y=a*Math.cos(o),e.z=a*Math.sin(o)*Math.sin(s))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function m(e){return e.initialize&&e.initialize(t,d,n),e}return null==t&&(t=[]),g(),i={tick:f,restart:function(){return h.restart(p),i},stop:function(){return h.stop(),i},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),c.forEach(m),i):n},nodes:function(e){return arguments.length?(t=e,g(),c.forEach(m),i):t},alpha:function(t){return arguments.length?(r=+t,i):r},alphaMin:function(t){return arguments.length?(a=+t,i):a},alphaDecay:function(t){return arguments.length?(o=+t,i):+o},alphaTarget:function(t){return arguments.length?(s=+t,i):s},velocityDecay:function(t){return arguments.length?(l=1-t,i):1-l},randomSource:function(t){return arguments.length?(d=t,c.forEach(m),i):d},force:function(t,e){return arguments.length>1?(null==e?c.delete(t):c.set(t,m(e)),i):c.get(t)},find:function(){var e,i,r,a,o,s,l=Array.prototype.slice.call(arguments),c=l.shift()||0,h=(n>1?l.shift():null)||0,u=(n>2?l.shift():null)||0,d=l.shift()||1/0,p=0,f=t.length;for(d*=d,p=0;p<f;++p)(a=(e=c-(o=t[p]).x)*e+(i=h-(o.y||0))*i+(r=u-(o.z||0))*r)<d&&(s=o,d=a);return s},on:function(t,e){return arguments.length>1?(u.on(t,e),i):u.on(t)}}},Fl=function(t){return function(){return t}},Ll=function(t){return 1e-6*(t()-.5)};function Ul(t){return t.index}function Rl(t,e){var i=t.get(e);if(!i)throw new Error("node not found: "+e);return i}var Dl=function(t){var e,i,n,r,a,o,s,l=Ul,c=function(t){return 1/Math.min(a[t.source.index],a[t.target.index])},h=Fl(30),u=1;function d(n){for(var a=0,l=t.length;a<u;++a)for(var c,h,d,p,f,g=0,m=0,y=0,b=0;g<l;++g)h=(c=t[g]).source,m=(d=c.target).x+d.vx-h.x-h.vx||Ll(s),r>1&&(y=d.y+d.vy-h.y-h.vy||Ll(s)),r>2&&(b=d.z+d.vz-h.z-h.vz||Ll(s)),m*=p=((p=Math.sqrt(m*m+y*y+b*b))-i[g])/p*n*e[g],y*=p,b*=p,d.vx-=m*(f=o[g]),r>1&&(d.vy-=y*f),r>2&&(d.vz-=b*f),h.vx+=m*(f=1-f),r>1&&(h.vy+=y*f),r>2&&(h.vz+=b*f)}function p(){if(n){var r,s,c=n.length,h=t.length,u=new Map(n.map((t,e)=>[l(t,e,n),t]));for(r=0,a=new Array(c);r<h;++r)(s=t[r]).index=r,"object"!=typeof s.source&&(s.source=Rl(u,s.source)),"object"!=typeof s.target&&(s.target=Rl(u,s.target)),a[s.source.index]=(a[s.source.index]||0)+1,a[s.target.index]=(a[s.target.index]||0)+1;for(r=0,o=new Array(h);r<h;++r)s=t[r],o[r]=a[s.source.index]/(a[s.source.index]+a[s.target.index]);e=new Array(h),f(),i=new Array(h),g()}}function f(){if(n)for(var i=0,r=t.length;i<r;++i)e[i]=+c(t[i],i,t)}function g(){if(n)for(var e=0,r=t.length;e<r;++e)i[e]=+h(t[e],e,t)}return null==t&&(t=[]),d.initialize=function(t,...e){n=t,s=e.find(t=>"function"==typeof t)||Math.random,r=e.find(t=>[1,2,3].includes(t))||2,p()},d.links=function(e){return arguments.length?(t=e,p(),d):t},d.id=function(t){return arguments.length?(l=t,d):l},d.iterations=function(t){return arguments.length?(u=+t,d):u},d.strength=function(t){return arguments.length?(c="function"==typeof t?t:Fl(+t),f(),d):c},d.distance=function(t){return arguments.length?(h="function"==typeof t?t:Fl(+t),g(),d):h},d};function Pl(t,e,i){if(isNaN(e))return t;var n,r,a,o,s,l,c=t._root,h={data:i},u=t._x0,d=t._x1;if(!c)return t._root=h,t;for(;c.length;)if((o=e>=(r=(u+d)/2))?u=r:d=r,n=c,!(c=c[s=+o]))return n[s]=h,t;if(e===(a=+t._x.call(null,c.data)))return h.next=c,n?n[s]=h:t._root=h,t;do{n=n?n[s]=new Array(2):t._root=new Array(2),(o=e>=(r=(u+d)/2))?u=r:d=r}while((s=+o)==(l=+(a>=r)));return n[l]=c,n[s]=h,t}var Nl=function(t,e,i){this.node=t,this.x0=e,this.x1=i};function zl(t){return t[0]}function Ql(t,e){var i=new Ol(null==e?zl:e,NaN,NaN);return null==t?i:i.addAll(t)}function Ol(t,e,i){this._x=t,this._x0=e,this._x1=i,this._root=void 0}function kl(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var Hl=Ql.prototype=Ol.prototype;Hl.copy=function(){var t,e,i=new Ol(this._x,this._x0,this._x1),n=this._root;if(!n)return i;if(!n.length)return i._root=kl(n),i;for(t=[{source:n,target:i._root=new Array(2)}];n=t.pop();)for(var r=0;r<2;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(2)}):n.target[r]=kl(e));return i},Hl.add=function(t){var e=+this._x.call(null,t);return Pl(this.cover(e),e,t)},Hl.addAll=function(t){var e,i,n=t.length,r=new Array(n),a=1/0,o=-1/0;for(e=0;e<n;++e)isNaN(i=+this._x.call(null,t[e]))||(r[e]=i,i<a&&(a=i),i>o&&(o=i));if(a>o)return this;for(this.cover(a).cover(o),e=0;e<n;++e)Pl(this,r[e],t[e]);return this},Hl.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,i=this._x1;if(isNaN(e))i=(e=Math.floor(t))+1;else{for(var n,r,a=i-e||1,o=this._root;e>t||t>=i;)switch(r=+(t<e),(n=new Array(2))[r]=o,o=n,a*=2,r){case 0:i=e+a;break;case 1:e=i-a}this._root&&this._root.length&&(this._root=o)}return this._x0=e,this._x1=i,this},Hl.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Hl.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},Hl.find=function(t,e){var i,n,r,a,o,s=this._x0,l=this._x1,c=[],h=this._root;for(h&&c.push(new Nl(h,s,l)),null==e?e=1/0:(s=t-e,l=t+e);a=c.pop();)if(!(!(h=a.node)||(n=a.x0)>l||(r=a.x1)<s))if(h.length){var u=(n+r)/2;c.push(new Nl(h[1],u,r),new Nl(h[0],n,u)),(o=+(t>=u))&&(a=c[c.length-1],c[c.length-1]=c[c.length-1-o],c[c.length-1-o]=a)}else{var d=Math.abs(t-+this._x.call(null,h.data));d<e&&(e=d,s=t-d,l=t+d,i=h.data)}return i},Hl.remove=function(t){if(isNaN(a=+this._x.call(null,t)))return this;var e,i,n,r,a,o,s,l,c,h=this._root,u=this._x0,d=this._x1;if(!h)return this;if(h.length)for(;;){if((s=a>=(o=(u+d)/2))?u=o:d=o,e=h,!(h=h[l=+s]))return this;if(!h.length)break;e[l+1&1]&&(i=e,c=l)}for(;h.data!==t;)if(n=h,!(h=h.next))return this;return(r=h.next)&&delete h.next,n?(r?n.next=r:delete n.next,this):e?(r?e[l]=r:delete e[l],(h=e[0]||e[1])&&h===(e[1]||e[0])&&!h.length&&(i?i[c]=h:this._root=h),this):(this._root=r,this)},Hl.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},Hl.root=function(){return this._root},Hl.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Hl.visit=function(t){var e,i,n,r,a=[],o=this._root;for(o&&a.push(new Nl(o,this._x0,this._x1));e=a.pop();)if(!t(o=e.node,n=e.x0,r=e.x1)&&o.length){var s=(n+r)/2;(i=o[1])&&a.push(new Nl(i,s,r)),(i=o[0])&&a.push(new Nl(i,n,s))}return this},Hl.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new Nl(this._root,this._x0,this._x1));e=i.pop();){var r=e.node;if(r.length){var a,o=e.x0,s=e.x1,l=(o+s)/2;(a=r[0])&&i.push(new Nl(a,o,l)),(a=r[1])&&i.push(new Nl(a,l,s))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},Hl.x=function(t){return arguments.length?(this._x=t,this):this._x};function Vl(t,e,i,n){if(isNaN(e)||isNaN(i))return t;var r,a,o,s,l,c,h,u,d,p=t._root,f={data:n},g=t._x0,m=t._y0,y=t._x1,b=t._y1;if(!p)return t._root=f,t;for(;p.length;)if((c=e>=(a=(g+y)/2))?g=a:y=a,(h=i>=(o=(m+b)/2))?m=o:b=o,r=p,!(p=p[u=h<<1|c]))return r[u]=f,t;if(s=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===s&&i===l)return f.next=p,r?r[u]=f:t._root=f,t;do{r=r?r[u]=new Array(4):t._root=new Array(4),(c=e>=(a=(g+y)/2))?g=a:y=a,(h=i>=(o=(m+b)/2))?m=o:b=o}while((u=h<<1|c)==(d=(l>=o)<<1|s>=a));return r[d]=p,r[u]=f,t}var Gl=function(t,e,i,n,r){this.node=t,this.x0=e,this.y0=i,this.x1=n,this.y1=r};function jl(t){return t[0]}function Wl(t){return t[1]}function ql(t,e,i){var n=new Zl(null==e?jl:e,null==i?Wl:i,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function Zl(t,e,i,n,r,a){this._x=t,this._y=e,this._x0=i,this._y0=n,this._x1=r,this._y1=a,this._root=void 0}function Jl(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var Xl=ql.prototype=Zl.prototype;Xl.copy=function(){var t,e,i=new Zl(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return i;if(!n.length)return i._root=Jl(n),i;for(t=[{source:n,target:i._root=new Array(4)}];n=t.pop();)for(var r=0;r<4;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(4)}):n.target[r]=Jl(e));return i},Xl.add=function(t){const e=+this._x.call(null,t),i=+this._y.call(null,t);return Vl(this.cover(e,i),e,i,t)},Xl.addAll=function(t){var e,i,n,r,a=t.length,o=new Array(a),s=new Array(a),l=1/0,c=1/0,h=-1/0,u=-1/0;for(i=0;i<a;++i)isNaN(n=+this._x.call(null,e=t[i]))||isNaN(r=+this._y.call(null,e))||(o[i]=n,s[i]=r,n<l&&(l=n),n>h&&(h=n),r<c&&(c=r),r>u&&(u=r));if(l>h||c>u)return this;for(this.cover(l,c).cover(h,u),i=0;i<a;++i)Vl(this,o[i],s[i],t[i]);return this},Xl.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var i=this._x0,n=this._y0,r=this._x1,a=this._y1;if(isNaN(i))r=(i=Math.floor(t))+1,a=(n=Math.floor(e))+1;else{for(var o,s,l=r-i||1,c=this._root;i>t||t>=r||n>e||e>=a;)switch(s=(e<n)<<1|t<i,(o=new Array(4))[s]=c,c=o,l*=2,s){case 0:r=i+l,a=n+l;break;case 1:i=r-l,a=n+l;break;case 2:r=i+l,n=a-l;break;case 3:i=r-l,n=a-l}this._root&&this._root.length&&(this._root=c)}return this._x0=i,this._y0=n,this._x1=r,this._y1=a,this},Xl.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Xl.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Xl.find=function(t,e,i){var n,r,a,o,s,l,c,h=this._x0,u=this._y0,d=this._x1,p=this._y1,f=[],g=this._root;for(g&&f.push(new Gl(g,h,u,d,p)),null==i?i=1/0:(h=t-i,u=e-i,d=t+i,p=e+i,i*=i);l=f.pop();)if(!(!(g=l.node)||(r=l.x0)>d||(a=l.y0)>p||(o=l.x1)<h||(s=l.y1)<u))if(g.length){var m=(r+o)/2,y=(a+s)/2;f.push(new Gl(g[3],m,y,o,s),new Gl(g[2],r,y,m,s),new Gl(g[1],m,a,o,y),new Gl(g[0],r,a,m,y)),(c=(e>=y)<<1|t>=m)&&(l=f[f.length-1],f[f.length-1]=f[f.length-1-c],f[f.length-1-c]=l)}else{var b=t-+this._x.call(null,g.data),v=e-+this._y.call(null,g.data),x=b*b+v*v;if(x<i){var _=Math.sqrt(i=x);h=t-_,u=e-_,d=t+_,p=e+_,n=g.data}}return n},Xl.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(o=+this._y.call(null,t)))return this;var e,i,n,r,a,o,s,l,c,h,u,d,p=this._root,f=this._x0,g=this._y0,m=this._x1,y=this._y1;if(!p)return this;if(p.length)for(;;){if((c=a>=(s=(f+m)/2))?f=s:m=s,(h=o>=(l=(g+y)/2))?g=l:y=l,e=p,!(p=p[u=h<<1|c]))return this;if(!p.length)break;(e[u+1&3]||e[u+2&3]||e[u+3&3])&&(i=e,d=u)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(r=p.next)&&delete p.next,n?(r?n.next=r:delete n.next,this):e?(r?e[u]=r:delete e[u],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(i?i[d]=p:this._root=p),this):(this._root=r,this)},Xl.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},Xl.root=function(){return this._root},Xl.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Xl.visit=function(t){var e,i,n,r,a,o,s=[],l=this._root;for(l&&s.push(new Gl(l,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(l=e.node,n=e.x0,r=e.y0,a=e.x1,o=e.y1)&&l.length){var c=(n+a)/2,h=(r+o)/2;(i=l[3])&&s.push(new Gl(i,c,h,a,o)),(i=l[2])&&s.push(new Gl(i,n,h,c,o)),(i=l[1])&&s.push(new Gl(i,c,r,a,h)),(i=l[0])&&s.push(new Gl(i,n,r,c,h))}return this},Xl.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new Gl(this._root,this._x0,this._y0,this._x1,this._y1));e=i.pop();){var r=e.node;if(r.length){var a,o=e.x0,s=e.y0,l=e.x1,c=e.y1,h=(o+l)/2,u=(s+c)/2;(a=r[0])&&i.push(new Gl(a,o,s,h,u)),(a=r[1])&&i.push(new Gl(a,h,s,l,u)),(a=r[2])&&i.push(new Gl(a,o,u,h,c)),(a=r[3])&&i.push(new Gl(a,h,u,l,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},Xl.x=function(t){return arguments.length?(this._x=t,this):this._x},Xl.y=function(t){return arguments.length?(this._y=t,this):this._y};function Yl(t,e,i,n,r){if(isNaN(e)||isNaN(i)||isNaN(n))return t;var a,o,s,l,c,h,u,d,p,f,g,m,y=t._root,b={data:r},v=t._x0,x=t._y0,_=t._z0,A=t._x1,w=t._y1,C=t._z1;if(!y)return t._root=b,t;for(;y.length;)if((d=e>=(o=(v+A)/2))?v=o:A=o,(p=i>=(s=(x+w)/2))?x=s:w=s,(f=n>=(l=(_+C)/2))?_=l:C=l,a=y,!(y=y[g=f<<2|p<<1|d]))return a[g]=b,t;if(c=+t._x.call(null,y.data),h=+t._y.call(null,y.data),u=+t._z.call(null,y.data),e===c&&i===h&&n===u)return b.next=y,a?a[g]=b:t._root=b,t;do{a=a?a[g]=new Array(8):t._root=new Array(8),(d=e>=(o=(v+A)/2))?v=o:A=o,(p=i>=(s=(x+w)/2))?x=s:w=s,(f=n>=(l=(_+C)/2))?_=l:C=l}while((g=f<<2|p<<1|d)==(m=(u>=l)<<2|(h>=s)<<1|c>=o));return a[m]=y,a[g]=b,t}var Kl=function(t,e,i,n,r,a,o){this.node=t,this.x0=e,this.y0=i,this.z0=n,this.x1=r,this.y1=a,this.z1=o};function $l(t){return t[0]}function tc(t){return t[1]}function ec(t){return t[2]}function ic(t,e,i,n){var r=new nc(null==e?$l:e,null==i?tc:i,null==n?ec:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function nc(t,e,i,n,r,a,o,s,l){this._x=t,this._y=e,this._z=i,this._x0=n,this._y0=r,this._z0=a,this._x1=o,this._y1=s,this._z1=l,this._root=void 0}function rc(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var ac=ic.prototype=nc.prototype;ac.copy=function(){var t,e,i=new nc(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return i;if(!n.length)return i._root=rc(n),i;for(t=[{source:n,target:i._root=new Array(8)}];n=t.pop();)for(var r=0;r<8;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(8)}):n.target[r]=rc(e));return i},ac.add=function(t){var e=+this._x.call(null,t),i=+this._y.call(null,t),n=+this._z.call(null,t);return Yl(this.cover(e,i,n),e,i,n,t)},ac.addAll=function(t){var e,i,n,r,a,o=t.length,s=new Array(o),l=new Array(o),c=new Array(o),h=1/0,u=1/0,d=1/0,p=-1/0,f=-1/0,g=-1/0;for(i=0;i<o;++i)isNaN(n=+this._x.call(null,e=t[i]))||isNaN(r=+this._y.call(null,e))||isNaN(a=+this._z.call(null,e))||(s[i]=n,l[i]=r,c[i]=a,n<h&&(h=n),n>p&&(p=n),r<u&&(u=r),r>f&&(f=r),a<d&&(d=a),a>g&&(g=a));if(h>p||u>f||d>g)return this;for(this.cover(h,u,d).cover(p,f,g),i=0;i<o;++i)Yl(this,s[i],l[i],c[i],t[i]);return this},ac.cover=function(t,e,i){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(i=+i))return this;var n=this._x0,r=this._y0,a=this._z0,o=this._x1,s=this._y1,l=this._z1;if(isNaN(n))o=(n=Math.floor(t))+1,s=(r=Math.floor(e))+1,l=(a=Math.floor(i))+1;else{for(var c,h,u=o-n||1,d=this._root;n>t||t>=o||r>e||e>=s||a>i||i>=l;)switch(h=(i<a)<<2|(e<r)<<1|t<n,(c=new Array(8))[h]=d,d=c,u*=2,h){case 0:o=n+u,s=r+u,l=a+u;break;case 1:n=o-u,s=r+u,l=a+u;break;case 2:o=n+u,r=s-u,l=a+u;break;case 3:n=o-u,r=s-u,l=a+u;break;case 4:o=n+u,s=r+u,a=l-u;break;case 5:n=o-u,s=r+u,a=l-u;break;case 6:o=n+u,r=s-u,a=l-u;break;case 7:n=o-u,r=s-u,a=l-u}this._root&&this._root.length&&(this._root=d)}return this._x0=n,this._y0=r,this._z0=a,this._x1=o,this._y1=s,this._z1=l,this},ac.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},ac.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},ac.find=function(t,e,i,n){var r,a,o,s,l,c,h,u,d,p=this._x0,f=this._y0,g=this._z0,m=this._x1,y=this._y1,b=this._z1,v=[],x=this._root;for(x&&v.push(new Kl(x,p,f,g,m,y,b)),null==n?n=1/0:(p=t-n,f=e-n,g=i-n,m=t+n,y=e+n,b=i+n,n*=n);u=v.pop();)if(!(!(x=u.node)||(a=u.x0)>m||(o=u.y0)>y||(s=u.z0)>b||(l=u.x1)<p||(c=u.y1)<f||(h=u.z1)<g))if(x.length){var _=(a+l)/2,A=(o+c)/2,w=(s+h)/2;v.push(new Kl(x[7],_,A,w,l,c,h),new Kl(x[6],a,A,w,_,c,h),new Kl(x[5],_,o,w,l,A,h),new Kl(x[4],a,o,w,_,A,h),new Kl(x[3],_,A,s,l,c,w),new Kl(x[2],a,A,s,_,c,w),new Kl(x[1],_,o,s,l,A,w),new Kl(x[0],a,o,s,_,A,w)),(d=(i>=w)<<2|(e>=A)<<1|t>=_)&&(u=v[v.length-1],v[v.length-1]=v[v.length-1-d],v[v.length-1-d]=u)}else{var C=t-+this._x.call(null,x.data),M=e-+this._y.call(null,x.data),I=i-+this._z.call(null,x.data),E=C*C+M*M+I*I;if(E<n){var S=Math.sqrt(n=E);p=t-S,f=e-S,g=i-S,m=t+S,y=e+S,b=i+S,r=x.data}}return r},ac.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(o=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))return this;var e,i,n,r,a,o,s,l,c,h,u,d,p,f,g,m=this._root,y=this._x0,b=this._y0,v=this._z0,x=this._x1,_=this._y1,A=this._z1;if(!m)return this;if(m.length)for(;;){if((u=a>=(l=(y+x)/2))?y=l:x=l,(d=o>=(c=(b+_)/2))?b=c:_=c,(p=s>=(h=(v+A)/2))?v=h:A=h,e=m,!(m=m[f=p<<2|d<<1|u]))return this;if(!m.length)break;(e[f+1&7]||e[f+2&7]||e[f+3&7]||e[f+4&7]||e[f+5&7]||e[f+6&7]||e[f+7&7])&&(i=e,g=f)}for(;m.data!==t;)if(n=m,!(m=m.next))return this;return(r=m.next)&&delete m.next,n?(r?n.next=r:delete n.next,this):e?(r?e[f]=r:delete e[f],(m=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&m===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!m.length&&(i?i[g]=m:this._root=m),this):(this._root=r,this)},ac.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},ac.root=function(){return this._root},ac.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},ac.visit=function(t){var e,i,n,r,a,o,s,l,c=[],h=this._root;for(h&&c.push(new Kl(h,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=c.pop();)if(!t(h=e.node,n=e.x0,r=e.y0,a=e.z0,o=e.x1,s=e.y1,l=e.z1)&&h.length){var u=(n+o)/2,d=(r+s)/2,p=(a+l)/2;(i=h[7])&&c.push(new Kl(i,u,d,p,o,s,l)),(i=h[6])&&c.push(new Kl(i,n,d,p,u,s,l)),(i=h[5])&&c.push(new Kl(i,u,r,p,o,d,l)),(i=h[4])&&c.push(new Kl(i,n,r,p,u,d,l)),(i=h[3])&&c.push(new Kl(i,u,d,a,o,s,p)),(i=h[2])&&c.push(new Kl(i,n,d,a,u,s,p)),(i=h[1])&&c.push(new Kl(i,u,r,a,o,d,p)),(i=h[0])&&c.push(new Kl(i,n,r,a,u,d,p))}return this},ac.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new Kl(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=i.pop();){var r=e.node;if(r.length){var a,o=e.x0,s=e.y0,l=e.z0,c=e.x1,h=e.y1,u=e.z1,d=(o+c)/2,p=(s+h)/2,f=(l+u)/2;(a=r[0])&&i.push(new Kl(a,o,s,l,d,p,f)),(a=r[1])&&i.push(new Kl(a,d,s,l,c,p,f)),(a=r[2])&&i.push(new Kl(a,o,p,l,d,h,f)),(a=r[3])&&i.push(new Kl(a,d,p,l,c,h,f)),(a=r[4])&&i.push(new Kl(a,o,s,f,d,p,u)),(a=r[5])&&i.push(new Kl(a,d,s,f,c,p,u)),(a=r[6])&&i.push(new Kl(a,o,p,f,d,h,u)),(a=r[7])&&i.push(new Kl(a,d,p,f,c,h,u))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},ac.x=function(t){return arguments.length?(this._x=t,this):this._x},ac.y=function(t){return arguments.length?(this._y=t,this):this._y},ac.z=function(t){return arguments.length?(this._z=t,this):this._z};var oc=function(){var t,e,i,n,r,a,o=Fl(-30),s=1,l=1/0,c=.81;function h(n){var a,o=t.length,s=(1===e?Ql(t,Ml):2===e?ql(t,Ml,Il):3===e?ic(t,Ml,Il,El):null).visitAfter(d);for(r=n,a=0;a<o;++a)i=t[a],s.visit(p)}function u(){if(t){var e,i,n=t.length;for(a=new Array(n),e=0;e<n;++e)i=t[e],a[i.index]=+o(i,e,t)}}function d(t){var i,n,r,o,s,l,c=0,h=0,u=t.length;if(u){for(r=o=s=l=0;l<u;++l)(i=t[l])&&(n=Math.abs(i.value))&&(c+=i.value,h+=n,r+=n*(i.x||0),o+=n*(i.y||0),s+=n*(i.z||0));c*=Math.sqrt(4/u),t.x=r/h,e>1&&(t.y=o/h),e>2&&(t.z=s/h)}else{(i=t).x=i.data.x,e>1&&(i.y=i.data.y),e>2&&(i.z=i.data.z);do{c+=a[i.data.index]}while(i=i.next)}t.value=c}function p(t,o,h,u,d){if(!t.value)return!0;var p=[h,u,d][e-1],f=t.x-i.x,g=e>1?t.y-i.y:0,m=e>2?t.z-i.z:0,y=p-o,b=f*f+g*g+m*m;if(y*y/c<b)return b<l&&(0===f&&(b+=(f=Ll(n))*f),e>1&&0===g&&(b+=(g=Ll(n))*g),e>2&&0===m&&(b+=(m=Ll(n))*m),b<s&&(b=Math.sqrt(s*b)),i.vx+=f*t.value*r/b,e>1&&(i.vy+=g*t.value*r/b),e>2&&(i.vz+=m*t.value*r/b)),!0;if(!(t.length||b>=l)){(t.data!==i||t.next)&&(0===f&&(b+=(f=Ll(n))*f),e>1&&0===g&&(b+=(g=Ll(n))*g),e>2&&0===m&&(b+=(m=Ll(n))*m),b<s&&(b=Math.sqrt(s*b)));do{t.data!==i&&(y=a[t.data.index]*r/b,i.vx+=f*y,e>1&&(i.vy+=g*y),e>2&&(i.vz+=m*y))}while(t=t.next)}}return h.initialize=function(i,...r){t=i,n=r.find(t=>"function"==typeof t)||Math.random,e=r.find(t=>[1,2,3].includes(t))||2,u()},h.strength=function(t){return arguments.length?(o="function"==typeof t?t:Fl(+t),u(),h):o},h.distanceMin=function(t){return arguments.length?(s=t*t,h):Math.sqrt(s)},h.distanceMax=function(t){return arguments.length?(l=t*t,h):Math.sqrt(l)},h.theta=function(t){return arguments.length?(c=t*t,h):Math.sqrt(c)},h},sc=function(t,e,i){var n,r=1;function a(){var a,o,s=n.length,l=0,c=0,h=0;for(a=0;a<s;++a)l+=(o=n[a]).x||0,c+=o.y||0,h+=o.z||0;for(l=(l/s-t)*r,c=(c/s-e)*r,h=(h/s-i)*r,a=0;a<s;++a)o=n[a],l&&(o.x-=l),c&&(o.y-=c),h&&(o.z-=h)}return null==t&&(t=0),null==e&&(e=0),null==i&&(i=0),a.initialize=function(t){n=t},a.x=function(e){return arguments.length?(t=+e,a):t},a.y=function(t){return arguments.length?(e=+t,a):e},a.z=function(t){return arguments.length?(i=+t,a):i},a.strength=function(t){return arguments.length?(r=+t,a):r},a},lc=i(8),cc=i.n(lc),hc=i(9),uc=i.n(hc),dc=i(10),pc=i.n(dc);function fc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t))&&"[object Arguments]"!==Object.prototype.toString.call(t))return;var i=[],n=!0,r=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done)&&(i.push(o.value),!e||i.length!==e);n=!0);}catch(t){r=!0,a=t}finally{try{n||null==s.return||s.return()}finally{if(r)throw a}}return i}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var gc=function t(e,i){var n=i.default,r=void 0===n?null:n,a=i.triggerUpdate,o=void 0===a||a,s=i.onChange,l=void 0===s?function(t,e){}:s;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l};var mc=function(t){var e=t.stateInit,i=void 0===e?function(){return{}}:e,n=t.props,r=void 0===n?{}:n,a=t.methods,o=void 0===a?{}:a,s=t.aliases,l=void 0===s?{}:s,c=t.init,h=void 0===c?function(){}:c,u=t.update,d=void 0===u?function(){}:u,p=Object.keys(r).map((function(t){return new gc(t,r[t])}));return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign({},i instanceof Function?i(t):i,{initialised:!1}),n={};function r(e){return a(e,t),s(),r}var a=function(t,i){h.call(r,t,e,i),e.initialised=!0},s=pc()((function(){e.initialised&&(d.call(r,e,n),n={})}),1);return p.forEach((function(t){r[t.name]=function(t){var i=t.name,a=t.triggerUpdate,o=void 0!==a&&a,l=t.onChange,c=void 0===l?function(t,e){}:l,h=t.defaultVal,u=void 0===h?null:h;return function(t){var a=e[i];if(!arguments.length)return a;var l=void 0===t?u:t;return e[i]=l,c.call(r,l,e,a),!n.hasOwnProperty(i)&&(n[i]=a),o&&s(),r}}(t)})),Object.keys(o).forEach((function(t){r[t]=function(){for(var i,n=arguments.length,a=new Array(n),s=0;s<n;s++)a[s]=arguments[s];return(i=o[t]).call.apply(i,[r,e].concat(a))}})),Object.entries(l).forEach((function(t){var e=fc(t,2),i=e[0],n=e[1];return r[i]=r[n]})),r.resetProps=function(){return p.forEach((function(t){r[t.name](t.defaultVal)})),r},r.resetProps(),e._rerender=s,r}},yc=i(1);function bc(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i>e||void 0===i&&e>=e)&&(i=e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(i>r||void 0===i&&r>=r)&&(i=r)}return i}function vc(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i<e||void 0===i&&e>=e)&&(i=e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(i<r||void 0===i&&r>=r)&&(i=r)}return i}function xc(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function _c(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t))&&"[object Arguments]"!==Object.prototype.toString.call(t))return;var i=[],n=!0,r=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done)&&(i.push(o.value),!e||i.length!==e);n=!0);}catch(t){r=!0,a=t}finally{try{n||null==s.return||s.return()}finally{if(r)throw a}}return i}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ac(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function wc(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var Cc=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=(e instanceof Array?e.length?e:[void 0]:[e]).map((function(t){return{keyAccessor:t,isProp:!(t instanceof Function)}})),a=t.reduce((function(t,e){var n=t,a=e;return r.forEach((function(t,e){var o,s=t.keyAccessor;if(t.isProp){var l=a,c=l[s],h=xc(l,[s].map(wc));o=c,a=h}else o=s(a,e);e+1<r.length?(n.hasOwnProperty(o)||(n[o]={}),n=n[o]):i?(n.hasOwnProperty(o)||(n[o]=[]),n[o].push(a)):n[o]=a})),t}),{});i instanceof Function&&function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;n===r.length?Object.keys(e).forEach((function(t){return e[t]=i(e[t])})):Object.values(e).forEach((function(e){return t(e,n+1)}))}(a);var o=a;return n&&(o=[],function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];i.length===r.length?o.push({keys:i,vals:e}):Object.entries(e).forEach((function(e){var n=_c(e,2),r=n[0],a=n[1];return t(a,[].concat(Ac(i),[r]))}))}(a),e instanceof Array&&0===e.length&&1===o.length&&(o[0].keys=[])),o};function Mc(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ic(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Ec(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function Sc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t))&&"[object Arguments]"!==Object.prototype.toString.call(t))return;var i=[],n=!0,r=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done)&&(i.push(o.value),!e||i.length!==e);n=!0);}catch(t){r=!0,a=t}finally{try{n||null==s.return||s.return()}finally{if(r)throw a}}return i}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Tc(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function Bc(t,e,i){var n=i.objBindAttr,r=void 0===n?"__obj":n,a=i.dataBindAttr,o=void 0===a?"__data":a,s=i.idAccessor,l=i.purge,c=void 0!==l&&l,h=function(t){return t.hasOwnProperty(o)},u=e.filter((function(t){return!h(t)})),d=e.filter(h).map((function(t){return t[o]})),p=c?{enter:t,exit:d,update:[]}:function(t,e,i){var n={enter:[],update:[],exit:[]};if(i){var r=Cc(t,i,!1),a=Cc(e,i,!1),o=Object.assign({},r,a);Object.entries(o).forEach((function(t){var e=Sc(t,2),i=e[0],o=e[1],s=r.hasOwnProperty(i)?a.hasOwnProperty(i)?"update":"exit":"enter";n[s].push("update"===s?[r[i],a[i]]:o)}))}else{var s=new Set(t),l=new Set(e);new Set([].concat(Tc(s),Tc(l))).forEach((function(t){var e=s.has(t)?l.has(t)?"update":"exit":"enter";n[e].push("update"===e?[t,t]:t)}))}return n}(d,t,s);return p.update=p.update.map((function(t){var e=Sc(t,2),i=e[0],n=e[1];return i!==n&&(n[r]=i[r],n[r][o]=n),n})),p.exit=p.exit.concat(u.map((function(t){return Mc({},r,t)}))),p}var Fc=function(t,e,i,n,r){var a=r.createObj,o=void 0===a?function(t){return{}}:a,s=r.updateObj,l=void 0===s?function(t,e){}:s,c=r.exitObj,h=void 0===c?function(t){}:c,u=r.objBindAttr,d=void 0===u?"__obj":u,p=r.dataBindAttr,f=void 0===p?"__data":p,g=Ec(r,["createObj","updateObj","exitObj","objBindAttr","dataBindAttr"]),m=Bc(t,e,function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ic(Object(i),!0).forEach((function(e){Mc(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ic(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({objBindAttr:d,dataBindAttr:f},g)),y=m.enter,b=m.update;m.exit.forEach((function(t){var e=t[d];delete t[d],h(e),n(e)}));var v=function(t){var e=[];return t.forEach((function(t){var i=o(t);i&&(i[f]=t,t[d]=i,e.push(i))})),e}(y);!function(t){t.forEach((function(t){var e=t[d];e&&(e[f]=t,l(e,t))}))}([].concat(Tc(y),Tc(b))),v.forEach(i)};function Lc(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}const Uc=Symbol("implicit");var Rc=function(t){for(var e=t.length/6|0,i=new Array(e),n=0;n<e;)i[n]="#"+t.slice(6*n,6*++n);return i}("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Dc=i(5),Pc=i.n(Dc);function Nc(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function zc(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Nc(Object(i),!0).forEach((function(e){kc(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Nc(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Qc(t){return(Qc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Oc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kc(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Hc(t,e){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}}),e&&Gc(t,e)}function Vc(t){return(Vc=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Gc(t,e){return(Gc=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function jc(){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(t){return!1}}function Wc(t,e,i){return(Wc=jc()?Reflect.construct:function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&Gc(r,i.prototype),r}).apply(null,arguments)}function qc(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function Zc(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Jc(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?Zc(t):e}function Xc(t){var e=jc();return function(){var i,n=Vc(t);if(e){var r=Vc(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return Jc(this,i)}}function Yc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==i)return;var n,r,a=[],o=!0,s=!1;try{for(i=i.call(t);!(o=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);o=!0);}catch(t){s=!0,r=t}finally{try{o||null==i.return||i.return()}finally{if(s)throw r}}return a}(t,e)||$c(t,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.")}()}function Kc(t){return function(t){if(Array.isArray(t))return th(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$c(t)||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 $c(t,e){if(t){if("string"==typeof t)return th(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?th(t,e):void 0}}function th(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var eh=function t(e){e.geometry&&e.geometry.dispose(),e.material&&function t(e){e instanceof Array?e.forEach(t):(e.map&&e.map.dispose(),e.dispose())}(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(t)},ih=function(t){for(;t.children.length;){var e=t.children[0];t.remove(e),eh(e)}},nh=["objFilter"];function rh(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.objFilter,r=void 0===n?function(){return!0}:n,a=qc(i,nh);return Fc(t,e.children.filter(r),(function(t){return e.add(t)}),(function(t){e.remove(t),ih(t)}),zc({objBindAttr:"__threeObj"},a))}var ah=function(t){return isNaN(t)?parseInt(Pc()(t).toHex(),16):t},oh=function(t){return isNaN(t)?Pc()(t).getAlpha():1},sh=function t(){var e=new Map,i=[],n=[],r=Uc;function a(t){var a=t+"",o=e.get(a);if(!o){if(r!==Uc)return r;e.set(a,o=i.push(t))}return n[(o-1)%n.length]}return a.domain=function(t){if(!arguments.length)return i.slice();i=[],e=new Map;for(const n of t){const t=n+"";e.has(t)||e.set(t,i.push(n))}return a},a.range=function(t){return arguments.length?(n=Array.from(t),a):n.slice()},a.unknown=function(t){return arguments.length?(r=t,a):r},a.copy=function(){return t(i,n).unknown(r)},Lc.apply(a,arguments),a}(Rc);function lh(t,e,i){e&&"string"==typeof i&&t.filter((function(t){return!t[i]})).forEach((function(t){t[i]=sh(e(t))}))}var ch=window.THREE?window.THREE:{Group:Wn,Mesh:Ee,MeshLambertMaterial:ja,Color:Ot,BufferGeometry:ce,BufferAttribute:Gt,Matrix4:j,Vector3:y,SphereBufferGeometry:Pa,CylinderBufferGeometry:ia,TubeBufferGeometry:Na,ConeBufferGeometry:na,Line:Vr,LineBasicMaterial:Nr,QuadraticBezierCurve3:No,CubicBezierCurve3:Ro,Box3:x},hh={graph:cc.a,forcelayout:uc.a},uh=(new ch.BufferGeometry).setAttribute?"setAttribute":"addAttribute",dh=(new ch.BufferGeometry).applyMatrix4?"applyMatrix4":"applyMatrix";var ph=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=function(e){Hc(r,e);var n=Xc(r);function r(){var e;Oc(this,r);for(var a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];return(e=n.call.apply(n,[this].concat(o))).__kapsuleInstance=t().apply(void 0,[].concat(Kc(i?[Zc(e)]:[]),o)),e}return r}(e);return Object.keys(t()).forEach((function(t){return n.prototype[t]=function(){var e,i=(e=this.__kapsuleInstance)[t].apply(e,arguments);return i===this.__kapsuleInstance?this:i}})),n}(mc({props:{jsonUrl:{onChange:function(t,e){var i=this;t&&!e.fetchingJson&&(e.fetchingJson=!0,e.onLoading(),fetch(t).then((function(t){return t.json()})).then((function(t){e.fetchingJson=!1,e.onFinishLoading(t),i.graphData(t)})))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(t,e){e.engineRunning=!1}},numDimensions:{default:3,onChange:function(t,e){var i=e.d3ForceLayout.force("charge");function n(t,e){t.forEach((function(t){delete t[e],delete t["v".concat(e)]}))}i&&i.strength(t>2?-60:-30),t<3&&n(e.graphData.nodes,"z"),t<2&&n(e.graphData.nodes,"y")}},dagMode:{onChange:function(t,e){!t&&"d3"===e.forceEngine&&(e.graphData.nodes||[]).forEach((function(t){return t.fx=t.fy=t.fz=void 0}))}},dagLevelDistance:{},dagNodeFilter:{default:function(t){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.alphaDecay(t)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.alphaTarget(t)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.velocityDecay(t)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(t){return t._flushObjects=!0,t._rerender(),this},d3Force:function(t,e,i){return void 0===i?t.d3ForceLayout.force(e):(t.d3ForceLayout.force(e,i),this)},d3ReheatSimulation:function(t){return t.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(t){return t.cntTicks=0,t.startTickTime=new Date,t.engineRunning=!0,this},tickFrame:function(t){var e,i,n,r,a="ngraph"!==t.forceEngine;return t.engineRunning&&function(){++t.cntTicks>t.cooldownTicks||new Date-t.startTickTime>t.cooldownTime||a&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin?(t.engineRunning=!1,t.onEngineStop()):(t.layout[a?"tick":"step"](),t.onEngineTick());t.graphData.nodes.forEach((function(e){var i=e.__threeObj;if(i){var n=a?e:t.layout.getNodePosition(e[t.nodeId]);i.position.x=n.x,i.position.y=n.y||0,i.position.z=n.z||0}}));var e=Object(yc.default)(t.linkWidth),i=Object(yc.default)(t.linkCurvature),n=Object(yc.default)(t.linkCurveRotation),r=Object(yc.default)(t.linkThreeObjectExtend);t.graphData.links.forEach((function(o){var s=o.__lineObj;if(s){var l=a?o:t.layout.getLinkPosition(t.layout.graph.getLink(o.source,o.target).id),c=l[a?"source":"from"],h=l[a?"target":"to"];if(c&&h&&c.hasOwnProperty("x")&&h.hasOwnProperty("x")){!function(e){var r=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),o=r[a?"source":"from"],s=r[a?"target":"to"];if(o&&s&&o.hasOwnProperty("x")&&s.hasOwnProperty("x")){var l=i(e);if(l){var c,h=new ch.Vector3(o.x,o.y||0,o.z||0),u=new ch.Vector3(s.x,s.y||0,s.z||0),d=h.distanceTo(u),p=n(e);if(d>0){var f=s.x-o.x,g=s.y-o.y||0,m=(new ch.Vector3).subVectors(u,h),y=m.clone().multiplyScalar(l).cross(0!==f||0!==g?new ch.Vector3(0,0,1):new ch.Vector3(0,1,0)).applyAxisAngle(m.normalize(),p).add((new ch.Vector3).addVectors(h,u).divideScalar(2));c=new ch.QuadraticBezierCurve3(h,y,u)}else{var b=70*l,v=-p,x=v+Math.PI/2;c=new ch.CubicBezierCurve3(h,new ch.Vector3(b*Math.cos(x),b*Math.sin(x),0).add(h),new ch.Vector3(b*Math.cos(v),b*Math.sin(v),0).add(h),u)}e.__curve=c}else e.__curve=null}}(o);var u=r(o);if(!t.linkPositionUpdate||!t.linkPositionUpdate(u?s.children[1]:s,{start:{x:c.x,y:c.y,z:c.z},end:{x:h.x,y:h.y,z:h.z}},o)||u){var d=o.__curve,p=s.children.length?s.children[0]:s;if("Line"===p.type){if(d)p.geometry.setFromPoints(d.getPoints(30));else{var f=p.geometry.getAttribute("position");f&&f.array&&6===f.array.length||p.geometry[uh]("position",f=new ch.BufferAttribute(new Float32Array(6),3)),f.array[0]=c.x,f.array[1]=c.y||0,f.array[2]=c.z||0,f.array[3]=h.x,f.array[4]=h.y||0,f.array[5]=h.z||0,f.needsUpdate=!0}p.geometry.computeBoundingSphere()}else if("Mesh"===p.type)if(d){p.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(p.position.set(0,0,0),p.rotation.set(0,0,0),p.scale.set(1,1,1));var g=Math.ceil(10*e(o))/10/2,m=new ch.TubeBufferGeometry(d,30,g,t.linkResolution,!1);p.geometry.dispose(),p.geometry=m}else{if(!p.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var y=Math.ceil(10*e(o))/10/2,b=new ch.CylinderBufferGeometry(y,y,1,t.linkResolution,1,!1);b[dh]((new ch.Matrix4).makeTranslation(0,.5,0)),b[dh]((new ch.Matrix4).makeRotationX(Math.PI/2)),p.geometry.dispose(),p.geometry=b}var v=new ch.Vector3(c.x,c.y||0,c.z||0),x=new ch.Vector3(h.x,h.y||0,h.z||0),_=v.distanceTo(x);p.position.x=v.x,p.position.y=v.y,p.position.z=v.z,p.scale.z=_,p.parent.localToWorld(x),p.lookAt(x)}}}}}))}(),e=Object(yc.default)(t.linkDirectionalArrowRelPos),i=Object(yc.default)(t.linkDirectionalArrowLength),n=Object(yc.default)(t.nodeVal),t.graphData.links.forEach((function(r){var o=r.__arrowObj;if(o){var s=a?r:t.layout.getLinkPosition(t.layout.graph.getLink(r.source,r.target).id),l=s[a?"source":"from"],c=s[a?"target":"to"];if(l&&c&&l.hasOwnProperty("x")&&c.hasOwnProperty("x")){var h=Math.sqrt(Math.max(0,n(l)||1))*t.nodeRelSize,u=Math.sqrt(Math.max(0,n(c)||1))*t.nodeRelSize,d=i(r),p=e(r),f=r.__curve?function(t){return r.__curve.getPoint(t)}:function(t){var e=function(t,e,i,n){return e[t]+(i[t]-e[t])*n||0};return{x:e("x",l,c,t),y:e("y",l,c,t),z:e("z",l,c,t)}},g=r.__curve?r.__curve.getLength():Math.sqrt(["x","y","z"].map((function(t){return Math.pow((c[t]||0)-(l[t]||0),2)})).reduce((function(t,e){return t+e}),0)),m=h+d+(g-h-u-d)*p,y=f(m/g),b=f((m-d)/g);["x","y","z"].forEach((function(t){return o.position[t]=b[t]}));var v=Wc(ch.Vector3,Kc(["x","y","z"].map((function(t){return y[t]}))));o.parent.localToWorld(v),o.lookAt(v)}}})),r=Object(yc.default)(t.linkDirectionalParticleSpeed),t.graphData.links.forEach((function(e){var i=e.__photonsObj&&e.__photonsObj.children,n=e.__singleHopPhotonsObj&&e.__singleHopPhotonsObj.children;if(n&&n.length||i&&i.length){var o=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),s=o[a?"source":"from"],l=o[a?"target":"to"];if(s&&l&&s.hasOwnProperty("x")&&l.hasOwnProperty("x")){var c=r(e),h=e.__curve?function(t){return e.__curve.getPoint(t)}:function(t){var e=function(t,e,i,n){return e[t]+(i[t]-e[t])*n||0};return{x:e("x",s,l,t),y:e("y",s,l,t),z:e("z",s,l,t)}};[].concat(Kc(i||[]),Kc(n||[])).forEach((function(t,e){var n="singleHopPhotons"===t.parent.__linkThreeObjType;if(t.hasOwnProperty("__progressRatio")||(t.__progressRatio=n?0:e/i.length),t.__progressRatio+=c,t.__progressRatio>=1){if(n)return t.parent.remove(t),void ih(t);t.__progressRatio=t.__progressRatio%1}var r=t.__progressRatio,a=h(r);["x","y","z"].forEach((function(e){return t.position[e]=a[e]}))}))}}})),this},emitParticle:function(t,e){if(e){if(!e.__singleHopPhotonsObj){var i=new ch.Group;i.__linkThreeObjType="singleHopPhotons",e.__singleHopPhotonsObj=i,t.graphScene.add(i)}var n=Object(yc.default)(t.linkDirectionalParticleWidth),r=Math.ceil(10*n(e))/10/2,a=t.linkDirectionalParticleResolution,o=new ch.SphereBufferGeometry(r,a,a),s=Object(yc.default)(t.linkColor),l=Object(yc.default)(t.linkDirectionalParticleColor)(e)||s(e)||"#f0f0f0",c=new ch.Color(ah(l)),h=3*t.linkOpacity,u=new ch.MeshLambertMaterial({color:c,transparent:!0,opacity:h});e.__singleHopPhotonsObj.add(new ch.Mesh(o,u))}return this},getGraphBbox:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};if(!t.initialised)return null;var i=function t(i){var n=[];if(i.geometry){i.geometry.computeBoundingBox();var r=new ch.Box3;r.copy(i.geometry.boundingBox).applyMatrix4(i.matrixWorld),n.push(r)}return n.concat.apply(n,Kc((i.children||[]).filter((function(t){return!t.hasOwnProperty("__graphObjType")||"node"===t.__graphObjType&&e(t.__data)})).map(t)))}(t.graphScene);return i.length?Object.assign.apply(Object,Kc(["x","y","z"].map((function(t){return kc({},t,[bc(i,(function(e){return e.min[t]})),vc(i,(function(e){return e.max[t]}))])})))):null}},stateInit:function(){return{d3ForceLayout:Bl().force("link",Dl()).force("charge",oc()).force("center",sc()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(t,e){e.graphScene=t},update:function(t,e){var i=function(t){return t.some((function(t){return e.hasOwnProperty(t)}))};if(t.engineRunning=!1,t.onUpdate(),null!==t.nodeAutoColorBy&&i(["nodeAutoColorBy","graphData","nodeColor"])&&lh(t.graphData.nodes,Object(yc.default)(t.nodeAutoColorBy),t.nodeColor),null!==t.linkAutoColorBy&&i(["linkAutoColorBy","graphData","linkColor"])&&lh(t.graphData.links,Object(yc.default)(t.linkAutoColorBy),t.linkColor),t._flushObjects||i(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var n=Object(yc.default)(t.nodeThreeObject),r=Object(yc.default)(t.nodeThreeObjectExtend),a=Object(yc.default)(t.nodeVal),o=Object(yc.default)(t.nodeColor),s=Object(yc.default)(t.nodeVisibility),l={},c={};rh(t.graphData.nodes.filter(s),t.graphScene,{purge:t._flushObjects||i(["nodeThreeObject","nodeThreeObjectExtend"]),objFilter:function(t){return"node"===t.__graphObjType},createObj:function(e){var i,a=n(e),o=r(e);return a&&t.nodeThreeObject===a&&(a=a.clone()),a&&!o?i=a:((i=new ch.Mesh).__graphDefaultObj=!0,a&&o&&i.add(a)),i.__graphObjType="node",i},updateObj:function(e,i){if(e.__graphDefaultObj){var n=a(i)||1,r=Math.cbrt(n)*t.nodeRelSize,s=t.nodeResolution;e.geometry.type.match(/^Sphere(Buffer)?Geometry$/)&&e.geometry.parameters.radius===r&&e.geometry.parameters.widthSegments===s||(l.hasOwnProperty(n)||(l[n]=new ch.SphereBufferGeometry(r,s,s)),e.geometry.dispose(),e.geometry=l[n]);var h=o(i),u=new ch.Color(ah(h||"#ffffaa")),d=t.nodeOpacity*oh(h);"MeshLambertMaterial"===e.material.type&&e.material.color.equals(u)&&e.material.opacity===d||(c.hasOwnProperty(h)||(c[h]=new ch.MeshLambertMaterial({color:u,transparent:!0,opacity:d})),e.material.dispose(),e.material=c[h])}}})}if(t._flushObjects||i(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution"])){var h=Object(yc.default)(t.linkThreeObject),u=Object(yc.default)(t.linkThreeObjectExtend),d=Object(yc.default)(t.linkMaterial),p=Object(yc.default)(t.linkVisibility),f=Object(yc.default)(t.linkColor),g=Object(yc.default)(t.linkWidth),m={},y={},b={},v=t.graphData.links.filter(p);if(rh(v,t.graphScene,{objBindAttr:"__lineObj",purge:t._flushObjects||i(["linkThreeObject","linkThreeObjectExtend","linkWidth"]),objFilter:function(t){return"link"===t.__graphObjType},createObj:function(e){var i,n,r=h(e),a=u(e);if(r&&t.linkThreeObject===r&&(r=r.clone()),!r||a)if(!!g(e))i=new ch.Mesh;else{var o=new ch.BufferGeometry;o[uh]("position",new ch.BufferAttribute(new Float32Array(6),3)),i=new ch.Line(o)}return r?a?((n=new ch.Group).__graphDefaultObj=!0,n.add(i),n.add(r)):n=r:(n=i).__graphDefaultObj=!0,n.renderOrder=10,n.__graphObjType="link",n},updateObj:function(e,i){if(e.__graphDefaultObj){var n=e.children.length?e.children[0]:e,r=Math.ceil(10*g(i))/10,a=!!r;if(a){var o=r/2,s=t.linkResolution;if(!n.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||n.geometry.parameters.radiusTop!==o||n.geometry.parameters.radialSegments!==s){if(!m.hasOwnProperty(r)){var l=new ch.CylinderBufferGeometry(o,o,1,s,1,!1);l[dh]((new ch.Matrix4).makeTranslation(0,.5,0)),l[dh]((new ch.Matrix4).makeRotationX(Math.PI/2)),m[r]=l}n.geometry.dispose(),n.geometry=m[r]}}var c=d(i);if(c)n.material=c;else{var h=f(i),u=new ch.Color(ah(h||"#f0f0f0")),p=t.linkOpacity*oh(h),v=a?"MeshLambertMaterial":"LineBasicMaterial";if(n.material.type!==v||!n.material.color.equals(u)||n.material.opacity!==p){var x=a?y:b;x.hasOwnProperty(h)||(x[h]=new ch[v]({color:u,transparent:p<1,opacity:p,depthWrite:p>=1})),n.material.dispose(),n.material=x[h]}}}}}),t.linkDirectionalArrowLength||e.hasOwnProperty("linkDirectionalArrowLength")){var x=Object(yc.default)(t.linkDirectionalArrowLength),_=Object(yc.default)(t.linkDirectionalArrowColor);rh(v.filter(x),t.graphScene,{objBindAttr:"__arrowObj",objFilter:function(t){return"arrow"===t.__linkThreeObjType},createObj:function(){var t=new ch.Mesh(void 0,new ch.MeshLambertMaterial({transparent:!0}));return t.__linkThreeObjType="arrow",t},updateObj:function(e,i){var n=x(i),r=t.linkDirectionalArrowResolution;if(!e.geometry.type.match(/^Cone(Buffer)?Geometry$/)||e.geometry.parameters.height!==n||e.geometry.parameters.radialSegments!==r){var a=new ch.ConeBufferGeometry(.25*n,n,r);a.translate(0,n/2,0),a.rotateX(Math.PI/2),e.geometry.dispose(),e.geometry=a}e.material.color=new ch.Color(_(i)||f(i)||"#f0f0f0"),e.material.opacity=3*t.linkOpacity}})}if(t.linkDirectionalParticles||e.hasOwnProperty("linkDirectionalParticles")){var A=Object(yc.default)(t.linkDirectionalParticles),w=Object(yc.default)(t.linkDirectionalParticleWidth),C=Object(yc.default)(t.linkDirectionalParticleColor),M={},I={};rh(v.filter(A),t.graphScene,{objBindAttr:"__photonsObj",objFilter:function(t){return"photons"===t.__linkThreeObjType},createObj:function(){var t=new ch.Group;return t.__linkThreeObjType="photons",t},updateObj:function(e,i){var n,r=Math.round(Math.abs(A(i))),a=!!e.children.length&&e.children[0],o=Math.ceil(10*w(i))/10/2,s=t.linkDirectionalParticleResolution;a&&a.geometry.parameters.radius===o&&a.geometry.parameters.widthSegments===s?n=a.geometry:(I.hasOwnProperty(o)||(I[o]=new ch.SphereBufferGeometry(o,s,s)),n=I[o],a&&a.geometry.dispose());var l,c=C(i)||f(i)||"#f0f0f0",h=new ch.Color(ah(c)),u=3*t.linkOpacity;a&&a.material.color.equals(h)&&a.material.opacity===u?l=a.material:(M.hasOwnProperty(c)||(M[c]=new ch.MeshLambertMaterial({color:h,transparent:!0,opacity:u})),l=M[c],a&&a.material.dispose()),rh(Kc(new Array(r)).map((function(t,e){return{idx:e}})),e,{idAccessor:function(t){return t.idx},createObj:function(){return new ch.Mesh(n,l)},updateObj:function(t){t.geometry=n,t.material=l}})}})}}if(t._flushObjects=!1,i(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach((function(e){e.source=e[t.linkSource],e.target=e[t.linkTarget]}));var E,S="ngraph"!==t.forceEngine;if(S){(E=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var T=t.d3ForceLayout.force("link");T&&T.id((function(e){return e[t.nodeId]})).links(t.graphData.links);var B=t.dagMode&&function(t,e){var i=t.nodes,n=t.links,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.nodeFilter,o=void 0===a?function(){return!0}:a,s=r.onLoopError,l=void 0===s?function(t){throw"Invalid DAG structure! Found cycle in node path: ".concat(t.join(" -> "),".")}:s,c={};i.forEach((function(t){return c[e(t)]={data:t,out:[],depth:-1,skip:!o(t)}})),n.forEach((function(t){var i=t.source,n=t.target,r=l(i),a=l(n);if(!c.hasOwnProperty(r))throw"Missing source node with id: ".concat(r);if(!c.hasOwnProperty(a))throw"Missing target node with id: ".concat(a);var o=c[r],s=c[a];function l(t){return"object"===Qc(t)?e(t):t}o.out.push(s)}));var h=[];d(Object.values(c));var u=Object.assign.apply(Object,[{}].concat(Kc(Object.entries(c).filter((function(t){return!Yc(t,2)[1].skip})).map((function(t){var e=Yc(t,2);return kc({},e[0],e[1].depth)})))));return u;function d(t){for(var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=0,a=t.length;r<a;r++){var o=t[r];if(-1!==i.indexOf(o)){var s=function(){var t=[].concat(Kc(i.slice(i.indexOf(o))),[o]).map((function(t){return e(t.data)}));return h.some((function(e){return e.length===t.length&&e.every((function(e,i){return e===t[i]}))}))||(h.push(t),l(t)),"continue"}();if("continue"===s)continue}n>o.depth&&(o.depth=n,d(o.out,[].concat(Kc(i),[o]),n+(o.skip?0:1)))}}}(t.graphData,(function(e){return e[t.nodeId]}),{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),F=Math.max.apply(Math,Kc(Object.values(B||[]))),L=t.dagLevelDistance||t.graphData.nodes.length/(F||1)*2*(-1!==["radialin","radialout"].indexOf(t.dagMode)?.7:1);if(t.dagMode){var U=function(e,i){return function(n){return e?(B[n[t.nodeId]]-F/2)*L*(i?-1:1):void 0}},R=U(-1!==["lr","rl"].indexOf(t.dagMode),"rl"===t.dagMode),D=U(-1!==["td","bu"].indexOf(t.dagMode),"td"===t.dagMode),P=U(-1!==["zin","zout"].indexOf(t.dagMode),"zout"===t.dagMode);t.graphData.nodes.filter(t.dagNodeFilter).forEach((function(t){t.fx=R(t),t.fy=D(t),t.fz=P(t)}))}t.d3ForceLayout.force("dagRadial",-1!==["radialin","radialout"].indexOf(t.dagMode)?function(t,e,i,n){var r,a,o,s,l=Fl(.1);function c(t){for(var l=0,c=r.length;l<c;++l){var h=r[l],u=h.x-e||1e-6,d=(h.y||0)-i||1e-6,p=(h.z||0)-n||1e-6,f=Math.sqrt(u*u+d*d+p*p),g=(s[l]-f)*o[l]*t/f;h.vx+=u*g,a>1&&(h.vy+=d*g),a>2&&(h.vz+=p*g)}}function h(){if(r){var e,i=r.length;for(o=new Array(i),s=new Array(i),e=0;e<i;++e)s[e]=+t(r[e],e,r),o[e]=isNaN(s[e])?0:+l(r[e],e,r)}}return"function"!=typeof t&&(t=Fl(+t)),null==e&&(e=0),null==i&&(i=0),null==n&&(n=0),c.initialize=function(t,...e){r=t,a=e.find(t=>[1,2,3].includes(t))||2,h()},c.strength=function(t){return arguments.length?(l="function"==typeof t?t:Fl(+t),h(),c):l},c.radius=function(e){return arguments.length?(t="function"==typeof e?e:Fl(+e),h(),c):t},c.x=function(t){return arguments.length?(e=+t,c):e},c.y=function(t){return arguments.length?(i=+t,c):i},c.z=function(t){return arguments.length?(n=+t,c):n},c}((function(e){var i=B[e[t.nodeId]]||-1;return("radialin"===t.dagMode?F-i:i)*L})).strength((function(e){return t.dagNodeFilter(e)?1:0})):null)}else{var N=hh.graph();t.graphData.nodes.forEach((function(e){N.addNode(e[t.nodeId])})),t.graphData.links.forEach((function(t){N.addLink(t.source,t.target)})),(E=hh.forcelayout(N,zc({dimensions:t.numDimensions},t.ngraphPhysics))).graph=N}for(var z=0;z<t.warmupTicks&&!(S&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);z++)E[S?"tick":"step"]();t.layout=E,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}}),(window.THREE?window.THREE:{Group:Wn}).Group,!0);e.default=ph}]);
|
|
1
|
+
!function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=12)}([function(t,e){const i={palettes:{blues:["#142850","#27496d","#00909e","#dae1e7"],foxy:["#f79071","#fa744f","#16817a","#024249"],flat:["#120136","#035aa6","#40bad5","#fcbf1e"],sunset:["#202040","#543864","#ff6363","#ffbd69"],bussiness:["#de7119","#dee3e2","#116979","#18b0b0"],icecream:["#f76a8c","#f8dc88","#f8fab8","#ccf0e1"],ubuntu:["#511845","#900c3f","#c70039","#ff5733"],pearl:["#efa8e4","#f8e1f4","#fff0f5","#97e5ef"],commerce:["#222831","#30475e","#f2a365","#ececec"],bluesextra:["#00429d","#09459e","#1147a0","#174aa1","#1c4da2","#214fa3","#2552a5","#2855a6","#2c57a7","#2f5aa8","#335daa","#3660ab","#3962ac","#3b65ad","#3e68ae","#416bb0","#446eb1","#4670b2","#4973b3","#4c76b4","#4e79b6","#517cb7","#537eb8","#5681b9","#5884ba","#5b87bc","#5d8abd","#608dbe","#6290bf","#6593c0","#6895c1","#6a98c2","#6d9bc4","#6f9ec5","#72a1c6","#74a4c7","#77a7c8","#7aaac9","#7cadca","#7fb0cb","#82b3cc","#84b5cd","#87b8ce","#8abbcf","#8dbed0","#90c1d1","#93c4d2","#96c7d3","#99cad4","#9ccdd5","#9fd0d6","#a2d3d7","#a5d5d8","#a9d8d9","#acdbda","#b0dedb","#b4e1db","#b7e4dc","#bbe6dd","#c0e9de","#c4ecde","#c8efdf","#cdf1e0","#d2f4e0","#d7f6e1","#ddf9e1","#e4fbe1","#ebfde1","#f3fee1","#ffffe0"],ubuntuextra:["#511845","#541845","#581844","#5b1844","#5e1744","#621744","#651743","#681743","#6b1743","#6e1643","#711642","#741642","#771642","#7a1641","#7d1541","#801541","#831541","#861540","#891540","#8c1540","#8f1540","#92153f","#94163f","#97163f","#9a163f","#9d173e","#9f173e","#a2183e","#a5183e","#a7193d","#aa1a3d","#ac1a3d","#af1b3d","#b21c3d","#b41d3c","#b71e3c","#b9203c","#bb213c","#be223b","#c0233b","#c3253b","#c5263b","#c7273b","#ca293a","#cc2a3a","#ce2c3a","#d02e3a","#d32f39","#d53139","#d73239","#d93439","#db3638","#dd3738","#e03938","#e23b38","#e43d37","#e63e37","#e84037","#ea4236","#ec4436","#ee4636","#f04836","#f24a35","#f44b35","#f64d35","#f84f34","#f95134","#fb5334","#fd5533","#ff5733"],ubuntudiver:["#511845","#711643","#8d1640","#a81b3f","#c1253d","#d7333a","#ec4437","#ff5733","#ffdac4","#ffb3a7","#fb8a8c","#eb6574","#d5405e","#b81b4a","#93003a"],bluesdiver:["#00429d","#325da9","#4e78b5","#6694c1","#80b1cc","#9dced6","#c0eade","#ffffe0","#f2f0e4","#e5e1e8","#d7d3eb","#c8c5ed","#b8b7ef","#a5aaf0","#6ea9da"]},get:function(t,e){if(e in i){let i=this.palettes[e].length;return this.palettes[e][t%i]}try{let i=JSON.parse(e);return i[t%i.length]}catch(t){console.error(t)}let n=this.palettes.ubuntu.length;return this.palettes[e][t%n]}};let n=(t,e,i)=>{let n;if(t.from){let i=document.getElementById(t.from);if(i.components["babia-filter"])n=i.components["babia-filter"];else if(i.components["babia-queryjson"])n=i.components["babia-queryjson"];else if(i.components["babia-querycsv"])n=i.components["babia-querycsv"];else if(i.components["babia-queryes"])n=i.components["babia-queryes"];else if(i.components["babia-querygithub"])n=i.components["babia-querygithub"];else if(i.components["babia-selector"])n=i.components["babia-selector"];else{if(!i.components["babia-treebuilder"])return void console.error("Problem registering to the querier",e);n=i.components["babia-treebuilder"]}}else{if(t.nodesFrom){let i=document.getElementById(t.nodesFrom);if(i.components["babia-filter"])prodComponentNodes=i.components["babia-filter"];else if(i.components["babia-queryjson"])prodComponentNodes=i.components["babia-queryjson"];else if(i.components["babia-querycsv"])prodComponentNodes=i.components["babia-querycsv"];else if(i.components["babia-queryes"])prodComponentNodes=i.components["babia-queryes"];else{if(!i.components["babia-querygithub"])return void console.error("Problem registering to the querier",e);prodComponentNodes=i.components["babia-querygithub"]}let n=document.getElementById(t.linksFrom);if(n.components["babia-filter"])prodComponentLinks=n.components["babia-filter"];else if(n.components["babia-queryjson"])prodComponentLinks=n.components["babia-queryjson"];else if(n.components["babia-querycsv"])prodComponentLinks=n.components["babia-querycsv"];else if(n.components["babia-queryes"])prodComponentLinks=n.components["babia-queryes"];else{if(!n.components["babia-querygithub"])return void console.error("Problem registering to the querier",e);prodComponentLinks=n.components["babia-querygithub"]}return{nodes:prodComponentNodes,links:prodComponentLinks}}if(e.components["babia-filter"]&&"babia-filter"!=i)n=e.components["babia-filter"];else if(e.components["babia-queryjson"]&&"babia-queryjson"!=i)n=e.components["babia-queryjson"];else if(e.components["babia-querycsv"]&&"babia-querycsv"!=i)n=e.components["babia-querycsv"];else if(e.components["babia-queryes"]&&"babia-queryes"!=i)n=e.components["babia-queryes"];else if(e.components["babia-querygithub"]&&"babia-querygithub"!=i)n=e.components["babia-querygithub"];else if(e.components["babia-selector"]&&"babia-selector"!=i)n=e.components["babia-selector"];else if(e.components["babia-treebuilder"])n=e.components["babia-treebuilder"];else if(document.querySelectorAll("[babia-filter]").length>0)n=document.querySelectorAll("[babia-filter]")[0].components["babia-filter"];else if(document.querySelectorAll("[babia-queryjson]").length>0)n=document.querySelectorAll("[babia-queryjson]")[0].components["babia-queryjson"];else if(document.querySelectorAll("[babia-querycsv]").length>0)n=document.querySelectorAll("[babia-querycsv]")[0].components["babia-queryjson"];else if(document.querySelectorAll("[babia-queryes]").length>0)n=document.querySelectorAll("[babia-queryes]")[0].components["babia-queryes"];else if(document.querySelectorAll("[babia-querygithub]").length>0)n=document.querySelectorAll("[babia-querygithub]")[0].components["babia-querygithub"];else if(document.querySelectorAll("[babia-selector]").length>0)n=document.querySelectorAll("[babia-selector]")[0].components["babia-selector"];else{if(!(document.querySelectorAll("[babia-treebuilder]").length>0))return void console.error("Error, querier not found",e,e.components,e.components["babia-selector"]);n=document.querySelectorAll("[babia-treebuilder]")[0].components["babia-treebuilder"]}}return n},r=t=>{let e;return e="string"==typeof t||t instanceof String?JSON.parse(t):t,e};t.exports.findProdComponent=n,t.exports.findNavComponent=(t,e)=>{let i;if(t.controller){let n=document.getElementById(t.controller);if(!n.components["babia-navigator"])return void console.error("Problem registering to the navigator",e);i=n.components["babia-navigator"]}else if(e.components["babia-navigator"])i=e.components["babia-navigator"];else{if(!(document.querySelectorAll("[babia-navigator]").length>0))return void console.error("Error, navigator not found",e,e.components,e.components["babia-navigator"]);i=document.querySelectorAll("[babia-navigator]")[0].components["babia-navigator"]}return i},t.exports.findTargetComponent=(t,e)=>{let i;if(t.target){{let e=document.getElementById(t.target);if(null==e)return void console.error("Target not exist.");if(e.components["babia-bars"])i=e.components["babia-bars"];else if(e.components["babia-barsmap"])i=e.components["babia-barsmap"];else if(e.components["babia-cyls"])i=e.components["babia-cyls"];else if(e.components["babia-cylsmap"])i=e.components["babia-cylsmap"];else if(e.components["babia-pie"])i=e.components["babia-pie"];else if(e.components["babia-doughnut"])i=e.components["babia-doughnut"];else if(e.components["babia-bubbles"])i=e.components["babia-bubbles"];else if(e.components["babia-city"])i=e.components["babia-city"];else if(e.components["babia-boats"])i=e.components["babia-boats"];else{if(!e.components["babia-network"])return void console.error("Visualizer not found.");i=e.components["babia-network"]}}return i}console.error("Error: Target not inserted. ")},t.exports.colors=i,t.exports.updateTitle=(t,e)=>{let i=document.createElement("a-entity");return i.classList.add("babiaxrTitle"),i.setAttribute("text-geometry",{value:t.title}),t.titleFont&&i.setAttribute("text-geometry",{font:t.titleFont}),t.titleColor&&i.setAttribute("material",{color:t.titleColor}),i.setAttribute("position",t.titlePosition),i.setAttribute("rotation",e),i},t.exports.parseJson=r,t.exports.updateFunction=(t,e)=>{let i=t.data,a=t.el;if((a.components["babia-bars"]||a.components["babia-barsmap"]||a.components["babia-cyls"])&&(i.index||(i.index=i.x_axis),t.animation=i.animation,t.bar_array=[]),a.components["babia-boats"]&&(t.figures||(t.figures=[])),i.data&&e.data!==i.data){let e=r(i.data);t.processData(e)}else i.from!==e.from?(t.slice_array&&(t.slice_array=[]),t.prodComponent&&t.prodComponent.notiBuffer.unregister(t.notiBufferId),t.prodComponent=n(i,a),t.prodComponent.notiBuffer&&(t.notiBufferId=t.prodComponent.notiBuffer.register(t.processData.bind(t)))):i!==e&&t.newData&&(t.slice_array&&(t.slice_array=[]),t.bar_array&&(t.bar_array=[]),t.processData(t.newData))}},function(t,e,i){"use strict";i.r(e);e.default=function(t){return t instanceof Function?t:"string"==typeof t?function(e){return e[t]}:function(e){return t}}},function(t,e,i){class n{constructor(t,e){this.currentId=0,this.notifiers={},this.data,this.function1=t,this.function2=e}set(t){console.log("produced",t),this.data=t;for(const t of Object.values(this.notifiers))t(this.data)}register(t,e){void 0!==this.data&&(console.log("Data was ready"),t(this.data));let i=this.currentId;return this.notifiers[i]=t,this.currentId++,e&&this.function1&&this.function1(e),i}unregister(t,e){delete this.notifiers[t],e&&this.function2&&this.function2(e)}}t.exports.NotiBuffer=n},function(t,e,i){const n=i(8);t.exports=function(t){return function(e,i){let r=i&&i.indent||0,a=i&&void 0!==i.join?i.join:"\n",s=Array(r+1).join(" "),o=[];for(let i=0;i<t;++i){let t=n(i),r=0===i?"":s;o.push(r+e.replace(/{var}/g,t))}return o.join(a)}}},function(t,e){t.exports=function(t){!function(t){if(!t)throw new Error("Eventify cannot use falsy object as events subject");for(var e=["on","fire","off"],i=0;i<e.length;++i)if(t.hasOwnProperty(e[i]))throw new Error("Subject cannot be eventified, since it already has property '"+e[i]+"'")}(t);var e=function(t){var e=Object.create(null);return{on:function(i,n,r){if("function"!=typeof n)throw new Error("callback is expected to be a function");var a=e[i];return a||(a=e[i]=[]),a.push({callback:n,ctx:r}),t},off:function(i,n){if(void 0===i)return e=Object.create(null),t;if(e[i])if("function"!=typeof n)delete e[i];else for(var r=e[i],a=0;a<r.length;++a)r[a].callback===n&&r.splice(a,1);return t},fire:function(i){var n,r=e[i];if(!r)return t;arguments.length>1&&(n=Array.prototype.splice.call(arguments,1));for(var a=0;a<r.length;++a){var s=r[a];s.callback.apply(s.ctx,n)}return t}}}(t);return t.on=e.on,t.off=e.off,t.fire=e.fire,t}},function(t,e,i){var n;!function(r){var a=/^\s+/,s=/\s+$/,o=0,l=r.round,c=r.min,h=r.max,u=r.random;function d(t,e){if(e=e||{},(t=t||"")instanceof d)return t;if(!(this instanceof d))return new d(t,e);var i=function(t){var e={r:0,g:0,b:0},i=1,n=null,o=null,l=null,u=!1,d=!1;"string"==typeof t&&(t=function(t){t=t.replace(a,"").replace(s,"").toLowerCase();var e,i=!1;if(B[t])t=B[t],i=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(e=H.rgb.exec(t))return{r:e[1],g:e[2],b:e[3]};if(e=H.rgba.exec(t))return{r:e[1],g:e[2],b:e[3],a:e[4]};if(e=H.hsl.exec(t))return{h:e[1],s:e[2],l:e[3]};if(e=H.hsla.exec(t))return{h:e[1],s:e[2],l:e[3],a:e[4]};if(e=H.hsv.exec(t))return{h:e[1],s:e[2],v:e[3]};if(e=H.hsva.exec(t))return{h:e[1],s:e[2],v:e[3],a:e[4]};if(e=H.hex8.exec(t))return{r:D(e[1]),g:D(e[2]),b:D(e[3]),a:z(e[4]),format:i?"name":"hex8"};if(e=H.hex6.exec(t))return{r:D(e[1]),g:D(e[2]),b:D(e[3]),format:i?"name":"hex"};if(e=H.hex4.exec(t))return{r:D(e[1]+""+e[1]),g:D(e[2]+""+e[2]),b:D(e[3]+""+e[3]),a:z(e[4]+""+e[4]),format:i?"name":"hex8"};if(e=H.hex3.exec(t))return{r:D(e[1]+""+e[1]),g:D(e[2]+""+e[2]),b:D(e[3]+""+e[3]),format:i?"name":"hex"};return!1}(t));"object"==typeof t&&(G(t.r)&&G(t.g)&&G(t.b)?(p=t.r,f=t.g,g=t.b,e={r:255*U(p,255),g:255*U(f,255),b:255*U(g,255)},u=!0,d="%"===String(t.r).substr(-1)?"prgb":"rgb"):G(t.h)&&G(t.s)&&G(t.v)?(n=k(t.s),o=k(t.v),e=function(t,e,i){t=6*U(t,360),e=U(e,100),i=U(i,100);var n=r.floor(t),a=t-n,s=i*(1-e),o=i*(1-a*e),l=i*(1-(1-a)*e),c=n%6;return{r:255*[i,o,s,s,l,i][c],g:255*[l,i,i,o,s,s][c],b:255*[s,s,l,i,i,o][c]}}(t.h,n,o),u=!0,d="hsv"):G(t.h)&&G(t.s)&&G(t.l)&&(n=k(t.s),l=k(t.l),e=function(t,e,i){var n,r,a;function s(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(t=U(t,360),e=U(e,100),i=U(i,100),0===e)n=r=a=i;else{var o=i<.5?i*(1+e):i+e-i*e,l=2*i-o;n=s(l,o,t+1/3),r=s(l,o,t),a=s(l,o,t-1/3)}return{r:255*n,g:255*r,b:255*a}}(t.h,n,l),u=!0,d="hsl"),t.hasOwnProperty("a")&&(i=t.a));var p,f,g;return i=L(i),{ok:u,format:t.format||d,r:c(255,h(e.r,0)),g:c(255,h(e.g,0)),b:c(255,h(e.b,0)),a:i}}(t);this._originalInput=t,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=l(100*this._a)/100,this._format=e.format||i.format,this._gradientType=e.gradientType,this._r<1&&(this._r=l(this._r)),this._g<1&&(this._g=l(this._g)),this._b<1&&(this._b=l(this._b)),this._ok=i.ok,this._tc_id=o++}function p(t,e,i){t=U(t,255),e=U(e,255),i=U(i,255);var n,r,a=h(t,e,i),s=c(t,e,i),o=(a+s)/2;if(a==s)n=r=0;else{var l=a-s;switch(r=o>.5?l/(2-a-s):l/(a+s),a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return{h:n,s:r,l:o}}function f(t,e,i){t=U(t,255),e=U(e,255),i=U(i,255);var n,r,a=h(t,e,i),s=c(t,e,i),o=a,l=a-s;if(r=0===a?0:l/a,a==s)n=0;else{switch(a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return{h:n,s:r,v:o}}function g(t,e,i,n){var r=[N(l(t).toString(16)),N(l(e).toString(16)),N(l(i).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function m(t,e,i,n){return[N(P(n)),N(l(t).toString(16)),N(l(e).toString(16)),N(l(i).toString(16))].join("")}function b(t,e){e=0===e?0:e||10;var i=d(t).toHsl();return i.s-=e/100,i.s=R(i.s),d(i)}function y(t,e){e=0===e?0:e||10;var i=d(t).toHsl();return i.s+=e/100,i.s=R(i.s),d(i)}function v(t){return d(t).desaturate(100)}function x(t,e){e=0===e?0:e||10;var i=d(t).toHsl();return i.l+=e/100,i.l=R(i.l),d(i)}function _(t,e){e=0===e?0:e||10;var i=d(t).toRgb();return i.r=h(0,c(255,i.r-l(-e/100*255))),i.g=h(0,c(255,i.g-l(-e/100*255))),i.b=h(0,c(255,i.b-l(-e/100*255))),d(i)}function A(t,e){e=0===e?0:e||10;var i=d(t).toHsl();return i.l-=e/100,i.l=R(i.l),d(i)}function w(t,e){var i=d(t).toHsl(),n=(i.h+e)%360;return i.h=n<0?360+n:n,d(i)}function C(t){var e=d(t).toHsl();return e.h=(e.h+180)%360,d(e)}function M(t){var e=d(t).toHsl(),i=e.h;return[d(t),d({h:(i+120)%360,s:e.s,l:e.l}),d({h:(i+240)%360,s:e.s,l:e.l})]}function E(t){var e=d(t).toHsl(),i=e.h;return[d(t),d({h:(i+90)%360,s:e.s,l:e.l}),d({h:(i+180)%360,s:e.s,l:e.l}),d({h:(i+270)%360,s:e.s,l:e.l})]}function I(t){var e=d(t).toHsl(),i=e.h;return[d(t),d({h:(i+72)%360,s:e.s,l:e.l}),d({h:(i+216)%360,s:e.s,l:e.l})]}function S(t,e,i){e=e||6,i=i||30;var n=d(t).toHsl(),r=360/i,a=[d(t)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,a.push(d(n));return a}function T(t,e){e=e||6;for(var i=d(t).toHsv(),n=i.h,r=i.s,a=i.v,s=[],o=1/e;e--;)s.push(d({h:n,s:r,v:a})),a=(a+o)%1;return s}d.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,i,n=this.toRgb();return t=n.r/255,e=n.g/255,i=n.b/255,.2126*(t<=.03928?t/12.92:r.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:r.pow((e+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:r.pow((i+.055)/1.055,2.4))},setAlpha:function(t){return this._a=L(t),this._roundA=l(100*this._a)/100,this},toHsv:function(){var t=f(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=f(this._r,this._g,this._b),e=l(360*t.h),i=l(100*t.s),n=l(100*t.v);return 1==this._a?"hsv("+e+", "+i+"%, "+n+"%)":"hsva("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=p(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=p(this._r,this._g,this._b),e=l(360*t.h),i=l(100*t.s),n=l(100*t.l);return 1==this._a?"hsl("+e+", "+i+"%, "+n+"%)":"hsla("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return g(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,i,n,r){var a=[N(l(t).toString(16)),N(l(e).toString(16)),N(l(i).toString(16)),N(P(n))];if(r&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1))return a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0);return a.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:l(this._r),g:l(this._g),b:l(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+l(this._r)+", "+l(this._g)+", "+l(this._b)+")":"rgba("+l(this._r)+", "+l(this._g)+", "+l(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:l(100*U(this._r,255))+"%",g:l(100*U(this._g,255))+"%",b:l(100*U(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+l(100*U(this._r,255))+"%, "+l(100*U(this._g,255))+"%, "+l(100*U(this._b,255))+"%)":"rgba("+l(100*U(this._r,255))+"%, "+l(100*U(this._g,255))+"%, "+l(100*U(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(F[g(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+m(this._r,this._g,this._b,this._a),i=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var r=d(t);i="#"+m(r._r,r._g,r._b,r._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+i+")"},toString:function(t){var e=!!t;t=t||this._format;var i=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(i=this.toRgbString()),"prgb"===t&&(i=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(i=this.toHexString()),"hex3"===t&&(i=this.toHexString(!0)),"hex4"===t&&(i=this.toHex8String(!0)),"hex8"===t&&(i=this.toHex8String()),"name"===t&&(i=this.toName()),"hsl"===t&&(i=this.toHslString()),"hsv"===t&&(i=this.toHsvString()),i||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return d(this.toString())},_applyModification:function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(x,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(A,arguments)},desaturate:function(){return this._applyModification(b,arguments)},saturate:function(){return this._applyModification(y,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(C,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(I,arguments)},triad:function(){return this._applyCombination(M,arguments)},tetrad:function(){return this._applyCombination(E,arguments)}},d.fromRatio=function(t,e){if("object"==typeof t){var i={};for(var n in t)t.hasOwnProperty(n)&&(i[n]="a"===n?t[n]:k(t[n]));t=i}return d(t,e)},d.equals=function(t,e){return!(!t||!e)&&d(t).toRgbString()==d(e).toRgbString()},d.random=function(){return d.fromRatio({r:u(),g:u(),b:u()})},d.mix=function(t,e,i){i=0===i?0:i||50;var n=d(t).toRgb(),r=d(e).toRgb(),a=i/100;return d({r:(r.r-n.r)*a+n.r,g:(r.g-n.g)*a+n.g,b:(r.b-n.b)*a+n.b,a:(r.a-n.a)*a+n.a})},d.readability=function(t,e){var i=d(t),n=d(e);return(r.max(i.getLuminance(),n.getLuminance())+.05)/(r.min(i.getLuminance(),n.getLuminance())+.05)},d.isReadable=function(t,e,i){var n,r,a=d.readability(t,e);switch(r=!1,(n=function(t){var e,i;e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),i=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA");"small"!==i&&"large"!==i&&(i="small");return{level:e,size:i}}(i)).level+n.size){case"AAsmall":case"AAAlarge":r=a>=4.5;break;case"AAlarge":r=a>=3;break;case"AAAsmall":r=a>=7}return r},d.mostReadable=function(t,e,i){var n,r,a,s,o=null,l=0;r=(i=i||{}).includeFallbackColors,a=i.level,s=i.size;for(var c=0;c<e.length;c++)(n=d.readability(t,e[c]))>l&&(l=n,o=d(e[c]));return d.isReadable(t,o,{level:a,size:s})||!r?o:(i.includeFallbackColors=!1,d.mostReadable(t,["#fff","#000"],i))};var B=d.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=d.hexNames=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[t[i]]=i);return e}(B);function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function U(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var i=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=c(e,h(0,parseFloat(t))),i&&(t=parseInt(t*e,10)/100),r.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function R(t){return c(1,h(0,t))}function D(t){return parseInt(t,16)}function N(t){return 1==t.length?"0"+t:""+t}function k(t){return t<=1&&(t=100*t+"%"),t}function P(t){return r.round(255*parseFloat(t)).toString(16)}function z(t){return D(t)/255}var O,Q,V,H=(Q="[\\s|\\(]+("+(O="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+O+")[,|\\s]+("+O+")\\s*\\)?",V="[\\s|\\(]+("+O+")[,|\\s]+("+O+")[,|\\s]+("+O+")[,|\\s]+("+O+")\\s*\\)?",{CSS_UNIT:new RegExp(O),rgb:new RegExp("rgb"+Q),rgba:new RegExp("rgba"+V),hsl:new RegExp("hsl"+Q),hsla:new RegExp("hsla"+V),hsv:new RegExp("hsv"+Q),hsva:new RegExp("hsva"+V),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function G(t){return!!H.CSS_UNIT.exec(t)}t.exports?t.exports=d:void 0===(n=function(){return d}.call(e,i,e,t))||(t.exports=n)}(Math)},function(t,e,i){let n=i(0).updateTitle;const r=i(0).colors;let a=i(0).updateFunction;const s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-cyls",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},from:{type:"string"},legend:{type:"boolean",default:!1},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"vec3",default:{x:0,y:0,z:0}},chartHeight:{type:"number",default:10},radiusMax:{type:"number",default:2},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},uiLink:{type:"boolean",default:!1},uiLinkPosition:{type:"vec3",default:{x:-4.5,y:2,z:2.5}}},visProperties:["height","radius","x_axis"],multiple:!1,init:function(){this.notiBuffer=new s,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t),this.data.uiLink&&l(el,this.data.uiLinkPosition)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},valueMax:void 0,xLabels:[],xTicks:[],updateTitle:function(){this.titleEl=n(this.data,{x:0,y:0,z:0})},updateChart:function(){let t=this.newData;t=this.currentData?this.currentData:this.newData,console.log("Data babia-cyls:",t);const e=this.data;this.el;this.updateTitle();let i=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*maxValue/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=i;let n=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));this.radius_scale=e.radiusMax/n;let r=this.chartEl.querySelectorAll("a-entity[babia-cyl]"),a={};for(let t of r){a[t.getAttribute("babia-name")]={el:t,found:!1}}let s,l=[],c=[],h=0;for(let i=0;i<t.length;i++){let n,r,u=t[i],d=u[e.x_axis];n=0==i?.5+u[e.radius]*this.radius_scale:c[i-1]+s+.5+u[e.radius]*this.radius_scale,a[d]&&!u._not?(r=a[d].el,a[d].found=!0):(r=document.createElement("a-entity"),r.setAttribute("babia-name",d),r.id=u[e.index],r.object3D.position.x=n,this.chartEl.appendChild(r)),o(this,r,e,u,h,d,n,0),l.push(d),c.push(n),h++,s=u[e.radius]*this.radius_scale}for(let t in a)a[t].found||a[t].el.remove();if(e.axis){const i=c[c.length-1]+(t[0][e.radius]+t[t.length-1][e.radius])*this.radius_scale/2;this.updateAxis(l,c,i,this.maxValue)}},updateAxis:function(t,e,i,n){const r=this.data;r.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:r.palette}),this.xAxisEl.setAttribute("position",{x:0,y:0,z:r.radiusMax+.25}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:0,y:0,z:r.radiusMax+.25}),r.axis_name&&(r.index?this.xAxisEl.setAttribute("babia-axis-x","name",r.index):this.xAxisEl.setAttribute("babia-axis-x","name",r.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",r.height)))},processData:function(t){console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating cyls..."),this.updateChart(),this.notiBuffer.set(this.newData)}});let o=(t,e,i,n,a,s,o,l,c)=>{e.setAttribute("babia-cyl",{height:n[i.height]*t.lengthY/t.maxValue,radius:n[i.radius]*t.radius_scale,color:r.get(a,i.palette),label:"events",animation:i.animation}),i.legend&&(c?e.setAttribute("babia-cyl",{labelText:s+" | "+c+"\nHeight: "+n[i.height]+"\nRadius: "+n[i.radius],labelLookat:i.legend_lookat,labelScale:i.legend_scale}):e.setAttribute("babia-cyl",{labelText:s+"\nHeight: "+n[i.height]+"\nRadius: "+n[i.radius],labelLookat:i.legend_lookat,labelScale:i.legend_scale})),o!==e.object3D.position.x&&(i.animation?e.setAttribute("animation",{property:"object3D.position.x",to:o,dur:i.dur}):e.object3D.position.x=o),l!==e.object3D.position.z&&(i.animation?e.setAttribute("animation",{property:"object3D.position.z",to:l,dur:i.dur}):e.object3D.position.z=l)},l=(t,e)=>{let i=document.createElement("a-entity");if(!t.id){let e="bars"+Math.floor(1e3*Math.random());t.id=e}console.log("id:",t.id),i.setAttribute("babia-ui-link",{viz:t.id}),i.setAttribute("position",{x:e.x,y:e.y,z:e.z}),t.appendChild(i),console.log("Create Button",t)};t.exports.createCylinder=o},function(t,e,i){t.exports=function(t){var e=i(46),u=i(47),d=i(4);if(t){if(void 0!==t.springCoeff)throw new Error("springCoeff was renamed to springCoefficient");if(void 0!==t.dragCoeff)throw new Error("dragCoeff was renamed to dragCoefficient")}t=u(t,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var p=c[t.dimensions];if(!p){var f=t.dimensions;p={Body:n(f,t.debug),createQuadTree:r(f),createBounds:a(f),createDragForce:s(f),createSpringForce:o(f),integrate:l(f)},c[f]=p}var g=p.Body,m=p.createQuadTree,b=p.createBounds,y=p.createDragForce,v=p.createSpringForce,x=p.integrate,_=i(48).random(42),A=[],w=[],C=m(t,_),M=b(A,t,_),E=v(t,_),I=y(t),S=[],T=new Map,B=0;U("nbody",(function(){if(0===A.length)return;C.insertBodies(A);var t=A.length;for(;t--;){var e=A[t];e.isPinned||(e.reset(),C.updateBodyForce(e),I.update(e))}})),U("spring",(function(){var t=w.length;for(;t--;)E.update(w[t])}));var F={bodies:A,quadTree:C,springs:w,settings:t,addForce:U,removeForce:function(t){var e=S.indexOf(T.get(t));if(e<0)return;S.splice(e,1),T.delete(t)},getForces:function(){return T},step:function(){for(var e=0;e<S.length;++e)S[e](B);var i=x(A,t.timeStep,t.adaptiveTimeStepWeight);return B+=1,i},addBody:function(t){if(!t)throw new Error("Body is required");return A.push(t),t},addBodyAt:function(t){if(!t)throw new Error("Body position is required");var e=(t=>new g(t))(t);return A.push(e),e},removeBody:function(t){if(t){var e=A.indexOf(t);if(!(e<0))return A.splice(e,1),0===A.length&&M.reset(),!0}},addSpring:function(t,i,n,r){if(!t||!i)throw new Error("Cannot add null spring to force simulator");"number"!=typeof n&&(n=-1);var a=new e(t,i,n,r>=0?r:-1);return w.push(a),a},getTotalMovement:function(){return 0},removeSpring:function(t){if(t){var e=w.indexOf(t);return e>-1?(w.splice(e,1),!0):void 0}},getBestNewBodyPosition:function(t){return M.getBestNewPosition(t)},getBBox:L,getBoundingBox:L,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(e){return void 0!==e?(t.gravity=e,C.options({gravity:e}),this):t.gravity},theta:function(e){return void 0!==e?(t.theta=e,C.options({theta:e}),this):t.theta},random:_};return function(t,e){for(var i in t)h(t,e,i)}(t,F),d(F),F;function L(){return M.update(),M.box}function U(t,e){if(T.has(t))throw new Error("Force "+t+" is already added");T.set(t,e),S.push(e)}};var n=i(40),r=i(41),a=i(42),s=i(43),o=i(44),l=i(45),c={};function h(t,e,i){if(t.hasOwnProperty(i)&&"function"!=typeof e[i]){var n=Number.isFinite(t[i]);e[i]=n?function(n){if(void 0!==n){if(!Number.isFinite(n))throw new Error("Value of "+i+" should be a valid number.");return t[i]=n,e}return t[i]}:function(n){return void 0!==n?(t[i]=n,e):t[i]}}}},function(t,e){t.exports=function(t){return 0===t?"x":1===t?"y":2===t?"z":"c"+(t+1)}},function(t,e,i){t.exports=function(t){"uniqueLinkId"in(t=t||{})&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n","\n","Note: there is also change in default behavior: From now on each graph\nis considered to be not a multigraph by default (each edge is unique)."),t.multigraph=t.uniqueLinkId);void 0===t.multigraph&&(t.multigraph=!1);if("function"!=typeof Map)throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var e=new Map,i=[],c={},h=0,u=t.multigraph?function(t,e,i){var n=l(t,e),r=c.hasOwnProperty(n);if(r||E(t,e)){r||(c[n]=0);var a="@"+ ++c[n];n=l(t+a,e+a)}return new o(t,e,i,n)}:function(t,e,i){var n=l(t,e);return new o(t,e,i,n)},d=[],p=I,f=I,g=I,m=I,b={addNode:x,addLink:function(t,e,n){g();var r=_(t)||x(t),a=_(e)||x(e),o=u(t,e,n);i.push(o),s(r,o),t!==e&&s(a,o);return p(o,"add"),m(),o},removeLink:M,removeNode:A,getNode:_,getNodeCount:w,getLinkCount:C,getLinksCount:C,getNodesCount:w,getLinks:function(t){var e=_(t);return e?e.links:null},forEachNode:B,forEachLinkedNode:function(t,i,n){var r=_(t);if(r&&r.links&&"function"==typeof i)return n?function(t,i,n){for(var r=0;r<t.length;++r){var a=t[r];if(a.fromId===i&&n(e.get(a.toId),a))return!0}}(r.links,t,i):function(t,i,n){for(var r=0;r<t.length;++r){var a=t[r],s=a.fromId===i?a.toId:a.fromId;if(n(e.get(s),a))return!0}}(r.links,t,i)},forEachLink:function(t){var e,n;if("function"==typeof t)for(e=0,n=i.length;e<n;++e)t(i[e])},beginUpdate:g,endUpdate:m,clear:function(){g(),B((function(t){A(t.id)})),m()},hasLink:E,hasNode:_,getLink:E};return n(b),function(){var t=b.on;b.on=function(){return b.beginUpdate=g=S,b.endUpdate=m=T,p=y,f=v,b.on=t,t.apply(b,arguments)}}(),b;function y(t,e){d.push({link:t,changeType:e})}function v(t,e){d.push({node:t,changeType:e})}function x(t,i){if(void 0===t)throw new Error("Invalid node identifier");g();var n=_(t);return n?(n.data=i,f(n,"update")):(n=new a(t,i),f(n,"add")),e.set(t,n),m(),n}function _(t){return e.get(t)}function A(t){var i=_(t);if(!i)return!1;g();var n=i.links;if(n){i.links=null;for(var r=0;r<n.length;++r)M(n[r])}return e.delete(t),f(i,"remove"),m(),!0}function w(){return e.size}function C(){return i.length}function M(t){if(!t)return!1;var e=r(t,i);if(e<0)return!1;g(),i.splice(e,1);var n=_(t.fromId),a=_(t.toId);return n&&(e=r(t,n.links))>=0&&n.links.splice(e,1),a&&(e=r(t,a.links))>=0&&a.links.splice(e,1),p(t,"remove"),m(),!0}function E(t,e){var i,n=_(t);if(!n||!n.links)return null;for(i=0;i<n.links.length;++i){var r=n.links[i];if(r.fromId===t&&r.toId===e)return r}return null}function I(){}function S(){h+=1}function T(){0===(h-=1)&&d.length>0&&(b.fire("changed",d),d.length=0)}function B(t){if("function"!=typeof t)throw new Error("Function is expected to iterate over graph nodes. You passed "+t);for(var i=e.values(),n=i.next();!n.done;){if(t(n.value))return!0;n=i.next()}}};var n=i(4);function r(t,e){if(!e)return-1;if(e.indexOf)return e.indexOf(t);var i,n=e.length;for(i=0;i<n;i+=1)if(e[i]===t)return i;return-1}function a(t,e){this.id=t,this.links=null,this.data=e}function s(t,e){t.links?t.links.push(e):t.links=[e]}function o(t,e,i,n){this.fromId=t,this.toId=e,this.data=i,this.id=n}function l(t,e){return t.toString()+"👉 "+e.toString()}},function(t,e,i){t.exports=function(t,e){if(!t)throw new Error("Graph structure cannot be undefined");var a=(e&&e.createSimulator||i(7))(e);if(Array.isArray(e))throw new Error("Physics settings is expected to be an object");var s=t.version>19?function(e){var i=t.getLinks(e);return i?1+i.size/3:1}:function(e){var i=t.getLinks(e);return i?1+i.length/3:1};e&&"function"==typeof e.nodeMass&&(s=e.nodeMass);var o=new Map,l={},c=0,h=a.settings.springTransform||r;c=0,t.forEachNode((function(t){m(t.id),c+=1})),t.forEachLink(y),t.on("changed",g);var u=!1,d={step:function(){if(0===c)return p(!0),!0;var t=a.step();d.lastMove=t,d.fire("step");var e=t/c<=.01;return p(e),e},getNodePosition:function(t){return _(t).pos},setNodePosition:function(t){var e=_(t);e.setPosition.apply(e,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(t){var e=l[t];if(e)return{from:e.from.pos,to:e.to.pos}},getGraphRect:function(){return a.getBBox()},forEachBody:f,pinNode:function(t,e){_(t.id).isPinned=!!e},isNodePinned:function(t){return _(t.id).isPinned},dispose:function(){t.off("changed",g),d.fire("disposed")},getBody:function(t){return o.get(t)},getSpring:function(e,i){var n;if(void 0===i)n="object"!=typeof e?e:e.id;else{var r=t.hasLink(e,i);if(!r)return;n=r.id}return l[n]},getForceVectorLength:function(){var t=0,e=0;return f((function(i){t+=Math.abs(i.force.x),e+=Math.abs(i.force.y)})),Math.sqrt(t*t+e*e)},simulator:a,graph:t,lastMove:0};return n(d),d;function p(t){var e;u!==t&&(u=t,e=t,d.fire("stable",e))}function f(t){o.forEach(t)}function g(e){for(var i=0;i<e.length;++i){var n=e[i];"add"===n.changeType?(n.node&&m(n.node.id),n.link&&y(n.link)):"remove"===n.changeType&&(n.node&&b(n.node),n.link&&v(n.link))}c=t.getNodesCount()}function m(e){var i=o.get(e);if(!i){var n=t.getNode(e);if(!n)throw new Error("initBody() was called with unknown node id");var r=n.position;if(!r){var s=function(t){var e=[];if(!t.links)return e;for(var i=Math.min(t.links.length,2),n=0;n<i;++n){var r=t.links[n],a=r.fromId!==t.id?o.get(r.fromId):o.get(r.toId);a&&a.pos&&e.push(a)}return e}(n);r=a.getBestNewBodyPosition(s)}(i=a.addBodyAt(r)).id=e,o.set(e,i),x(e),function(t){return t&&(t.isPinned||t.data&&t.data.isPinned)}(n)&&(i.isPinned=!0)}}function b(t){var e=t.id,i=o.get(e);i&&(o.delete(e),a.removeBody(i))}function y(t){x(t.fromId),x(t.toId);var e=o.get(t.fromId),i=o.get(t.toId),n=a.addSpring(e,i,t.length);h(t,n),l[t.id]=n}function v(e){var i=l[e.id];if(i){var n=t.getNode(e.fromId),r=t.getNode(e.toId);n&&x(n.id),r&&x(r.id),delete l[e.id],a.removeSpring(i)}}function x(t){var e=o.get(t);if(e.mass=s(t),Number.isNaN(e.mass))throw new Error("Node mass should be a number")}function _(t){var e=o.get(t);return e||(m(t),e=o.get(t)),e}},t.exports.simulator=i(7);var n=i(4);function r(){}},function(t,e){function i(t,e,i){var n,r,a,s,o;function l(){var c=Date.now()-s;c<e&&c>=0?n=setTimeout(l,e-c):(n=null,i||(o=t.apply(a,r),a=r=null))}null==e&&(e=100);var c=function(){a=this,r=arguments,s=Date.now();var c=i&&!n;return n||(n=setTimeout(l,e)),c&&(o=t.apply(a,r),a=r=null),o};return c.clear=function(){n&&(clearTimeout(n),n=null)},c.flush=function(){n&&(o=t.apply(a,r),a=r=null,clearTimeout(n),n=null)},c}i.debounce=i,t.exports=i},function(t,e,i){i(14),i(15),i(16),i(18),i(19),i(20),i(21),i(22),i(23),i(24),i(25),i(26),i(27),i(28),i(29),i(30),i(6),i(31),i(32),i(33),i(34),i(35),i(36),i(37),i(38),i(39),i(49),i(50),i(0),i(51),i(52),i(53),i(54),i(55),i(56),i(2),i(57),i(58),pauseButton=i(59),playButton=i(60),skipButton=i(61),rewindButton=i(62),tooltip=i(63)},,function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-querygithub",{schema:{user:{type:"string"},token:{type:"string"},repos:{type:"array"},data:{type:"string"}},multiple:!1,init:function(){},update:function(t){let e=this.data,r=this.el,s=this;e.data&&t.data!==e.data?a(e.data,r,s):t.user===e.user&&t.repos===e.repos&&t.token===e.token||(e.user&&0===e.repos.length?n(e,r,s):e.repos.length>0&&i(e,r,s))},remove:function(){},pause:function(){},play:function(){},babiaData:void 0,babiaMetadata:{id:0},register:function(t){this.el;this.interestedElements.push(t),this.babiaData&&o(t,"babiaData")},unregister:function(t){const e=this.interestedElements.indexOf(t);e>-1&&this.interestedElements.splice(e,1)},interestedElements:[]});let i=(t,e,i)=>{let n=[];t.repos.forEach((i,r)=>{let a=new XMLHttpRequest,s="https://api.github.com/repos/"+t.user+"/"+i+"?_="+(new Date).getTime();a.open("get",s,!1),a.onload=function(){if(this.status>=200&&this.status<300){console.log("data OK in request.response",e.id);let t=JSON.parse(a.response);n.push(t)}else reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.send()}),i.babiaData=n,i.babiaMetadata={id:i.babiaMetadata.id++},s("babiaData",i)},n=(t,e,i)=>{let n=new XMLHttpRequest,a="https://api.github.com/users/"+t.user+"/repos?_="+(new Date).getTime();n.open("get",a),n.onload=function(){this.status>=200&&this.status<300?(console.log("data OK in request.response",e.id),i.babiaData=r(JSON.parse(n.response)),i.babiaMetadata={id:i.babiaMetadata.id++},s("babiaData",i)):(reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText))},n.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},n.send()},r=t=>{let e=[];return t.forEach((t,i)=>{e.push(t)}),e},a=(t,e,i)=>{let n=JSON.parse(t);i.babiaData=n,i.babiaMetadata={id:i.babiaMetadata.id++},s("babiaData",i)},s=(t,e)=>{e.interestedElements.forEach(e=>{o(e,t)})},o=(t,e)=>{t.emit("babiaQuerierDataReady",e)}},function(t,e,i){let n=i(0).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=i(2).NotiBuffer;AFRAME.registerComponent("babia-queryjson",{schema:{url:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data;if(e.data&&t.data!==e.data){let t=n(e.data);this.notiBuffer.set(t)}else t.url!==e.url&&this.getJSON(e.url)},remove:function(){},pause:function(){},play:function(){},getJSON:async function(t){let e=await fetch(t);if(200!=e.status)throw new Error(e.status);{let t=await e.json(),i=n(t);this.notiBuffer.set(i)}}})},function(t,e,i){let n=i(17).parse;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=i(2).NotiBuffer;AFRAME.registerComponent("babia-querycsv",{schema:{url:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data;if(e.data&&t.data!==e.data){let t=n(e.data,{header:!0,dynamicTyping:!0,skipEmptyLines:!0});this.notiBuffer.set(t.data)}else t.url!==e.url&&this.getCSV(e.url)},remove:function(){},pause:function(){},play:function(){},getCSV:async function(t){let e=this.notiBuffer;n(t,{download:!0,header:!0,skipEmptyLines:!0,dynamicTyping:!0,complete:function(t){e.set(t.data)}})}})},function(t,e,i){var n,r,a;
|
|
2
|
+
/* @license
|
|
3
|
+
Papa Parse
|
|
4
|
+
v5.3.1
|
|
5
|
+
https://github.com/mholt/PapaParse
|
|
6
|
+
License: MIT
|
|
7
|
+
*/r=[],void 0===(a="function"==typeof(n=function t(){"use strict";var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{},i=!e.document&&!!e.postMessage,n=i&&/blob:/i.test((e.location||{}).protocol),r={},a=0,s={parse:function(i,n){var o=(n=n||{}).dynamicTyping||!1;if(_(o)&&(n.dynamicTypingFunction=o,o={}),n.dynamicTyping=o,n.transform=!!_(n.transform)&&n.transform,n.worker&&s.WORKERS_SUPPORTED){var l=function(){if(!s.WORKERS_SUPPORTED)return!1;var i,n,o=(i=e.URL||e.webkitURL||null,n=t.toString(),s.BLOB_URL||(s.BLOB_URL=i.createObjectURL(new Blob(["(",n,")();"],{type:"text/javascript"})))),l=new e.Worker(o);return l.onmessage=m,l.id=a++,r[l.id]=l}();return l.userStep=n.step,l.userChunk=n.chunk,l.userComplete=n.complete,l.userError=n.error,n.step=_(n.step),n.chunk=_(n.chunk),n.complete=_(n.complete),n.error=_(n.error),delete n.worker,void l.postMessage({input:i,config:n,workerId:l.id})}var p=null;return s.NODE_STREAM_INPUT,"string"==typeof i?p=n.download?new c(n):new u(n):!0===i.readable&&_(i.read)&&_(i.on)?p=new d(n):(e.File&&i instanceof File||i instanceof Object)&&(p=new h(n)),p.stream(i)},unparse:function(t,e){var i=!1,n=!0,r=",",a="\r\n",o='"',l=o+o,c=!1,h=null,u=!1;!function(){if("object"==typeof e){if("string"!=typeof e.delimiter||s.BAD_DELIMITERS.filter((function(t){return-1!==e.delimiter.indexOf(t)})).length||(r=e.delimiter),("boolean"==typeof e.quotes||"function"==typeof e.quotes||Array.isArray(e.quotes))&&(i=e.quotes),"boolean"!=typeof e.skipEmptyLines&&"string"!=typeof e.skipEmptyLines||(c=e.skipEmptyLines),"string"==typeof e.newline&&(a=e.newline),"string"==typeof e.quoteChar&&(o=e.quoteChar),"boolean"==typeof e.header&&(n=e.header),Array.isArray(e.columns)){if(0===e.columns.length)throw new Error("Option columns is empty");h=e.columns}void 0!==e.escapeChar&&(l=e.escapeChar+o),"boolean"==typeof e.escapeFormulae&&(u=e.escapeFormulae)}}();var d=new RegExp(f(o),"g");if("string"==typeof t&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return p(null,t,c);if("object"==typeof t[0])return p(h||Object.keys(t[0]),t,c)}else if("object"==typeof t)return"string"==typeof t.data&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:"object"==typeof t.data[0]?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||"object"==typeof t.data[0]||(t.data=[t.data])),p(t.fields||[],t.data||[],c);throw new Error("Unable to serialize unrecognized input");function p(t,e,i){var s="";"string"==typeof t&&(t=JSON.parse(t)),"string"==typeof e&&(e=JSON.parse(e));var o=Array.isArray(t)&&0<t.length,l=!Array.isArray(e[0]);if(o&&n){for(var c=0;c<t.length;c++)0<c&&(s+=r),s+=g(t[c],c);0<e.length&&(s+=a)}for(var h=0;h<e.length;h++){var u=o?t.length:e[h].length,d=!1,p=o?0===Object.keys(e[h]).length:0===e[h].length;if(i&&!o&&(d="greedy"===i?""===e[h].join("").trim():1===e[h].length&&0===e[h][0].length),"greedy"===i&&o){for(var f=[],m=0;m<u;m++){var b=l?t[m]:m;f.push(e[h][b])}d=""===f.join("").trim()}if(!d){for(var y=0;y<u;y++){0<y&&!p&&(s+=r);var v=o&&l?t[y]:y;s+=g(e[h][v],y)}h<e.length-1&&(!i||0<u&&!p)&&(s+=a)}}return s}function g(t,e){if(null==t)return"";if(t.constructor===Date)return JSON.stringify(t).slice(1,25);!0===u&&"string"==typeof t&&null!==t.match(/^[=+\-@].*$/)&&(t="'"+t);var n=t.toString().replace(d,l);return"boolean"==typeof i&&i||"function"==typeof i&&i(t,e)||Array.isArray(i)&&i[e]||function(t,e){for(var i=0;i<e.length;i++)if(-1<t.indexOf(e[i]))return!0;return!1}(n,s.BAD_DELIMITERS)||-1<n.indexOf(r)||" "===n.charAt(0)||" "===n.charAt(n.length-1)?o+n+o:n}}};if(s.RECORD_SEP=String.fromCharCode(30),s.UNIT_SEP=String.fromCharCode(31),s.BYTE_ORDER_MARK="\ufeff",s.BAD_DELIMITERS=["\r","\n",'"',s.BYTE_ORDER_MARK],s.WORKERS_SUPPORTED=!i&&!!e.Worker,s.NODE_STREAM_INPUT=1,s.LocalChunkSize=10485760,s.RemoteChunkSize=5242880,s.DefaultDelimiter=",",s.Parser=g,s.ParserHandle=p,s.NetworkStreamer=c,s.FileStreamer=h,s.StringStreamer=u,s.ReadableStreamStreamer=d,e.jQuery){var o=e.jQuery;o.fn.parse=function(t){var i=t.config||{},n=[];return this.each((function(t){if("INPUT"!==o(this).prop("tagName").toUpperCase()||"file"!==o(this).attr("type").toLowerCase()||!e.FileReader||!this.files||0===this.files.length)return!0;for(var r=0;r<this.files.length;r++)n.push({file:this.files[r],inputElem:this,instanceConfig:o.extend({},i)})})),r(),this;function r(){if(0!==n.length){var e,i,r,l=n[0];if(_(t.before)){var c=t.before(l.file,l.inputElem);if("object"==typeof c){if("abort"===c.action)return e=l.file,i=l.inputElem,r=c.reason,void(_(t.error)&&t.error({name:"AbortError"},e,i,r));if("skip"===c.action)return void a();"object"==typeof c.config&&(l.instanceConfig=o.extend(l.instanceConfig,c.config))}else if("skip"===c)return void a()}var h=l.instanceConfig.complete;l.instanceConfig.complete=function(t){_(h)&&h(t,l.file,l.inputElem),a()},s.parse(l.file,l.instanceConfig)}else _(t.complete)&&t.complete()}function a(){n.splice(0,1),r()}}}function l(t){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(t){var e=v(t);e.chunkSize=parseInt(e.chunkSize),t.step||t.chunk||(e.chunkSize=null),this._handle=new p(e),(this._handle.streamer=this)._config=e}.call(this,t),this.parseChunk=function(t,i){if(this.isFirstChunk&&_(this._config.beforeFirstChunk)){var r=this._config.beforeFirstChunk(t);void 0!==r&&(t=r)}this.isFirstChunk=!1,this._halted=!1;var a=this._partialLine+t;this._partialLine="";var o=this._handle.parse(a,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=o.meta.cursor;this._finished||(this._partialLine=a.substring(l-this._baseIndex),this._baseIndex=l),o&&o.data&&(this._rowCount+=o.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(n)e.postMessage({results:o,workerId:s.WORKER_ID,finished:c});else if(_(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!c||!_(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){_(this._config.error)?this._config.error(t):n&&this._config.error&&e.postMessage({workerId:s.WORKER_ID,error:t,finished:!1})}}function c(t){var e;(t=t||{}).chunkSize||(t.chunkSize=s.RemoteChunkSize),l.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var n in t)e.setRequestHeader(n,t[n])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function h(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=s.LocalChunkSize),l.call(this,t);var n="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,n?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var t=this._input;if(this._config.chunkSize){var r=Math.min(this._start+this._config.chunkSize,this._input.size);t=i.call(t,this._start,r)}var a=e.readAsText(t,this._config.encoding);n||this._chunkLoaded({target:{result:a}})},this._chunkLoaded=function(t){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function u(t){var e;l.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){l.call(this,t=t||{});var e=[],i=!0,n=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),n=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,n,r=Math.pow(2,53),a=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,l=/^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))$/,c=this,h=0,u=0,d=!1,p=!1,m=[],b={data:[],errors:[],meta:{}};if(_(t.step)){var y=t.step;t.step=function(e){if(b=e,w())A();else{if(A(),0===b.data.length)return;h+=e.data.length,t.preview&&h>t.preview?i.abort():(b.data=b.data[0],y(b,c))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function A(){if(b&&n&&(M("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),n=!1),t.skipEmptyLines)for(var e=0;e<b.data.length;e++)x(b.data[e])&&b.data.splice(e--,1);return w()&&function(){if(b)if(Array.isArray(b.data[0])){for(var e=0;w()&&e<b.data.length;e++)b.data[e].forEach(i);b.data.splice(0,1)}else b.data.forEach(i);function i(e,i){_(t.transformHeader)&&(e=t.transformHeader(e,i)),m.push(e)}}(),function(){if(!b||!t.header&&!t.dynamicTyping&&!t.transform)return b;function e(e,i){var n,r=t.header?{}:[];for(n=0;n<e.length;n++){var a=n,s=e[n];t.header&&(a=n>=m.length?"__parsed_extra":m[n]),t.transform&&(s=t.transform(s,a)),s=C(a,s),"__parsed_extra"===a?(r[a]=r[a]||[],r[a].push(s)):r[a]=s}return t.header&&(n>m.length?M("FieldMismatch","TooManyFields","Too many fields: expected "+m.length+" fields but parsed "+n,u+i):n<m.length&&M("FieldMismatch","TooFewFields","Too few fields: expected "+m.length+" fields but parsed "+n,u+i)),r}var i=1;return!b.data.length||Array.isArray(b.data[0])?(b.data=b.data.map(e),i=b.data.length):b.data=e(b.data,0),t.header&&b.meta&&(b.meta.fields=m),u+=i,b}()}function w(){return t.header&&0===m.length}function C(e,i){return n=e,t.dynamicTypingFunction&&void 0===t.dynamicTyping[n]&&(t.dynamicTyping[n]=t.dynamicTypingFunction(n)),!0===(t.dynamicTyping[n]||t.dynamicTyping)?"true"===i||"TRUE"===i||"false"!==i&&"FALSE"!==i&&(function(t){if(o.test(t)){var e=parseFloat(t);if(a<e&&e<r)return!0}return!1}(i)?parseFloat(i):l.test(i)?new Date(i):""===i?null:i):i;var n}function M(t,e,i,n){var r={type:t,code:e,message:i};void 0!==n&&(r.row=n),b.errors.push(r)}this.parse=function(r,a,o){var l=t.quoteChar||'"';if(t.newline||(t.newline=function(t,e){t=t.substring(0,1048576);var i=new RegExp(f(e)+"([^]*?)"+f(e),"gm"),n=(t=t.replace(i,"")).split("\r"),r=t.split("\n"),a=1<r.length&&r[0].length<n[0].length;if(1===n.length||a)return"\n";for(var s=0,o=0;o<n.length;o++)"\n"===n[o][0]&&s++;return s>=n.length/2?"\r\n":"\r"}(r,l)),n=!1,t.delimiter)_(t.delimiter)&&(t.delimiter=t.delimiter(r),b.meta.delimiter=t.delimiter);else{var c=function(e,i,n,r,a){var o,l,c,h;a=a||[",","\t","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var u=0;u<a.length;u++){var d=a[u],p=0,f=0,m=0;c=void 0;for(var b=new g({comments:r,delimiter:d,newline:i,preview:10}).parse(e),y=0;y<b.data.length;y++)if(n&&x(b.data[y]))m++;else{var v=b.data[y].length;f+=v,void 0!==c?0<v&&(p+=Math.abs(v-c),c=v):c=v}0<b.data.length&&(f/=b.data.length-m),(void 0===l||p<=l)&&(void 0===h||h<f)&&1.99<f&&(l=p,o=d,h=f)}return{successful:!!(t.delimiter=o),bestDelimiter:o}}(r,t.newline,t.skipEmptyLines,t.comments,t.delimitersToGuess);c.successful?t.delimiter=c.bestDelimiter:(n=!0,t.delimiter=s.DefaultDelimiter),b.meta.delimiter=t.delimiter}var h=v(t);return t.preview&&t.header&&h.preview++,e=r,i=new g(h),b=i.parse(e,a,o),A(),d?{meta:{paused:!0}}:b||{meta:{paused:!1}}},this.paused=function(){return d},this.pause=function(){d=!0,i.abort(),e=_(t.chunk)?"":e.substring(i.getCharIndex())},this.resume=function(){c.streamer._halted?(d=!1,c.streamer.parseChunk(e,!0)):setTimeout(c.resume,3)},this.aborted=function(){return p},this.abort=function(){p=!0,i.abort(),b.meta.aborted=!0,_(t.complete)&&t.complete(b),e=""}}function f(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(t){var e,i=(t=t||{}).delimiter,n=t.newline,r=t.comments,a=t.step,o=t.preview,l=t.fastMode,c=e=void 0===t.quoteChar?'"':t.quoteChar;if(void 0!==t.escapeChar&&(c=t.escapeChar),("string"!=typeof i||-1<s.BAD_DELIMITERS.indexOf(i))&&(i=","),r===i)throw new Error("Comment character same as delimiter");!0===r?r="#":("string"!=typeof r||-1<s.BAD_DELIMITERS.indexOf(r))&&(r=!1),"\n"!==n&&"\r"!==n&&"\r\n"!==n&&(n="\n");var h=0,u=!1;this.parse=function(t,s,d){if("string"!=typeof t)throw new Error("Input must be a string");var p=t.length,g=i.length,m=n.length,b=r.length,y=_(a),v=[],x=[],A=[],w=h=0;if(!t)return N();if(l||!1!==l&&-1===t.indexOf(e)){for(var C=t.split(n),M=0;M<C.length;M++){if(A=C[M],h+=A.length,M!==C.length-1)h+=n.length;else if(d)return N();if(!r||A.substring(0,b)!==r){if(y){if(v=[],L(A.split(i)),k(),u)return N()}else L(A.split(i));if(o&&o<=M)return v=v.slice(0,o),N(!0)}}return N()}for(var E=t.indexOf(i,h),I=t.indexOf(n,h),S=new RegExp(f(c)+f(e),"g"),T=t.indexOf(e,h);;)if(t[h]!==e)if(r&&0===A.length&&t.substring(h,h+b)===r){if(-1===I)return N();h=I+m,I=t.indexOf(n,h),E=t.indexOf(i,h)}else if(-1!==E&&(E<I||-1===I))A.push(t.substring(h,E)),h=E+g,E=t.indexOf(i,h);else{if(-1===I)break;if(A.push(t.substring(h,I)),D(I+m),y&&(k(),u))return N();if(o&&v.length>=o)return N(!0)}else for(T=h,h++;;){if(-1===(T=t.indexOf(e,T+1)))return d||x.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:v.length,index:h}),R();if(T===p-1)return R(t.substring(h,T).replace(S,e));if(e!==c||t[T+1]!==c){if(e===c||0===T||t[T-1]!==c){-1!==E&&E<T+1&&(E=t.indexOf(i,T+1)),-1!==I&&I<T+1&&(I=t.indexOf(n,T+1));var B=U(-1===I?E:Math.min(E,I));if(t[T+1+B]===i){A.push(t.substring(h,T).replace(S,e)),t[h=T+1+B+g]!==e&&(T=t.indexOf(e,h)),E=t.indexOf(i,h),I=t.indexOf(n,h);break}var F=U(I);if(t.substring(T+1+F,T+1+F+m)===n){if(A.push(t.substring(h,T).replace(S,e)),D(T+1+F+m),E=t.indexOf(i,h),T=t.indexOf(e,h),y&&(k(),u))return N();if(o&&v.length>=o)return N(!0);break}x.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:v.length,index:h}),T++}}else T++}return R();function L(t){v.push(t),w=h}function U(e){var i=0;if(-1!==e){var n=t.substring(T+1,e);n&&""===n.trim()&&(i=n.length)}return i}function R(e){return d||(void 0===e&&(e=t.substring(h)),A.push(e),h=p,L(A),y&&k()),N()}function D(e){h=e,L(A),A=[],I=t.indexOf(n,h)}function N(t){return{data:v,errors:x,meta:{delimiter:i,linebreak:n,aborted:u,truncated:!!t,cursor:w+(s||0)}}}function k(){a(N()),v=[],x=[]}},this.abort=function(){u=!0},this.getCharIndex=function(){return h}}function m(t){var e=t.data,i=r[e.workerId],n=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var a={abort:function(){n=!0,b(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(_(i.userStep)){for(var s=0;s<e.results.data.length&&(i.userStep({data:e.results.data[s],errors:e.results.errors,meta:e.results.meta},a),!n);s++);delete e.results}else _(i.userChunk)&&(i.userChunk(e.results,a,e.file),delete e.results)}e.finished&&!n&&b(e.workerId,e.results)}function b(t,e){var i=r[t];_(i.userComplete)&&i.userComplete(e),i.terminate(),delete r[t]}function y(){throw new Error("Not implemented.")}function v(t){if("object"!=typeof t||null===t)return t;var e=Array.isArray(t)?[]:{};for(var i in t)e[i]=v(t[i]);return e}function x(t,e){return function(){t.apply(e,arguments)}}function _(t){return"function"==typeof t}return n&&(e.onmessage=function(t){var i=t.data;if(void 0===s.WORKER_ID&&i&&(s.WORKER_ID=i.workerId),"string"==typeof i.input)e.postMessage({workerId:s.WORKER_ID,results:s.parse(i.input,i.config),finished:!0});else if(e.File&&i.input instanceof File||i.input instanceof Object){var n=s.parse(i.input,i.config);n&&e.postMessage({workerId:s.WORKER_ID,results:n,finished:!0})}}),(c.prototype=Object.create(l.prototype)).constructor=c,(h.prototype=Object.create(l.prototype)).constructor=h,(u.prototype=Object.create(u.prototype)).constructor=u,(d.prototype=Object.create(l.prototype)).constructor=d,s})?n.apply(e,r):n)||(t.exports=a)},function(t,e,i){let n=i(0).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=i(2).NotiBuffer;AFRAME.registerComponent("babia-queryes",{schema:{elasticsearch_url:{type:"string"},index:{type:"string"},query:{type:"string"},size:{type:"int",default:10},request:{type:"string"},user:{type:"string"},password:{type:"string"},data:{type:"string"},tableBars:{type:"boolean",default:!1},rangeSelector:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r,this.tableBars=this.data.tableBars},update:function(t){this.oldData=t;let e="";if(this.data.rangeSelector){let t=document.getElementById(this.data.rangeSelector);t.components["babia-range-selector"]&&(this.prodComponent=t.components["babia-range-selector"]),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.updateQuerier.bind(this)),e=this.prodComponent.notiBuffer.data)}this.updateQuerier(e)},updateQuerier:function(t){let e=this.data,i=this.oldData;if(e.data&&i.data!==e.data){let t=n(e.data);this.notiBuffer.set(t)}else if(e.elasticsearch_url!==i.elasticsearch_url||e.index!==i.index||e.query!==i.query||e.size!==i.size){if(!e.elasticsearch_url||!e.index)return void console.error("elasicsearch_url and index must be defined");this.getJSON(e,t)}else t&&this.getJSON(e,t)},getJSON:async function(t,e){let i,r;if(t.size&&t.query)if(i=`${t.elasticsearch_url}/${t.index}/_search?size=${t.size}&${t.query}`,t.user&&t.password){let e=new Headers;e.append("Authorization","Basic "+btoa(t.user+":"+t.password)),r=await fetch(i,{headers:e})}else r=await fetch(i);else if(t.request){i=`${t.elasticsearch_url}/${t.index}/_search`;let a=await fetch(t.request);if(200!=a.status)throw new Error(a.status);if(this.json=await a.json(),this.json=n(this.json),e){let t;for(let e=0;e<this.json.query.bool.must.length;e++)this.json.query.bool.must[e].range&&(t=e);let i=this.json.query.bool.must[t].range[Object.keys(this.json.query.bool.must[t].range)[0]];i.gte=e.from,i.lte=e.to,this.json.aggs[2]&&this.json.aggs[2].date_histogram&&(this.json.aggs[2].date_histogram.interval=e.interval)}r=t.user&&t.password?await fetch(i,{method:"POST",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json","Access-Control-Allow-Origin":"*",Authorization:"Basic "+btoa(t.user+":"+t.password)},body:JSON.stringify(this.json)}):await fetch(i,{method:"POST",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json","Access-Control-Allow-Origin":"*"},body:JSON.stringify(this.json)})}if(200==r.status){let t=await r.json();return t=this.parseDataES(t),void this.notiBuffer.set(t)}throw new Error(r.status)},parseDataES:function(t){let e=[];console.log("REQUEST:",this.json),console.log("REPLY:",t);let i=Object.keys(t.aggregations);if(this.json.aggs&&1==i.length&&!this.json.aggs[i[0]].aggs){t=t.aggregations[i[0]].buckets;for(let i=0;i<t.length;i++)e.push(t[i])}else if(this.json.aggs&&1==i.length&&this.json.aggs[i[0]].aggs){t=t.aggregations[i[0]].buckets;for(let n=0;n<t.length;n++)if(t[0][Object.keys(t[0])[0]].values)e.push({key_as_string:t[n].key_as_string,key:t[n].key,doc_count:t[n].doc_count,value:t[n][Object.keys(t[0])[0]].values[0].value});else if(t[0][Object.keys(t[0])[0]].value&&1==t[0][Object.keys(t[0])[0]].length)e.push({key_as_string:t[n].key_as_string,key:t[n].key,doc_count:t[n].doc_count,value:t[n][Object.keys(t[0])[0]].value});else if(t[0][Object.keys(t[0])[0]].buckets&&t[0][Object.keys(t[0])[0]].buckets.length>0)for(let i=0;i<t[n][Object.keys(t[0])[0]].buckets.length;i++)e.push({key_as_string:t[n].key_as_string,key:t[n][Object.keys(t[0])[0]].buckets[i].key,count:t[n][Object.keys(t[0])[0]].buckets[i].doc_count,doc_count:t[n].doc_count,value:t[n][Object.keys(t[0])[0]].value});else if(Object.keys(t[0]).length>1)if(1==this.tableBars){e.push({key_as_string:i[0],key:t[n].key,value:t[n].doc_count});for(let i=0;i<Object.keys(t[0]).length;i++)t[n][Object.keys(t[0])[i]].value&&e.push({key_as_string:Object.keys(t[0])[i],key:t[n].key,value:t[n][Object.keys(t[0])[i]].value})}else{let r={key:t[n].key,value:t[n].doc_count};t[n].key_as_string?r.key_as_string=t[n].key_as_string:r.key_as_string=i[0];for(let e=0;e<Object.keys(t[0]).length;e++)t[n][Object.keys(t[0])[e]].value&&(r[Object.keys(t[0])[e]]=t[n][Object.keys(t[0])[e]].value);if(t[0][Object.keys(t[0])[0]].buckets)for(let e=0;e<Object.keys(t[0][Object.keys(t[0])[0]].buckets).length;e++)t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]][Object.keys(t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]])[0]].value?r[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]]=t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]][Object.keys(t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]])[0]].value:r[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]]=t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]].doc_count;e.push(r)}else e.push({key_as_string:t[n].key_as_string,key:t[n].key,doc_count:t[n].doc_count})}else{t=t.hits.hits;for(let i=0;i<t.length;i++)e[i]=t[i]._source}return e}})},function(t,e,i){let n=i(0).findTargetComponent;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-ui",{schema:{target:{type:"string"}},multiple:!1,init:function(){console.log("WELCOME TO UI: Control your data.")},update:function(t){let e=this.data;this.targetComponent&&this.targetComponent.notiBuffer.unregister(this.notiBufferId),this.targetComponent=n(e,this),this.findQuerierComponents(this),this.targetComponent.visProperties&&(this.targetComponentVisProperties=this.targetComponent.visProperties),this.targetComponent.notiBuffer&&(this.notiBufferId=this.targetComponent.notiBuffer.register(this.updateInterface.bind(this)))},targetComponent:void 0,targetComponentVisProperties:void 0,dataMetrics:void 0,interface:void 0,dataQueriers:void 0,handController:void 0,nodesQueriers:void 0,linksQueriers:void 0,updateInterface:function(t){let e=this;for(t&&a(e,t,e.targetComponentVisProperties);e.el.firstChild;)e.el.firstChild.remove();if(console.log("Generating interface..."),document.querySelector("#babia-menu-hand")){let t=document.querySelector("#babia-menu-hand");t.parentNode.removeChild(t),r(e,e.handController)}else e.interface=o(e,e.dataMetrics,e.el);document.addEventListener("controllerconnected",t=>{for(;e.el.firstChild;)e.el.firstChild.remove();controller=t.detail.name,"left"!==t.target.getAttribute(controller).hand||document.querySelector("#babia-menu-hand")||(e.handController=t.target.id,r(e,e.handController))})},findQuerierComponents:function(){this.targetComponent.el.components["babia-network"]&&(this.targetComponent.el.components["babia-network"].data.nodesFrom||this.targetComponent.el.components["babia-network"].data.nodes)?(console.log("nodesFrom or nodes"),this.nodesQueriers=[],this.linksQueriers=[],document.querySelectorAll("[babia-queryjson]").forEach(t=>{(t.id!=this.data.target||t.id==this.data.target&&"babia-filter"==!this.targetComponent.prodComponent.attrName)&&(this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id))}),document.querySelectorAll("[babia-queryes]").forEach(t=>{this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id)}),document.querySelectorAll("[babia-querygithub]").forEach(t=>{this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id)}),document.querySelectorAll("[babia-filter]").forEach(t=>{this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id)})):(this.dataQueriers=[],document.querySelectorAll("[babia-queryjson]").forEach(t=>{(t.id!=this.data.target||t.id==this.data.target&&"babia-filter"==!this.targetComponent.prodComponent.attrName)&&this.dataQueriers.push(t.id)}),document.querySelectorAll("[babia-queryes]").forEach(t=>{this.dataQueriers.push(t.id)}),document.querySelectorAll("[babia-querygithub]").forEach(t=>{this.dataQueriers.push(t.id)}),document.querySelectorAll("[babia-filter]").forEach(t=>{this.dataQueriers.push(t.id)}))}});let r=(t,e)=>{let i=document.getElementById(e);t.interface=o(t,t.dataMetrics,i),t.interface.id="babia-menu-hand",t.interface.setAttribute("scale",{x:.03,y:.03,z:.03}),t.interface.setAttribute("position",{x:-.03*t.interface.width/2,y:.03*t.interface.height/2,z:-.1}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),d(t.handController,t.interface)},a=(t,e,i)=>{if("babia-network"==t.targetComponent.attrName)if(e.nodes){t.dataMetrics={nodes:[],links:[]};let n,r=["height","radius","width","size","farea","fheight","area","depth"],a=[];n=s(e.nodes[0]),Object.keys(n).forEach(t=>{"number"==typeof n[t]&&a.push(t)}),i.nodes.forEach(i=>{r.includes(i)?t.dataMetrics.nodes.push({property:i,metrics:a}):t.dataMetrics.nodes.push({property:i,metrics:Object.keys(e.nodes[0])})}),i.links1.forEach(i=>{r.includes(i)?t.dataMetrics.links.push({property:i,metrics:a}):t.dataMetrics.links.push({property:i,metrics:Object.keys(e.links[0])})})}else{t.dataMetrics=[];let n,r=["height","radius","width","size","farea","fheight","area","depth"],a=[];n=s(e[0]),Object.keys(n).forEach(t=>{"number"==typeof n[t]&&a.push(t)}),i.nodes.forEach(i=>{r.includes(i)?t.dataMetrics.push({property:i,metrics:a}):t.dataMetrics.push({property:i,metrics:Object.keys(e[0])})}),i.links0.forEach(i=>{r.includes(i)?t.dataMetrics.push({property:i,metrics:a}):t.dataMetrics.push({property:i,metrics:Object.keys(e[0])})})}else{t.dataMetrics=[];let n,r=["height","radius","width","size","farea","fheight","area","depth"],a=[];n="babia-city"==t.targetComponent.attrName?s(e):"babia-boats"==t.targetComponent.attrName?s(e[0]):e[0],Object.keys(n).forEach(t=>{"number"==typeof n[t]&&a.push(t)}),i.forEach(i=>{r.includes(i)?t.dataMetrics.push({property:i,metrics:a}):t.dataMetrics.push({property:i,metrics:Object.keys(e[0])})})}},s=t=>(t.children?child=s(t.children[0]):child=t,child),o=(t,e,i)=>{t.interface=document.createElement("a-entity"),t.interface.id="babia-menu";let n=0,r=0,a=0;if(t.targetComponent.el.components["babia-network"]&&(t.targetComponent.el.components["babia-network"].data.nodesFrom||t.targetComponent.el.components["babia-network"].data.nodes)){if(t.nodesQueriers.length>1){let e=h("Nodes",r,n);t.interface.appendChild(e),t.nodesQueriers.forEach(e=>{r+=3.25;let i=u(t,e,r,n,"nodes");i.classList.add("babiaxraycasterclass"),t.interface.appendChild(i)})}if(--n,a<r&&(a=r),r=0,t.linksQueriers.length>1){let e=h("Links",r,n);t.interface.appendChild(e),t.linksQueriers.forEach(e=>{r+=3.25;let i=u(t,e,r,n,"links");i.classList.add("babiaxraycasterclass"),t.interface.appendChild(i)})}--n,a<r&&(a=r),r=0,e.nodes.forEach(e=>{let i=h(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach(i=>{r+=3.25;let a=l(t,e.property,i,r,n);a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a)}),--n,a<r&&(a=r),r=0}),e.links.forEach(e=>{let i=h(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach(i=>{r+=3.25;let a=l(t,e.property,i,r,n);a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a)}),--n,a<r&&(a=r),r=0})}else{if(t.dataQueriers.length>1){let e=h("Data",r,n);t.interface.appendChild(e),t.dataQueriers.forEach(e=>{r+=3.25;let i=u(t,e,r,n);i.classList.add("babiaxraycasterclass"),t.interface.appendChild(i)})}--n,a<r&&(a=r),r=0,e.forEach(e=>{let i=h(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach(i=>{r+=3.25;let a=l(t,e.property,i,r,n);a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a)}),--n,a<r&&(a=r),r=0})}return t.interface.width=a+3,t.interface.height=Math.abs(n),t.interface.setAttribute("position",{x:-t.interface.width/2,y:t.interface.height,z:0}),i.appendChild(t.interface),t.interface},l=(t,e,i,n,r)=>{let a=document.createElement("a-box");a.property=e,a.metric=i,a.classList.add("babiaxraycasterclass"),a.setAttribute("position",{x:n,y:r,z:0}),a.setAttribute("rotation",{x:0,y:0,z:0}),a.setAttribute("height",.8),a.setAttribute("width",3),a.setAttribute("depth",.01);let s=document.createElement("a-entity");return s.setAttribute("text",{value:i,align:"center",width:"10",color:"black"}),s.setAttribute("position","0 0 0.01"),a.appendChild(s),t.targetComponent.data[e]==i&&a.setAttribute("color","#555555"),c(a,t.targetComponent,!1),a},c=(t,e,i)=>{t.addEventListener("mouseenter",(function(){t.children[0].setAttribute("text",{color:"#FFFFFF"}),t.setAttribute("color","#333333")})),i?t.addEventListener("mouseleave",(function(){t.children[0].setAttribute("text",{color:"black"}),e.data.from==t.from?t.setAttribute("color","#555555"):""!=e.data.from&&e.data.from==t.from||t.setAttribute("color","#FFFFFF")})):t.addEventListener("mouseleave",(function(){t.children[0].setAttribute("text",{color:"black"}),e.data[t.property]==t.metric?t.setAttribute("color","#555555"):t.setAttribute("color","#FFFFFF")})),t.addEventListener("click",(function(){t.property&&t.metric?("babia-boats"==e.attrName&&"area"==t.property?(e.el.removeAttribute(e.attrName,"width"),e.el.removeAttribute(e.attrName,"depth")):"babia-boats"!=e.attrName||"width"!=t.property&&"depth"!=t.property||!e.el.getAttribute("babia-boats").area||(e.el.removeAttribute(e.attrName,"area"),"width"==t.property?e.el.setAttribute(e.attrName,"depth",t.metric):e.el.setAttribute(e.attrName,"width",t.metric)),e.el.setAttribute(e.attrName,t.property,t.metric)):t.from?e.el.setAttribute(e.attrName,"from",t.from):t.nodes?e.el.setAttribute(e.attrName,"nodesFrom",t.nodes):t.links&&e.el.setAttribute(e.attrName,"linksFrom",t.links)}))},h=(t,e,i)=>{let n=document.createElement("a-plane");return n.setAttribute("position",{x:e,y:i,z:0}),n.setAttribute("rotation",{x:0,y:0,z:0}),n.setAttribute("height",.8),n.setAttribute("width",3),n.setAttribute("text",{value:t,align:"center",width:"10",color:"#FFFFFF"}),n.setAttribute("color","black"),n},u=(t,e,i,n,r)=>{let a=document.createElement("a-box");"nodes"==r?a.nodes=e:"links"==r?a.links=e:a.from=e,a.classList.add("babiaxraycasterclass"),a.setAttribute("position",{x:i,y:n,z:0}),a.setAttribute("rotation",{x:0,y:0,z:0}),a.setAttribute("height",.8),a.setAttribute("width",3),a.setAttribute("depth",.01);let s=document.createElement("a-entity");return s.setAttribute("text",{value:e,align:"center",width:"10",color:"black"}),s.setAttribute("position","0 0 0.01"),a.appendChild(s),t.targetComponent.prodComponent&&t.targetComponent.prodComponent.el.id==e?a.setAttribute("color","#555555"):a.setAttribute("color","#FFFFFF"),c(a,t.targetComponent,!0),a},d=(t,e)=>{let i=!0;document.getElementById(t).addEventListener("gripdown",(function(){i?(i=!1,e.setAttribute("visible",!1)):(i=!0,e.setAttribute("visible",!0))}))}},function(t,e,i){let n=i(0).findProdComponent,r=i(0).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const a=i(2).NotiBuffer;AFRAME.registerComponent("babia-filter",{schema:{from:{type:"string"},filter:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new a},update:function(t){let e=this.data,i=this.el;if(!e.data||t.data===e.data&&e.filter===t.filter)e.from===t.from&&e.filter===t.filter||(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i,"babia-filter"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));else{let t=r(e.data);this.processData(t)}},remove:function(){},pause:function(){},play:function(){},prodComponent:void 0,notiBufferId:void 0,processData:function(t){let e,i=this.data.filter.split("=");i[0]&&i[1]?(e=t.filter(t=>t[i[0]]==i[1]),this.notiBuffer.set(e)):console.error("Error on filter, please use key=value syntax")}})},function(e,i,n){let r=n(0).findProdComponent,a=n(0).parseJson;const s=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function o(e,i,n){for(t=0;t<e.length&&e[t][i]!==n;)t++;return t<e.length&&e[t]}AFRAME.registerComponent("babia-treebuilder",{schema:{from:{type:"string"},field:{type:"string"},split_by:{type:"string"},data:{type:"string"}},multiple:!1,prodComponent:void 0,notiBufferId:void 0,init:function(){this.notiBuffer=new s},update:function(t){let e=this.data,i=this.el;if(!e.data||t.data===e.data&&e.field===t.field&&e.split_by===t.split_by)e.from===t.from&&e.field===t.field&&e.split_by===t.split_by||(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=r(e,i,"babia-treebuilder"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));else{let t=a(e.data);this.processData(t)}},processData:function(t){let e=this.data,i=[];for(let n=0;n<t.length;n++){let r=t[n][e.field].split(e.split_by),a=i;for(let i=0;i<r.length;i++){if(!r[i])continue;let s=r[i],l=o(a,"name",s);if(l)a=l.children;else{let o={};i===r.length-1?o=t[n]:o.children=[],o.uid=t[n][e.field].split(s)[0]+s,o.name=s,a.push(o),a=o.children}}}this.notiBuffer.set(i)}})},function(t,e,i){let n=i(0).findProdComponent,r=i(0).findNavComponent,a=i(0).parseJson;class s{constructor(t,e,i,n,r,a,s){this.data={};for(let i of t){let t=i[e];this.data[t]?this.data[t].push(i):this.data[t]=[i]}this.selectors=Object.keys(this.data).sort(),this.length=this.selectors.length,this.step=n||1,this.speed=r||1,this.current=-2==i?0:i,this.state=a||"play",this.direction=s||"forward"}next(){let t=this.data[this.selectors[this.current]];return this.current+this.step<=this.length-1?this.current+=this.step:(this.current=this.length-1,this.current=this.length),t}prev(){let t=this.data[this.selectors[this.current]];return this.current-this.step>=0?this.current-=this.step:this.current=-1,t}setValue(t){let e=this.data[this.selectors[t]];return"rewind"!=this.direction?t>this.length?this.current=this.length:this.current=t<1?1:t+1:t>this.length-2?this.current=this.length-2:this.current=t<-1?-1:t-1,e}}if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const o=i(2).NotiBuffer;AFRAME.registerComponent("babia-selector",{schema:{from:{type:"string"},controller:{type:"string"},select:{type:"string",default:"date"},timeout:{type:"number",default:6e3},data:{type:"string"},current_value:{type:"number",default:-2},speed:{type:"number",default:0},step:{type:"number",default:0},direction:{type:"string",default:""},state:{type:"string",default:""}},multiple:!1,interval:void 0,init:function(){this.notiBuffer=new o,this.navNotiBuffer=new o},babiaMetadata:{id:0},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from&&(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i,"babia-selector"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));if(e.controller!=t.controller&&(this.selectorController=document.querySelector("#"+e.controller),this.navComponent&&(this.navComponent.notiBuffer.unregister(this.navNotiBufferId,this),i.components.networked&&this.removeOldNavListener(this.navComponent.el)),this.navComponent=r(e,i),this.navComponent.notiBuffer&&(this.navNotiBufferId=this.navComponent.notiBuffer.register(this.processEvent.bind(this),this)),i.components.networked&&this.addMultiuserMode(this.navComponent.el)),e.direction&&e.direction!=t.direction&&("rewind"!=e.direction?(this.selectable.current!=this.selectable.length&&(this.selectable.current+=2),this.navNotiBuffer&&this.navNotiBuffer.set("forward")):(this.selectable.current<1?this.selectable.current=0:this.selectable.current-=2,this.navNotiBuffer&&this.navNotiBuffer.set("rewind"))),e.step&&e.step!=this.selectable.step&&(this.selectable.step=e.step,this.navNotiBuffer.set({type:"step",value:e.step}),"rewind"!=this.data.direction?this.selectable.current+e.step>this.selectable.length?this.selectable.current=this.selectable.length:this.selectable.current+=e.step-1:this.selectable.current-e.step<=0?this.selectable.current=-1:this.selectable.current-=e.step+1),e.speed&&e.speed!=this.selectable.speed){this.selectable.speed=e.speed;let t=this.data.timeout/e.speed;this.navNotiBuffer.set({type:"speed",value:e.speed});let i=this;clearInterval(this.interval),this.interval=window.setInterval((function(){i.loop()}),t)}i.components.networked&&i.components.networked.data.owner!=NAF.clientId&&"scene"!=i.components.networked.data.owner&&(-2!=e.current_value&&e.current_value!=t.current_value&&("rewind"!=e.direction?(this.navNotiBuffer.set({type:"position",value:e.current_value-1,label:this.selectable.selectors[e.current_value-1]}),this.setSelect(e.current_value-1)):(this.navNotiBuffer.set({type:"position",value:e.current_value+1,label:this.selectable.selectors[e.current_value+1]}),this.setSelect(e.current_value+1))),"pause"==e.state&&e.state!=t.state&&this.navNotiBuffer.set("pause"))},nextSelect:function(){this.selectable.current>this.selectable.length-1?(this.selectable.current=this.selectable.length,this.selectable.state="pause",this.el.setAttribute("babia-selector","state","pause"),this.navNotiBuffer.set("pause")):(this.newData=this.selectable.next(),this.el.setAttribute("babia-selector","current_value",this.selectable.current),this.notiBuffer.set(this.newData),this.navNotiBuffer.set({type:"position",value:this.selectable.current,label:this.selectable.selectors[this.selectable.current-1]}),this.babiaMetadata={id:this.selectable.current})},prevSelect:function(){this.selectable.current>=0?(this.newData=this.selectable.prev(),this.el.setAttribute("babia-selector","current_value",this.selectable.current),this.notiBuffer.set(this.newData),this.navNotiBuffer.set({type:"position",value:this.selectable.current,label:this.selectable.selectors[this.selectable.current+1]}),this.babiaMetadata={id:this.selectable.current}):(this.selectable.current=-1,this.selectable.state="pause",this.el.setAttribute("babia-selector","state","pause"),this.navNotiBuffer.set("pause"))},setSelect:function(t){if(t!=this.selectable.current-1&&"rewind"!=this.data.direction||t!=this.selectable.current+1&&"rewind"===this.data.direction){let e;this.newData=this.selectable.setValue(t),"rewind"!=this.data.direction?(this.babiaMetadata={id:t++},e=this.selectable.selectors[t-1]):(this.babiaMetadata={id:t--},this.selectable.current-=2,e=this.selectable.selectors[t+1]),this.notiBuffer.set(this.newData),this.navNotiBuffer.set({type:"position",value:t,label:e})}},loop:function(){"pause"!=this.data.state&&("rewind"!=this.data.direction?this.nextSelect():this.prevSelect())},prodComponent:void 0,navComponent:void 0,prodNotiBufferId:void 0,navNotiBufferId:void 0,newData:void 0,processData:function(t){this.selectable||(this.selectable=new s(t,this.data.select,this.data.current_value,this.data.step,this.data.speed)),this.navNotiBuffer.set({type:"position",value:this.selectable.current,label:this.selectable.selectors[this.selectable.current-1]});let e=this;this.nextSelect(),this.interval=window.setInterval((function(){e.loop()}),e.data.timeout*e.selectable.speed)},processEvent:function(t){if(t.includes("pause"))this.selectable.state="pause",this.el.setAttribute("babia-selector","state","pause");else if(t.includes("play"))this.selectable.state="play",this.el.setAttribute("babia-selector","state","play");else if(t.includes("forward"))this.selectable.direction="forward",this.el.setAttribute("babia-selector","direction","forward");else if(t.includes("rewind"))this.selectable.direction="rewind",this.el.setAttribute("babia-selector","direction","rewind");else if(t.includes("babiaSetPosition")){this.selectable.state="pause";let e=parseInt(t.substring(16),10);"rewind"!=this.data.direction?this.el.setAttribute("babia-selector",{state:"pause",current_value:e+1}):this.el.setAttribute("babia-selector",{state:"pause",current_value:e-1}),this.setSelect(e),this.navNotiBuffer.set("pause")}else t.includes("babiaSetStep")?this.el.setAttribute("babia-selector","step",parseInt(t.substring(12),10)):t.includes("babiaSetSpeed")&&this.el.setAttribute("babia-selector","speed",parseInt(t.substring(13),10))},removeOldNavListener:function(t){t.removeEventListener("click",(function(){NAF.utils.isMine(selector)||"scene"==selector.components.networked.data.owner||Object.keys(NAF.connection.connectedClients).length>0&&NAF.utils.takeOwnership(selector)}))},addMultiuserMode:function(t){let e=this.el;function i(){t.children[1].setAttribute("visible",!1),t.children[2].setAttribute("visible",!1),t.children[3].setAttribute("visible",!1)}document.body.addEventListener("clientConnected",(function(t){let n=t.detail.clientId;console.log("clientConnected event. clientId =",n),console.log("Selector owner: ",e.components.networked.data.owner);let r=!0;if("scene"==e.components.networked.data.owner){for(let t in NAF.connection.getConnectedClients()){let e=NAF.connection.getConnectedClients()[t].roomJoinTime,i=NAF.connection.adapter._myRoomJoinTime;console.log("Other: ",e),console.log("Mine: ",i),i>e&&(r=!1)}r?NAF.utils.takeOwnership(e):(console.log("I'm not first"),i())}else e.components.networked.data.owner!=NAF.clientId&&i()})),t.addEventListener("click",(function(){NAF.utils.isMine(e)||"scene"==e.components.networked.data.owner||Object.keys(NAF.connection.connectedClients).length>0&&NAF.utils.takeOwnership(e)})),e.addEventListener("ownership-gained",e=>{console.log("Selector ownership gained"),t.children[1].setAttribute("visible",!0),t.children[2].setAttribute("visible",!0),t.children[3].setAttribute("visible",!0)}),e.addEventListener("ownership-lost",t=>{console.log("Selector ownership lost"),i()})}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-interaction-mapper",{schema:{input:{type:"string"},output:{type:"string"}},multiple:!1,init:function(){let t=this.data,e=this.el;t.input&&t.output&&i(t,e)},update:function(t){let e=this.data,n=this.el;e!==t&&(e.input===t.input&&e.output===t.output||(console.log("Change event because from has changed"),n.removeEventListener(t.input,(function(t){})),i(e,n)))},remove:function(){},pause:function(){},play:function(){}});let i=(t,e)=>{e.addEventListener(t.input,(function(i){e.emit(t.output,i,!1)}))}},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-debug-data",{schema:{inputEvent:{type:"string"}},multiple:!1,init:function(){let t=this.data,e=this.el;t.input&&t.output&&i(t,e)},update:function(t){let e=this.data,n=this.el;e!==t&&e.inputEvent!==t.inputEvent&&(console.log("Change event because from has changed"),n.removeEventListener(e.inputEvent,(function(t){})),i(e,n))},remove:function(){},pause:function(){},play:function(){}});let i=(t,e)=>{e.addEventListener(t.inputEvent,(function(i){n(t,e)}))},n=(t,e)=>{if(!e.querySelector(".debug-data")){let t=function(t,e,i){let n=document.createElement("a-plane");n.setAttribute("color","white"),n.setAttribute("class","debug_data"),n.setAttribute("width",10),n.setAttribute("height",10);let r=e.getAttribute("position"),a=0,s=0;e.getAttribute("geometry")&&("box"===e.components.geometry.data.primitive?(a=e.getAttribute("geometry").width/2,s=e.getAttribute("geometry").height/2):"sphere"===e.components.geometry.data.primitive?a=e.getAttribute("geometry").radius:(a=0,s=0));n.setAttribute("position",{x:r.x+a+5,y:0-s+5,z:r.z});let o=document.createElement("a-text");return o.setAttribute("value",JSON.stringify(i)),o.setAttribute("width",10),o.setAttribute("height",10),o.setAttribute("color","black"),o.setAttribute("position",{x:0-n.getAttribute("width")/2,y:0-e.getAttribute("height")/2,z:0}),n.appendChild(o),n}(0,e,e.getAttribute("babiaData"));e.appendChild(t)}}},function(t,e,i){let n=i(0).updateTitle;const r=i(0).colors;let a=i(0).updateFunction;const s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function o(t,e,i,n,a){let s=r.get(n,a);console.log("Generating slice...");let o=document.createElement("a-cylinder");return o.setAttribute("color",s),o.setAttribute("theta-start",t),o.setAttribute("theta-length",e),o.setAttribute("side","double"),o.setAttribute("radius",i),o}function l(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e){let i=e[t.key]+": "+e[t.size],n=2;i.length>16&&(n=i.length/8);let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:0,z:-2}),r.setAttribute("rotation",{x:-90,y:0,z:0}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e[t.key]+": "+e[t.size],align:"center",width:6,color:"black"}),r.classList.add("babiaxrLegend"),r.setAttribute("babia-lookat",t.legend_lookat),r.setAttribute("scale",{x:t.legend_scale,y:t.legend_scale,z:t.legend_scale}),r}(t,i),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-pie",{schema:{data:{type:"string"},size:{type:"string",default:"size"},key:{type:"string",default:"key"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},animation:{type:"boolean",default:!1}},visProperties:["size","key"],multiple:!1,init:function(){this.notiBuffer=new s},update:function(t){a(this,t)},tick:function(t,e){if(this.data.animation&&this.loaded){let i=document.getElementsByClassName("babiaxrChart")[0].children;for(let n in this.slice_array){let r=this.slice_array[n].delay,a=this.slice_array[n].degreeLenght,s=parseFloat(i[n].getAttribute("theta-length"));t>=r&&s<a&&(s+=360*e/this.total_duration,s>a&&(s=a),i[n].setAttribute("theta-length",s))}}},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},loaded:!1,slice_array:[],total_duration:4e3,updateTitle:function(){const t=n(this.data,{x:-90,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-pie:",t);const e=this.data,i=this.el,n=e.animation,r=e.palette;let a=0,s=0,c=0,h=0;for(let i of t)h+=i[e.size];this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl);let u=0;for(let d of t){let t;if(s=360*d[e.size]/h,n){let e=this.total_duration*s/360;this.slice_array.push({degreeLenght:s,duration:e,delay:u}),u+=e,t=o(a,.01,1,c,r)}else t=o(a,s,1,c,r);t.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(t),a+=s,e.legend&&l(e,t,d,i),c++}this.updateTitle()},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating pie..."),this.updateChart(),this.loaded=!0,this.notiBuffer.set(this.newData)}})},function(t,e,i){let n=i(0).updateTitle;const r=i(0).colors;let a=i(0).updateFunction;const s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-bars",{schema:{data:{type:"string"},height:{type:"string",default:"height"},x_axis:{type:"string",default:"x_axis"},from:{type:"string"},legend:{type:"boolean",default:!1},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"vec3",default:{x:0,y:0,z:0}},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},uiLink:{type:"boolean",default:!1},uiLinkPosition:{type:"vec3",default:{x:-4.5,y:2,z:2.5}}},visProperties:["height","x_axis"],multiple:!1,init:function(){this.notiBuffer=new s,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t),this.data.uiLink&&l(el,this.data.uiLinkPosition)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},widthBars:1,total_duration:3e3,proportion:void 0,valueMax:void 0,xLabels:[],xTicks:[],updateTitle:function(){this.titleEl=n(this.data,{x:0,y:0,z:0})},updateAxis:function(t,e,i,n){const r=this.data;r.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:r.palette}),this.xAxisEl.setAttribute("position",{x:0,y:0,z:this.widthBars/2}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:this.widthBars/2}),r.axis_name&&(r.index?this.xAxisEl.setAttribute("babia-axis-x","name",r.index):this.xAxisEl.setAttribute("babia-axis-x","name",r.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",r.height)))},updateChart:function(){let t;t=this.currentData?this.currentData:this.newData,console.log("Data babia-bars:",t);const e=this.data,i=e.palette;this.updateTitle();let n=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*n/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=n;let a=this.chartEl,s=a.querySelectorAll("a-entity[babia-bar]"),o={};for(let t of s){o[t.getAttribute("babia-name")]={el:t,found:!1}}let l=[],c=[],h=0;for(let n=0;n<t.length;n++){let s,u=t[n],d=u[e.x_axis],p=n*this.widthBars*1.25;o[d]&&!u._not?(s=o[d].el,o[d].found=!0):(s=document.createElement("a-entity"),s.setAttribute("babia-name",d),s.id=u[e.index],s.object3D.position.x=p,a.appendChild(s)),s.setAttribute("babia-bar",{height:u[e.height]*this.lengthY/this.maxValue,width:this.widthBars,depth:this.widthBars,color:r.get(h,i),label:"events",animation:e.animation}),e.legend&&s.setAttribute("babia-bar",{labelText:d+": "+u[e.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale}),p!==s.object3D.position.x&&(e.animation?s.setAttribute("animation",{property:"object3D.position.x",to:p,dur:e.dur}):s.object3D.position.x=p),l.push(u[e.x_axis]),c.push(p),h++}for(let t in o)o[t].found||o[t].el.remove();const u=this.widthBars*(1.25*t.length);this.updateAxis(l,c,u,this.maxValue)},processData:function(t){console.log("processData",this);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.notiBuffer.set(this.newData),e.incremental)if(this.newData.forEach(t=>{let i=!1;for(let n in this.currentData)this.currentData[n][e.index]==t[e.index]&&(this.currentData[n]=t,i=!0);i||this.currentData.push(t)}),e.keepHeight)this.maxValue=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]}))),console.log("Re-draw the chart"),this.updateChart();else{this.newData.forEach(t=>{if(t._not)this.chartEl.querySelector("#"+t[e.index]).setAttribute("babia-bar","height",-.1);else if(this.chartEl.querySelector("#"+t[e.index]))this.chartEl.querySelector("#"+t[e.index]).setAttribute("babia-bar",{height:t[e.height]*e.chartHeight/this.maxValue,labelText:t[e.index]+": "+t[e.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale});else{let i=this.chartEl.querySelectorAll("[babia-bar]").length,n=this.chartEl.querySelectorAll("[babia-bar]")[i-1].getAttribute("position").x+this.widthBars+this.widthBars/4,r=o(this,e,t,i,e.palette,n);this.chartEl.appendChild(r),this.xLabels.push(r.id),this.xTicks.push(n)}});let t=this.xTicks[this.xTicks.length-1]+3*this.widthBars/4;if(!e.chartHeight||!e.keepHeight){let t=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]})));this.lengthY=t*e.chartHeight/this.maxValue,this.maxValue=t}this.updateAxis(this.xLabels,this.xTicks,t,this.maxValue)}else this.currentData=JSON.parse(JSON.stringify(this.newData)),this.updateChart()}});let o=(t,e,i,n,a,s)=>{let o=document.createElement("a-entity");return o.setAttribute("babia-bar",{height:i[t.data.height]*e.chartHeight/t.maxValue,width:t.widthBars,depth:t.widthBars,color:r.get(n,a),label:"events",animation:e.animation}),e.legend&&o.setAttribute("babia-bar",{labelText:i[t.data.x_axis]+": "+i[t.data.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale}),o.setAttribute("position",{x:s,y:0,z:0}),o.id=i[t.data.index],o},l=(t,e)=>{let i=document.createElement("a-entity");if(!t.id){let e="bars"+Math.floor(1e3*Math.random());t.id=e}console.log("id:",t.id),i.setAttribute("babia-ui-link",{viz:t.id}),i.setAttribute("position",{x:e.x,y:e.y,z:e.z}),t.appendChild(i),console.log("Create Button",t)}},function(t,e,i){var n=this;i(0).findProdComponent;let r=i(0).updateTitle;i(0).parseJson;const a=i(0).colors;let s=i(0).updateFunction;const o=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-barsmap",{schema:{data:{type:"string"},height:{type:"string",default:"height"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string",default:"x_axis"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3}},visProperties:["height","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new o,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){s(this,t)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},widthBars:1,proportion:void 0,valueMax:void 0,xLabels:[],zLabels:[],xTicks:[],zTicks:[],total_duration:3e3,updateTitle:function(){this.titleEl=r(this.data,{x:0,y:0,z:0})},updateAxis:function(t,e,i,n,r,a,s){const o=this.data;o.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:o.palette,align:"behind"}),this.xAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:-this.widthBars/2}),this.zAxisEl||(this.zAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.zAxisEl)),this.zAxisEl.setAttribute("babia-axis-z",{labels:r,ticks:a,length:s,palette:o.palette,align:"left"}),this.zAxisEl.setAttribute("position",{x:0-this.widthBars/2,y:0,z:-this.widthBars/2}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:-this.widthBars/2}),o.axis_name&&((o.index=!1)?this.xAxisEl.setAttribute("babia-axis-x","name",o.index):this.xAxisEl.setAttribute("babia-axis-x","name",o.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",o.height),this.zAxisEl.setAttribute("babia-axis-z","name",o.z_axis)))},updateChart:function(){let t;t=this.currentData?this.currentData:this.newData,console.log("Data babia-barsmap:",t);const e=this.data,i=e.palette;this.updateTitle();let n=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*n/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=n;let r=[],s=[],o=[],l=[],c=this.chartEl;c.querySelectorAll("a-entity[babia-bar]").forEach(t=>{t.remove()});for(let h=0;h<t.length;h++){let u,d,p=t[h],f=p[e.x_axis],g=p[e.z_axis];r.includes(f)||(r.push(f),u=(r.length-1)*this.widthBars*1.25,s.push(u+this.widthBars/2)),u||(u=r.indexOf(f)*this.widthBars*1.25),o.includes(g)||(o.push(g),d=(o.length-1)*this.widthBars*1.25,l.push(d+this.widthBars/2)),d||(d=o.indexOf(g)*this.widthBars*1.25),console.log(f+" "+g+" "+u+" "+d);let m,b=r.indexOf(f);m||(m=document.createElement("a-entity"),m.id=f+g,m.classList.add("babiaxraycasterclass"),m.object3D.position.x=u,m.object3D.position.z=d,c.appendChild(m)),p._not?m.setAttribute("babia-bar",{height:-.1,color:a.get(b,i)}):m.setAttribute("babia-bar",{height:p[e.height]*this.lengthY/n,width:this.widthBars,depth:this.widthBars,color:a.get(b,i),label:"events",animation:e.animation}),e.legend&&m.setAttribute("babia-bar",{labelText:f+", "+g+": "+p[e.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale})}const h=this.widthBars*(1.25*r.length+.75),u=this.widthBars*(1.25*o.length+.75);this.updateAxis(r,s,h,n,o,l,u),this.xLabels=r,this.xTicks=s,this.zLabels=o,this.zTicks=l},processData:function(t){console.log("processData",this);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.notiBuffer.set(this.newData),e.incremental)if(this.newData.forEach(t=>{let i=!1;for(let n in this.currentData)this.currentData[n][e.x_axis]==t[e.x_axis]&&this.currentData[n][e.z_axis]==t[e.z_axis]&&(this.currentData[n]=t,i=!0);i||this.currentData.push(t)}),e.keepHeight)this.maxValue=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]}))),console.log("Re-draw the chart"),this.updateChart();else{console.log("Keep ---\x3e Update"),this.newData.forEach(t=>{t._not?this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis]).setAttribute("babia-bar","height",-.1):this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis])?this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis]).setAttribute("babia-bar",{height:t[e.height]*e.chartHeight/this.maxValue,labelText:t[e.x_axis]+","+t[e.z_axis]+": "+t[e.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale}):l(this,e,t,this.maxValue,a,this.xLabels,this.zLabels,this.xTicks,this.zTicks)});let t=this.xTicks[this.xTicks.length-1]+3*this.widthBars/4,i=this.zTicks[this.zTicks.length-1]+3*this.widthBars/4;if(!e.chartHeight||!e.keepHeight){let t=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]})));this.lengthY=t*e.chartHeight/this.maxValue,this.maxValue=t}this.updateAxis(this.xLabels,this.xTicks,t,this.maxValue,this.zLabels,this.zTicks,i)}else this.currentData=JSON.parse(JSON.stringify(this.newData)),this.updateChart()}});let l=(t,e,i,r,s,o,l,c,h)=>{let u,d,p=i[e.x_axis],f=i[e.z_axis];o.includes(p)||(o.push(p),u=(o.length-1)*n.widthBars*1.25,c.push(u+n.widthBars/2)),u||(u=o.indexOf(p)*n.widthBars*1.25),l.includes(f)||(l.push(f),d=(l.length-1)*n.widthBars*1.25,h.push(d+n.widthBars/2)),d||(d=l.indexOf(f)*n.widthBars*1.25);let g=o.indexOf(p),m=document.createElement("a-entity");return m.id=p+f,m.classList.add("babiaxraycasterclass"),m.setAttribute("babia-bar",{height:i[e.height]*n.lengthY/r,width:n.widthBars,depth:n.widthBars,color:a.get(g,s),label:"events",animation:e.animation}),m.object3D.position.x=u,m.object3D.position.z=d,chartEl.appendChild(m),e.legend&&m.setAttribute("babia-bar",{labelText:i[t.data.x_axis]+": "+i[t.data.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale}),n.xLabels=o,n.xTicks=c,n.zLabels=l,n.zTicks=h,bar}},function(t,e,i){let n=i(0).updateTitle;const r=i(0).colors;let a=i(0).updateFunction;const s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function o(t,e,i,n,a,s,o,l,c,h){let u=r.get(i,n);console.log("Generating bubble..."),l?(t/=l,e/=l):(c||h)&&(c&&(t*=c),h&&(e*=h));let d=document.createElement("a-sphere");if(d.setAttribute("color",u),d.setAttribute("radius",e),o){let i=a.toString()+" "+e.toString()+" "+s.toString(),n=a.toString()+" "+(e+t).toString()+" "+s.toString();d.setAttribute("animation__position",{property:"position",from:i,to:n,dur:"3000",easing:"linear"})}else d.setAttribute("position",{x:a,y:e+t,z:s});return d}function l(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e,i){let n=e[t.x_axis]+": \n Radius:"+e[t.radius]+"\nHeight:"+e[t.height],r=2;n.length>16&&(r=n.length/8);let a=i.getAttribute("position"),s=parseFloat(i.getAttribute("radius")),o=document.createElement("a-plane");return o.setAttribute("position",{x:a.x,y:a.y+s+1,z:a.z+.1}),o.setAttribute("rotation",{x:0,y:0,z:0}),o.setAttribute("height","1"),o.setAttribute("width",r),o.setAttribute("color","white"),o.setAttribute("text",{value:n,align:"center",width:6,color:"black"}),o.classList.add("babiaxrLegend"),o.setAttribute("babia-lookat",t.legend_lookat),o.setAttribute("scale",{x:t.legend_scale,y:t.legend_scale,z:t.legend_scale}),o}(t,i,e),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-bubbles",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number"}},visProperties:["height","radius","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new s},update:function(t){a(this,t)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){const t=n(this.data,{x:0,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-bubbles:",t);const e=this.data,i=this.el,n=e.animation,r=e.palette,a=e.scale;let s=e.heightMax,c=e.radiusMax,h=[],u=[],d=[],p=[],f=0,g=0,m=0,b=0,y=0,v=0,x={},_={},A=Math.max.apply(Math,t.map((function(t){return t[e.height]}))),w=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));a&&(A/=a,w/=a),s||(s=A),proportion=s/A,c||(c=w),radius_scale=c/w,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl),a?(y=w/a,v=w/a):(y=w*radius_scale,v=w*radius_scale);for(let s of t){let t=s[e.x_axis],c=s[e.z_axis],A=s[e.height],C=s[e.radius];x[t]?(m=x[t].posX,f=x[t].colorId):(m+=a?2*w/a+.5:2*w*radius_scale+.5,f=g,x[t]={posX:m,colorId:f},h.push(t),u.push(m),g++),_[c]?b=_[c].posZ:(b=a?v+2*w/a+.5:v+2*w*radius_scale+.5,_[c]={posZ:b},d.push(c),p.push(b)),m>y&&(y=m),b>v&&(v=b);let M=o(A,C,f,r,m,b,n,a,proportion,radius_scale);M.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(M),e.legend&&l(e,M,s,i)}if(e.axis){const t=y,e=v,i=s;this.updateAxis(h,u,t,d,p,e,A,i)}this.updateTitle()},updateAxis:function(t,e,i,n,r,a,s,o){let l=document.createElement("a-entity");this.chartEl.appendChild(l),l.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:this.data.palette}),l.setAttribute("position",{x:0,y:0,z:0});let c=document.createElement("a-entity");this.chartEl.appendChild(c),c.setAttribute("babia-axis-y",{maxValue:s,length:o}),c.setAttribute("position",{x:0,y:0,z:0});let h=document.createElement("a-entity");this.chartEl.appendChild(h),h.setAttribute("babia-axis-z",{labels:n,ticks:r,length:a}),h.setAttribute("position",{x:0,y:0,z:0}),this.data.axis_name&&(l.setAttribute("babia-axis-x","name",this.data.x_axis),c.setAttribute("babia-axis-y","name",this.data.height),h.setAttribute("babia-axis-z","name",this.data.z_axis))},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating bubbles..."),this.updateChart(),this.notiBuffer.set(this.newData)}})},function(t,e,i){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let n;AFRAME.registerComponent("babiaxr-codecity",{schema:{absolute:{type:"boolean",default:!1},width:{type:"number",default:20},depth:{type:"number",default:20},split:{type:"string",default:"naive"},data:{type:"string",default:JSON.stringify({id:"CodeCity",area:1,height:1})},farea:{type:"string",default:"area"},fmaxarea:{type:"string",default:"max_area"},fheight:{type:"string",default:"height"},titles:{type:"boolean",default:!0},building_color:{type:"color",default:"#E6B9A1"},building_model:{type:"string",default:null},base:{type:"boolean",default:!0},base_thick:{type:"number",default:.2},base_color:{type:"color",default:"#98e690"},border:{type:"number",default:1},extra:{type:"number",default:1.4},zone_elevation:{type:"number",default:1},unicolor:{type:"color",default:!1},wireframe:{type:"boolean",default:!1},colormap:{type:"array",default:["blue","green","yellow","brown","orange","magenta","grey","cyan","azure","beige","blueviolet","coral","crimson","darkblue","darkgrey","orchid","olive","navy","palegreen"]},time_evolution_delta:{type:"number",default:8e3},time_evolution_init:{type:"string",default:"data_0"},time_evolution_past_present:{type:"boolean",default:!1},time_evolution_animation:{type:"boolean",default:!0},time_evolution_color:{type:"boolean",default:!1},ui_navbar:{type:"string",default:""}},multiple:!1,init:function(){},update:function(t){this.loader=new THREE.FileLoader;let e=this.data,i=this.el;C=e.building_color,n=i,"string"==typeof e.data?e.data.endsWith("json")?raw_items=l(e):raw_items=JSON.parse(e.data):raw_items=e.data,i.emit("babiaxr-dataLoaded",{data:raw_items,codecity:!0}),m=e.time_evolution_delta,this.zone_data=raw_items;let a,o,d=new r({data:this.zone_data,extra:function(t){return t*e.extra},farea:e.farea,fheight:e.fheight,fmaxarea:e.fmaxarea});1==e.absolute?(a=Math.sqrt(d.areas.canvas)*e.width/e.depth,o=d.areas.canvas/a):(a=e.width,o=e.depth);let b=new s({width:a,depth:o,x:0,z:0});d.add_rects({rect:b,split:e.split,relative:!1});let y=document.createElement("a-entity");this.base=y;d.draw_rects({ground:b,el:y,base:e.base,level:0,elevation:0,relative:!1,base_thick:e.base_thick,wireframe:e.wireframe,building_color:e.building_color,base_color:e.base_color,model:e.building_model,visible:!0,titles:e.titles}),i.appendChild(y),c&&(time_evolution_past_present=e.time_evolution_past_present,h=e.time_evolution_animation,u=e.time_evolution_color,A(e),function(){const t=Object.keys(g).length;let e=0;p&&(document.addEventListener("babiaxrToPast",(function(){time_evolution_past_present=!1})),document.addEventListener("babiaxrToPresent",(function(){time_evolution_past_present=!0})),document.addEventListener("babiaxrStop",(function(){clearInterval(_)})),document.addEventListener("babiaxrContinue",(function(){_=setTimeout((function(){M(t,e),e<t-1&&i()}),m)})),document.addEventListener("babiaxrSkipNext",(function(){time_evolution_past_present=!1,clearInterval(_),R(t-x-1),f=t-x-1,e--,x--,E()})),document.addEventListener("babiaxrSkipPrev",(function(){time_evolution_past_present=!0,clearInterval(_),R(t-x-3),f=t-x-3,e++,x++,E()})),document.addEventListener("babiaxrShow",(function(i){clearInterval(_),eventData=i.detail.data,e=eventData.data,R(t-e-1),f=t-e-1,x=e-1,E(!0)})));let i=()=>{_=setTimeout((function(){p&&R(t-x-2),f=t-x-2,M(t,e),e<t-1&&i()}),m)};i()}())},remove:function(){},play:function(){}});let r=class{constructor({data:t,extra:e=function(t){return t},farea:i="area",fmaxarea:n="max_area",fheight:r="height"}){this.data=t,this.id=this.data.id,this.extra=e,this.farea=i,this.fmaxarea=n,this.fheight=r,this.areas=this.areas_tree(),this.el=null,this.pending_rects=0}areas_tree({data:t=this.data,level:e=0}={}){let i=t,n={data:i};if("children"in i){n.inner=0,n.area=0,n.children=[];for(const t of i.children){let i=this.areas_tree({data:t,level:e+1});n.inner+=i.canvas,n.area+=i.area,n.children.push(i)}}else n.area=i[this.farea],n.max_area=i[this.fmaxarea],n.inner=n.max_area,n.inner_real=n.area;return n.canvas=this.extra(n.inner,e),n}add_rects({rect:t,area:e=this.areas,relative:i=!0,split:n="naive"}={}){if(e.rect=t,e.rect.inner(e.canvas,e.inner,e.inner_real),"children"in e){let t,r=new a(e.children.map(t=>t.canvas),e.inner);if("naive"===n)t=e.rect.split(r,i);else{if("pivot"!==n)throw new Error("CodeCity: Unknwon split method");t=e.rect.split_pivot(r,i)}for(const r in e.children)this.add_rects({rect:t[r],area:e.children[r],relative:i,split:n})}}draw_rects({ground:t,el:e,area:i=this.areas,level:r=0,elevation:a=0,relative:s=!0,base_thick:o=.2,wireframe:l=!1,building_color:c="red",base_color:h="green",model:u=null,visible:d=!0,titles:p=!0}){0===r&&(this.el=e);this.pending_rects;if("children"in i){let t=i.rect.box({elevation:a,height:o,color:h,inner:!1,wireframe:l,visible:d,id:i.data.id,rawarea:0});if(p){let e,i;t.addEventListener("click",(function(){if(e)n.removeChild(i),n.removeChild(e),e=void 0,i=void 0;else{i=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");i.setAttribute("geometry",{height:r.height+10,depth:r.depth,width:r.width}),i.setAttribute("position",a),i.setAttribute("material",{visible:!0,opacity:.4}),e=w(this.getAttribute("id"),r.height+10,a,null,n),n.appendChild(e),n.appendChild(i)}}))}t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t);let f=t;s||(f=e);for(const t of i.children){let e=o/2;s||(e=a+o),this.draw_rects({ground:i.rect,el:f,area:t,level:r+1,elevation:e,relative:s,building_color:c,base_color:h,model:u,base_thick:o,wireframe:l,visible:d,titles:p})}}else{i.data[this.fheight];let t=i.rect.box({height:i.data[this.fheight],elevation:a,wireframe:l,color:c,model:u,visible:d,id:i.data.id,rawarea:i.data[this.farea],inner_real:!0});if(t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t),p){let e,i,r=!1;t.addEventListener("click",(function(){r?(n.removeChild(e),n.removeChild(i),e=void 0,i=void 0,r=!1):r=!0})),t.addEventListener("mouseenter",(function(){if(!r){i=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");i.setAttribute("position",a),i.setAttribute("material",{visible:!0}),i.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),e=w(this.getAttribute("id"),r.height+.1,a,null,n),n.appendChild(e),n.appendChild(i)}})),t.addEventListener("mouseleave",(function(){!r&&e&&(n.removeChild(e),n.removeChild(i),e=void 0,i=void 0)}))}}}},a=class{constructor(t,e){this.items=t,this.total=void 0!==e?e:t.reduce((t,e)=>t+e,0)}imax(){let t=this.items[0],e=0;for(let i=0;i<this.items.length;i++)t<this.items[i]&&(t=this.items[i],e=i);return e}static range(t,e){var i=[];for(let n=t;n<t+e;n++)i.push(n);return i}scaled_area(t,e){return this.items[e]*t/this.total}values_i(t){let e=[];for(const i of t)e.push(this.items[i]);return new a(e)}pivot_regions(t,e){if(this.items.length<3)throw new Error("CodeCity - Values.pivot_regions: less than three items");if(t<e)throw new Error("Codecity - Values.pivot_regions: rectangle should be laying");let i,n,r=this.imax();if(this.items.lenght==r+1)return{pivot:r,a1:a.range(0,r),a2:[],a3:[]};if(this.items.length==r+2)return{pivot:r,a1:a.range(0,r),a2:[r+1],a3:[]};let s=t*e,o=this.scaled_area(s,r),l=Math.sqrt(o)*e-o,c=0,h=c,u=r+1;for(;c<l&&u<this.items.length;)h=c,c+=this.scaled_area(s,u),u++;let d=u;return u-1>r&&Math.abs(c-l)>Math.abs(h-l)&&(d=u-1),i=d-r-1,n=this.items.length-d,{pivot:r,a1:a.range(0,r),a2:a.range(r+1,i),a3:a.range(r+1+i,n)}}pivot_region_width(t,e){let i=0;for(const e of t)i+=this.items[e];return i/this.total*e}},s=class{constructor({width:t,depth:e,x:i=0,z:n=0}){this.width=t,this.depth=e,this.x=i,this.z=n}is_ilaying(){return Math.max(this.width,this.depth)==this.width}inner(t,e,i){if(t<e)throw"Rectangle.inner: Area for inner rectangle larger than my area";if(void 0!==t){let n=Math.sqrt(e/t);if(this.iwidth=n*this.width,this.idepth=n*this.depth,i){let e=Math.sqrt(i/t);this.iwidth_real=e*this.width,this.idepth_real=e*this.depth}}else this.iwidth=this.width,this.idepth=this.depth}reflect(){[this.width,this.depth]=[this.depth,this.width],[this.x,this.z]=[this.z,this.x]}idims_as_laying(){return this.is_ilaying()?[this.iwidth,this.idepth,this.x,this.z,!1]:[this.idepth,this.iwidth,this.z,this.x,!0]}split(t,e=!0){let[i,n,r,a,o]=this.idims_as_laying(),l=i/t.total,c=-i/2,h=0;e||(c+=r,h=a);let u=[];for(const e of t.items){let t=e*l,i=new s({width:t,depth:n,x:c+t/2,z:h});o&&i.reflect(),u.push(i),c+=t}return u}split_pivot(t,e=!0){if(t.items.length<=2)return this.split(t,e);let[i,n,r,a,o]=this.idims_as_laying();e&&(r=0,a=0);let{pivot:l,a1:c,a2:h,a3:u}=t.pivot_regions(i,n),d=t.pivot_region_width(c,i),p=t.pivot_region_width(h.concat(l),i),f=t.pivot_region_width(u,i),g=r-i/2+d/2,m=r-i/2+d+p/2,b=r-i/2+d+p+f/2,y=[],v=t.scaled_area(i*n,l)/p;y[l]=new s({width:p,depth:v,x:m,z:a+n/2-v/2});let x=[[c,d,n,g,a],[h,p,n-v,m,a-v/2],[u,f,n,b,a]];for(const[e,i,n,r,a]of x)if(e.length>0){let o=new s({width:i,depth:n,x:r,z:a});o.inner();let l=t.values_i(e),c=o.split_pivot(l,!1),h=0;for(const t of e)y[t]=c[h],h++}if(o)for(const t of y)t.reflect();return y}box({height:t,elevation:e=0,color:i="red",model:n=null,inner:r=!0,wireframe:a=!1,visible:s=!0,id:o="",rawarea:l=0,inner_real:c=!1}){let h,u;[h,u]=c?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let d=document.createElement("a-entity");return d.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:h,width:u,height:t}),d.setAttribute("material",{color:i}),d.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),d.setAttribute("id",o),d.setAttribute("babiaxr-rawarea",l),d}};t.exports={Values:a,Rectangle:s,Zone:r};let o,l=t=>{let e,i=t.data,n=new XMLHttpRequest;if(n.open("get",i,!1),n.onload=function(){this.status>=200&&this.status<300?e="string"==typeof n.response||n.response instanceof String?JSON.parse(n.response):n.response:reject({status:this.status,statusText:xhr.statusText})},n.onerror=function(){reject({status:this.status,statusText:xhr.statusText})},n.send(),e.time_evolution){b=e,c=!0,d=e.time_evolution_commit_by_commit;let i=e.data_files.find(t=>"data_0_tree"===t.key_tree);e=i.data_0_tree,y=i.data_0;let n=[];for(let t=0;t<b.data_files.length;t++){g["data_"+t]=b.data_files[t],n.push({date:new Date(1e3*b.data_files[t].date).toLocaleDateString(),commit:b.data_files[t].commit_sha,data:t})}if(t.ui_navbar&&(f=t.time_evolution_past_present?parseInt(t.time_evolution_init.split("_")[1]):b.data_files.length-1,p=t.ui_navbar,document.getElementById(p).setAttribute("babiaxr-navigation-bar","commits",JSON.stringify(n.reverse()))),"data_0"!==t.time_evolution_init){let i;i=g[t.time_evolution_init][t.time_evolution_init+"_allfiles"]?t.time_evolution_init+"_allfiles":t.time_evolution_init;let n=U(e.children,{});g[t.time_evolution_init][i].forEach(t=>{n[t.id]&&(n[t.id].height=t.height,n[t.id].area=t.area,n[t.id].max_area=t.max_area)}),x=parseInt(t.time_evolution_init.split("_")[1])}}return e},c=!1,h=!0,u=!1,d=!1,p=void 0,f=void 0,g={},m=8e3,b={},y=void 0,v=[],x=0,_=void 0,A=t=>{let e;if(document.getElementById("scene"))e=document.getElementById("scene");else{e=document.getElementsByTagName("a-scene");document.getElementsByTagName("a-entity")}let i=document.createElement("a-entity");i.classList.add("babiaxrDateBar"),i.setAttribute("position",{x:-13,y:10,z:-3}),i.setAttribute("rotation",{x:0,y:0,z:0}),i.setAttribute("material",{color:"black"}),i.setAttribute("height",.5),i.setAttribute("width",2),i.setAttribute("scale",{x:1,y:1,z:1});let n="Date: "+new Date(1e3*g[t.time_evolution_init].date).toLocaleDateString();g[t.time_evolution_init].commit_sha&&(n+="\n\nCommit: "+g[t.time_evolution_init].commit_sha),i.setAttribute("text-geometry",{value:n}),o=i,e.appendChild(i)},w=(t,e,i,n,r)=>{let a=2;t.length>16&&(a=t.length/8);let s=e,o=document.createElement("a-plane");o.setAttribute("babia-lookat","[camera]"),o.setAttribute("position",{x:i.x,y:i.y+s/2+1,z:i.z}),o.setAttribute("rotation",{x:0,y:0,z:0}),o.setAttribute("height","1"),o.setAttribute("width",a),o.setAttribute("color","white"),o.setAttribute("material",{side:"double"}),o.setAttribute("text",{value:t,align:"center",width:6,color:"black"});let l=r.getAttribute("scale");return!l||l.x===l.y&&l.x===l.z||o.setAttribute("scale",{x:1/l.x,y:1/l.y,z:1/l.z}),o};let C,M=(t,e)=>{console.log("Loop number",e),E(),time_evolution_past_present?(x--,0==x&&console.log("finished"),e--):(x++,e++,x>t-1&&(x=0))},E=t=>{let e,i="data_"+(x+1);e=t?"data_"+(x+1)+"_allfiles":time_evolution_past_present?"data_reverse_"+(x+1):"data_"+(x+1);let n="Date: "+new Date(1e3*g[i].date).toLocaleDateString();g[i].commit_sha&&(n+="\n\nCommit: "+g[i].commit_sha),o.setAttribute("text-geometry","value",n),v=[],u&&(I+=5,80!==I?C=function(t,e){let i,n=parseInt(t.slice(1,3),16),r=parseInt(t.slice(3,5),16),a=parseInt(t.slice(5,7),16),s=function(t,e,i){t/=255,e/=255,i/=255;let n,r,a=Math.max(t,e,i),s=Math.min(t,e,i),o=(a+s)/2;if(a==s)n=r=0;else{let l=a-s;switch(r=o>.5?l/(2-a-s):l/(a+s),a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return[n,r,o]}(n,r,a);return i=function(t,e,i){let n,r,a;if(0==e)n=r=a=i;else{function s(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}let o=i<.5?i*(1+e):i+e-i*e,l=2*i-o;n=s(l,o,t+1/3),r=s(l,o,t),a=s(l,o,t-1/3)}return[255*n,255*r,255*a]}(s[0],s[1],e/100),t="#"+D(i[0])+D(i[1])+D(i[2])}(C,I):(T++,T>S.length-1&&(T=0),C=S[T],I=20)),g[i][e]?g[i][e].forEach(t=>{B(t)}):g[i][i].forEach(t=>{B(t)}),d||y.forEach(t=>{v.includes(t.id)||F(t.id)}),L()},I=20,S=["#000066","#006600","#666600","#660000"],T=0,B=t=>{if(null!=document.getElementById(t.id)&&0!=t.area){v.push(t.id);let e=document.getElementById(t.id).getAttribute("position"),i=document.getElementById(t.id).getAttribute("position").x,n=document.getElementById(t.id).getAttribute("position").y,r=document.getElementById(t.id).getAttribute("position").z,a=document.getElementById(t.id).getAttribute("geometry").width,s=document.getElementById(t.id).getAttribute("geometry").depth,o=document.getElementById(t.id).getAttribute("geometry").height,l=parseFloat(document.getElementById(t.id).getAttribute("babiaxr-rawarea"));if(o.toFixed(6)!==t.height.toFixed(6)||l.toFixed(6)!==t.area.toFixed(6)){u&&document.getElementById(t.id).setAttribute("material",{color:C});let c=!1,d=a/s;d<1&&(c=!0,d=s/a);let p=t.area*(s*a)/l,f=Math.sqrt(p*d),g=Math.sqrt(p/d);if(c&&(g=Math.sqrt(p*d),f=Math.sqrt(p/d)),document.getElementById(t.id).setAttribute("babiaxr-rawarea",t.area),h){let e=500;if(f>a||g>s){let i=20*(f-a)/e,n=20*(g-s)/e,r=a,o=s,l=setInterval((function(){r>=f||o>=g?(document.getElementById(t.id).setAttribute("geometry","width",f),document.getElementById(t.id).setAttribute("geometry","depth",g),clearInterval(l)):(r+=i,o+=n,document.getElementById(t.id).setAttribute("geometry","width",r),document.getElementById(t.id).setAttribute("geometry","depth",o))}),1)}else if(f<a||g<s){let i=20*(a-f)/e,n=20*(s-g)/e,r=a,o=s,l=setInterval((function(){r<=f||o<=g?(document.getElementById(t.id).setAttribute("geometry","width",f),document.getElementById(t.id).setAttribute("geometry","depth",g),clearInterval(l)):(r-=i,o-=n,document.getElementById(t.id).setAttribute("geometry","width",r),document.getElementById(t.id).setAttribute("geometry","depth",o))}),1)}if(t.height<0)F(t.id);else if(t.height>o){let a=20*(t.height-o)/e,s=o,l=setInterval((function(){s>=t.height?(document.getElementById(t.id).setAttribute("position",{x:i,y:n-o/2+t.height/2,z:r}),clearInterval(l)):(s+=a,document.getElementById(t.id).setAttribute("geometry","height",s),document.getElementById(t.id).setAttribute("position",{x:i,y:n-o/2+s/2,z:r}))}),1)}else if(t.height<o){let a=20*(o-t.height)/e,s=o,l=setInterval((function(){s<=t.height?(document.getElementById(t.id).setAttribute("position",{x:i,y:n-o/2+t.height/2,z:r}),clearInterval(l)):(s-=a,document.getElementById(t.id).setAttribute("geometry","height",s),document.getElementById(t.id).setAttribute("position",{x:i,y:n-o/2+s/2,z:r}))}),1)}}else document.getElementById(t.id).setAttribute("geometry","width",f),document.getElementById(t.id).setAttribute("geometry","depth",g),document.getElementById(t.id).setAttribute("geometry","height",t.height),document.getElementById(t.id).setAttribute("position",{x:e.x,y:e.y-o/2+t.height/2,z:e.z})}}},F=t=>{let e=document.getElementById(t).getAttribute("material").color;document.getElementById(t).setAttribute("material",{color:"black"}),document.getElementById(t).setAttribute("material",{opacity:"0.3"});let i=setInterval((function(){!function(){let n=document.getElementById(t).getAttribute("position"),r=document.getElementById(t).getAttribute("geometry").height;document.getElementById(t).setAttribute("geometry","height",-.1),document.getElementById(t).setAttribute("position",{x:n.x,y:n.y-r/2-.05,z:n.z}),document.getElementById(t).setAttribute("material",{color:e}),document.getElementById(t).setAttribute("material",{opacity:"1.0"}),clearInterval(i)}()}),1e3)},L=()=>{console.log("Changing city")},U=(t,e)=>(t.forEach(t=>{t.children?U(t.children,e):e[t.id]=t}),e),R=t=>{let e=document.getElementsByClassName("babiaxrTimeBar")[0].children;if(f||0==f){e[f].emit("removeinfo")}e[t].emit("showinfo")};function D(t){let e=Math.round(t).toString(16);return e.length>1||(e="0"+e),e}},function(t,e,i){let n=i(0).findProdComponent;const r=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-city",{schema:{from:{type:"string"},absolute:{type:"boolean",default:!1},width:{type:"number",default:20},depth:{type:"number",default:20},split:{type:"string",default:"naive"},data:{type:"string"},farea:{type:"string",default:"area"},fmaxarea:{type:"string",default:"max_area"},fheight:{type:"string",default:"height"},titles:{type:"boolean",default:!0},building_color:{type:"color",default:"#E6B9A1"},building_model:{type:"string",default:null},base:{type:"boolean",default:!0},base_thick:{type:"number",default:.2},base_color:{type:"color",default:"#98e690"},border:{type:"number",default:1},extra:{type:"number",default:1.4},zone_elevation:{type:"number",default:1},unicolor:{type:"color",default:!1},wireframe:{type:"boolean",default:!1},colormap:{type:"array",default:["blue","green","yellow","brown","orange","magenta","grey","cyan","azure","beige","blueviolet","coral","crimson","darkblue","darkgrey","orchid","olive","navy","palegreen"]},time_evolution_delta:{type:"number",default:8e3},time_evolution_init:{type:"string",default:"data_0"},time_evolution_past_present:{type:"boolean",default:!1},time_evolution_animation:{type:"boolean",default:!0},time_evolution_color:{type:"boolean",default:!1},ui_navbar:{type:"string",default:""}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=JSON.parse(e.data);this.processData(t)}else if(e.from!==t.from)this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)));else if(e!==t&&this.newData){for(console.log("Generating city...");this.el.firstChild;)this.el.firstChild.remove();this.processData(this.newData)}},dataComponent:void 0,dataComponentDataPropertyName:"babiaData",dataComponentEventName:void 0,babiaData:void 0,babiaMetadata:{id:0},visProperties:["fheight","farea"],processData:function(t){let e;console.log("processData",t),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},e=this.newData.length>0?{id:"init",children:this.newData}:this.newData.length<=0?this.newData[0]:this.newData,console.log("toSave",e),this.notiBuffer.set(e),a(this,e)}});let a=(t,e)=>{t.loader=new THREE.FileLoader;let i=t.data,n=t.el;u=i.building_color;let r=n;n.emit("babiaxr-dataLoaded",{data:e,codecity:!0}),c=i.time_evolution_delta,t.zone_data=e;let a,o,h=new s({data:t.zone_data,extra:function(t){return t*i.extra},farea:i.farea,fheight:i.fheight,fmaxarea:i.fmaxarea});1==i.absolute?(a=Math.sqrt(h.areas.canvas)*i.width/i.depth,o=h.areas.canvas/a):(a=i.width,o=i.depth);let d=new l({width:a,depth:o,x:0,z:0});h.add_rects({rect:d,split:i.split,relative:!1});let p=document.createElement("a-entity");t.base=p;h.draw_rects({ground:d,el:p,base:i.base,level:0,elevation:0,relative:!1,base_thick:i.base_thick,wireframe:i.wireframe,building_color:i.building_color,base_color:i.base_color,model:i.building_model,visible:!0,titles:i.titles,rootCodecityEntity:r}),n.appendChild(p)},s=class{constructor({data:t,extra:e=function(t){return t},farea:i="area",fmaxarea:n="max_area",fheight:r="height"}){this.data=t,this.id=this.data.id,this.extra=e,this.farea=i,this.fmaxarea=n,this.fheight=r,this.areas=this.areas_tree(),this.el=null,this.pending_rects=0}areas_tree({data:t=this.data,level:e=0}={}){let i=t,n={data:i};if("children"in i){n.inner=0,n.area=0,n.children=[];for(const t of i.children){let i=this.areas_tree({data:t,level:e+1});n.inner+=i.canvas,n.area+=i.area,n.children.push(i)}}else n.area=i[this.farea]||.5,n.max_area=i[this.fmaxarea]||.5,n.inner=n.max_area,n.inner_real=n.area;return n.canvas=this.extra(n.inner,e),n}add_rects({rect:t,area:e=this.areas,relative:i=!0,split:n="naive"}={}){if(e.rect=t,e.rect.inner(e.canvas,e.inner,e.inner_real),"children"in e){let t,r=new o(e.children.map(t=>t.canvas),e.inner);if("naive"===n)t=e.rect.split(r,i);else{if("pivot"!==n)throw new Error("CodeCity: Unknwon split method");t=e.rect.split_pivot(r,i)}for(const r in e.children)this.add_rects({rect:t[r],area:e.children[r],relative:i,split:n})}}draw_rects({ground:t,el:e,area:i=this.areas,level:n=0,elevation:r=0,relative:a=!0,base_thick:s=.2,wireframe:o=!1,building_color:l="red",base_color:c="green",model:u=null,visible:d=!0,titles:p=!0,rootCodecityEntity:f}){let g=this;0===n&&(this.el=e);this.pending_rects;if("children"in i){let t=i.rect.box({elevation:r,height:s,color:c,inner:!1,wireframe:o,visible:d,id:i.data.id,rawarea:0});if(p){let e,i;t.addEventListener("click",(function(){if(e)f.removeChild(i),f.parentElement.removeChild(e),e=void 0,i=void 0;else{i=document.createElement("a-entity");let n=t.getAttribute("geometry"),r=t.getAttribute("position"),a=f.getAttribute("scale"),s=n.height+11;a&&(s=(n.height+11)/a.y),i.setAttribute("geometry",{height:s,depth:n.depth,width:n.width}),i.setAttribute("position",r),i.setAttribute("material",{visible:!0,opacity:.4}),f.appendChild(i),e=h(this.getAttribute("id"),"black","white");let o=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),l={x:o.x,y:12,z:o.z};e.setAttribute("position",l),e.setAttribute("visible",!0),f.parentElement.appendChild(e)}}))}t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t);let g=t;a||(g=e);for(const t of i.children){let e=s/2;a||(e=r+s),this.draw_rects({ground:i.rect,el:g,area:t,level:n+1,elevation:e,relative:a,building_color:l,base_color:c,model:u,base_thick:s,wireframe:o,visible:d,titles:p,rootCodecityEntity:f})}}else{let t=i.rect.box({height:i.data[this.fheight],elevation:r,wireframe:o,color:l,model:u,visible:d,id:i.data.id,rawarea:i.data[this.farea],inner_real:!0});if(t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t),p){let e,n,r=!1;t.addEventListener("click",(function(){r?(e.setAttribute("visible",!1),n.setAttribute("visible",!1),f.parentElement.removeChild(e),f.removeChild(n),e=void 0,n=void 0,r=!1):r=!0})),t.addEventListener("mouseenter",(function(){if(!r){n=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");n.setAttribute("position",a),n.setAttribute("material",{visible:!0}),n.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),e=h(this.getAttribute("id"),"white","black",i.data,g.fheight,g.farea);let s=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),o=(new THREE.Box3).setFromObject(t.object3D),l={x:s.x,y:o.max.y+1,z:s.z};e.setAttribute("position",l),e.setAttribute("visible",!0),f.parentElement.appendChild(e),f.appendChild(n)}})),t.addEventListener("mouseleave",(function(){!r&&e&&(e.setAttribute("visible",!1),n.setAttribute("visible",!1),f.parentElement.removeChild(e),f.removeChild(n),e=void 0,n=void 0)}))}}}},o=class{constructor(t,e){this.items=t,this.total=void 0!==e?e:t.reduce((t,e)=>t+e,0)}imax(){let t=this.items[0],e=0;for(let i=0;i<this.items.length;i++)t<this.items[i]&&(t=this.items[i],e=i);return e}static range(t,e){var i=[];for(let n=t;n<t+e;n++)i.push(n);return i}scaled_area(t,e){return this.items[e]*t/this.total}values_i(t){let e=[];for(const i of t)e.push(this.items[i]);return new o(e)}pivot_regions(t,e){if(this.items.length<3)throw new Error("CodeCity - Values.pivot_regions: less than three items");if(t<e)throw new Error("Codecity - Values.pivot_regions: rectangle should be laying");let i,n,r=this.imax();if(this.items.lenght==r+1)return{pivot:r,a1:o.range(0,r),a2:[],a3:[]};if(this.items.length==r+2)return{pivot:r,a1:o.range(0,r),a2:[r+1],a3:[]};let a=t*e,s=this.scaled_area(a,r),l=Math.sqrt(s)*e-s,c=0,h=c,u=r+1;for(;c<l&&u<this.items.length;)h=c,c+=this.scaled_area(a,u),u++;let d=u;return u-1>r&&Math.abs(c-l)>Math.abs(h-l)&&(d=u-1),i=d-r-1,n=this.items.length-d,{pivot:r,a1:o.range(0,r),a2:o.range(r+1,i),a3:o.range(r+1+i,n)}}pivot_region_width(t,e){let i=0;for(const e of t)i+=this.items[e];return i/this.total*e}},l=class{constructor({width:t,depth:e,x:i=0,z:n=0}){this.width=t,this.depth=e,this.x=i,this.z=n}is_ilaying(){return Math.max(this.width,this.depth)==this.width}inner(t,e,i){if(t<e)throw"Rectangle.inner: Area for inner rectangle larger than my area";if(void 0!==t){let n=Math.sqrt(e/t);if(this.iwidth=n*this.width,this.idepth=n*this.depth,i){let e=Math.sqrt(i/t);this.iwidth_real=e*this.width,this.idepth_real=e*this.depth}}else this.iwidth=this.width,this.idepth=this.depth}reflect(){[this.width,this.depth]=[this.depth,this.width],[this.x,this.z]=[this.z,this.x]}idims_as_laying(){return this.is_ilaying()?[this.iwidth,this.idepth,this.x,this.z,!1]:[this.idepth,this.iwidth,this.z,this.x,!0]}split(t,e=!0){let[i,n,r,a,s]=this.idims_as_laying(),o=i/t.total,c=-i/2,h=0;e||(c+=r,h=a);let u=[];for(const e of t.items){let t=e*o,i=new l({width:t,depth:n,x:c+t/2,z:h});s&&i.reflect(),u.push(i),c+=t}return u}split_pivot(t,e=!0){if(t.items.length<=2)return this.split(t,e);let[i,n,r,a,s]=this.idims_as_laying();e&&(r=0,a=0);let{pivot:o,a1:c,a2:h,a3:u}=t.pivot_regions(i,n),d=t.pivot_region_width(c,i),p=t.pivot_region_width(h.concat(o),i),f=t.pivot_region_width(u,i),g=r-i/2+d/2,m=r-i/2+d+p/2,b=r-i/2+d+p+f/2,y=[],v=t.scaled_area(i*n,o)/p;y[o]=new l({width:p,depth:v,x:m,z:a+n/2-v/2});let x=[[c,d,n,g,a],[h,p,n-v,m,a-v/2],[u,f,n,b,a]];for(const[e,i,n,r,a]of x)if(e.length>0){let s=new l({width:i,depth:n,x:r,z:a});s.inner();let o=t.values_i(e),c=s.split_pivot(o,!1),h=0;for(const t of e)y[t]=c[h],h++}if(s)for(const t of y)t.reflect();return y}box({height:t,elevation:e=0,color:i="red",model:n=null,inner:r=!0,wireframe:a=!1,visible:s=!0,id:o="",rawarea:l=0,inner_real:c=!1}){let h,u;[h,u]=c?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let d=document.createElement("a-entity");return d.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:h,width:u,height:t}),d.setAttribute("material",{color:i}),d.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),d.setAttribute("id",o),d.setAttribute("babiaxr-rawarea",l),d}};t.exports={Values:o,Rectangle:l,Zone:s};let c=8e3,h=(t,e,i,n,r,a)=>{let s=2;if(t.length>16&&(s=t.length/8),n){let e="\n "+r+" (height): "+n[r];e.length>16&&(s=e.length/8),t+=e;let i="\n "+a+" (area): "+n[a];i.length>16&&i>e&&(s=i.length/8),t+=i}let o=document.createElement("a-plane");return o.setAttribute("babia-lookat","[camera]"),o.setAttribute("rotation",{x:0,y:0,z:0}),o.setAttribute("height","1"),o.setAttribute("width",s),o.setAttribute("color",e),o.setAttribute("material",{side:"double"}),o.setAttribute("text",{value:t,align:"center",width:6,color:i}),o.setAttribute("visible",!1),o};let u},function(t,e,n){let r=n(0).updateTitle;n(0).colors;let a=n(0).updateFunction,s=n(6).createCylinder;const o=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-cylsmap",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number",default:2},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0}},visProperties:["height","radius","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new o,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){this.titleEl=r(this.data,{x:0,y:0,z:0})},updateChart:function(){const t=this.newData,e=this.data;let n=[],r=[],a=new Array,o=0,c=[],h=[];for(i=0;i<t.length;i++){let s=t[i][e.x_axis],o=t[i][e.z_axis];n.includes(s)||n.push(s),r.includes(o)||r.push(o);let l=n.indexOf(s),c=r.indexOf(o);if(a[l])a[l][c]=t[i][e.radius];else{let n=new Array;n[c]=t[i][e.radius],a[l]=n}}let u=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*this.maxValue/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=u;let d=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));for(this.radius_scale=e.radiusMax/d,i=0;i<n.length;i++){let t=Math.max.apply(Math,a[i].filter((function(t){if(""!=t)return t})));if(0==i)c.push(t*this.radius_scale);else{let e=Math.max.apply(Math,a[i-1].filter((function(t){if(""!=t)return t})));c.push(c[i-1]+t*this.radius_scale+.5+e*this.radius_scale)}}for(j=0;j<r.length;j++)rad_0=l(a,n.length,j),0==j?h.push(rad_0*this.radius_scale):(rad_1=l(a,n.length,j-1),h.push(h[j-1]+rad_1*this.radius_scale+.5+rad_0*this.radius_scale));let p=this.chartEl.querySelectorAll("a-entity[babia-cyl]"),f={};for(let t of p){f[t.getAttribute("babia-name")]={el:t,found:!1}}for(let i=0;i<t.length;i++){let a,l=t[i],u=l[e.x_axis],d=l[e.z_axis],p=u+"-"+d,g=c[n.indexOf(u)],m=h[r.indexOf(d)];f[p]&&!l._not?(a=f[p].el,f[p].found=!0):(a=document.createElement("a-entity"),a.setAttribute("babia-name",p),a.id=p,a.object3D.position.x=g,a.object3D.position.z=m,this.chartEl.appendChild(a)),o=n.indexOf(u),s(this,a,e,l,o,u,g,m,d)}for(let t in f)f[t].found||f[t].el.remove();if(e.axis){let t=Math.max.apply(Math,a[n.length-1].filter((function(t){if(""!=t)return t})));const e=c[c.length-1]+t*this.radius_scale+.5,i=h[h.length-1]+l(a,n.length,r.length-1)*this.radius_scale+.5;c+=.25,h+=.25,this.updateAxis(n,c,e,u,r,h,i)}this.updateTitle()},updateAxis:function(t,e,i,n,r,a,s){const o=this.data;o.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:o.palette,align:"behind"}),this.xAxisEl.setAttribute("position",{x:-.25,y:0,z:-.25}),this.zAxisEl||(this.zAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.zAxisEl)),this.zAxisEl.setAttribute("babia-axis-z",{labels:r,ticks:a,length:s,palette:o.palette,align:"left"}),this.zAxisEl.setAttribute("position",{x:-.25,y:0,z:-.25}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-.25,y:0,z:-.25}),o.axis_name&&((o.index=!1)?this.xAxisEl.setAttribute("babia-axis-x","name",o.index):this.xAxisEl.setAttribute("babia-axis-x","name",o.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",o.height),this.zAxisEl.setAttribute("babia-axis-z","name",o.z_axis)))},processData:function(t){console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating cylsmap..."),this.updateChart(),this.notiBuffer.set(this.newData)}});let l=(t,e,n)=>{let r=0;for(i=0;i<e;i++)t[i][n]&&r<t[i][n]&&(r=t[i][n]);return r}},function(t,e,i){let n=i(0).updateTitle;const r=i(0).colors;let a=i(0).updateFunction;const s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function o(t,e,i,n,a){let s=r.get(n,a);console.log("Generating slice...");let o=document.createElement("a-torus");return o.setAttribute("color",s),o.setAttribute("rotation",{x:90,y:0,z:t}),o.setAttribute("arc",e),o.setAttribute("side","double"),o.setAttribute("radius",i),o.setAttribute("radius-tubular",i/4),o}function l(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e){let i=e[t.key]+": "+e[t.size],n=2;i.length>16&&(n=i.length/8);let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:1,z:-2}),r.setAttribute("rotation",{x:-90,y:0,z:0}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e[t.key]+": "+e[t.size],align:"center",width:6,color:"black"}),r.classList.add("babiaxrLegend"),r.setAttribute("babia-lookat",t.legend_lookat),r.setAttribute("scale",{x:t.legend_scale,y:t.legend_scale,z:t.legend_scale}),r}(t,i),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-doughnut",{schema:{data:{type:"string"},size:{type:"string",default:"size"},key:{type:"string",default:"key"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},animation:{type:"boolean",default:!1}},visProperties:["size","key"],multiple:!1,init:function(){this.notiBuffer=new s},update:function(t){a(this,t)},tick:function(t,e){if(this.data.animation&&this.loaded){let i=document.getElementsByClassName("babiaxrChart")[0].children;for(let n in this.slice_array){let r=this.slice_array[n].delay,a=this.slice_array[n].arc,s=parseFloat(i[n].getAttribute("arc"));t>=r&&s<a&&(s+=360*e/this.total_duration,s>a&&(s=a),i[n].setAttribute("arc",s))}}},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},loaded:!1,slice_array:[],total_duration:4e3,updateTitle:function(){const t=n(this.data,{x:-90,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-doughnut",t);const e=this.data,i=this.el,n=e.animation,r=e.palette;let a=0,s=0,c=0,h=0;for(let i of t)h+=i[e.size];this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.chartEl.setAttribute("rotation",{y:90}),i.appendChild(this.chartEl);let u=0;for(let d of t){let t;if(s=360*d[e.size]/h,n){let e=this.total_duration*s/360;this.slice_array.push({arc:s,duration:e,delay:u}),u+=e,t=o(a,.01,1,c,r)}else t=o(a,s,1,c,r);t.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(t),a+=s,e.legend&&l(e,t,d,i),c++}this.updateTitle()},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating doughnut..."),this.updateChart(),this.loaded=!0,this.notiBuffer.set(this.newData)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-totem",{schema:{charts_id:{type:"string"},data_list:{type:"string"}},multiple:!1,init:function(){let t=this.data,e=this.el;i=e.id,t&&(s.push({id:e.id,charts_id:JSON.parse(t.charts_id)}),t.data_list&&(n=JSON.parse(t.data_list),function(t){let e=new THREE.FileLoader;for(let i of t)if(i.from_querier){let t=document.getElementById(i.from_querier);if(t.getAttribute("babiaData")){let e=JSON.parse(t.getAttribute("babiaData"));a.push({file:e,path:i.from_querier})}else t.addEventListener("dataReady"+i.from_querier,(function(t){a.push({file:t.detail,path:i.from_querier})}))}else if(i.path){let t=i.path;e.load(t,(function(e){a.push({file:e,path:t})}),(function(e){console.log(t.toString()+": "+e.loaded/e.total*100+"% loaded")}),(function(t){console.error("An error happened")}))}}(n)))},update:function(t){let e=this.data;if(r=this.el,e!==t){for(;this.el.firstChild;)this.el.firstChild.remove();console.log("Generating totemchart..."),o(r)}},remove:function(){},pause:function(){},play:function(){}});let i,n,r,a=[],s=[],o=t=>{a&&function(t,e){console.log("Generating Totem...");let i=7.5;if(e.length%2==1){let t=Math.trunc(e.length/2);i+=t}let n=function(t){let e=5;for(let i of t)i.data&&(i=i.data),i.length>10&&e<i.length/4&&(e=i.length/4);return e}(e);document.createElement;(function(t,e,i,n,r,a,s){let o=document.createElement("a-plane");o.setAttribute("class","title"),o.setAttribute("position",{x:e,y:i,z:n}),o.setAttribute("rotation",{x:0,y:r,z:0}),o.setAttribute("height",1),o.setAttribute("width",a),o.setAttribute("color","blue"),o.setAttribute("text",{value:s,align:"center",width:"10",color:"white"}),t.appendChild(o)})(t,-3,i,6,0,n,"Select Data"),i-=1,function(t,e,i,n,r,a,s,o){for(let c of s){c.data&&(c=c.data);let h=document.createElement("a-plane");h.setAttribute("position",{x:e,y:i,z:n}),h.setAttribute("rotation",{x:0,y:r,z:0}),h.setAttribute("height",1),h.setAttribute("width",a),h.setAttribute("text",{value:c,align:"center",width:"10"}),h.setAttribute("color","white"),h.setAttribute("text",{color:"black"}),t.appendChild(h),i-=1,h.classList.add("babiaxraycasterclass"),h.addEventListener("click",(function(){let t=h.parentElement.id,e=h.parentElement.children;o=c;for(let e of s)(e.path||e.from_querier)&&o==e.data&&l(e.path||e.from_querier,t);for(let t in e)e[t]===h?(h.setAttribute("color","black"),h.setAttribute("text",{color:"white"})):e[t].id||"title"!==e[t].className&&(e[t].setAttribute("color","white"),e[t].setAttribute("text",{color:"black"}))}))}}(t,-3,i,6,0,n,e)}(t,n)};function l(t,e){!function(t){document.getElementById(t)}(e);for(let i in s)if(e==s[i].id){let e=s[i].charts_id;for(obj in e){let i,n=e[obj].type,r=e[obj].id;for(let e in a)a[e].path==t&&(i=a[e].file,"babiaxr-vismapper"===n?document.getElementById(r).setAttribute(n,"dataToShow",JSON.stringify(i)):document.getElementById(r).setAttribute(n,"data",i))}}}},function(t,e){AFRAME.registerComponent("babia-terrain",{schema:{width:{type:"number",default:1},height:{type:"number",default:1},segmentsHeight:{type:"number",default:1},segmentsWidth:{type:"number",default:1},data:{type:"array"},color:{type:"string",default:"0xdddddd"},filled:{type:"boolean",default:!1}},init:function(){var t=this.data,e=this.el,i=t.data;console.log("Vertices:"),console.log(i),this.geometry=new THREE.PlaneGeometry(t.width,t.height,t.segmentsHeight,t.segmentsWidth);for(var n=0,r=this.geometry.vertices.length;n<r;n++)this.geometry.vertices[n].z=i[n];var a=t.color;t.filled?this.material=new THREE.MeshPhongMaterial({color:a,wireframe:!1}):this.material=new THREE.MeshPhongMaterial({color:a,wireframe:!0}),this.mesh=new THREE.Mesh(this.geometry,this.material),e.setObject3D("mesh",this.mesh)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let n,r,a,s,o,l,c,h,u,d,p;function f(t){let e=document.createElement("a-sphere");var i;return e.setAttribute("radius",.05),e.setAttribute("material",{color:"#FF0000"}),function(t,e){let i,n;t.addEventListener("mouseenter",(function(){h=this.getAttribute("material").color,this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),this.setAttribute("material",{color:"#AAAA00"}),n=g(e),this.appendChild(n)})),t.addEventListener("showinfo",(function(){i=g(e),this.setAttribute("material",{color:"#00AA00"}),this.appendChild(i)})),t.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),this.setAttribute("material",{color:h}),this.removeChild(n)})),t.addEventListener("removeinfo",(function(){i&&(this.removeChild(i),this.setAttribute("material",{color:"#FF0000"}))}))}(e,t),i=t,e.addEventListener("click",(function(){this.setAttribute("material",{color:"#00AA00"}),h=this.getAttribute("material").color,l.emit("babiaxrShow",{data:i}),document.getElementsByClassName("babiaxrPause")[0]&&(o.removeChild(s),o.appendChild(a))})),e}function g(t){let e="",i=[];i.push("Date: "+t.date+"\n"),i.push("commit: "+t.commit+"\n");let n=1;for(let t of i)t.length>10&&n<t.length/2&&(n=t.length/7),e+=t;let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:.4,z:.1}),r.setAttribute("scale",{x:.5,y:.5,z:1}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e,align:"center",width:6,color:"black"}),r.setAttribute("material",{opacity:.6}),r}function m(t){let e=t.length,n=[];for(i=0;i<e;i++){let e=.11*t[i][0],r=.11*t[i][1],a=.11*t[i][2],s=new THREE.Vector3(e,r,a);n.push(s)}let r=new THREE.Shape(n),a=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,wireframe:!1}),s=new THREE.ExtrudeGeometry(r,{depth:.05,bevelEnabled:!1,bevelSegments:1,steps:1,bevelThickness:1});return new THREE.Mesh(s,a)}function b(t){t.addEventListener("mouseenter",(function(){c=Object.assign({},this.object3DMap.mesh.material.color),this.object3DMap.mesh.material.color={r:170/255,g:170/255,b:170/255}})),t.addEventListener("mouseleave",(function(){this.object3DMap.mesh.material.color=c}))}function y(t,e){t.addEventListener("click",(function(){if(t.classList.contains("babiaxrPlay"))o.removeChild(t),o.appendChild(s);else if(t.classList.contains("babiaxrPause"))o.removeChild(s),o.appendChild(a);else if(t.classList.contains("babiaxrSkipNext")||t.classList.contains("babiaxrSkipPrev"))document.getElementsByClassName("babiaxrPause")[0]&&(o.removeChild(s),o.appendChild(a));else if(t.classList.contains("babiaxrForward")){c={r:85/255,g:85/255,b:85/255},document.getElementsByClassName("babiaxrRewind")[0].object3DMap.mesh.material.color={r:1,g:1,b:1}}else if(t.classList.contains("babiaxrRewind")){c={r:85/255,g:85/255,b:85/255},document.getElementsByClassName("babiaxrForward")[0].object3DMap.mesh.material.color={r:1,g:1,b:1}}console.log("Emit..... "+e),l.emit(e)}))}AFRAME.registerComponent("babiaxr-navigation-bar",{schema:{commits:{type:"string"},size:{type:"number",default:"5"},points_by_line:{type:"number",default:"5"},to:{type:"string",default:"left"},start_point:{type:"number",default:"0"}},multiple:!1,init:function(){let t=this.data;l=this.el,n=JSON.parse(t.commits),r=t.size,u=t.to,d=t.start_point,p=t.points_by_line;let e=function(t,e,i){let n=document.createElement("a-entity");n.classList.add("babiaxrTimeBar");let r=0,a=Math.ceil(t.length/i)/5-.2,s=e/(i-1),o=0,l=1;for(let e in t){let c=f(t[e]);c.classList.add("babiaxraycasterclass"),c.setAttribute("position",{x:r,y:a,z:0}),n.appendChild(c),e%i==i-1&&e!=t.length-1?(l++,a-=.2,r=0):e!=t.length-1&&(r+=s),o=r}for(let t=0;t<l;t++){let i=document.createElement("a-entity");0!=o&&0==t||1==p||0==o&&0==t?i.setAttribute("line",{start:"0 "+a+" 0",end:o+" "+a+" 0",color:"#FF0000"}):i.setAttribute("line",{start:"0 "+a+" 0",end:e+" "+a+" 0",color:"#FF0000"}),a+=.2,n.appendChild(i)}return n}(n,r,p);this.el.appendChild(e),o=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrPlayer"),t.setAttribute("position",{x:(r-5)/2,y:0,z:0}),t.classList.add("babiaxraycasterclass"),a=function(t){let e=document.createElement("a-entity");e.classList.add("babiaxrPlay");let i=m([[0,0,0],[0,3,0],[2.5,1.5,0],[0,0,0]]);return e.setObject3D("mesh",i),y(e,"babiaxrContinue"),b(e),e}(),a.setAttribute("position",{x:2.35,y:-.65,z:0}),a.classList.add("babiaxraycasterclass"),s=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrPause");let e=function(t,e){let n=t.length,r=e.length,a=[],s=[];for(i=0;i<n;i++){let e=.11*t[i][0],n=.11*t[i][1],r=.11*t[i][2],s=new THREE.Vector3(e,n,r);a.push(s)}for(i=0;i<r;i++){let t=.11*e[i][0],n=.11*e[i][1],r=.11*e[i][2],a=new THREE.Vector3(t,n,r);s.push(a)}let o=new THREE.Shape(a),l=new THREE.Shape(s),c={depth:.05,bevelEnabled:!1,bevelSegments:1,steps:1,bevelThickness:1},h=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,wireframe:!1}),u=new THREE.ExtrudeGeometry(o,c),d=new THREE.ExtrudeGeometry(l,c),p=new THREE.Mesh(u,h);return p.updateMatrix(),d.merge(p.geometry,p.matrix),new THREE.Mesh(d,h)}([[0,0,0],[0,3,0],[1,3,0],[1,0,0],[0,0,0]],[[1.5,0,0],[1.5,3,0],[2.5,3,0],[2.5,0,0],[1.5,0,0]]);return t.setObject3D("mesh",e),y(t,"babiaxrStop"),b(t),t}(),s.setAttribute("position",{x:2.35,y:-.65,z:0}),s.classList.add("babiaxraycasterclass"),t.appendChild(s);let e=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrRewind");let e=m([[0,0,0],[0,3,0],[1.25,1.5,0],[1.25,3,0],[2.5,1.5,0],[1.25,0,0],[1.25,1.5,0],[0,0,0]]);t.setObject3D("mesh",e),t.setAttribute("rotation",{x:0,y:180,z:0}),"left"==u&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255});return y(t,"babiaxrToPast"),b(t),t}();e.setAttribute("position",{x:1.25,y:-.65,z:0}),e.classList.add("babiaxraycasterclass"),t.appendChild(e);let n=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrForward");let e=m([[0,0,0],[0,3,0],[1.25,1.5,0],[1.25,3,0],[2.5,1.5,0],[1.25,0,0],[1.25,1.5,0],[0,0,0]]);t.setObject3D("mesh",e),"right"==u&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255});return y(t,"babiaxrToPresent"),b(t),t}();n.setAttribute("position",{x:3.7,y:-.65,z:0}),n.classList.add("babiaxraycasterclass"),t.appendChild(n);let o=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrSkipPrev");let e=m([[0,0,0],[0,3,0],[1,1.5,0],[1,3,0],[2,1.5,0],[2,3,0],[2.5,3,0],[2.5,0,0],[2,0,0],[2,1.5,0],[1,0,0],[1,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),t.setAttribute("rotation",{x:0,y:180,z:0}),y(t,"babiaxrSkipPrev"),b(t),t}();o.setAttribute("position",{x:1.95,y:-.65,z:0}),o.classList.add("babiaxraycasterclass"),t.appendChild(o);let l=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrSkipNext");let e=m([[0,0,0],[0,3,0],[1,1.5,0],[1,3,0],[2,1.5,0],[2,3,0],[2.5,3,0],[2.5,0,0],[2,0,0],[2,1.5,0],[1,0,0],[1,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),y(t,"babiaxrSkipNext"),b(t),t}();return l.setAttribute("position",{x:3,y:-.65,z:0}),l.classList.add("babiaxraycasterclass"),t.appendChild(l),t}(),this.el.appendChild(o),function(){let t=document.getElementsByClassName("babiaxrTimeBar")[0].children;for(let e in t)e==d&&t[e].emit("showinfo")}()},update:function(t){},remove:function(){},pause:function(){},play:function(){}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let i,n,r;var a;AFRAME.registerComponent("babiaxr-event-controller",{schema:{navigation:{type:"string"},targets:{type:"string"}},multiple:!1,init:function(){},update:function(t){i=this.el;let e=this.data;n=e.navigation,r=JSON.parse(e.targets),function(t){let e=document.getElementById(t).getAttribute("babiaxr-navigation-bar").commits;if(e&&h){a=JSON.parse(e);for(let t in a)s.push(a[t]);if(s.reverse(),c){let t=a.length-1-0;o=s[0],l=t}else o=a[0],l=0;h=!1,function(){u(c?s:a);document.addEventListener("babiaxrShow",(function(t){!function(t){for(let e in a)if(a[e].commit==t.commit){o=a[e],f(e),l=e;break}p()}(t.detail.data),i.emit("babiaxrStop")})),document.addEventListener("babiaxrContinue",(function(){console.log("PLAY"),u(c?s:a)})),document.addEventListener("babiaxrToPresent",(function(){console.log("TO PRESENT"),c=!1,i.emit("babiaxrStop"),u(a)})),document.addEventListener("babiaxrToPast",(function(){console.log("TO PAST"),c=!0,i.emit("babiaxrStop"),u(s)})),document.addEventListener("babiaxrSkipNext",(function(){console.log("SKIP NEXT"),i.emit("babiaxrStop"),d("next")})),document.addEventListener("babiaxrSkipPrev",(function(){console.log("SKIP PREV"),i.emit("babiaxrStop"),d("prev")}))}()}}(n)},remove:function(){},pause:function(){},play:function(){}});var s=[];let o,l,c=!1,h=!0;function u(t){let e=0;for(let i in t)t[i]==o&&(e=parseInt(i)+1);let n=setInterval((function(){if(e<t.length){if(o=t[e],c){let i=t.length-1-e;f(i),l=i}else f(e),l=e;if(p(),e++,document.addEventListener("babiaxrStop",(function(){clearInterval(n)})),e==t.length){document.getElementsByClassName("babiaxrPause")[0].emit("click")}}else i.emit("babiaxrStop")}),3e3)}function d(t){for(let e in a)if(a[e]==o){"next"==t&&e<a.length-1?e++:"prev"==t&&e>=1&&e--,o=a[e],f(e),l=e;break}p()}function p(){let t=document.getElementById(o.commit).getAttribute("babiadata");for(let e in r){let i=document.getElementById(r[e].id);i&&i.setAttribute("babiaxr-vismapper","dataToShow",t)}}function f(t){let e=document.getElementsByClassName("babiaxrTimeBar")[0].children;if(l||0==l){e[l].emit("removeinfo")}e[t].emit("showinfo")}},function(t,e,n){n(0).findProdComponent;let r=n(0).updateFunction;const a=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-boats",{schema:{data:{type:"asset"},from:{type:"string"},border:{type:"number",default:.5},width:{type:"string",default:"width"},depth:{type:"string",default:"depth"},area:{type:"string"},color:{type:"string"},height:{type:"string",default:"height"},zone_elevation:{type:"number",default:.3},building_separation:{type:"number",default:.25},extra:{type:"number",default:1},levels:{type:"number"},building_color:{type:"string",default:"#E6B9A1"},base_color:{type:"color",default:"#98e690"},min_building_height:{type:"number",default:1},height_quarter_legend_box:{type:"number",default:11},height_quarter_legend_title:{type:"number",default:12},height_building_legend:{type:"number",default:0},legend_scale:{type:"number",default:1},legend_lookat:{type:"string",default:"[camera]"},field:{type:"string",default:"uid"}},entitiesWithLegend:[],legendsActive:[],dataComponent:void 0,newData:void 0,babiaMetadata:{id:0},visProperties:["height","area","width","depth"],multiple:!1,duration:2e3,figures_del:[],figures_in:[],animation:!1,init:function(){this.notiBuffer=new a},update:function(t){r(this,t)},tick:function(t,e){let i=this;if(this.animation){let t={x:0,y:0,z:0};Date.now()-this.start_time>this.duration?(this.animation=!1,this.setFigures(this.figures,t),i.entitiesWithLegend=i.entitiesWithLegend.filter(t=>document.getElementById(t.entity.id)),i.entitiesWithLegend.forEach(t=>{let e=t.entity,n=t.figure;if(n.children){e.legend=s(n.name,i.data.legend_scale,i.data.legend_lookat,"black","white");let t=(new THREE.Vector3).setFromMatrixPosition(e.object3D.matrixWorld),r={x:t.x,y:i.data.height_quarter_legend_title,z:t.z};e.legend.setAttribute("position",r),e.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(e.legend),i.legendsActive.push(e.legend),e.alreadyActive=!0}else{e.legend=s(n.name,i.data.legend_scale,i.data.legend_lookat,"white","black",e.babiaRawData,i.data.height,i.data.area,i.data.depth,i.data.width,i.data.color);let t=(new THREE.Vector3).setFromMatrixPosition(e.object3D.matrixWorld),r=(new THREE.Box3).setFromObject(e.object3D),a={x:t.x,y:r.max.y+1+i.data.height_building_legend,z:t.z};e.legend.setAttribute("position",a),e.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(e.legend),i.legendsActive.push(e.legend),e.alreadyActive=!0}})):this.Animation(this.el,this.figures,this.figures_old,e,t,t)}},updateChart:function(t){console.log("Data Loaded.");let e={x:0,y:0,z:0};this.animation&&(this.figures_del.forEach(t=>{let e=document.getElementById(t.id);e&&e.remove()}),this.figures_in.forEach(t=>{let e=document.getElementById(t.id);e&&o(e,1)}),this.setFigures(this.figures,e),this.animation=!1,this.figures_del=[],this.figures_in=[]),this.figures_old=this.figures,this.figures=[];let i,n=this.el,r=t;if(this.data.levels)i=this.data.border*this.data.extra*this.data.levels;else{let t=l(r,0);i=this.data.border*this.data.extra*(t+1)}if([x,y,e,this.figures]=this.generateElements(r,this.figures,e,i),e.x=0,e.z=0,0==this.figures_old.length){for(;this.el.firstChild;)this.el.firstChild.remove();this.drawElements(n,this.figures,e)}else this.figures_old!==this.figures&&(this.animation=!0,this.start_time=Date.now())},generateElements:function(t,e,i,n){var r=n,a=0,s=0,o=0,l=0,c=0,h=0,u=0,d=0,p=0,f=0,g=0,m=0,b=!1,y=!1,v=!1,x=!0;for(let i=0;i<t.length;i++){let w,C={};if(this.data.width&&(C.width=t[i][this.data.width]||.5),this.data.height&&(C.height=t[i][this.data.height]||this.data.min_building_height),this.data.depth&&(C.depth=t[i][this.data.depth]||.5),this.data.area&&(C.area=t[i][this.data.area]||.5),t[i].children){C.children=t[i].children,this.quarter=!0;var _,A=[];C.height=this.data.zone_elevation,r-=this.data.border*this.data.extra,[C.width,C.depth,_,A]=this.generateElements(C.children,A,_,r),_.y=C.height,r=n}0==i?(this.data.area&&!t[i].children?(a+=Math.sqrt(C.area)/2,s-=Math.sqrt(C.area)/2,o+=Math.sqrt(C.area)/2,l-=Math.sqrt(C.area)/2):(a+=C.depth/2,s-=C.depth/2,o+=C.width/2,l-=C.width/2),m=a+this.data.building_separation/2):C.height>0&&(b?([g,c,h,f]=this.UpSide(C,a,g,f),g>o&&(u=g+=this.data.building_separation/2,b=!1,x=!0,d<l&&(l=d),m=a+this.data.building_separation/2)):x?([m,c,h,u]=this.RightSide(C,o,m,u),m<s&&(p=m+=this.data.building_separation/2,x=!1,y=!0,f>a&&(a=f),g=o+this.data.building_separation/2)):y?([g,c,h,p]=this.DownSide(C,s,g,p),g<l&&(d=g-=this.data.building_separation/2,y=!1,v=!0,u>o&&(o=u),m=s-this.data.building_separation/2)):v&&([m,c,h,d]=this.LeftSide(C,l,m,d),m>a&&(f=m-=this.data.building_separation/2,v=!1,b=!0,p<s&&(s=p),g=l-this.data.building_separation/2))),w=t[i].children?{id:id="boat-"+t[i][this.data.field],name:t[i][this.data.field],posX:c,posY:h,width:C.width,height:C.height,depth:C.depth,children:A,translate_matrix:_}:this.data.area?{id:"boat-"+t[i][this.data.field],name:t[i].name?t[i].name:t[i][this.data.field],posX:c,posY:h,width:Math.sqrt(C.area),height:C.height,depth:Math.sqrt(C.area)}:{id:"boat-"+t[i][this.data.field],name:t[i].name?t[i].name:t[i][this.data.field],posX:c,posY:h,width:C.width,height:C.height,depth:C.depth},w.rawData=t[i],e.push(w)}p<s&&(s=p),d<l&&(l=d),f>a&&(a=f),u>o&&(o=u),g<l&&(l=g+this.data.building_separation/2),g>o&&(o=g-this.data.building_separation/2),m>a&&(a=m-this.data.building_separation/2),m<s&&(s=m+this.data.building_separation/2);var w=Math.abs(l)+Math.abs(o),C=Math.abs(s)+Math.abs(a);return[w+=2*r,C+=2*r,{x:l+w/2-r,y:0,z:s+C/2-r},e]},drawElements:function(t,e,i){for(let n in e){let r=e[n].height,a=e[n].posX,s=e[n].posY,o={x:a-i.x,y:r/2+i.y/2,z:-s+i.z},l=this.createElement(e[n],o);this.addEvents(l,e[n]),t.appendChild(l)}},RightSide:function(t,e,i,n){let r,a,s=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)+s):(r=parseFloat(t.width),a=parseFloat(t.depth)+s);let o=i-a/2,l=e+r+s;return l>n&&(n=l),[i-=a,e+r/2+s,o,n]},DownSide:function(t,e,i,n){let r,a,s=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area)+s,a=Math.sqrt(t.area)):(r=parseFloat(t.width)+s,a=parseFloat(t.depth));let o=i-r/2,l=e-a-s;return l<n&&(n=l),[i-=r,o,e-a/2-s,n]},LeftSide:function(t,e,i,n){let r,a,s=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)+s):(r=parseFloat(t.width),a=parseFloat(t.depth)+s);let o=i+a/2,l=e-r-s;return l<n&&(n=l),[i+=a,e-r/2-s,o,n]},UpSide:function(t,e,i,n){let r,a,s=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area)+s,a=Math.sqrt(t.area)):(r=parseFloat(t.width)+s,a=parseFloat(t.depth));let o=i+r/2,l=e+a+s;return l>n&&(n=l),[i+=r,o,e+a/2+s,n]},Animation:function(t,e,i,n,r,a){let s,l=this,c=Date.now();l.legendsActive.forEach(t=>{t.remove()}),l.legendsActive=[];for(let d in e)if(document.getElementById(e[d].id))if(s=document.getElementById(e[d].id),e[d].inserted){let t="id="+e[d].id;u(l.figures_in,t)<0&&l.figures_in.push(e[d])}else{let t="id="+e[d].id,o=u(i,t);if(o<0)e[d].inserted=!0,s.getAttribute("width")!=e[d].width&&s.setAttribute("width",e[d].width),s.getAttribute("height")!=e[d].height&&s.setAttribute("height",e[d].height),s.getAttribute("depth")!=e[d].depth&&s.setAttribute("depth",e[d].depth);else if(this.resize(s,c,n,e[d],i[o]),this.traslate(s,c,n,e[d],i[o],r,a),e[d].children)this.Animation(s,e[d].children,i[o].children,n,e[d].translate_matrix,i[o].translate_matrix);else if(e[d].rawData[l.data.color]!==i[o].rawData[l.data.color]){let t=h(e[d].rawData[l.data.color],l.babiaMetadata.color_max,l.babiaMetadata.color_min);t!==s.getAttribute("color")&&s.setAttribute("color",t)}}else{position={x:e[d].posX-r.x,y:e[d].height/2+r.y/2,z:-e[d].posY+r.z};let i=this.createElement(e[d],position);this.addEvents(i,e[d]),o(i,.5),t.appendChild(i),e[d].inserted=!0}this.duration;for(let t in i){let n="id="+i[t].id;if(u(e,n)<0){u(l.figures_del,n)<0&&l.figures_del.push(i[t]);let e=document.getElementById(i[t].id);e&&(e.object3D.visible=!1,e.remove())}}},setFigures:function(t,e){t.forEach(t=>{let i=document.getElementById(t.id);i&&(i.getAttribute("width")!=t.width&&i.setAttribute("width",t.width),i.getAttribute("height")!=t.height&&i.setAttribute("height",t.height),i.getAttribute("depth")!=t.depth&&i.setAttribute("depth",t.depth),i.components.material.data.opacity<1&&o(i,1),i.object3D.position.set(t.posX-e.x,(parseFloat(t.height)+e.y)/2,-t.posY+e.z),t.children&&this.setFigures(t.children,t.translate_matrix))})},resize:function(t,e,i,n,r){if(e-this.start_time<this.duration&&(n.width!=r.width||n.height!=r.height||n.depth!=r.depth)){let e,a,s,o=Math.abs(n.width-r.width),l=Math.abs(n.height-r.height),c=Math.abs(n.depth-r.depth),h=i*o/this.duration,u=i*l/this.duration,d=i*c/this.duration,p=parseFloat(t.getAttribute("width")),f=parseFloat(t.getAttribute("height")),g=parseFloat(t.getAttribute("depth"));e=n.width-r.width<0?p-h:p+h,a=n.height-r.height<0?f-u:f+u,s=n.depth-r.depth<0?g-d:g+d,t.setAttribute("width",e),t.setAttribute("height",a),t.setAttribute("depth",s),t.babiaRawData=n.rawData,t.classList.contains("babiaquarterboxactivated")&&t.childNodes.forEach(t=>{t.classList.contains("babiaquarterlegendbox")&&(t.setAttribute("geometry","width",e),t.setAttribute("geometry","depth",s),t.setAttribute("material","opacity",.4))})}else e-this.start_time>this.duration&&(n.width!=r.width||n.height!=r.height||n.depth!=r.depth)&&(t.setAttribute("width",n.width),t.setAttribute("height",n.height),t.setAttribute("depth",n.depth),t.babiaRawData=n.rawData,t.classList.contains("babiaquarterboxactivated")&&t.childNodes.forEach(t=>{t.classList.contains("babiaquarterlegendbox")&&(t.setAttribute("geometry","width",new_width),t.setAttribute("geometry","depth",new_depth),t.setAttribute("material","opacity",.4))}))},traslate:function(t,e,i,n,r,a,s){let o=r.posX-s.x-(n.posX-a.x),l=n.height-r.height,c=r.posY-s.z-(n.posY-a.z);if(0!=o||0!=l||0!=c)if(e-this.start_time<this.duration){let e=i*o/this.duration,n=i*l/(2*this.duration),r=i*c/this.duration,a=parseFloat(t.object3D.position.x)-e,s=parseFloat(t.object3D.position.y)+n,h=parseFloat(t.object3D.position.z)+r;t.object3D.position.set(a,s,h)}else e-this.start_time>this.duration&&t.object3D.position.set(n.posX-a.x,(parseFloat(n.height)+a.y)/2,-n.posY+a.z)},createElement:function(t,e){let i=this,n=document.createElement("a-box");n.id=t.id,n.setAttribute("class","babiaxraycasterclass");let r=t.width,a=t.height,s=t.depth;return t.children?color=i.data.base_color:i.data.color?color=h(t.rawData[i.data.color],i.babiaMetadata.color_max,i.babiaMetadata.color_min):color=i.data.building_color,n.setAttribute("color",color),n.setAttribute("width",r),n.setAttribute("height",a),n.setAttribute("depth",s),t.rawData&&(n.babiaRawData=t.rawData),n.setAttribute("position",{x:e.x,y:e.y,z:e.z}),n},processData:function(t){console.log("processData",t);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},e.color){let[t,i]=c(this.newData,e.color);this.babiaMetadata.color_max=t,this.babiaMetadata.color_min=i}this.notiBuffer.set(this.newData),this.updateChart(this.newData)},addEvents:function(t,e){let i=this;if(e.children){let n;t.addEventListener("click",(function(r){if(r.target===this)if(t.legend){t.removeChild(n),t.classList.remove("babiaquarterboxactivated"),i.el.parentElement.removeChild(t.legend);const e=i.entitiesWithLegend.findIndex(e=>e.entity===t);e>-1&&i.entitiesWithLegend.splice(e,1);const r=i.legendsActive.indexOf(t.legend);e>-1&&i.legendsActive.splice(r,1),t.legend=void 0,n=void 0}else{n=document.createElement("a-entity"),n.setAttribute("class","babiaquarterlegendbox"),t.classList.add("babiaquarterboxactivated");let r=t.getAttribute("geometry"),a=i.el.getAttribute("scale"),o=r.height+i.data.height_quarter_legend_box;a&&(o=(r.height+i.data.height_quarter_legend_box)/a.y),n.setAttribute("geometry",{height:o,depth:r.depth,width:r.width}),n.setAttribute("material",{visible:!0,opacity:.4}),t.appendChild(n),t.legend=s(e.name,i.data.legend_scale,i.data.legend_lookat,"black","white");let l=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),c={x:l.x,y:i.data.height_quarter_legend_title,z:l.z};t.legend.setAttribute("position",c),t.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(t.legend),i.entitiesWithLegend.push({figure:e,entity:t}),i.legendsActive.push(t.legend)}})),this.drawElements(t,e.children,e.translate_matrix)}else{let n;t.alreadyActive=!1,t.addEventListener("click",(function(r){if(r.target===this)if(t.alreadyActive){t.legend.setAttribute("visible",!1),t.setAttribute("geometry",{height:n.height-.1,depth:n.depth-.1,width:n.width-.1}),t.setAttribute("material",{color:t.getAttribute("babiaxrFirstColor")}),i.el.parentElement.removeChild(t.legend);const e=i.entitiesWithLegend.findIndex(e=>e.entity===t);e>-1&&i.entitiesWithLegend.splice(e,1);const r=i.legendsActive.indexOf(t.legend);e>-1&&i.legendsActive.splice(r,1),t.legend=void 0,t.alreadyActive=!1}else{if(t.alreadyActive=!0,!t.legend){n=t.getAttribute("geometry");let r=t.getAttribute("position");t.setAttribute("position",r),t.setAttribute("babiaxrFirstColor",t.getAttribute("material").color),t.setAttribute("material",{color:"white"}),t.setAttribute("geometry",{height:n.height+.1,depth:n.depth+.1,width:n.width+.1}),t.legend=s(e.name,i.data.legend_scale,i.data.legend_lookat,"white","black",t.babiaRawData,i.data.height,i.data.area,i.data.depth,i.data.width,i.data.color);let a=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),o=(new THREE.Box3).setFromObject(t.object3D),l={x:a.x,y:o.max.y+1+i.data.height_building_legend,z:a.z};t.legend.setAttribute("position",l),t.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(t.legend)}i.entitiesWithLegend.push({figure:e,entity:t}),i.legendsActive.push(t.legend)}})),t.addEventListener("mouseenter",(function(){if(!t.alreadyActive){n=t.getAttribute("geometry");let r=t.getAttribute("position");t.setAttribute("position",r),t.setAttribute("babiaxrFirstColor",t.getAttribute("material").color),t.setAttribute("material",{color:"white"}),t.setAttribute("geometry",{height:n.height+.1,depth:n.depth+.1,width:n.width+.1}),t.legend=s(e.name,i.data.legend_scale,i.data.legend_lookat,"white","black",t.babiaRawData,i.data.height,i.data.area,i.data.depth,i.data.width,i.data.color);let a=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),o=(new THREE.Box3).setFromObject(t.object3D),l={x:a.x,y:o.max.y+1+i.data.height_building_legend,z:a.z};t.legend.setAttribute("position",l),t.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(t.legend)}})),t.addEventListener("mouseleave",(function(){!t.alreadyActive&&t.legend&&(t.legend.setAttribute("visible",!1),t.setAttribute("geometry",{height:n.height-.1,depth:n.depth-.1,width:n.width-.1}),t.setAttribute("material",{color:t.getAttribute("babiaxrFirstColor")}),i.el.parentElement.removeChild(t.legend),t.legend=void 0)}))}}});let s=(t,e,i,n,r,a,s,o,l,c,h)=>{let u=2,d=1;if(t.length>16&&(u=t.length/5),a){let e="\n "+s+" (height): "+Math.round(100*a[s])/100;if(e.length>16&&(u=e.length/5),t+=e,o){let i="\n "+o+" (area): "+Math.round(100*a[o])/100;i.length>16&&i>e&&(u=i.length/5),t+=i}else{let i="\n "+l+" (depth): "+Math.round(100*a[l])/100;i.length>16&&i>e&&(u=i.length/5),t+=i;let n="\n "+c+" (width): "+Math.round(100*a[c])/100;n.length>16&&n>e&&n>i&&(u=n.length/5),t+=n,d=1.5}if(h){let i="\n "+h+" (color): "+Math.round(100*a[h])/100;i.length>16&&i>e&&(u=i.length/5),t+=i,d+=.2}}let p=document.createElement("a-plane");return p.setAttribute("babia-lookat",i),p.setAttribute("rotation",{x:0,y:0,z:0}),p.setAttribute("height",d),p.setAttribute("width",u),p.setAttribute("color",n),p.setAttribute("material",{side:"double"}),p.setAttribute("text",{value:t,align:"center",width:6,color:r,alphaTest:6,opacity:6,transparent:!1}),p.setAttribute("visible",!1),p.setAttribute("class","babialegend"),p.setAttribute("scale",{x:e,y:e,z:e}),p};function o(t,e){if(t.setAttribute("material","opacity",e),t.childNodes)for(let i=0;i<t.childNodes.length;i++)o(t.childNodes[i],e)}let l=(t,e)=>{let i=e,n=e;for(let r in t)t[r].children&&(i++,n<(e=l(t[r].children,i))&&(n=e),i--);return n},c=(t,e,i,n)=>{for(let r=0;r<t.length;r++)t[r].children?[i,n]=c(t[r].children,e,i,n):(("null"!==t[r][e]&&!i||t[r][e]>i)&&(i=t[r][e]),("null"!==t[r][e]&&!n||t[r][e]<n)&&(n=t[r][e]));return[i,n]};function h(t,e,i){let n=[19,82,138],r=[255,94,83];var a=((2*(((t||0)-i)/(e-i))-1)/1+1)/2,s=1-a,o=[Math.round(r[0]*a+n[0]*s),Math.round(r[1]*a+n[1]*s),Math.round(r[2]*a+n[2]*s)];return"rgb("+o[0]+","+o[1]+","+o[2]+")"}let u=(t,e)=>{for(e=e.split("="),i=0;i<t.length;i++)if(t[i][e[0]]===e[1])return i;return-1}},function(t,e){var i,n=AFRAME.utils.debug,r=AFRAME.utils.coordinates,a=n("components:babia-lookat:warn"),s=r.isCoordinates||r.isCoordinate;delete AFRAME.components["babia-lookat"],AFRAME.registerComponent("babia-lookat",{schema:{default:"0 0 0",parse:function(t){return s(t)||"object"==typeof t?r.parse(t):t},stringify:function(t){return"object"==typeof t?r.stringify(t):t}},init:function(){this.target3D=null,this.vector=new THREE.Vector3,this.cameraListener=AFRAME.utils.bind(this.cameraListener,this),this.el.addEventListener("componentinitialized",this.cameraListener),this.el.addEventListener("componentremoved",this.cameraListener)},update:function(){var t,e=this,i=e.data;return!i||"object"==typeof i&&!Object.keys(i).length?e.remove():"object"==typeof i?this.lookAt(new THREE.Vector3(i.x,i.y,i.z)):(t=e.el.sceneEl.querySelector(i))?t.hasLoaded?e.beginTracking(t):t.addEventListener("loaded",(function(){e.beginTracking(t)})):void a('"'+i+'" does not point to a valid entity to babia-lookat')},tick:(i=new THREE.Vector3,function(t){var e=this.target3D;e&&(e.getWorldPosition(i),this.lookAt(i))}),remove:function(){this.el.removeEventListener("componentinitialized",this.cameraListener),this.el.removeEventListener("componentremoved",this.cameraListener)},beginTracking:function(t){this.target3D=t.object3D},cameraListener:function(t){t.detail&&"camera"===t.detail.name&&this.update()},lookAt:function(t){var e=this.vector,i=this.el.object3D;this.el.getObject3D("camera")?e.subVectors(i.position,t).add(i.position):e.copy(t),i.lookAt(e)}})},function(t,e,i){let n=i(0).findProdComponent,r=i(0).parseJson;const a=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let s=i(1);"default"in s&&(s=s.default);let o=i(64);"default"in o&&(o=o.default);let l=function(t){if("function"==typeof t)return t;let e=eval;try{return e("("+t+")")}catch(t){}return null},c=function(t){return isNaN(parseFloat(t))?l(t)?l(t):t:parseFloat(t)},h="";AFRAME.registerComponent("babia-network",{schema:{nodeLegend:{type:"boolean",default:!1},linkLegend:{type:"boolean",default:!1},from:{type:"string"},nodesFrom:{type:"string"},linksFrom:{type:"string"},data:{type:"string",default:""},nodes:{type:"string",default:""},links:{type:"string",default:""},nodeId:{type:"string",default:"id"},nodeLabel:{parse:c,default:"id"},linkId:{type:"string",default:""},linkSource:{type:"string",default:"source"},linkTarget:{type:"string",default:"target"},nodeVal:{type:"string",default:""},nodeRelSize:{type:"number",default:4},nodeColor:{parse:c,default:"color"},nodeAutoColorBy:{parse:c,default:""},nodeResolution:{type:"number",default:8},linkColor:{parse:c,default:"color"},linkAutoColorBy:{parse:c,default:""},linkWidth:{parse:c,default:0},linkResolution:{type:"number",default:6},linkLabel:{parse:c,default:""},nodeDesc:{parse:c,default:"desc"},linkDesc:{parse:c,default:"desc"},nodeVisibility:{parse:c,default:!0},nodeOpacity:{type:"number",default:1},linkVisibility:{parse:c,default:!0},linkOpacity:{type:"number",default:1},nodeThreeObject:{parse:c,default:null},nodeThreeObjectExtend:{parse:c,default:!1},linkCurvature:{parse:c,default:0},linkCurveRotation:{parse:c,default:0},linkMaterial:{parse:c,default:null},linkThreeObject:{parse:c,default:null},linkThreeObjectExtend:{parse:c,default:!1},linkPositionUpdate:{parse:l,default:null},linkDirectionalArrowLength:{parse:c,default:0},linkDirectionalArrowColor:{parse:c,default:null},linkDirectionalArrowRelPos:{parse:c,default:.5},linkDirectionalArrowResolution:{type:"number",default:8},linkDirectionalParticles:{parse:c,default:0},linkDirectionalParticleSpeed:{parse:c,default:.01},linkDirectionalParticleWidth:{parse:c,default:.5},linkDirectionalParticleColor:{parse:c,default:null},linkDirectionalParticleResolution:{type:"number",default:4},linkHoverPrecision:{type:"number",default:2},onNodeCenterHover:{parse:l,default:function(){}},onLinkCenterHover:{parse:l,default:function(){}},numDimensions:{type:"number",default:3},dagMode:{type:"string",default:""},dagLevelDistance:{type:"number",default:0},dagNodeFilter:{parse:l,function:()=>!0},onDagError:{parse:l,default:void 0},forceEngine:{type:"string",default:"d3"},d3AlphaMin:{type:"number",default:0},d3AlphaDecay:{type:"number",default:.0228},d3VelocityDecay:{type:"number",default:.4},ngraphPhysics:{parse:r,default:null},warmupTicks:{type:"int",default:0},cooldownTicks:{type:"int",default:1e18},cooldownTime:{type:"int",default:15e3},onEngineTick:{parse:l,default:function(){}},onEngineStop:{parse:l,default:function(){}}},getGraphBbox:function(){return this.forceGraph||(this.forceGraph=new o),this.forceGraph.getGraphBbox()},emitParticle:function(){this.forceGraph||(this.forceGraph=new o);const t=this.forceGraph,e=t.emitParticle.apply(t,arguments);return e===t?this:e},d3Force:function(){this.forceGraph||(this.forceGraph=new o);const t=this.forceGraph,e=t.d3Force.apply(t,arguments);return e===t?this:e},d3ReheatSimulation:function(){return this.forceGraph&&this.forceGraph.d3ReheatSimulation(),this},refresh:function(){return this.forceGraph&&this.forceGraph.refresh(),this},visProperties:{nodes:["nodeId"],links0:["linkId"],links1:["linkSource","linkTarget"]},init:function(){this.isFirstTimeNodes=!0,this.isFirstTimeLinks=!0,this.notiBuffer=new a;let t=this.state={},e=document.querySelector("a-entity[camera], a-camera");t.cameraObj=e.object3D.children.filter((function(t){return"PerspectiveCamera"===t.type}))[0],this.el.sceneEl.addEventListener("camera-set-active",(function(e){t.cameraObj=e.detail.cameraEl.components.camera.camera})),this.forceGraph||(this.forceGraph=new o),this.el.object3D.add(this.forceGraph),h=document.querySelector("[cursor]"),document.addEventListener("controllerconnected",t=>{h=document.querySelector("[laser-controls]")})},update:function(t){let e=this.el,i=this.data;if(this.currentData=t,i.data&&t.data!==i.data){let t=r(i.data);this.processData(t)}else if(i.nodes){if(t.nodes!==i.nodes){let t=r(i.nodes);this.processNodes(t)}if(t.links!==i.links){let t=r(i.links);this.processLinks(t)}}else if(i.from===t.from||i.nodesFrom){if(i.nodesFrom!==t.nodesFrom||i.linksFrom!==t.linksFrom){this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.nodesProdComponent&&this.nodesProdComponent.notiBuffer.unregister(this.notiBufferId),this.linksProdComponent&&this.linksProdComponent.notiBuffer.unregister(this.notiBufferId);let t=n(i,e);this.nodesProdComponent=t.nodes,this.nodesProdComponent.notiBuffer&&(this.notiBufferId=this.nodesProdComponent.notiBuffer.register(this.processNodes.bind(this))),this.linksProdComponent=t.links,this.linksProdComponent.notiBuffer&&(this.notiBufferId=this.linksProdComponent.notiBuffer.register(this.processLinks.bind(this)))}else if(i!==t)if(this.newData){let t=r(this.newData);this.processData(t,!0)}else if(this.newNodes)if(i.linkSource!=t.linkSource||i.linkTarget!=t.linkTarget){let t=r(this.newLinks);this.processLinks(t,!0)}else{let t=r(this.newNodes);this.processNodes(t,!0)}}else this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.nodesProdComponent&&this.nodesProdComponent.notiBuffer.unregister(this.notiBufferId),this.linksProdComponent&&this.linksProdComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(i,e),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))},tick:function(t,e){let i=h.components.raycaster.raycaster.intersectObjects(this.forceGraph.children).filter((function(t){return-1!==["node","link"].indexOf(t.object.__graphObjType)})).sort((function(t,e){return i(e)-i(t);function i(t){return"node"===t.object.__graphObjType}})),n=i.length?i[0].object:null;if(n!==this.state.hoverObj){const t=this.state.hoverObj?this.state.hoverObj.__graphObjType:null,e=this.state.hoverObj?this.state.hoverObj.__data:null,i=n?n.__graphObjType:null,r=n?n.__data:null;t&&t!==i&&this.data["on"+("node"===t?"Node":"Link")+"CenterHover"](null,e),(this.data.nodeLegend&&"node"===t||this.data.linkLegend&&""!=this.data.linkLabel&&"link"===t)&&this.removeLegend(this),i&&this.data["on"+("node"===i?"Node":"Link")+"CenterHover"](r,t===i?e:null),this.state.hoverObj=n,n&&(this.data.nodeLegend&&"node"===n.__graphObjType?this.showLegend(n,n.__data,this.data.nodeLabel,this.el.getAttribute("scale")):this.data.linkLegend&&"link"===n.__graphObjType&&""!=this.data.linkLabel&&this.showLinkLegend(n,n.__data,this.data.linkLabel,this.el.getAttribute("scale")))}this.forceGraph.tickFrame()},prodComponent:void 0,nodesProdComponent:void 0,linksProdComponent:void 0,notiBufferId:void 0,newData:void 0,newNodes:void 0,newLinks:void 0,isFirstTimeNodes:void 0,isFirstTimeLinks:void 0,nodeFields:void 0,linkFields:void 0,currentData:void 0,babiaMetadata:{id:0},legend:"",updateChart:function(t,e){if(e.currentData){let i=[];for(let t in this.data)i[t]=this.data[t];i.nodes=t.nodes,i.links=t.links;let n=AFRAME.utils.diff(i,e.currentData);["jsonUrl","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeVisibility","nodeColor","nodeAutoColorBy","nodeOpacity","nodeThreeObject","nodeThreeObjectExtend","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","forceEngine","d3AlphaMin","d3AphaDecay","d3VelocityDecay","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].filter((function(t){return t in n})).forEach((function(t){e.forceGraph[t](""!==i[t]?i[t]:null)})),("nodes"in n||"links"in n)&&e.forceGraph.graphData({nodes:i.nodes,links:i.links})}},processData:function(t,e){if(console.log("processData",this),this.newData!=t||e){this.newData=t;let e=this.elDataFromData(t);this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this),this.notiBuffer.set(t)}},processNodes:function(t,e){if(console.log("processNodes",this),this.newNodes!=t||e){this.newNodes=t;let e=this.elDataFromNodesAndLinks(t,this.newLinks);if(e)this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this),this.notiBuffer.set({nodes:e.nodes,links:e.links});else if(this.data.links){let t=r(this.data.links);this.processLinks(t)}else this.data.linksFrom&&(this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."))}},processLinks:function(t,e){console.log("processLinks",this);let i=r(t);if(this.newLinks!=i||e){this.newLinks=i;let t=this.elDataFromNodesAndLinks(this.newNodes,i);if(t)this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(t,this),this.notiBuffer.set({nodes:t.nodes,links:t.links});else if(this.data.nodes){let t=r(this.data.nodes);this.processNodes(t)}else this.data.nodesFrom&&(this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."))}},elDataFromData:function(t){let e=[],i=[];const n=this.data.nodeId,r=this.data.linkId,a=this.data.nodeVal,s=this.data.linkSource,o=this.data.linkTarget,l=this.data.linkLabel;return t.forEach(t=>{let i={};Object.keys(t).forEach((function(e){e===n&&(i[n]=t[e]),e===r&&(i.linkId=t[e]),e===a&&(i[a]=t[e])})),e.push(i)}),e.forEach(t=>{e.forEach(e=>{if(t[n]!==e[n]&&t.linkId===e.linkId)if(i.length>0){let r=!1;if(i.forEach(i=>{(i[s]===t[n]&&i[o]===e[n]||i[s]===e[n]&&i[o]===t[n])&&(r=!0)}),!r){let r={};r[l]=t[l],r[s]=t[n],r[o]=e[n],i.push(r)}}else{let r={};r[l]=t[l],r[s]=t[n],r[o]=e[n],i.push(r)}})}),{nodes:e,links:i}},elDataFromNodesAndLinks:function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;this.isFirstTimeNodes&&(this.nodeFields=[],Object.keys(t[0]).forEach(t=>{this.nodeFields.push(t)}),this.isFirstTimeNodes=!1),this.isFirstTimeLinks&&(this.linkFields=[],Object.keys(e[0]).forEach(t=>{this.linkFields.push(t)}),this.isFirstTimeLinks=!1),"object"==typeof e[0].source&&e.forEach(t=>{t.source=t.source[this.data.nodeId],t.target=t.target[this.data.nodeId]});let i=[];t.forEach(t=>{let e={};Object.keys(t).forEach(i=>{for(let n in this.nodeFields)i==this.nodeFields[n]&&(e[i]=t[i])}),i.push(e)});let n=[];return e.forEach(t=>{let e={};Object.keys(t).forEach(i=>{for(let n in this.linkFields)i==this.linkFields[n]&&i!=this.data.linkId&&(e[i]=t[i])}),n.push(e)}),{nodes:i,links:n}},showLegend:function(t,e,i,n){let r=new THREE.Vector3;t.getWorldPosition(r);let a=t.geometry.boundingSphere.radius,s=document.querySelector("a-scene");this.legend=function(t,e,i,n,r){let a=t[e];if(a){let s=2,o=3,l=3,c=3;a.length>16&&(s=a.length/8),r&&(o*=r.x,l*=r.y,c*=r.z,n=(n+3)*r.y);let h=document.createElement("a-plane");return h.setAttribute("position",{x:i.x,y:i.y+n,z:i.z}),h.setAttribute("babia-lookat","[camera]"),h.setAttribute("width",s),h.setAttribute("height","1"),h.setAttribute("color","white"),h.setAttribute("scale",{x:o,y:l,z:c}),h.setAttribute("text",{value:t[e],align:"center",width:6,color:"black"}),h.classList.add("babiaxrLegend"),h}}(e,i,r,a,n),this.legend&&s.appendChild(this.legend)},showLinkLegend:function(t,e,i,n){let r=new THREE.Vector3,a=t.geometry.boundingSphere.radius,s=new THREE.Vector3,o=new THREE.Vector3;this.forceGraph.children.filter(t=>"node"==t.__graphObjType).forEach(t=>{t.__data[this.data.nodeId]==e.source[this.data.nodeId]&&t.getWorldPosition(s),t.__data[this.data.nodeId]==e.target[this.data.nodeId]&&t.getWorldPosition(o)}),r.x=(s.x+o.x)/2,r.y=(s.y+o.y)/2,r.z=(s.z+o.z)/2;let l=document.querySelector("a-scene");this.legend=function(t,e,i,n,r){let a=t[e];if(a){let s=2,o=3,l=3,c=3;a.length>16&&(s=a.length/8),r&&(o*=r.x,l*=r.y,c*=r.z,n=(n+3)*r.y);let h=document.createElement("a-plane");return h.setAttribute("position",{x:i.x,y:i.y+n,z:i.z}),h.setAttribute("babia-lookat","[camera]"),h.setAttribute("width",s),h.setAttribute("height","1"),h.setAttribute("color","white"),h.setAttribute("scale",{x:o,y:l,z:c}),h.setAttribute("text",{value:t[e],align:"center",width:6,color:"black"}),h.classList.add("babiaxrLegend"),h}}(e,i,r,a,n),this.legend&&l.appendChild(this.legend)},removeLegend:function(){if(this.legend){document.querySelector("a-scene").removeChild(this.legend)}}})},function(t,e,i){const n=i(3);function r(t,e){return`\n${s(t,e)}\n${a(t)}\nreturn {Body: Body, Vector: Vector};\n`}function a(t){let e=n(t),i=e("{var}",{join:", "});return`\nfunction Body(${i}) {\n this.isPinned = false;\n this.pos = new Vector(${i});\n this.force = new Vector();\n this.velocity = new Vector();\n this.mass = 1;\n\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.reset = function() {\n this.force.reset();\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.setPosition = function (${i}) {\n ${e("this.pos.{var} = {var} || 0;",{indent:2})}\n};`}function s(t,e){let i=n(t),r="";return e&&(r=""+i("\n var v{var};\nObject.defineProperty(this, '{var}', {\n set: function(v) { \n if (!Number.isFinite(v)) throw new Error('Cannot set non-numbers to {var}');\n v{var} = v; \n },\n get: function() { return v{var}; }\n});")),`function Vector(${i("{var}",{join:", "})}) {\n ${r}\n if (typeof arguments[0] === 'object') {\n // could be another vector\n let v = arguments[0];\n ${i('if (!Number.isFinite(v.{var})) throw new Error("Expected value is not a finite number at Vector constructor ({var})");',{indent:4})}\n ${i("this.{var} = v.{var};",{indent:4})}\n } else {\n ${i('this.{var} = typeof {var} === "number" ? {var} : 0;',{indent:4})}\n }\n }\n \n Vector.prototype.reset = function () {\n ${i("this.{var} = ",{join:""})}0;\n };`}t.exports=function(t,e){let i=r(t,e),{Body:n}=new Function(i)();return n},t.exports.generateCreateBodyFunctionBody=r,t.exports.getVectorCode=s,t.exports.getBodyCode=a},function(t,e,i){const n=i(3),r=i(8);function a(t){let e=n(t),i=Math.pow(2,t);return`\n${h()}\n${c(t)}\n${s(t)}\n${l(t)}\n${o(t)}\n\nfunction createQuadTree(options, random) {\n options = options || {};\n options.gravity = typeof options.gravity === 'number' ? options.gravity : -1;\n options.theta = typeof options.theta === 'number' ? options.theta : 0.8;\n\n var gravity = options.gravity;\n var updateQueue = [];\n var insertStack = new InsertStack();\n var theta = options.theta;\n\n var nodesCache = [];\n var currentInCache = 0;\n var root = newNode();\n\n return {\n insertBodies: insertBodies,\n\n /**\n * Gets root node if it is present\n */\n getRoot: function() {\n return root;\n },\n\n updateBodyForce: update,\n\n options: function(newOptions) {\n if (newOptions) {\n if (typeof newOptions.gravity === 'number') {\n gravity = newOptions.gravity;\n }\n if (typeof newOptions.theta === 'number') {\n theta = newOptions.theta;\n }\n\n return this;\n }\n\n return {\n gravity: gravity,\n theta: theta\n };\n }\n };\n\n function newNode() {\n // To avoid pressure on GC we reuse nodes.\n var node = nodesCache[currentInCache];\n if (node) {\n${function(t){let e=[];for(let n=0;n<i;++n)e.push(`${t}quad${n} = null;`);return e.join("\n")}(" node.")}\n node.body = null;\n node.mass = ${e("node.mass_{var} = ",{join:""})}0;\n ${e("node.min_{var} = node.max_{var} = ",{join:""})}0;\n } else {\n node = new QuadNode();\n nodesCache[currentInCache] = node;\n }\n\n ++currentInCache;\n return node;\n }\n\n function update(sourceBody) {\n var queue = updateQueue;\n var v;\n ${e("var d{var};",{indent:4})}\n var r; \n ${e("var f{var} = 0;",{indent:4})}\n var queueLength = 1;\n var shiftIdx = 0;\n var pushIdx = 1;\n\n queue[0] = root;\n\n while (queueLength) {\n var node = queue[shiftIdx];\n var body = node.body;\n\n queueLength -= 1;\n shiftIdx += 1;\n var differentBody = (body !== sourceBody);\n if (body && differentBody) {\n // If the current node is a leaf node (and it is not source body),\n // calculate the force exerted by the current node on body, and add this\n // amount to body's net force.\n ${e("d{var} = body.pos.{var} - sourceBody.pos.{var};",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n // Poor man's protection against zero distance.\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n\n // This is standard gravitation force calculation but we divide\n // by r^3 to save two operations when normalizing force vector.\n v = gravity * body.mass * sourceBody.mass / (r * r * r);\n ${e("f{var} += v * d{var};",{indent:8})}\n } else if (differentBody) {\n // Otherwise, calculate the ratio s / r, where s is the width of the region\n // represented by the internal node, and r is the distance between the body\n // and the node's center-of-mass\n ${e("d{var} = node.mass_{var} / node.mass - sourceBody.pos.{var};",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n // Sorry about code duplication. I don't want to create many functions\n // right away. Just want to see performance first.\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n // If s / r < θ, treat this internal node as a single body, and calculate the\n // force it exerts on sourceBody, and add this amount to sourceBody's net force.\n if ((node.max_${r(0)} - node.min_${r(0)}) / r < theta) {\n // in the if statement above we consider node's width only\n // because the region was made into square during tree creation.\n // Thus there is no difference between using width or height.\n v = gravity * node.mass * sourceBody.mass / (r * r * r);\n ${e("f{var} += v * d{var};",{indent:10})}\n } else {\n // Otherwise, run the procedure recursively on each of the current node's children.\n\n // I intentionally unfolded this loop, to save several CPU cycles.\n${function(){let t=Array(11).join(" "),e=[];for(let n=0;n<i;++n)e.push(t+`if (node.quad${n}) {`),e.push(t+` queue[pushIdx] = node.quad${n};`),e.push(t+" queueLength += 1;"),e.push(t+" pushIdx += 1;"),e.push(t+"}");return e.join("\n")}()}\n }\n }\n }\n\n ${e("sourceBody.force.{var} += f{var};",{indent:4})}\n }\n\n function insertBodies(bodies) {\n ${e("var {var}min = Number.MAX_VALUE;",{indent:4})}\n ${e("var {var}max = Number.MIN_VALUE;",{indent:4})}\n var i = bodies.length;\n\n // To reduce quad tree depth we are looking for exact bounding box of all particles.\n while (i--) {\n var pos = bodies[i].pos;\n ${e("if (pos.{var} < {var}min) {var}min = pos.{var};",{indent:6})}\n ${e("if (pos.{var} > {var}max) {var}max = pos.{var};",{indent:6})}\n }\n\n // Makes the bounds square.\n var maxSideLength = -Infinity;\n ${e("if ({var}max - {var}min > maxSideLength) maxSideLength = {var}max - {var}min ;",{indent:4})}\n\n currentInCache = 0;\n root = newNode();\n ${e("root.min_{var} = {var}min;",{indent:4})}\n ${e("root.max_{var} = {var}min + maxSideLength;",{indent:4})}\n\n i = bodies.length - 1;\n if (i >= 0) {\n root.body = bodies[i];\n }\n while (i--) {\n insert(bodies[i], root);\n }\n }\n\n function insert(newBody) {\n insertStack.reset();\n insertStack.push(root, newBody);\n\n while (!insertStack.isEmpty()) {\n var stackItem = insertStack.pop();\n var node = stackItem.node;\n var body = stackItem.body;\n\n if (!node.body) {\n // This is internal node. Update the total mass of the node and center-of-mass.\n ${e("var {var} = body.pos.{var};",{indent:8})}\n node.mass += body.mass;\n ${e("node.mass_{var} += body.mass * {var};",{indent:8})}\n\n // Recursively insert the body in the appropriate quadrant.\n // But first find the appropriate quadrant.\n var quadIdx = 0; // Assume we are in the 0's quad.\n ${e("var min_{var} = node.min_{var};",{indent:8})}\n ${e("var max_{var} = (min_{var} + node.max_{var}) / 2;",{indent:8})}\n\n${function(e){let i=[],n=Array(e+1).join(" ");for(let e=0;e<t;++e)i.push(n+`if (${r(e)} > max_${r(e)}) {`),i.push(n+` quadIdx = quadIdx + ${Math.pow(2,e)};`),i.push(n+` min_${r(e)} = max_${r(e)};`),i.push(n+` max_${r(e)} = node.max_${r(e)};`),i.push(n+"}");return i.join("\n")}(8)}\n\n var child = getChild(node, quadIdx);\n\n if (!child) {\n // The node is internal but this quadrant is not taken. Add\n // subnode to it.\n child = newNode();\n ${e("child.min_{var} = min_{var};",{indent:10})}\n ${e("child.max_{var} = max_{var};",{indent:10})}\n child.body = body;\n\n setChild(node, quadIdx, child);\n } else {\n // continue searching in this quadrant.\n insertStack.push(child, body);\n }\n } else {\n // We are trying to add to the leaf node.\n // We have to convert current leaf into internal node\n // and continue adding two nodes.\n var oldBody = node.body;\n node.body = null; // internal nodes do not cary bodies\n\n if (isSamePosition(oldBody.pos, body.pos)) {\n // Prevent infinite subdivision by bumping one node\n // anywhere in this quadrant\n var retriesCount = 3;\n do {\n var offset = random.nextDouble();\n ${e("var d{var} = (node.max_{var} - node.min_{var}) * offset;",{indent:12})}\n\n ${e("oldBody.pos.{var} = node.min_{var} + d{var};",{indent:12})}\n retriesCount -= 1;\n // Make sure we don't bump it out of the box. If we do, next iteration should fix it\n } while (retriesCount > 0 && isSamePosition(oldBody.pos, body.pos));\n\n if (retriesCount === 0 && isSamePosition(oldBody.pos, body.pos)) {\n // This is very bad, we ran out of precision.\n // if we do not return from the method we'll get into\n // infinite loop here. So we sacrifice correctness of layout, and keep the app running\n // Next layout iteration should get larger bounding box in the first step and fix this\n return;\n }\n }\n // Next iteration should subdivide node further.\n insertStack.push(node, oldBody);\n insertStack.push(node, body);\n }\n }\n }\n}\nreturn createQuadTree;\n\n`}function s(t){let e=n(t);return`\n function isSamePosition(point1, point2) {\n ${e("var d{var} = Math.abs(point1.{var} - point2.{var});",{indent:2})}\n \n return ${e("d{var} < 1e-8",{join:" && "})};\n } \n`}function o(t){var e=Math.pow(2,t);return`\nfunction setChild(node, idx, child) {\n ${function(){let t=[];for(let i=0;i<e;++i){let e=0===i?" ":" else ";t.push(`${e}if (idx === ${i}) node.quad${i} = child;`)}return t.join("\n")}()}\n}`}function l(t){return`function getChild(node, idx) {\n${function(){let e=[],i=Math.pow(2,t);for(let t=0;t<i;++t)e.push(` if (idx === ${t}) return node.quad${t};`);return e.join("\n")}()}\n return null;\n}`}function c(t){let e=n(t),i=Math.pow(2,t);return`\nfunction QuadNode() {\n // body stored inside this node. In quad tree only leaf nodes (by construction)\n // contain bodies:\n this.body = null;\n\n // Child nodes are stored in quads. Each quad is presented by number:\n // 0 | 1\n // -----\n // 2 | 3\n${function(t){let e=[];for(let n=0;n<i;++n)e.push(`${t}quad${n} = null;`);return e.join("\n")}(" this.")}\n\n // Total mass of current node\n this.mass = 0;\n\n // Center of mass coordinates\n ${e("this.mass_{var} = 0;",{indent:2})}\n\n // bounding box coordinates\n ${e("this.min_{var} = 0;",{indent:2})}\n ${e("this.max_{var} = 0;",{indent:2})}\n}\n`}function h(){return"\n/**\n * Our implementation of QuadTree is non-recursive to avoid GC hit\n * This data structure represent stack of elements\n * which we are trying to insert into quad tree.\n */\nfunction InsertStack () {\n this.stack = [];\n this.popIdx = 0;\n}\n\nInsertStack.prototype = {\n isEmpty: function() {\n return this.popIdx === 0;\n },\n push: function (node, body) {\n var item = this.stack[this.popIdx];\n if (!item) {\n // we are trying to avoid memory pressure: create new element\n // only when absolutely necessary\n this.stack[this.popIdx] = new InsertStackElement(node, body);\n } else {\n item.node = node;\n item.body = body;\n }\n ++this.popIdx;\n },\n pop: function () {\n if (this.popIdx > 0) {\n return this.stack[--this.popIdx];\n }\n },\n reset: function () {\n this.popIdx = 0;\n }\n};\n\nfunction InsertStackElement(node, body) {\n this.node = node; // QuadTree node\n this.body = body; // physical body which needs to be inserted to node\n}\n"}t.exports=function(t){let e=a(t);return new Function(e)()},t.exports.generateQuadTreeFunctionBody=a,t.exports.getInsertStackCode=h,t.exports.getQuadNodeCode=c,t.exports.isSamePosition=s,t.exports.getChildBodyCode=l,t.exports.setChildBodyCode=o},function(t,e,i){t.exports=function(t){let e=r(t);return new Function("bodies","settings","random",e)},t.exports.generateFunctionBody=r;const n=i(3);function r(t){let e=n(t);return`\n var boundingBox = {\n ${e("min_{var}: 0, max_{var}: 0,",{indent:4})}\n };\n\n return {\n box: boundingBox,\n\n update: updateBoundingBox,\n\n reset: resetBoundingBox,\n\n getBestNewPosition: function (neighbors) {\n var ${e("base_{var} = 0",{join:", "})};\n\n if (neighbors.length) {\n for (var i = 0; i < neighbors.length; ++i) {\n let neighborPos = neighbors[i].pos;\n ${e("base_{var} += neighborPos.{var};",{indent:10})}\n }\n\n ${e("base_{var} /= neighbors.length;",{indent:8})}\n } else {\n ${e("base_{var} = (boundingBox.min_{var} + boundingBox.max_{var}) / 2;",{indent:8})}\n }\n\n var springLength = settings.springLength;\n return {\n ${e("{var}: base_{var} + (random.nextDouble() - 0.5) * springLength,",{indent:8})}\n };\n }\n };\n\n function updateBoundingBox() {\n var i = bodies.length;\n if (i === 0) return; // No bodies - no borders.\n\n ${e("var max_{var} = -Infinity;",{indent:4})}\n ${e("var min_{var} = Infinity;",{indent:4})}\n\n while(i--) {\n // this is O(n), it could be done faster with quadtree, if we check the root node bounds\n var bodyPos = bodies[i].pos;\n ${e("if (bodyPos.{var} < min_{var}) min_{var} = bodyPos.{var};",{indent:6})}\n ${e("if (bodyPos.{var} > max_{var}) max_{var} = bodyPos.{var};",{indent:6})}\n }\n\n ${e("boundingBox.min_{var} = min_{var};",{indent:4})}\n ${e("boundingBox.max_{var} = max_{var};",{indent:4})}\n }\n\n function resetBoundingBox() {\n ${e("boundingBox.min_{var} = boundingBox.max_{var} = 0;",{indent:4})}\n }\n`}},function(t,e,i){const n=i(3);function r(t){return`\n if (!Number.isFinite(options.dragCoefficient)) throw new Error('dragCoefficient is not a finite number');\n\n return {\n update: function(body) {\n ${n(t)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}\n }\n };\n`}t.exports=function(t){let e=r(t);return new Function("options",e)},t.exports.generateCreateDragForceFunctionBody=r},function(t,e,i){const n=i(3);function r(t){let e=n(t);return`\n if (!Number.isFinite(options.springCoefficient)) throw new Error('Spring coefficient is not a number');\n if (!Number.isFinite(options.springLength)) throw new Error('Spring length is not a number');\n\n return {\n /**\n * Updates forces acting on a spring\n */\n update: function (spring) {\n var body1 = spring.from;\n var body2 = spring.to;\n var length = spring.length < 0 ? options.springLength : spring.length;\n ${e("var d{var} = body2.pos.{var} - body1.pos.{var};",{indent:6})}\n var r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n\n var d = r - length;\n var coefficient = ((spring.coefficient > 0) ? spring.coefficient : options.springCoefficient) * d / r;\n\n ${e("body1.force.{var} += coefficient * d{var}",{indent:6})};\n body1.springCount += 1;\n body1.springLength += r;\n\n ${e("body2.force.{var} -= coefficient * d{var}",{indent:6})};\n body2.springCount += 1;\n body2.springLength += r;\n }\n };\n`}t.exports=function(t){let e=r(t);return new Function("options","random",e)},t.exports.generateCreateSpringForceFunctionBody=r},function(t,e,i){const n=i(3);function r(t){let e=n(t);return`\n var length = bodies.length;\n if (length === 0) return 0;\n\n ${e("var d{var} = 0, t{var} = 0;",{indent:2})}\n\n for (var i = 0; i < length; ++i) {\n var body = bodies[i];\n if (body.isPinned) continue;\n\n if (adaptiveTimeStepWeight && body.springCount) {\n timeStep = (adaptiveTimeStepWeight * body.springLength/body.springCount);\n }\n\n var coeff = timeStep / body.mass;\n\n ${e("body.velocity.{var} += coeff * body.force.{var};",{indent:4})}\n ${e("var v{var} = body.velocity.{var};",{indent:4})}\n var v = Math.sqrt(${e("v{var} * v{var}",{join:" + "})});\n\n if (v > 1) {\n // We normalize it so that we move within timeStep range. \n // for the case when v <= 1 - we let velocity to fade out.\n ${e("body.velocity.{var} = v{var} / v;",{indent:6})}\n }\n\n ${e("d{var} = timeStep * body.velocity.{var};",{indent:4})}\n\n ${e("body.pos.{var} += d{var};",{indent:4})}\n\n ${e("t{var} += Math.abs(d{var});",{indent:4})}\n }\n\n return (${e("t{var} * t{var}",{join:" + "})})/length;\n`}t.exports=function(t){let e=r(t);return new Function("bodies","timeStep","adaptiveTimeStepWeight",e)},t.exports.generateIntegratorFunctionBody=r},function(t,e){t.exports=function(t,e,i,n){this.from=t,this.to=e,this.length=i,this.coefficient=n}},function(t,e){t.exports=function t(e,i){var n;e||(e={});if(i)for(n in i)if(i.hasOwnProperty(n)){var r=e.hasOwnProperty(n),a=typeof i[n];!r||typeof e[n]!==a?e[n]=i[n]:"object"===a&&(e[n]=t(e[n],i[n]))}return e}},function(t,e){function i(t){return new n("number"==typeof t?t:+new Date)}function n(t){this.seed=t}function r(t){return Math.sqrt(2*Math.PI/t)*Math.pow(1/Math.E*(t+1/(12*t-1/(10*t))),t)}function a(){var t=this.seed;return t=4294967295&(3042594569^(t=(t=4294967295&((t=(t=4294967295&(3345072700^(t=t+2127912214+(t<<12)&4294967295)^t>>>19))+374761393+(t<<5)&4294967295)+3550635116^t<<9))+4251993797+(t<<3)&4294967295)^t>>>16),this.seed=t,(268435455&t)/268435456}t.exports=i,t.exports.random=i,t.exports.randomIterator=function(t,e){var n=e||i();if("function"!=typeof n.next)throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:function(e){var i,r,a;for(i=t.length-1;i>0;--i)r=n.next(i+1),a=t[r],t[r]=t[i],t[i]=a,e(a);t.length&&e(t[0])},shuffle:function(){var e,i,r;for(e=t.length-1;e>0;--e)i=n.next(e+1),r=t[i],t[i]=t[e],t[e]=r;return t}}},n.prototype.next=function(t){return Math.floor(this.nextDouble()*t)},n.prototype.nextDouble=a,n.prototype.uniform=a,n.prototype.gaussian=function(){var t,e,i;do{e=2*this.nextDouble()-1,i=2*this.nextDouble()-1,t=e*e+i*i}while(t>=1||0===t);return e*Math.sqrt(-2*Math.log(t)/t)},n.prototype.levy=function(){var t=Math.pow(r(2.5)*Math.sin(1.5*Math.PI/2)/(1.5*r(1.25)*Math.pow(2,.25)),1/1.5);return this.gaussian()*t/Math.pow(Math.abs(this.gaussian()),1/1.5)}},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-label",{schema:{text:{type:"string"},height:{type:"number",default:1},width:{type:"number",default:3},textWidth:{type:"number",default:6},color:{type:"color",default:"white"},font:{type:"string",default:"default"},background:{type:"color",default:"black"},align:{type:"string",default:"center"}},update:function(t){console.log("Starting label..."),this.el.setAttribute("geometry",{primitive:"plane",height:this.data.height,width:this.data.width}),this.el.setAttribute("material",{color:this.data.color}),this.el.setAttribute("text",{value:this.data.text,align:this.data.align,width:this.data.textWidth,color:this.data.background}),this.el.classList.add("babiaxrLegend")}})},function(t,e,i){const n=i(0).colors;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");class r{constructor(t,e,i,n){this.el=t,this.axis=e,this.anim=i,this.dur=n}updateLine(t,e){const i=this.axis,n=this.el,r=this.anim,a=this.dur,s=`line__${i}axis`;let o=n.components[s],l={x:0,y:0,z:0};l[i]=t,r&&o?(n.setAttribute(`animation__${i}axis`,{property:s+".end",to:l,dur:a}),n.setAttribute(s,{color:e})):n.setAttribute(s,{start:{x:0,y:0,z:0},end:l,color:e})}removeLabels(){const t=this.el,e=this.anim,i=this.dur;let n=t.querySelectorAll("[text]");for(const t of n)e?(t.addEventListener("animationcomplete",(function(t){t.target.remove()})),t.setAttribute("animation",{property:"text.opacity",to:0,dur:i})):t.remove()}updateLabels(t,e,i,r,a){const s=this.axis;let o=this.el;const l=this.anim,c=this.dur;for(let h=0;h<t.length;++h){let u,d=document.createElement("a-entity"),p=i;r&&(p=n.get(h,r)),d.setAttribute("text",{value:e[h],align:"right",width:10,color:p,opacity:0}),"behind"!=a&&"right"!=a||d.setAttribute("text",{align:"left"}),"x"===s?u="behind"==a?{x:t[h],y:0,z:-5.15}:{x:t[h],y:0,z:5.25}:"y"===s?u="right"==a?{x:5.2,y:t[h],z:0}:{x:-5.2,y:t[h],z:0}:"z"===s&&(u="right"==a?{x:5.2,y:0,z:t[h]}:{x:-5.2,y:0,z:t[h]}),d.setAttribute("position",u),"x"===s?d.setAttribute("rotation",{x:-90,y:90,z:0}):"z"===s&&d.setAttribute("rotation",{x:-90,y:0,z:0}),l?d.setAttribute("animation",{property:"text.opacity",to:1,dur:c}):d.setAttribute("text",{opacity:1}),o.appendChild(d)}}updateName(t,e,i){const n=this.axis;let r=this.el;const a=this.anim,s=this.dur;let o,l=document.createElement("a-entity");l.setAttribute("text",{value:t,align:"right",width:10,color:"#000",opacity:0}),"behind"!=e&&"right"!=e||l.setAttribute("text",{align:"left"}),"x"===n?o="behind"==e?{x:i+.5,y:0,z:-5.15}:{x:i+.5,y:0,z:5.25}:"y"===n?o="right"==e?{x:5.2,y:i+.5,z:0}:{x:-5.2,y:i+.5,z:0}:"z"===n&&(o="right"==e?{x:5.2,y:0,z:i+.5}:{x:-5.2,y:0,z:i+.5}),l.setAttribute("position",o),"x"===n?l.setAttribute("rotation",{x:-90,y:90,z:0}):"z"===n&&l.setAttribute("rotation",{x:-90,y:0,z:0}),a?l.setAttribute("animation",{property:"text.opacity",to:1,dur:s}):l.setAttribute("text",{opacity:1}),r.appendChild(l)}}AFRAME.registerComponent("babia-axis-y",{schema:{maxValue:{type:"number"},length:{type:"number"},minSteps:{type:"number",default:6},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"left"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"y",this.data.animation,this.data.dur)},update:function(t){const e=this.data;let i=this.data.maxValue,n=this.data.length,r=this.data.minSteps;this.data.animation,this.data.dur;let a=0;if(console.log("Starting babia-axis-y:",i,n,this.data.color),i!=t.maxValue||n!=t.maxValue||r!=t.minSteps){let t=Math.floor(Math.log10(i));t<=0&&(a=1-t);let s=n/i,o=Math.pow(10,t),l=i/o;for(;l<=r;)o/=2,l=i/o;this.axis.updateLine(n,e.color),this.axis.removeLabels();let c=[],h=[];for(let t=1;o*t<i;t++)vtick=o*t,c.push(vtick*s),h.push(vtick.toFixed(a));this.axis.updateLabels(c,h,e.color,e.palette,e.align)}e.name&&this.axis.updateName(e.name,e.align,e.length)}}),AFRAME.registerComponent("babia-axis-x",{schema:{labels:{type:"array"},ticks:{type:"array"},length:{type:"number"},color:{type:"color",default:"#000"},palette:{type:"string",default:""},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"front"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"x",this.data.animation,this.data.dur)},update:function(t){const e=this.data;console.log("Starting babia-axis-x:",e.ticks.length,e.length,this.data.color),this.axis.updateLine(e.length,e.color),this.axis.removeLabels(),this.axis.updateLabels(e.ticks,e.labels,e.color,e.palette,e.align),e.name&&this.axis.updateName(e.name,e.align,e.length)}}),AFRAME.registerComponent("babia-axis-z",{schema:{labels:{type:"array"},ticks:{type:"array"},length:{type:"number"},color:{type:"color",default:"#000"},palette:{type:"string",default:""},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"left"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"z",this.data.animation,this.data.dur)},update:function(t){const e=this.data;console.log("Starting babia-axis-z:",e.ticks.length,e.length,this.data.color),this.axis.updateLine(e.length,e.color),this.axis.removeLabels(),this.axis.updateLabels(e.ticks,e.labels,e.color,e.palette,e.align),e.name&&this.axis.updateName(e.name,e.align,e.length)}})},function(t,e,i){i(0).colors;AFRAME.registerComponent("babia-bar",{schema:{height:{type:"number"},width:{type:"number"},depth:{type:"number"},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},label:{type:"string",default:""},labelText:{type:"string",default:""},labelLookat:{type:"string",default:"[camera]"},labelScale:{type:"number",default:1}},init:function(){console.log("Starting bar:",this.data.height,this.data.color);let t=this.data;this.box=document.createElement("a-entity"),this.box.classList.add("babiaxraycasterclass"),this.el.appendChild(this.box);let e={};e=t.animation?{height:0,width:t.width,depth:t.depth}:{height:t.height,width:t.width,depth:t.depth},this.box.setAttribute("geometry",{primitive:"box",height:e.height,width:e.width,depth:e.depth}),this.box.setAttribute("material",{color:t.color})},update:function(t){let e=this.data,i=this.box;this.updateProperty(i,"geometry","height",e.animation,e.height,t.height),e.height!=t.height&&(e.animation?(i.setAttribute("animation__pos",{property:"position",to:{x:0,y:e.height/2,z:0},dur:e.dur}),e.height<=0&&t.height>0?i.setAttribute("animation__opacity",{property:"material.opacity",to:0,dur:e.dur}):t.height<=0&&e.height>0&&i.setAttribute("animation__opacity",{property:"material.opacity",to:100,dur:e.dur})):(i.setAttribute("position",{x:0,y:e.height/2,z:0}),e.height<=0&&t.height>0?i.setAttribute("material","opacity",0):t.height<=0&&e.height>0&&i.setAttribute("material","opacity",100))),this.updateProperty(i,"geometry","width",e.animation,e.width,t.width),this.updateProperty(i,"geometry","depth",e.animation,e.depth,t.depth),this.updateProperty(i,"material","color",e.animation,e.color,t.color),"events"===this.data.label?(i.addEventListener("mouseenter",this.showLabel.bind(this)),i.addEventListener("mouseleave",this.hideLabel.bind(this))):"fixed"===this.data.label&&this.showLabel(t)},updateProperty:function(t,e,i,n,r,a){let s=this.data;if(r!==a)if(n){let n=e;i&&(n=n+"."+i),t.setAttribute("animation__"+e+"_"+i,{property:n,to:r,dur:s.dur})}else i?t.setAttribute(e,{[i]:r}):t.setAttribute(e,r)},showLabel:function(t){let e=this.data;"events"===e.label&&this.el.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),text=e.labelText;let i=2;text.length>16&&(i=text.length/8);oldHeight=t.height||0,oldDepth=t.depth||0;let n={x:0,y:oldHeight+.6,z:0};this.labelEl||(this.labelEl=document.createElement("a-entity"),this.labelEl.setAttribute("babia-label",{width:i,textWidth:6}),e.animation&&"fixed"===e.label&&this.labelEl.setAttribute("position",n),this.el.appendChild(this.labelEl));let r={x:0,y:e.height+.6,z:.7*e.depth},a=e.animation&&"fixed"===e.label;this.updateProperty(this.labelEl,"position","",a,r,n),this.labelEl.setAttribute("rotation",{x:0,y:0,z:0}),text!=t.labelText&&this.labelEl.setAttribute("babia-label",{text:e.labelText}),e.labelLookat&&t.labelLookat!==e.labelLookat&&this.labelEl.setAttribute("babia-lookat",e.labelLookat),e.labelScale&&t.labelScale!==e.labelScale&&this.labelEl.setAttribute("scale",{x:e.labelScale,y:e.labelScale,z:e.labelScale})},hideLabel:function(){"events"===this.data.label&&this.el.setAttribute("scale",{x:1,y:1,z:1}),this.labelEl&&(this.el.removeChild(this.labelEl),this.labelEl=null)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function i(t,e){t.getObject3D("mesh")?n(t,e):t.addEventListener("model-loaded",(function(){t.color=e,n(t,e)}))}function n(t,e){t.object3D.traverse((function(t){last_material=t.material,last_material&&(t.material=new THREE.MeshBasicMaterial({color:e}))}))}AFRAME.registerComponent("babia-controls",{schema:{direction:{type:"string",default:""},state:{type:"string",default:""}},multiple:!1,init:function(){this.createPlayer()},update:function(t){let e=this.data;if(e.state&&e.state!=t.state){let t=document.getElementsByClassName("babiaPause")[0],i=document.getElementsByClassName("babiaPlay")[0];"pause"===e.state?(t&&this.el.children[0].removeChild(t),i||this.createButton("play","white")):(i&&this.el.children[0].removeChild(i),t||this.createButton("pause","white")),this.el.parentEl.setAttribute("babia-navigator","state",e.state)}if(e.direction&&e.direction!=t.direction){let t=document.getElementsByClassName("babiaRewind")[0],n=document.getElementsByClassName("babiaForward")[0];"rewind"===e.direction?(n.color="white",t.color="grey",i(n,"white"),i(t,"grey")):(n.color="grey",t.color="white",i(n,"grey"),i(t,"white")),this.el.parentEl.setAttribute("babia-navigator","direction",e.direction)}},player:void 0,createPlayer:function(){this.player=document.createElement("a-entity"),this.player.classList.add("babiaxrPlayer"),this.player.classList.add("babiaxraycasterclass"),this.el.appendChild(this.player),this.createButton("rewind","white"),this.createButton("skipPrev","white"),this.createButton("pause","white"),this.createButton("skipNext","white"),this.createButton("forward","grey")},createButton:function(t,e){let n,r,a,s=!1;if("play"===t)n=playButton.default,r=.2,a="babiaPlay";else if("pause"===t)n=pauseButton.default,r=0,a="babiaPause";else if("skipNext"===t)n=skipButton.default,r=3,a="babiaSkipNext",s=!0;else if("skipPrev"===t)n=skipButton.default,r=-3,a="babiaSkipPrev";else if("rewind"===t)n=rewindButton.default,r=-6,a="babiaRewind";else{if("forward"!==t)throw new Error("That button type doesn't exist.");n=rewindButton.default,r=6,a="babiaForward",s=!0}let o=document.createElement("a-entity");o.setAttribute("gltf-model","url("+n+")"),o.classList.add("babiaxraycasterclass"),o.classList.add(a),o.setAttribute("position",{x:r,y:0,z:0}),i(o,e),s&&o.setAttribute("rotation",{x:0,y:180,z:0}),this.player.appendChild(o),this.mouseOver(o),this.processEvents(o)},mouseOver:function(t){t.addEventListener("mouseenter",(function(){i(t,"grey")})),t.addEventListener("mouseleave",(function(){i(t,t.color)}))},processEvents:function(t){let e=this;t.addEventListener("click",(function(){if(t.classList.contains("babiaPlay"))this.parentEl.parentEl.setAttribute("babia-controls","state","play");else if(t.classList.contains("babiaPause"))this.parentEl.parentEl.setAttribute("babia-controls","state","pause");else if(t.classList.contains("babiaSkipNext")||t.classList.contains("babiaSkipPrev")){"pause"!=e.data.state&&this.parentEl.parentEl.setAttribute("babia-controls","state","pause");let i="skipPrev";t.classList.contains("babiaSkipNext")&&(i="skipNext"),e.el.parentEl.components["babia-navigator"].controlNavigator(i)}else t.classList.contains("babiaForward")?this.parentEl.parentEl.setAttribute("babia-controls","direction","forward"):t.classList.contains("babiaRewind")&&this.parentEl.parentEl.setAttribute("babia-controls","direction","rewind")}))}})},function(t,e,i){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const n=i(2).NotiBuffer;AFRAME.registerComponent("babia-navigator",{schema:{direction:{type:"string",default:""},state:{type:"string",default:""}},multiple:!1,sliderEl:void 0,init:function(){this.notiBuffer=new n(this.registerBack.bind(this),this.unregisterBack.bind(this))},update:function(t){let e=this.data;e.state&&e.state!=t.state&&this.controlNavigator(e.state),e.direction&&e.direction!=t.direction&&this.controlNavigator(e.direction)},initializeControls:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.min=0,this.sliderEl.max=this.selector.selectable.length-1,this.current=this.selector.selectable.current,this.sliderEl.setAttribute("babia-slider",{size:1.5,min:this.sliderEl.min,max:this.sliderEl.max,value:this.current}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="timeline",this.sliderEl.setAttribute("scale",{x:2.3,y:2.3,z:2.3}),this.el.appendChild(this.sliderEl),this.controlsEl=document.createElement("a-entity"),this.controlsEl.setAttribute("babia-controls",""),this.controlsEl.classList.add("babiaxraycasterclass"),this.controlsEl.setAttribute("scale",{x:.15,y:.15,z:.3}),this.controlsEl.object3D.position.y=-.5,this.el.appendChild(this.controlsEl),this.stepControllerEl=document.createElement("a-entity"),this.stepControllerEl.setAttribute("babia-step-controller",""),this.stepControllerEl.classList.add("babiaxraycasterclass"),this.stepControllerEl.object3D.position.x=2.5,this.el.appendChild(this.stepControllerEl),this.speedControllerEl=document.createElement("a-entity"),this.speedControllerEl.setAttribute("babia-speed-controller",""),this.speedControllerEl.classList.add("babiaxraycasterclass"),this.speedControllerEl.object3D.position.x=3,this.el.appendChild(this.speedControllerEl)},updateSlider:function(t){let e=this.sliderEl.getAttribute("babia-slider").value;"skipNext"===t?e++:"skipPrev"===t&&e--,"skipPrev"===t&&e>=0||"skipNext"===t&&e<=this.sliderEl.max?(this.current=e,this.notiBuffer.set("babiaSetPosition"+this.current)):this.controlsEl.querySelector(".babiaPause")&&(this.current=e,processData("pause"))},registerBack:function(t){this.selector=t,this.prodComponent=t,this.prodComponent.navNotiBuffer&&(this.navNotiBufferId=this.prodComponent.navNotiBuffer.register(this.processData.bind(this)))},unregisterBack:function(t){t.navNotiBuffer.unregister(this.navNotiBufferId)},processData:function(t){"pause"==t?this.controlsEl.setAttribute("babia-controls","state","pause"):"rewind"==t?this.el.setAttribute("babia-navigator","direction","rewind"):"forward"==t?this.el.setAttribute("babia-navigator","direction","forward"):t.type&&("position"===t.type?(this.sliderEl||this.initializeControls(),"rewind"!=this.data.direction?this.current=t.value-1:this.current=t.value+1,this.current>=this.sliderEl.min&&this.current<=this.sliderEl.max&&(t.label?this.sliderEl.setAttribute("babia-slider",{label:t.label,value:this.current}):this.sliderEl.setAttribute("babia-slider","value",this.current))):"step"===t.type?this.stepControllerEl.setAttribute("babia-step-controller","value",t.value):"speed"===t.type&&this.speedControllerEl.setAttribute("babia-speed-controller","value",t.value))},prodComponent:void 0,navNotiBufferId:void 0,sliderComp:void 0,controlsComp:void 0,stepComp:void 0,speedComp:void 0,controlNavigator:function(t,e){"skipNext"==t||"skipPrev"==t?this.updateSlider(t):this.notiBuffer.set(t+e)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-slider",{schema:{color:{type:"color",default:"#fff"},size:{type:"number",default:.5},min:{type:"number",default:-6},max:{type:"number",default:-4},value:{type:"number",default:-5},innerSize:{type:"number",default:.8},precision:{type:"number",default:2},vertical:{type:"boolean",default:!1},label:{type:"string"}},multiple:!0,init:function(){this.loader=new THREE.FontLoader;let t=new THREE.MeshBasicMaterial({color:this.data.color});this.material=t;let e=new THREE.Mesh(new THREE.BoxGeometry(.05,.15,.05),t),i=new THREE.Mesh(new THREE.CylinderGeometry(.015,.015,this.data.size,12),t);i.rotateZ(Math.PI/2);let n=new THREE.Group;this.lever=e,n.add(i),n.add(e),this.data.vertical&&n.rotateZ(Math.PI/2),this.el.setObject3D("mesh",n),this.el.classList.add("babiaxraycasterclass"),this.controllers=Array.prototype.slice.call(document.querySelectorAll("a-entity[hand-controls]")),this.fontURL="https://threejsfundamentals.org/threejs/resources/threejs/fonts/helvetiker_regular.typeface.json",this.loader.load(this.fontURL,t=>{this.font=t;let e=this.createTextGeometry(this.data.min,-this.data.size/2-.15,-.025),i=this.createTextGeometry(this.data.max,this.data.size/2+.08,-.025);n.add(e),n.add(i)})},createTextGeometry:function(t,e,i){let n=new THREE.TextGeometry(t.toString(),{font:this.font,size:.07,height:.01,curveSegments:12,bevelEnabled:!1}),r=new THREE.Mesh(n,this.material);return r.position.x=e,r.position.y=i,this.data.vertical&&(r.rotation.z=-Math.PI/2,r.position.y+=.05),r},setTextGeometry:function(t){this.textmesh&&(this.lever.children=[]),this.loader.load(this.fontURL,e=>{this.font=e,this.data.vertical?this.textmesh=this.createTextGeometry(t,-.025,-.2):this.textmesh=this.createTextGeometry(t,-.025,.15),this.lever.add(this.textmesh)})},play:function(){this.grabbed=!1,this.el.addEventListener("rangeout",this.onTriggerUp.bind(this)),this.controllers.forEach(function(t){t.addEventListener("triggerdown",this.onTriggerDown.bind(this)),t.addEventListener("triggerup",this.onTriggerUp.bind(this))}.bind(this))},pause:function(){this.el.removeEventListener("rangeout",this.onTriggerUp.bind(this)),this.controllers.forEach(function(t){t.removeEventListener("triggerdown",this.onTriggerDown.bind(this)),t.removeEventListener("triggerup",this.onTriggerUp.bind(this))}.bind(this))},onTriggerDown:function(t){var e=t.target.object3D,i=this.lever,n=(new THREE.Box3).setFromObject(e),r=(new THREE.Box3).setFromObject(i);if(n.intersectsBox(r)){let t=new THREE.Vector3;e.getWorldPosition(t);let n=new THREE.Vector3;i.getWorldPosition(n),t.distanceTo(n)<.1&&(this.grabbed=e,this.grabbed.visible=!1,this.knob.material=this.knobGrabbedMaterial)}},onTriggerUp:function(){this.grabbed&&(this.grabbed.visible=!0,this.grabbed=!1,this.knob.material=this.knobMaterial)},setValue:function(t){var e=this.lever;t<this.data.min?t=this.data.min:t>this.data.max&&(t=this.data.max),this.value=t,e.position.x=this.valueToLeverPosition(t),this.data.label?this.setTextGeometry(this.data.label):this.setTextGeometry(t)},valueToLeverPosition:function(t){var e=this.data.size*this.data.innerSize,i=Math.abs(this.data.max-this.data.min);let n=-1*e/2;return(t-this.data.min)*e/i+n},leverPositionToValue:function(t){var e=this.data.size*this.data.innerSize;return(t- -1*e/2)*Math.abs(this.data.max-this.data.min)/e+this.data.min},tick:function(){if(this.grabbed){var t=this.grabbed,e=this.lever,i=this.data.size*this.data.innerSize,n=(new THREE.Vector3).setFromMatrixPosition(t.matrixWorld);e.parent.worldToLocal(n),Math.abs(n.x)>i/2?e.position.x=i/2*Math.sign(e.position.x):e.position.x=n.x;var r=this.leverPositionToValue(e.position.x);Math.abs(this.value-r)>=Math.pow(10,-this.data.precision)&&(r=Math.round(r),this.value=r,this.setTextGeometry(r),this.el.parentEl.components["babia-navigator"]?this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetPosition",Math.round(r)):this.el.parentEl.components["babia-step-controller"]?this.el.parentEl.components["babia-step-controller"].controlStep(Math.round(r)):this.el.parentEl.components["babia-speed-controller"]&&this.el.parentEl.components["babia-speed-controller"].controlSpeed(Math.round(r)))}},mousexPositionToValue:function(t){let e=this.el.object3D.getWorldPosition().x,i=this.data.size*this.data.innerSize*this.el.object3D.getWorldScale().x,n=(t-(e-i/2))*Math.abs(this.data.max-this.data.min)/i+this.data.min;return n<this.data.min?this.data.min:n>this.data.max?this.data.max:n},mouseyPositionToValue:function(t){let e=this.el.object3D.getWorldPosition().y,i=this.data.size*this.data.innerSize*this.el.object3D.getWorldScale().y,n=(t-(e-i/2))*Math.abs(this.data.max-this.data.min)/i+this.data.min;return n<this.data.min?this.data.min:n>this.data.max?this.data.max:n},update:function(t){this.data.value!==t.value&&this.setValue(this.data.value),this.el.addEventListener("click",_listener=t=>{let e,i=t.detail.intersection.point;e=this.data.vertical?this.mouseyPositionToValue(i.y):this.mousexPositionToValue(i.x),this.el.parentEl.components["babia-navigator"]?this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetPosition",Math.round(e)):this.el.parentEl.components["babia-step-controller"]?this.el.parentEl.components["babia-step-controller"].controlStep(Math.round(e)):this.el.parentEl.components["babia-speed-controller"]&&this.el.parentEl.components["babia-speed-controller"].controlSpeed(Math.round(e))})}}),AFRAME.registerComponent("babia-step-controller",{schema:{value:{type:"number",default:-5}},multiple:!0,sliderEl:void 0,step:void 0,init:function(){this.createSlider()},update:function(t){this.data.value!==t.value&&this.sliderEl.setAttribute("babia-slider","value",this.data.value)},createSlider:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.setAttribute("babia-slider",{size:1,min:1,max:10,value:1,vertical:!0}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="step-controller",this.el.appendChild(this.sliderEl)},controlStep:function(t){this.step=t,this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetStep",this.step)}}),AFRAME.registerComponent("babia-speed-controller",{schema:{value:{type:"number",default:-5}},multiple:!0,sliderEl:void 0,speed:void 0,init:function(){this.createSlider()},update:function(t){this.data.value!==t.value&&this.sliderEl.setAttribute("babia-slider","value",this.data.value)},createSlider:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.setAttribute("babia-slider",{size:1,min:1,max:3,value:1,vertical:!0}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="speed-controller",this.el.appendChild(this.sliderEl)},controlSpeed:function(t){this.speed=t,this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetSpeed",this.speed)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-ui-link",{schema:{viz:{type:"string"},ui:{type:"string"}},linked_viz:void 0,ui_target:void 0,init:function(){this.createButton()},update:function(t){let e=this.data;n(e,this.el,this),i(e,this.el,this),console.log("VIZ",this.linked_viz)},createButton:function(){this.button=document.createElement("a-entity"),this.button.classList.add("babiaxraycasterclass"),this.button.setAttribute("geometry",{primitive:"plane",height:1,width:3}),this.button.setAttribute("material",{color:"#FFF"}),this.button.setAttribute("text",{value:"Manage me",align:"center",width:8,color:"#000"}),this.button.setAttribute("position",{x:0,y:-1,z:0}),this.addListeners(this.button,this),this.el.appendChild(this.button)},addListeners:function(t,e){t.addEventListener("mouseenter",(function(){t.setAttribute("text",{color:"#FFF"}),t.setAttribute("material",{color:"#333"})})),t.addEventListener("mouseleave",(function(){t.setAttribute("text",{color:"#000"}),t.setAttribute("material",{color:"#FFF"})})),t.addEventListener("click",(function(){let t=document.querySelector("#"+e.ui_target);console.log(e.linked_viz),t.setAttribute("babia-ui","target",e.linked_viz)}))}});let i=(t,e,i)=>t.ui?void(i.ui_target=t.ui):e.components["babia-ui"]?void(i.ui_target=e.components["babia-ui"]):document.querySelectorAll("[babia-ui]").length>0?void(i.ui_target=document.querySelectorAll("[babia-ui]")[0].id):void console.error("UI Component not found."),n=(t,e,i)=>{if(!t.viz)return e.components["babia-bars"]||e.components["babia-barsmap"]||e.components["babia-boats"]||e.components["babia-bubbles"]||e.components["babia-city"]||e.components["babia-cyls"]||e.components["babia-cylsmap"]||e.components["babia-doughnut"]||e.components["babia-network"]||e.components["babia-pie"]?void(i.linked_viz=e.id):void console.error("Visuzlizer not found.");i.linked_viz=t.viz}},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-camera",{schema:{raycasterMouse:{type:"string",default:".babiaxraycasterclass"},raycasterHand:{type:"string",default:".babiaxraycasterclass"},tipsOpened:{type:"boolean",default:!0},gripRLabel:{type:"string",default:"Open/Close \nTips"},gripLLabel:{type:"string",default:"Stop Audio"},triggerRLabel:{type:"string",default:"Click"},triggerLLabel:{type:"string",default:"Teleport"},teleportCollisions:{type:"string",default:".environmentGround"}},multiple:!1,init:function(){},update:function(t){this.data!=this.oldData&&(this.el.setAttribute("camera",""),this.addCursor(),this.setOculusConnected())},addCursor:function(){this.cursor=document.createElement("a-entity"),this.cursor.id="cursor",this.cursor.setAttribute("cursor",{rayOrigin:"mouse"}),this.cursor.setAttribute("raycaster",{objects:this.data.raycasterMouse}),this.el.parentElement.append(this.cursor)},createTip:function(t,e,i){let n=document.createElement("a-entity");return n.id=t,n.classList.add("tips"),n.setAttribute("tooltip",e),n.setAttribute("position",i),n},setOculusConnected:function(){let t=this;t.tooltips=[],t.leftHand=document.createElement("a-entity"),t.leftHand.id="babia-leftHand",t.leftHand.setAttribute("oculus-touch-controls",{hand:"left"}),t.el.parentElement.append(t.leftHand),t.rightHand=document.createElement("a-entity"),t.rightHand.id="babia-rightHand",t.rightHand.setAttribute("oculus-touch-controls",{hand:"right"}),t.el.parentElement.append(t.rightHand),document.addEventListener("controllerconnected",e=>{let i=t.el.parentElement.object3D.position;t.el.parentElement.setAttribute("position",{x:i.x,y:0,z:i.z}),"babia-leftHand"===e.target.id&&(t.leftHand.setAttribute("teleport-controls",{cameraRig:"#"+t.el.parentElement.id,teleportOrigin:"#"+t.el.id,collisionEntities:t.data.teleportCollisions,hitCylinderColor:"#ff3468",curveHitColor:"#ff3468",curveMissColor:"#333333",curveLineWidth:.01,button:"trigger"}),tipTriggerLconfig={text:t.data.triggerLLabel,width:.07,height:.03,targetPosition:"0.002 -0.02 -0.014",lineHorizontalAlign:"right",rotation:"-90 0 0",src:tooltip.default},tipTriggerLpos={x:-.09,y:-.04,z:-.08},t.tipTriggerL=this.createTip("babia-tooltip_trigger_L",tipTriggerLconfig,tipTriggerLpos),t.leftHand.append(t.tipTriggerL),t.tooltips.push(t.tipTriggerL),tipGripLconfig={text:t.data.gripLLabel,width:.08,height:.04,targetPosition:"0.006 -0.008 0.033",rotation:"-90 0 0",src:tooltip.default},tipGripLpos={x:.085,y:-.01,z:.07},t.tipGripL=this.createTip("babia-tooltip_grip_L",tipGripLconfig,tipGripLpos),t.leftHand.append(t.tipGripL),t.tooltips.push(t.tipGripL)),"babia-rightHand"===e.target.id&&(t.rightHand.setAttribute("laser-controls",{hand:"right"}),t.rightHand.setAttribute("raycaster",{objects:this.data.raycasterHand}),tipTriggerRconfig={text:t.data.triggerRLabel,width:.07,height:.03,targetPosition:"0.005 -0.02 -0.014",lineHorizontalAlign:"left",rotation:"-90 0 0",src:tooltip.default},tipTriggerRpos={x:-.09,y:-.04,z:-.08},t.tipTriggerR=this.createTip("babia-tooltip_trigger_R",tipTriggerRconfig,tipTriggerRpos),t.rightHand.append(t.tipTriggerR),t.tooltips.push(t.tipTriggerR),tipGripRconfig={text:t.data.gripRLabel,width:.08,height:.04,targetPosition:"0.006 -0.008 0.033",lineHorizontalAlign:"right",rotation:"-90 0 0",src:tooltip.default},tipGripRpos={x:-.085,y:-.01,z:.07},t.tipGripR=this.createTip("babia-tooltip_grip_R",tipGripRconfig,tipGripRpos),t.rightHand.append(t.tipGripR),t.tooltips.push(t.tipGripR)),this.tipsController(),this.data.networkedAudio&&this.setAudioController()})},tipsController:function(){let t=this;this.tipsOpened=t.data.tipsOpened,t.tipsOpened||t.tooltips.forEach(t=>{t.setAttribute("visible",!1)}),t.rightHand.addEventListener("gripdown",()=>{t.tipsOpened?(t.tipsOpened=!1,t.tooltips.forEach(t=>{t.setAttribute("visible",!1)})):(t.tipsOpened=!0,t.tooltips.forEach(t=>{t.setAttribute("visible",!0)}))})}})},function(t,e,i){i(0).colors;AFRAME.registerComponent("babia-cyl",{schema:{height:{type:"number"},radius:{type:"number"},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},label:{type:"string",default:""},labelText:{type:"string",default:""},labelLookat:{type:"string",default:"[camera]"}},init:function(){console.log("Starting cyl:",this.data.height,this.data.color);let t=this.data;this.cylinder=document.createElement("a-entity"),this.cylinder.classList.add("babiaxraycasterclass"),this.el.appendChild(this.cylinder);let e={};e=t.animation?{height:0,radius:t.radius}:{height:t.height,radius:t.radius},this.cylinder.setAttribute("geometry",{primitive:"cylinder",height:e.height,radius:e.radius}),this.cylinder.setAttribute("material",{color:t.color})},update:function(t){let e=this.data,i=this.cylinder;this.updateProperty(i,"geometry","height",e.animation,e.height,t.height),e.height!=t.height&&(e.animation?(i.setAttribute("animation__pos",{property:"position",to:{x:0,y:e.height/2,z:0},dur:e.dur}),e.height<=0&&t.height>0?i.setAttribute("animation__opacity",{property:"material.opacity",to:0,dur:e.dur}):t.height<=0&&e.height>0&&i.setAttribute("animation__opacity",{property:"material.opacity",to:100,dur:e.dur})):(i.setAttribute("position",{x:0,y:e.height/2,z:0}),e.height<=0&&t.height>0?i.setAttribute("material","opacity",0):t.height<=0&&e.height>0&&i.setAttribute("material","opacity",100))),this.updateProperty(i,"geometry","radius",e.animation,e.radius,t.radius),this.updateProperty(i,"material","color",e.animation,e.color,t.color),"events"===this.data.label?(i.addEventListener("mouseenter",this.showLabel.bind(this)),i.addEventListener("mouseleave",this.hideLabel.bind(this))):"fixed"===this.data.label&&this.showLabel(t)},updateProperty:function(t,e,i,n,r,a){let s=this.data;if(r!==a)if(n){let n=e;i&&(n=n+"."+i),t.setAttribute("animation__"+e+"_"+i,{property:n,to:r,dur:s.dur})}else i?t.setAttribute(e,{[i]:r}):t.setAttribute(e,r)},showLabel:function(t){let e=this.data;"events"===e.label&&this.el.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),text=e.labelText;let i=2;text.length>16&&(i=text.length/8);oldHeight=t.height||0;let n={x:0,y:oldHeight+.6,z:0};this.labelEl||(this.labelEl=document.createElement("a-entity"),this.labelEl.setAttribute("babia-label",{width:i,textWidth:6}),e.animation&&"fixed"===e.label&&this.labelEl.setAttribute("position",n),this.el.appendChild(this.labelEl));let r={x:0,y:e.height+.7,z:.7*e.radius},a=e.animation&&"fixed"===e.label;this.updateProperty(this.labelEl,"position","",a,r,n),this.labelEl.setAttribute("rotation",{x:0,y:0,z:0}),text!=t.labelText&&this.labelEl.setAttribute("babia-label",{text:e.labelText}),e.labelLookat&&t.labelLookat!==e.labelLookat&&this.labelEl.setAttribute("babia-lookat",e.labelLookat),e.labelScale&&t.labelScale!==e.labelScale&&this.labelEl.setAttribute("scale",{x:e.labelScale,y:e.labelScale,z:e.labelScale})},hideLabel:function(){"events"===this.data.label&&this.el.setAttribute("scale",{x:1,y:1,z:1}),this.labelEl&&(this.el.removeChild(this.labelEl),this.labelEl=null)}})},function(t,e,n){n(0).findTargetComponent;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=n(2).NotiBuffer;AFRAME.registerComponent("babia-range-selector",{schema:{from:{type:"string"},to:{type:"string"},defaultRange:{type:"string",default:"Last 5 years"}},multiple:!1,init:function(){this.notiBuffer=new r,this.options=[{label:"Last 15 minutes",time:9e5,interval:"30s"},{label:"Last 30 minutes",time:9e5,interval:"30s"},{label:"Last 1 hour",time:36e5,interval:"1m"},{label:"Last 4 hours",time:144e5,interval:"5m"},{label:"Last 12 hours",time:432e5,interval:"10m"},{label:"Last 24 hours",time:864e5,interval:"30m"},{label:"Last 7 days",time:6048e5,interval:"3h"},{label:"Last 30 days",time:2592e6,interval:"12h"},{label:"Last 60 days",time:5184e6,interval:"1d"},{label:"Last 90 days",time:7776e6,interval:"2d"},{label:"Last 6 months",time:15552e6,interval:"3d"},{label:"Last 1 year",time:31536e6,interval:"1w"},{label:"Last 2 years",time:63072e6,interval:"15d"},{label:"Last 5 years",time:15768e7,interval:"30d"}];let t=0;for(i=0;i<this.options.length;i++)if(this.data.defaultRange===this.options[i].label){t=i;break}this.label_select="babia-button-"+this.options[t].label.replaceAll(" ","-")},update:function(t){let e=this.data;this.updateInterface(e)},interface:void 0,options:void 0,handController:void 0,label_select:void 0,updateInterface:function(t){let e=this;for(;e.el.firstChild;)e.el.firstChild.remove();if(console.log("Generating interface..."),document.querySelector("#babia-menu-hand")){let t=document.querySelector("#babia-menu-hand");t.parentNode.removeChild(t),a(e,e.handController)}else e.interface=s(e),e.el.appendChild(e.interface);document.addEventListener("controllerconnected",t=>{for(;e.el.firstChild;)e.el.firstChild.remove();let i=t.detail.name;"left"!==t.target.getAttribute(i).hand||document.querySelector("#babia-menu-hand")||(e.handController=t.target.id,e.interface=s(e),a(e,e.handController))})}});let a=(t,e)=>{let i=document.getElementById(e);t.interface.id="babia-menu-hand",t.interface.setAttribute("scale",{x:.03,y:.03,z:.03}),t.interface.setAttribute("position",{x:-.05,y:-.05,z:-.1}),t.interface.setAttribute("rotation",{x:-60,y:0,z:0}),t.interface.setAttribute("visible",!1),i.appendChild(t.interface),c(e,t.interface)},s=t=>{t.interface=document.createElement("a-entity"),t.interface.id="babia-menu";let e=7,i=0;return t.options.forEach(n=>{let r=o(t,n.label,i,e);t.interface.appendChild(r),e>1?--e:(i+=3.75,e=7)}),t.interface},o=(t,e,i,n)=>{let r=document.createElement("a-box");r.id="babia-button-"+e.replaceAll(" ","-"),r.classList.add("babiaxraycasterclass"),r.setAttribute("position",{x:i,y:n,z:0}),r.setAttribute("rotation",{x:0,y:0,z:0}),r.setAttribute("height",.8),r.setAttribute("width",3.5),r.setAttribute("depth",.01);let a=document.createElement("a-entity");return a.setAttribute("text",{value:e,align:"center",width:"10",color:"black"}),a.setAttribute("position","0 0 0.01"),r.appendChild(a),l(t,r),t.label_select==r.id&&r.emit("click"),r},l=(t,e)=>{e.addEventListener("mouseenter",(function(){e.children[0].setAttribute("text",{color:"#FFFFFF"}),e.setAttribute("color","#333333")})),e.addEventListener("mouseleave",(function(){e.children[0].setAttribute("text",{color:"black"}),t.label_select==e.id?e.setAttribute("color","#555555"):e.setAttribute("color","#FFFFFF")})),e.addEventListener("click",(function(){let i=document.getElementById(t.label_select);null!=i&&(i.children[0].setAttribute("text",{color:"black"}),i.setAttribute("color","#FFFFFF")),t.label_select=e.id,e.children[0].setAttribute("text",{color:"black"}),e.setAttribute("color","#555555");let n=t.label_select.slice(13).replaceAll("-"," ");t.options.forEach(e=>{if(e.label==n){let i=Date.now(),n={from:i-e.time,interval:e.interval,to:i};t.notiBuffer.set(n)}})}))},c=(t,e)=>{let i=!1;document.getElementById(t).addEventListener("gripdown",(function(){i?(i=!1,e.setAttribute("visible",!1)):(i=!0,e.setAttribute("visible",!0))}))}},function(t,e,i){"use strict";i.r(e),e.default="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInBhdXNlIiwKICAgICAgICAgICAgInJvdGF0aW9uIiA6IFsKICAgICAgICAgICAgICAgIDAuNzA3MTA2NzY5MDg0OTMwNCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgIm1lc2hlcyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAibmFtZSIgOiAiUGxhbmUiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNTYsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMC44MDk2NzM1NDc3NDQ3NTEsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMQogICAgICAgICAgICBdLAogICAgICAgICAgICAibWluIiA6IFsKICAgICAgICAgICAgICAgIC0wLjc5NjU0NzUzMjA4MTYwNCwKICAgICAgICAgICAgICAgIC0wLjE5Njg4OTQ2MDA4NjgyMjUsCiAgICAgICAgICAgICAgICAtMQogICAgICAgICAgICBdLAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMyIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMSwKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyNiwKICAgICAgICAgICAgImNvdW50IiA6IDU2LAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMyIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMiwKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyNiwKICAgICAgICAgICAgImNvdW50IiA6IDU2LAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMiIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMywKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyMywKICAgICAgICAgICAgImNvdW50IiA6IDcyLAogICAgICAgICAgICAidHlwZSIgOiAiU0NBTEFSIgogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVyVmlld3MiIDogWwogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA2NzIsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDAKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA2NzIsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDY3MgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDQ0OCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTM0NAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDE0NCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTc5MgogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAxOTM2LAogICAgICAgICAgICAidXJpIiA6ICJkYXRhOmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTtiYXNlNjQsaXVwTHZ3QUFBQUFBQUlBL2l1cEx2d0FBQUFBQUFJQy82RlZRdmdBQUFBQUFBSUMvNkZWUXZnQUFBQUFBQUlBL3hFWlBQMlNkU2I0QUFJQS94RVpQUDJTZFNiNEFBSUMvYkoxSlBtU2RTYjRBQUlDL2NKMUpQbVNkU2I0QUFJQS82RlZRdm1TZFNiNEFBSUEvNkZWUXZtU2RTYjRBQUlDL2l1cEx2MlNkU2I0QUFJQy9pdXBMdjJTZFNiNEFBSUEvY0oxSlBnQUFBQUFBQUlBL2JKMUpQZ0FBQUFBQUFJQy94RVpQUHdBQUFBQUFBSUMveEVaUFB3QUFBQUFBQUlBLzZGVlF2Z0FBQUFBQUFJQy82RlZRdm1TZFNiNEFBSUMvNkZWUXZtU2RTYjRBQUlBLzZGVlF2Z0FBQUFBQUFJQS94RVpQUHdBQUFBQUFBSUMveEVaUFAyU2RTYjRBQUlDL3hFWlBQMlNkU2I0QUFJQS94RVpQUHdBQUFBQUFBSUEvaXVwTHZ3QUFBQUFBQUlBL2l1cEx2MlNkU2I0QUFJQS9pdXBMdjJTZFNiNEFBSUMvaXVwTHZ3QUFBQUFBQUlDL2NKMUpQZ0FBQUFBQUFJQS9jSjFKUG1TZFNiNEFBSUEvYkoxSlBtU2RTYjRBQUlDL2NKMUpQZ0FBQUFBQUFJQS9iSjFKUG1TZFNiNEFBSUMvYkoxSlBnQUFBQUFBQUlDLzZGVlF2Z0FBQUFBQUFJQS82RlZRdm1TZFNiNEFBSUEvaXVwTHYyU2RTYjRBQUlBLzZGVlF2Z0FBQUFBQUFJQS9pdXBMdjJTZFNiNEFBSUEvaXVwTHZ3QUFBQUFBQUlBL2l1cEx2d0FBQUFBQUFJQy9pdXBMdjJTZFNiNEFBSUMvNkZWUXZtU2RTYjRBQUlDL2l1cEx2d0FBQUFBQUFJQy82RlZRdm1TZFNiNEFBSUMvNkZWUXZnQUFBQUFBQUlDL3hFWlBQd0FBQUFBQUFJQS94RVpQUDJTZFNiNEFBSUEvY0oxSlBtU2RTYjRBQUlBL3hFWlBQd0FBQUFBQUFJQS9jSjFKUG1TZFNiNEFBSUEvY0oxSlBnQUFBQUFBQUlBL2JKMUpQZ0FBQUFBQUFJQy9iSjFKUG1TZFNiNEFBSUMveEVaUFAyU2RTYjRBQUlDL3hFWlBQd0FBQUFBQUFJQy9BQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFBQUFDQUFBQ0FQd0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFhaDZLeUFBQ0FQd0FBQUFBYWg2S3lBQUNBUHdBQUFBQWFoNkt5QUFDQVB3QUFBQUFhaHlLekFBQ0FQd0FBQUFBYWh5S3pBQUNBUHdBQUFBQWFoeUt6QUFBQUFBQUFBQUFBQUlDL0FBQUFBQUFBQUFBQUFJQy9BQUFBQUFBQUFBQUFBSUMvQUFBQUFBQUFBQUQvLzMrL0FBQUFBQUFBQUFELy8zKy9BQUFBQUFBQUFBRC8vMysvQUFBQUFBQUFBQUQvLzM4L0FBQUFBQUFBQUFELy8zOC9BQUFBQUFBQUFBRC8vMzgvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlDL0FBQUFBQUFBQUFBQUFJQy9BQUFBQUFBQUFBQUFBSUMvQUFBQUFBQUFBQUQvLzMrL0FBQUFBQUFBQUFELy8zKy9BQUFBQUFBQUFBRC8vMysvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBZ0Q4QUFBQUFBQUFBQUJEVmx6NEFBQUFBRU5XWFBnQUFnRDhBQUlBL0FBQ0FQd0FBZ0Q4QUFBQUFUSkF4UHdBQUFBQk1rREUvQUFDQVB4RFZsejRBQUlBL0VOV1hQZ0FBQUFBQUFBQUFBQUFBQUFBQUFBQUFBSUEvVEpBeFB3QUFnRDlNa0RFL0FBQUFBQUFBZ0Q4QUFBQUFBQUNBUHdBQWdEOFExWmMrQUFBQUFCRFZsejRBQUFBQUVOV1hQZ0FBZ0Q4UTFaYytBQUNBUHdBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUlBL0FBQ0FQd0FBZ0Q4QUFJQS9BQUFBQUFBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUFBQUFBQUFBQUFBQUFCTWtERS9BQUNBUDB5UU1UOEFBSUEvVEpBeFB3QUFBQUJNa0RFL0FBQ0FQMHlRTVQ4QUFBQUFUSkF4UHdBQUFBQVExWmMrQUFDQVB4RFZsejRBQUlBL0FBQUFBQUFBZ0Q4UTFaYytBQUNBUHdBQUFBQUFBSUEvQUFBQUFBQUFnRDhBQUFBQUFBQUFBQUFBQUFBQUFBQUFFTldYUGdBQUFBQUFBQUFBQUFBQUFCRFZsejRBQUFBQUVOV1hQZ0FBQUFBQUFJQS9BQUNBUHdBQWdEOEFBSUEvVEpBeFB3QUFnRDhBQUlBL0FBQ0FQMHlRTVQ4QUFJQS9USkF4UHdBQWdEOU1rREUvQUFBQUFFeVFNVDhBQUFBQUFBQ0FQd0FBQUFBQUFJQS9BQUFBQUFBQUFRQUNBQUFBQWdBREFBUUFCUUFHQUFRQUJnQUhBQWdBQ1FBS0FBZ0FDZ0FMQUF3QURRQU9BQXdBRGdBUEFCQUFFUUFTQUJBQUVnQVRBQlFBRlFBV0FCUUFGZ0FYQUJnQUdRQWFBQmdBR2dBYkFCd0FIUUFlQUI4QUlBQWhBQ0lBSXdBa0FDVUFKZ0FuQUNnQUtRQXFBQ3NBTEFBdEFDNEFMd0F3QURFQU1nQXpBRFFBTlFBMkFEUUFOZ0EzQUE9PSIKICAgICAgICB9CiAgICBdCn0K"},function(t,e,i){"use strict";i.r(e),e.default="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogIlBsYXkiLAogICAgICAgICAgICAicm90YXRpb24iIDogWwogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0LAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibWVzaGVzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJuYW1lIiA6ICJQbGFuZS4wMDEiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJtaW4iIDogWwogICAgICAgICAgICAgICAgLTEsCiAgICAgICAgICAgICAgICAtMC4xOTY4ODk0NzQ5ODc5ODM3LAogICAgICAgICAgICAgICAgLTAuOTk0OTY1NjcyNDkyOTgxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAxLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAyLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMyIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAzLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTIzLAogICAgICAgICAgICAiY291bnQiIDogMjQsCiAgICAgICAgICAgICJ0eXBlIiA6ICJTQ0FMQVIiCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJWaWV3cyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDIxNiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDIxNiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMjE2CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMTQ0LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiA0MzIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA0OCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogNTc2CiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDYyNCwKICAgICAgICAgICAgInVyaSIgOiAiZGF0YTphcHBsaWNhdGlvbi9vY3RldC1zdHJlYW07YmFzZTY0LEFBQ0F2MldkU2I0U3RuNi9BQUNBdjJXZFNiNEFBSUEvQUFDQVAyV2RTYjRBR2txOEFBQ0FQd0FBQUFBQUdrcThBQUNBUDJXZFNiNEFHa3E4QUFDQXYyV2RTYjRBQUlBL0FBQ0F2d0FBQUFBQUFJQS9BQUNBdndBQUFBQVN0bjYvQUFDQVB3QUFBQUFBR2txOEFBQ0F2d0FBQUFBQUFJQS9BQUNBdndBQUFBQVN0bjYvQUFDQXYyV2RTYjRTdG42L0FBQ0FQMldkU2I0QUdrcThBQUNBUHdBQUFBQUFHa3E4QUFDQXZ3QUFBQUFBQUlBL0FBQ0F2MldkU2I0QUFJQS9BQUNBdjJXZFNiNFN0bjYvQUFDQXZ3QUFBQUFTdG42L0FBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQWZqbm52Z0FBQUFBNGFHUy9mam5udmdBQUFBQTRhR1MvZmpubnZnQUFBQUE0YUdTL2Zqbm52Z0FBQUFBNGFHUy9BQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FhY2JodmdBQUFBQVh4R1UvYWNiaHZnQUFBQUFYeEdVL2FjYmh2Z0FBQUFBWHhHVS9hY2JodmdBQUFBQVh4R1UvQUFDQVB3QUFBQUFBQUFDQUFBQ0FQd0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFBQUFDQUFBQUFBQUQzSkRzQUFBQUFBQUNBUHdBQWdEK1kxL3crQUFDQVA1algvRDRBQUlBL21OZjhQZ0FBQUFBQUFJQS9BQUFBQUFBQWdEOEFBQUFBQVBja093QUFnRCtZMS93K0FBQUFBQUFBZ0Q4QUFBQUFBUGNrT3dBQUFBQUE5eVE3QUFDQVA1algvRDRBQUlBL21OZjhQZ0FBQUFBQUFJQS9BQUFBQUFBQWdEOEFBQUFBQVBja093QUFBQUFBOXlRN0FBQUJBQUlBQXdBRUFBVUFBd0FGQUFZQUJ3QUlBQWtBQ2dBTEFBd0FDZ0FNQUEwQURnQVBBQkFBRGdBUUFCRUEiCiAgICAgICAgfQogICAgXQp9Cg=="},function(t,e,i){"use strict";i.r(e),e.default="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInNraXAiLAogICAgICAgICAgICAicm90YXRpb24iIDogWwogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0LAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibWVzaGVzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJuYW1lIiA6ICJQbGFuZS4wMDIiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJtaW4iIDogWwogICAgICAgICAgICAgICAgLTEsCiAgICAgICAgICAgICAgICAtMC4yMDIzNTg2MDM0Nzc0NzgwMywKICAgICAgICAgICAgICAgIC0xCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAxLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAyLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMyIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAzLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTIzLAogICAgICAgICAgICAiY291bnQiIDogNzIsCiAgICAgICAgICAgICJ0eXBlIiA6ICJTQ0FMQVIiCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJWaWV3cyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDU1MiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDU1MiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogNTUyCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMzY4LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAxMTA0CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMTQ0LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAxNDcyCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDE2MTYsCiAgICAgICAgICAgICJ1cmkiIDogImRhdGE6YXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtO2Jhc2U2NCxBQUNBdndBQUFBQUFBSUEvQUFDQXZ3QUFBQUFBQUlDLzVBSWF2d0FBQUFBQUFJQy81QUlhdndBQUFBQUFOck83NUFJYXZ3QUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQS9BQUNBUHhnM1Q3NEFBSUEvNUFJYXZ4ZzNUNzRBTnJPNzVBSWF2d0FBQUFBQU5yTzdBQUNBUHhnM1Q3NEFBSUMvNUFJYXZ4ZzNUNzRBTnJPN0FBQ0FQeGczVDc0QUFJQS9BQUNBUHdBQUFBQUFBSUMvQUFDQVB3QUFBQUFBQUlBLzVBSWF2d0FBQUFBQU5yTzc1QUlhdnhnM1Q3NEFOck83NUFJYXZ4ZzNUNzRBQUlDL0FBQ0F2eGczVDc0QUFJQy9BQUNBdnhnM1Q3NEFBSUEvNUFJYXZ4ZzNUNzRBQUlBLzVBSWF2d0FBQUFBQUFJQy81QUlhdnhnM1Q3NEFBSUMvNUFJYXZ4ZzNUNzRBTnJPNzVBSWF2d0FBQUFBQU5yTzdBQUNBdndBQUFBQUFBSUMvQUFDQXZ4ZzNUNzRBQUlDLzVBSWF2eGczVDc0QUFJQy81QUlhdndBQUFBQUFBSUMvNUFJYXZ3QUFBQUFBTnJPNzVBSWF2eGczVDc0QU5yTzdBQUNBUHhnM1Q3NEFBSUMvQUFDQVB3QUFBQUFBQUlDLzVBSWF2eGczVDc0QUFJQS81QUlhdndBQUFBQUFBSUEvNUFJYXZ3QUFBQUFBQUlBLzVBSWF2eGczVDc0QUFJQS9BQUNBdnhnM1Q3NEFBSUEvQUFDQXZ3QUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQy9BQUNBUHhnM1Q3NEFBSUMvQUFDQVB4ZzNUNzRBQUlBL0FBQ0FQd0FBQUFBQUFJQS9BQUNBdndBQUFBQUFBSUEvQUFDQXZ4ZzNUNzRBQUlBL0FBQ0F2eGczVDc0QUFJQy9BQUNBdndBQUFBQUFBSUMvQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FOUjBJUHdBQUFBREQwRmkvTlIwSVB3QUFBQUREMEZpL05SMElQd0FBQUFERDBGaS9OUjBJUHdBQUFBREQwRmkvQUFBQUFQLy9mejhBQUFBQUFBQUFBUC8vZno4QUFBQUFBQUFBQVAvL2Z6OEFBQUFBQUFBQUFQLy9mNzhBQUFDQUFBQUFBUC8vZjc4QUFBQ0FBQUFBQVAvL2Y3OEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlBL0RRd0hQd0FBQUFCUmUxay9EUXdIUHdBQUFBQlJlMWsvRFF3SFB3QUFBQUJSZTFrL0RRd0hQd0FBQUFCUmUxay9BQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQUFBQUFBQUlBQUFJQy9BQUFBQUFBQUFJQUFBSUMvQUFBQUFBQUFBSUFBQUlDL0FBQUFBQUFBQUlBQUFJQy9BQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQVB3QUFBSUFBQUFDQUFBQ0FQd0FBQUlBQUFBQ0FBQUNBUHdBQUFJQUFBQUNBQUFDQVB3QUFBSUFBQUFDQUFBQUFBQUFBZ0Q4QUFBQUFBQUFBQURqNlN6NEFBQUFBT1BwTFBwU1ovajQ0K2tzK0FBQ0FQd0FBZ0Q4QUFJQS9BQUNBUHdBQWdEODQra3MrbEpuK1BqajZTejZVbWY0K0FBQ0FQd0FBQUFBNCtrcytsSm4rUGdBQWdEOEFBSUEvQUFDQVB3QUFBQUFBQUlBL0FBQ0FQemo2U3o2VW1mNCtPUHBMUHBTWi9qNDQra3MrQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBZ0Q4NCtrcytBQUNBUHpqNlN6NEFBQUFBT1BwTFBnQUFBQUE0K2tzK2xKbitQamo2U3o2VW1mNCtBQUFBQUFBQUFBQUFBQUFBQUFBQUFEajZTejRBQUFBQU9QcExQZ0FBQUFBNCtrcytsSm4rUGpqNlN6NlVtZjQrQUFDQVB3QUFBQUFBQUlBL0FBQUFBRGo2U3o0QUFJQS9PUHBMUGdBQWdEODQra3MrQUFDQVB6ajZTejRBQUlBL0FBQUFBQUFBZ0Q4QUFBQUFBQUNBUHdBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUlBL0FBQ0FQd0FBZ0Q4QUFJQS9BQUFBQUFBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBRUFBZ0FBQUFJQUF3QUFBQU1BQkFBRkFBWUFCd0FGQUFjQUNBQUpBQW9BQ3dBTUFBMEFEZ0FQQUJBQUVRQVBBQkVBRWdBVEFBOEFFZ0FVQUJVQUZnQVVBQllBRndBWUFCa0FHZ0FZQUJvQUd3QWNBQjBBSGdBY0FCNEFId0FYQUJZQUlBQVhBQ0FBSVFBaUFDTUFKQUFpQUNRQUpRQW1BQ2NBS0FBbUFDZ0FLUUFxQUNzQUxBQXFBQ3dBTFFBPSIKICAgICAgICB9CiAgICBdCn0K"},function(t,e,i){"use strict";i.r(e),e.default="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInJld2luZCIsCiAgICAgICAgICAgICJyb3RhdGlvbiIgOiBbCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAuNzA3MTA2NzY5MDg0OTMwNAogICAgICAgICAgICBdCiAgICAgICAgfQogICAgXSwKICAgICJtZXNoZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlBsYW5lLjAwMyIsCiAgICAgICAgICAgICJwcmltaXRpdmVzIiA6IFsKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAiYXR0cmlidXRlcyIgOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICJQT1NJVElPTiIgOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAiTk9STUFMIiA6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICJURVhDT09SRF8wIiA6IDIKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICJpbmRpY2VzIiA6IDMKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAiYWNjZXNzb3JzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDAsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgIm1heCIgOiBbCiAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgXSwKICAgICAgICAgICAgIm1pbiIgOiBbCiAgICAgICAgICAgICAgICAtMSwKICAgICAgICAgICAgICAgIC0wLjE5NzQ5NzA4NDczNjgyNDA0LAogICAgICAgICAgICAgICAgLTEKICAgICAgICAgICAgXSwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzMiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDEsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzMiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDIsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzIiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDMsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjMsCiAgICAgICAgICAgICJjb3VudCIgOiA2MCwKICAgICAgICAgICAgInR5cGUiIDogIlNDQUxBUiIKICAgICAgICB9CiAgICBdLAogICAgImJ1ZmZlclZpZXdzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogNDgwLAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAwCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogNDgwLAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiA0ODAKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAzMjAsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDk2MAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDEyMCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTI4MAogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAxNDAwLAogICAgICAgICAgICAidXJpIiA6ICJkYXRhOmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTtiYXNlNjQsQUFDQVB3QUFBQUFBQUlBL0FBQ0FQNjA4U3I0QUFJQS9KeFk3dTYwOFNyNEFLbmc3SnhZN3V3QUFBQUFBS25nN0FBQ0FQNjA4U3I0QUFJQy9KeFk3dTYwOFNyNEFLbmc3QUFDQVA2MDhTcjRBQUlBL0FBQ0F2d0FBQUFBQTZQaTdBQUNBdjYwOFNyNEE2UGk3QUNDcnU2MDhTcjRBQUlDL0FDQ3J1d0FBQUFBQUFJQy9BQUNBdndBQUFBQUE2UGk3QUNDcnV3QUFBQUFBQUlDL0p4WTd1d0FBQUFBQUtuZzdBR0FFdWdBQUFBQUFBSUEvQUNDcnV3QUFBQUFBQUlDL0FDQ3J1NjA4U3I0QUFJQy9KeFk3dTYwOFNyNEFLbmc3SnhZN3V3QUFBQUFBS25nN0FBQ0FQd0FBQUFBQUFJQy9BQUNBUHdBQUFBQUFBSUEvQUNDcnU2MDhTcjRBQUlDL0FBQ0F2NjA4U3I0QTZQaTdBR0FFdXEwOFNyNEFBSUEvSnhZN3V3QUFBQUFBS25nN0p4WTd1NjA4U3I0QUtuZzdBR0FFdXEwOFNyNEFBSUEvQUdBRXVnQUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQy9BQUNBUDYwOFNyNEFBSUMvQUFDQVA2MDhTcjRBQUlBL0FBQ0FQd0FBQUFBQUFJQS9KeFk3dXdBQUFBQUFLbmc3SnhZN3U2MDhTcjRBS25nN0FBQ0FQNjA4U3I0QUFJQy9BQUNBUHdBQUFBQUFBSUMvQUdBRXVnQUFBQUFBQUlBL0FHQUV1cTA4U3I0QUFJQS9BQUNBdjYwOFNyNEE2UGk3QUFDQXZ3QUFBQUFBNlBpN3ZXbzBQd0FBQUFDbm5qVy92V28wUHdBQUFBQ25ualcvdldvMFB3QUFBQUNubmpXL3ZXbzBQd0FBQUFDbm5qVy9BQUFBQUFBQWdEOEFBQUFBQUFBQUFBQUFnRDhBQUFBQUFBQUFBQUFBZ0Q4QUFBQUFrTTAwUHdBQUFBQkZQRFUva00wMFB3QUFBQUJGUERVL2tNMDBQd0FBQUFCRlBEVS9rTTAwUHdBQUFBQkZQRFUvQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQTB2OS92d0FBQUFEbGt4bzcwdjkvdndBQUFBRGxreG83MHY5L3Z3QUFBQURsa3hvNzB2OS92d0FBQUFEbGt4bzdBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQTBQOS92d0FBQUFEamt4bzcwUDkvdndBQUFBRGpreG83MFA5L3Z3QUFBQURqa3hvNzBQOS92d0FBQUFEamt4bzdBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBZHhvMVB3QUFBQUJyN3pRL2R4bzFQd0FBQUFCcjd6US9keG8xUHdBQUFBQnI3elEvZHhvMVB3QUFBQUJyN3pRL25iODFQd0FBQUFDSlNUUy9uYjgxUHdBQUFBQ0pTVFMvbmI4MVB3QUFBQUNKU1RTL25iODFQd0FBQUFDSlNUUy9BQUNBUHdBQWdEOEFBSUEvQUFDQVArcEUvejRWZkFBLzZrVC9QaFY4QUQ4QUFJQS9BQUFBQU9wRS96NFZmQUEvQUFDQVB3QUFnRDhBQUFBQU1BNytQZ0FBQUFBd0R2NCt3S24rUGdBQUFBREFxZjQrQUFBQUFBQUFBQUF3RHY0K3dLbitQZ0FBQUFEcVJQOCtGWHdBUCtqZS96NEFBSUEvd0tuK1BnQUFBQURBcWY0K0FBQUFBT3BFL3o0VmZBQS82a1QvUGhWOEFEOEFBSUEvQUFBQUFBQUFnRDhBQUlBL3dLbitQZ0FBQUFBQUFBQUFNQTcrUHVqZS96NEFBSUEvNmtUL1BoVjhBRC9xUlA4K0ZYd0FQK2plL3o0QUFJQS82TjcvUGdBQWdEOEFBSUEvQUFBQUFBQUFnRDhBQUFBQUFBQ0FQd0FBZ0Q4QUFJQS9BQUNBUCtwRS96NFZmQUEvNmtUL1BoVjhBRDhBQUlBL0FBQUFBQUFBZ0Q4QUFBQUE2TjcvUGdBQWdEL28zdjgrQUFDQVB3QUFBQUF3RHY0K0FBQUFBREFPL2o0QUFBRUFBZ0FBQUFJQUF3QUVBQVVBQmdBSEFBZ0FDUUFIQUFrQUNnQUxBQXdBRFFBT0FBc0FEUUFQQUJBQUVRQVBBQkVBRWdBVEFCUUFEUUFGQUJVQUZnQUZBQllBRndBWUFCa0FHZ0FZQUJvQUd3QWNBQjBBSGdBY0FCNEFId0FnQUNFQUlnQWdBQ0lBSXdBa0FDVUFKZ0FrQUNZQUp3QT0iCiAgICAgICAgfQogICAgXQp9Cg=="},function(t,e,i){"use strict";i.r(e),e.default="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAC70lEQVR42u3by04TURzH8W+nFx0kMUBbE6eNiSCXjQlxZQKU2qUbSERfwUQQ0ATfwATYGCPxHSwoLtzZ9ObWGIMRSDDRlFlIW1xIUuxtXHQ0gC1MTRM6nfNPupmeaef3OTNnziRzbJqmcUy5gDH9cx24qG9r5toDtoEPwCvgNZCv1dh2DMA4sAD0YO7aAh4BL6t9KVXZZgfm9R3MHh49w4qeyX4SgB14DMzRejWnZ7PXAmjl8DURDo4B8y0e/mAt6OPCX4BbQBhr1QSwbNM0zQV8AXwWA1CBy5IuYbXwAApwW9InOVatMZumaV+BS0b3KBSK5XgyqcYSSXXt01o2k87k8sVi+TSOvk2WHV6vV+7r7e0IBoaVkaFhxel0SHX8xDebpmn7wBkjrWPxhPp06fnHlLq914zd6Vd87VP37l4NBgJGL+m8TTvhYeBgz49P3HnzPb2Ta+Zz2uv2yKvLL24aPRMMny6RaDTV7OEBdjLp3NtIJGW0vWGAWDyhmmVkiyXfqQ0H+LyxvmsWgPU6jtUwQDa7u28WgGwmu99wgHyhUDYLQD23ZQmLlwAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAByqc22ywyyhXA7jL0oZbtjV6ZbNAtDl7jrbcIArPd3nzQIw0D/Q2XCA0cCIYhaA0eEhpeEAoWDQf8HjbfrLwOv2yKHQDX89AD+NNHQ6HdLs9NSgX/G1N2t4v+Jrfzhzf9DldBrt2LxN07RNoNfonxQKxXIkGk1F4wl1Y3PjR3onkyuUTudVWafdIXm8brm/r78jGBhRQsGg/39elQ1TWS9gxVqRgFULz4NWrb5goluisqjwgQV7fxb49WfACAOLFgq/qGc+tGrMDjwBJls8/BIwDZSOToRKwAzwzCrhq80EWxnhn/C1psIlYEqfG2y1QPAtKivjJo+GPzoGVH201nceB65RWWrmbPLABf0W957K8vkwxyyf/w0kIOOe2pS1LAAAAABJRU5ErkJggg=="},function(t,e,i){"use strict";i.r(e);class n{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t);t.target=null}}}const r=Math.PI/180,a=180/Math.PI,s=[];for(let t=0;t<256;t++)s[t]=(t<16?"0":"")+t.toString(16);const o="undefined"!=typeof crypto&&"randomUUID"in crypto;function l(){if(o)return crypto.randomUUID().toUpperCase();const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(s[255&t]+s[t>>8&255]+s[t>>16&255]+s[t>>24&255]+"-"+s[255&e]+s[e>>8&255]+"-"+s[e>>16&15|64]+s[e>>24&255]+"-"+s[63&i|128]+s[i>>8&255]+"-"+s[i>>16&255]+s[i>>24&255]+s[255&n]+s[n>>8&255]+s[n>>16&255]+s[n>>24&255]).toUpperCase()}function c(t,e,i){return Math.max(e,Math.min(i,t))}function h(t,e){return(t%e+e)%e}function u(t,e,i){return(1-i)*t+i*e}function d(t){return 0==(t&t-1)&&0!==t}function p(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}class f{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}f.prototype.isVector2=!0;class g{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,a,s,o,l){const c=this.elements;return c[0]=t,c[1]=n,c[2]=s,c[3]=e,c[4]=r,c[5]=o,c[6]=i,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,a=i[0],s=i[3],o=i[6],l=i[1],c=i[4],h=i[7],u=i[2],d=i[5],p=i[8],f=n[0],g=n[3],m=n[6],b=n[1],y=n[4],v=n[7],x=n[2],_=n[5],A=n[8];return r[0]=a*f+s*b+o*x,r[3]=a*g+s*y+o*_,r[6]=a*m+s*v+o*A,r[1]=l*f+c*b+h*x,r[4]=l*g+c*y+h*_,r[7]=l*m+c*v+h*A,r[2]=u*f+d*b+p*x,r[5]=u*g+d*y+p*_,r[8]=u*m+d*v+p*A,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8];return e*a*c-e*s*l-i*r*c+i*s*o+n*r*l-n*a*o}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8],h=c*a-s*l,u=s*o-c*r,d=l*r-a*o,p=e*h+i*u+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(n*l-c*i)*f,t[2]=(s*i-n*a)*f,t[3]=u*f,t[4]=(c*e-n*o)*f,t[5]=(n*r-s*e)*f,t[6]=d*f,t[7]=(i*o-l*e)*f,t[8]=(a*e-i*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,a,s){const o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*a+l*s)+a+t,-n*l,n*o,-n*(-l*a+o*s)+s+e,0,0,1),this}scale(t,e){const i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],a=n[3],s=n[6],o=n[1],l=n[4],c=n[7];return n[0]=e*r+i*o,n[3]=e*a+i*l,n[6]=e*s+i*c,n[1]=-i*r+e*o,n[4]=-i*a+e*l,n[7]=-i*s+e*c,this}translate(t,e){const i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}function m(t){if(0===t.length)return-1/0;let e=t[0];for(let i=1,n=t.length;i<n;++i)t[i]>e&&(e=t[i]);return e}g.prototype.isMatrix3=!0;Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function b(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}let y;class v{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===y&&(y=b("canvas")),y.width=t.width,y.height=t.height;const i=y.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=y}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}}let x=0;class _ extends n{constructor(t=_.DEFAULT_IMAGE,e=_.DEFAULT_MAPPING,i=1001,n=1001,r=1006,a=1008,s=1023,o=1009,c=1,h=3e3){super(),Object.defineProperty(this,"id",{value:x++}),this.uuid=l(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=a,this.anisotropy=c,this.format=s,this.internalFormat=null,this.type=o,this.offset=new f(0,0),this.repeat=new f(1,1),this.center=new f(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new g,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const n=this.image;if(void 0===n.uuid&&(n.uuid=l()),!e&&void 0===t.images[n.uuid]){let e;if(Array.isArray(n)){e=[];for(let t=0,i=n.length;t<i;t++)n[t].isDataTexture?e.push(A(n[t].image)):e.push(A(n[t]))}else e=A(n);t.images[n.uuid]={uuid:n.uuid,url:e}}i.image=n.uuid}return e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function A(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?v.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}_.DEFAULT_IMAGE=void 0,_.DEFAULT_MAPPING=300,_.prototype.isTexture=!0;class w{constructor(t=0,e=0,i=0,n=1){this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*e+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*e+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*e+a[7]*i+a[11]*n+a[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r;const a=t.elements,s=a[0],o=a[4],l=a[8],c=a[1],h=a[5],u=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(o-c)<.01&&Math.abs(l-d)<.01&&Math.abs(u-p)<.01){if(Math.abs(o+c)<.1&&Math.abs(l+d)<.1&&Math.abs(u+p)<.1&&Math.abs(s+h+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(s+1)/2,a=(h+1)/2,g=(f+1)/2,m=(o+c)/4,b=(l+d)/4,y=(u+p)/4;return t>a&&t>g?t<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(t),n=m/i,r=b/i):a>g?a<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(a),i=m/n,r=y/n):g<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(g),i=b/r,n=y/r),this.set(i,n,r,e),this}let g=Math.sqrt((p-u)*(p-u)+(l-d)*(l-d)+(c-o)*(c-o));return Math.abs(g)<.001&&(g=1),this.x=(p-u)/g,this.y=(l-d)/g,this.z=(c-o)/g,this.w=Math.acos((s+h+f-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}w.prototype.isVector4=!0;class C extends n{constructor(t,e,i={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new w(0,0,t,e),this.scissorTest=!1,this.viewport=new w(0,0,t,e),this.texture=new _(void 0,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:t,height:e,depth:1},this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.internalFormat=void 0!==i.internalFormat?i.internalFormat:null,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:1006,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,i=1){this.width===t&&this.height===e&&this.depth===i||(this.width=t,this.height=e,this.depth=i,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}C.prototype.isWebGLRenderTarget=!0;(class extends C{constructor(t,e,i){super(t,e);const n=this.texture;this.texture=[];for(let t=0;t<i;t++)this.texture[t]=n.clone()}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let n=0,r=this.texture.length;n<r;n++)this.texture[n].image.width=t,this.texture[n].image.height=e,this.texture[n].image.depth=i;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this.texture.length=0;for(let e=0,i=t.texture.length;e<i;e++)this.texture[e]=t.texture[e].clone();return this}}).prototype.isWebGLMultipleRenderTargets=!0;class M extends C{constructor(t,e,i){super(t,e,i),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}M.prototype.isWebGLMultisampleRenderTarget=!0;class E{constructor(t=0,e=0,i=0,n=1){this._x=t,this._y=e,this._z=i,this._w=n}static slerp(t,e,i,n){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),i.slerpQuaternions(t,e,n)}static slerpFlat(t,e,i,n,r,a,s){let o=i[n+0],l=i[n+1],c=i[n+2],h=i[n+3];const u=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(0===s)return t[e+0]=o,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===s)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(h!==f||o!==u||l!==d||c!==p){let t=1-s;const e=o*u+l*d+c*p+h*f,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const r=Math.sqrt(n),a=Math.atan2(r,e*i);t=Math.sin(t*a)/r,s=Math.sin(s*a)/r}const r=s*i;if(o=o*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+f*r,t===1-s){const t=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=t,l*=t,c*=t,h*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,i,n,r,a){const s=i[n],o=i[n+1],l=i[n+2],c=i[n+3],h=r[a],u=r[a+1],d=r[a+2],p=r[a+3];return t[e]=s*p+c*h+o*d-l*u,t[e+1]=o*p+c*u+l*h-s*d,t[e+2]=l*p+c*d+s*u-o*h,t[e+3]=c*p-s*h-o*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=t._x,n=t._y,r=t._z,a=t._order,s=Math.cos,o=Math.sin,l=s(i/2),c=s(n/2),h=s(r/2),u=o(i/2),d=o(n/2),p=o(r/2);switch(a){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],a=e[1],s=e[5],o=e[9],l=e[2],c=e[6],h=e[10],u=i+s+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(a-n)*t}else if(i>s&&i>h){const t=2*Math.sqrt(1+i-s-h);this._w=(c-o)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(r+l)/t}else if(s>h){const t=2*Math.sqrt(1+s-i-h);this._w=(r-l)/t,this._x=(n+a)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+h-i-s);this._w=(a-n)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(c(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,a=t._w,s=e._x,o=e._y,l=e._z,c=e._w;return this._x=i*c+a*s+n*l-r*o,this._y=n*c+a*o+r*s-i*l,this._z=r*c+a*l+i*o-n*s,this._w=a*c-i*s-n*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,r=this._z,a=this._w;let s=a*t._w+i*t._x+n*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;const o=1-s*s;if(o<=Number.EPSILON){const t=1-e;return this._w=t*a+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(o),c=Math.atan2(l,s),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=a*h+this._w*u,this._x=i*h+this._x*u,this._y=n*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,i){this.copy(t).slerp(e,i)}random(){const t=Math.random(),e=Math.sqrt(1-t),i=Math.sqrt(t),n=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(n),i*Math.sin(r),i*Math.cos(r),e*Math.sin(n))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}E.prototype.isQuaternion=!0;class I{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(T.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(T.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*a,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,s=t.z,o=t.w,l=o*e+a*n-s*i,c=o*i+s*e-r*n,h=o*n+r*i-a*e,u=-r*e-a*i-s*n;return this.x=l*o+u*-r+c*-s-h*-a,this.y=c*o+u*-a+h*-r-l*-s,this.z=h*o+u*-s+l*-a-c*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,r=t.z,a=e.x,s=e.y,o=e.z;return this.x=n*o-r*s,this.y=r*a-i*o,this.z=i*s-n*a,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return S.copy(this).projectOnVector(t),this.sub(S)}reflect(t){return this.sub(S.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(c(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,i=Math.sqrt(1-t**2);return this.x=i*Math.cos(e),this.y=i*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}I.prototype.isVector3=!0;const S=new I,T=new E;class B{constructor(t=new I(1/0,1/0,1/0),e=new I(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,s=-1/0;for(let o=0,l=t.length;o<l;o+=3){const l=t[o],c=t[o+1],h=t[o+2];l<e&&(e=l),c<i&&(i=c),h<n&&(n=h),l>r&&(r=l),c>a&&(a=c),h>s&&(s=h)}return this.min.set(e,i,n),this.max.set(r,a,s),this}setFromBufferAttribute(t){let e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,s=-1/0;for(let o=0,l=t.count;o<l;o++){const l=t.getX(o),c=t.getY(o),h=t.getZ(o);l<e&&(e=l),c<i&&(i=c),h<n&&(n=h),l>r&&(r=l),c>a&&(a=c),h>s&&(s=h)}return this.min.set(e,i,n),this.max.set(r,a,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=L.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),U.copy(e.boundingBox),U.applyMatrix4(t.matrixWorld),this.union(U));const i=t.children;for(let t=0,e=i.length;t<e;t++)this.expandByObject(i[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,L),L.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(O),Q.subVectors(this.max,O),R.subVectors(t.a,O),D.subVectors(t.b,O),N.subVectors(t.c,O),k.subVectors(D,R),P.subVectors(N,D),z.subVectors(R,N);let e=[0,-k.z,k.y,0,-P.z,P.y,0,-z.z,z.y,k.z,0,-k.x,P.z,0,-P.x,z.z,0,-z.x,-k.y,k.x,0,-P.y,P.x,0,-z.y,z.x,0];return!!G(e,R,D,N,Q)&&(e=[1,0,0,0,1,0,0,0,1],!!G(e,R,D,N,Q)&&(V.crossVectors(k,P),e=[V.x,V.y,V.z],G(e,R,D,N,Q)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return L.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(L).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(F[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),F[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),F[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),F[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),F[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),F[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),F[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),F[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(F)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}B.prototype.isBox3=!0;const F=[new I,new I,new I,new I,new I,new I,new I,new I],L=new I,U=new B,R=new I,D=new I,N=new I,k=new I,P=new I,z=new I,O=new I,Q=new I,V=new I,H=new I;function G(t,e,i,n,r){for(let a=0,s=t.length-3;a<=s;a+=3){H.fromArray(t,a);const s=r.x*Math.abs(H.x)+r.y*Math.abs(H.y)+r.z*Math.abs(H.z),o=e.dot(H),l=i.dot(H),c=n.dot(H);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}const j=new B,W=new I,q=new I,Z=new I;class J{constructor(t=new I,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):j.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;e<r;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){Z.subVectors(t,this.center);const e=Z.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.add(Z.multiplyScalar(i/t)),this.radius+=i}return this}union(t){return q.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(W.copy(t.center).add(q)),this.expandByPoint(W.copy(t.center).sub(q)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const X=new I,Y=new I,K=new I,$=new I,tt=new I,et=new I,it=new I;class nt{constructor(t=new I,e=new I(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,X)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=X.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(X.copy(this.direction).multiplyScalar(e).add(this.origin),X.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){Y.copy(t).add(e).multiplyScalar(.5),K.copy(e).sub(t).normalize(),$.copy(this.origin).sub(Y);const r=.5*t.distanceTo(e),a=-this.direction.dot(K),s=$.dot(this.direction),o=-$.dot(K),l=$.lengthSq(),c=Math.abs(1-a*a);let h,u,d,p;if(c>0)if(h=a*o-s,u=a*s-o,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+a*u+2*s)+u*(a*h+u+2*o)+l}else u=r,h=Math.max(0,-(a*u+s)),d=-h*h+u*(u+2*o)+l;else u=-r,h=Math.max(0,-(a*u+s)),d=-h*h+u*(u+2*o)+l;else u<=-p?(h=Math.max(0,-(-a*r+s)),u=h>0?-r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(h=Math.max(0,-(a*r+s)),u=h>0?r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l);else u=a>0?-r:r,h=Math.max(0,-(a*u+s)),d=-h*h+u*(u+2*o)+l;return i&&i.copy(this.direction).multiplyScalar(h).add(this.origin),n&&n.copy(K).multiplyScalar(u).add(Y),d}intersectSphere(t,e){X.subVectors(t.center,this.origin);const i=X.dot(this.direction),n=X.dot(X)-i*i,r=t.radius*t.radius;if(n>r)return null;const a=Math.sqrt(r-n),s=i-a,o=i+a;return s<0&&o<0?null:s<0?this.at(o,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,a,s,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(i=(t.min.x-u.x)*l,n=(t.max.x-u.x)*l):(i=(t.max.x-u.x)*l,n=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,a=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,a=(t.min.y-u.y)*c),i>a||r>n?null:((r>i||i!=i)&&(i=r),(a<n||n!=n)&&(n=a),h>=0?(s=(t.min.z-u.z)*h,o=(t.max.z-u.z)*h):(s=(t.max.z-u.z)*h,o=(t.min.z-u.z)*h),i>o||s>n?null:((s>i||i!=i)&&(i=s),(o<n||n!=n)&&(n=o),n<0?null:this.at(i>=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,X)}intersectTriangle(t,e,i,n,r){tt.subVectors(e,t),et.subVectors(i,t),it.crossVectors(tt,et);let a,s=this.direction.dot(it);if(s>0){if(n)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}$.subVectors(this.origin,t);const o=a*this.direction.dot(et.crossVectors($,et));if(o<0)return null;const l=a*this.direction.dot(tt.cross($));if(l<0)return null;if(o+l>s)return null;const c=-a*$.dot(it);return c<0?null:this.at(c/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class rt{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,a,s,o,l,c,h,u,d,p,f,g){const m=this.elements;return m[0]=t,m[4]=e,m[8]=i,m[12]=n,m[1]=r,m[5]=a,m[9]=s,m[13]=o,m[2]=l,m[6]=c,m[10]=h,m[14]=u,m[3]=d,m[7]=p,m[11]=f,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new rt).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/at.setFromMatrixColumn(t,0).length(),r=1/at.setFromMatrixColumn(t,1).length(),a=1/at.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*a,e[9]=i[9]*a,e[10]=i[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,i=t.x,n=t.y,r=t.z,a=Math.cos(i),s=Math.sin(i),o=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=a*c,i=a*h,n=s*c,r=s*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=i+n*l,e[5]=t-r*l,e[9]=-s*o,e[2]=r-t*l,e[6]=n+i*l,e[10]=a*o}else if("YXZ"===t.order){const t=o*c,i=o*h,n=l*c,r=l*h;e[0]=t+r*s,e[4]=n*s-i,e[8]=a*l,e[1]=a*h,e[5]=a*c,e[9]=-s,e[2]=i*s-n,e[6]=r+t*s,e[10]=a*o}else if("ZXY"===t.order){const t=o*c,i=o*h,n=l*c,r=l*h;e[0]=t-r*s,e[4]=-a*h,e[8]=n+i*s,e[1]=i+n*s,e[5]=a*c,e[9]=r-t*s,e[2]=-a*l,e[6]=s,e[10]=a*o}else if("ZYX"===t.order){const t=a*c,i=a*h,n=s*c,r=s*h;e[0]=o*c,e[4]=n*l-i,e[8]=t*l+r,e[1]=o*h,e[5]=r*l+t,e[9]=i*l-n,e[2]=-l,e[6]=s*o,e[10]=a*o}else if("YZX"===t.order){const t=a*o,i=a*l,n=s*o,r=s*l;e[0]=o*c,e[4]=r-t*h,e[8]=n*h+i,e[1]=h,e[5]=a*c,e[9]=-s*c,e[2]=-l*c,e[6]=i*h+n,e[10]=t-r*h}else if("XZY"===t.order){const t=a*o,i=a*l,n=s*o,r=s*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=a*c,e[9]=i*h-n,e[2]=n*h-i,e[6]=s*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(ot,t,lt)}lookAt(t,e,i){const n=this.elements;return ut.subVectors(t,e),0===ut.lengthSq()&&(ut.z=1),ut.normalize(),ct.crossVectors(i,ut),0===ct.lengthSq()&&(1===Math.abs(i.z)?ut.x+=1e-4:ut.z+=1e-4,ut.normalize(),ct.crossVectors(i,ut)),ct.normalize(),ht.crossVectors(ut,ct),n[0]=ct.x,n[4]=ht.x,n[8]=ut.x,n[1]=ct.y,n[5]=ht.y,n[9]=ut.y,n[2]=ct.z,n[6]=ht.z,n[10]=ut.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,a=i[0],s=i[4],o=i[8],l=i[12],c=i[1],h=i[5],u=i[9],d=i[13],p=i[2],f=i[6],g=i[10],m=i[14],b=i[3],y=i[7],v=i[11],x=i[15],_=n[0],A=n[4],w=n[8],C=n[12],M=n[1],E=n[5],I=n[9],S=n[13],T=n[2],B=n[6],F=n[10],L=n[14],U=n[3],R=n[7],D=n[11],N=n[15];return r[0]=a*_+s*M+o*T+l*U,r[4]=a*A+s*E+o*B+l*R,r[8]=a*w+s*I+o*F+l*D,r[12]=a*C+s*S+o*L+l*N,r[1]=c*_+h*M+u*T+d*U,r[5]=c*A+h*E+u*B+d*R,r[9]=c*w+h*I+u*F+d*D,r[13]=c*C+h*S+u*L+d*N,r[2]=p*_+f*M+g*T+m*U,r[6]=p*A+f*E+g*B+m*R,r[10]=p*w+f*I+g*F+m*D,r[14]=p*C+f*S+g*L+m*N,r[3]=b*_+y*M+v*T+x*U,r[7]=b*A+y*E+v*B+x*R,r[11]=b*w+y*I+v*F+x*D,r[15]=b*C+y*S+v*L+x*N,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],a=t[1],s=t[5],o=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*o*h-n*l*h-r*s*u+i*l*u+n*s*d-i*o*d)+t[7]*(+e*o*d-e*l*u+r*a*u-n*a*d+n*l*c-r*o*c)+t[11]*(+e*l*h-e*s*d-r*a*h+i*a*d+r*s*c-i*l*c)+t[15]*(-n*s*c-e*o*h+e*s*u+n*a*h-i*a*u+i*o*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],f=t[13],g=t[14],m=t[15],b=h*g*l-f*u*l+f*o*d-s*g*d-h*o*m+s*u*m,y=p*u*l-c*g*l-p*o*d+a*g*d+c*o*m-a*u*m,v=c*f*l-p*h*l+p*s*d-a*f*d-c*s*m+a*h*m,x=p*h*o-c*f*o-p*s*u+a*f*u+c*s*g-a*h*g,_=e*b+i*y+n*v+r*x;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/_;return t[0]=b*A,t[1]=(f*u*r-h*g*r-f*n*d+i*g*d+h*n*m-i*u*m)*A,t[2]=(s*g*r-f*o*r+f*n*l-i*g*l-s*n*m+i*o*m)*A,t[3]=(h*o*r-s*u*r-h*n*l+i*u*l+s*n*d-i*o*d)*A,t[4]=y*A,t[5]=(c*g*r-p*u*r+p*n*d-e*g*d-c*n*m+e*u*m)*A,t[6]=(p*o*r-a*g*r-p*n*l+e*g*l+a*n*m-e*o*m)*A,t[7]=(a*u*r-c*o*r+c*n*l-e*u*l-a*n*d+e*o*d)*A,t[8]=v*A,t[9]=(p*h*r-c*f*r-p*i*d+e*f*d+c*i*m-e*h*m)*A,t[10]=(a*f*r-p*s*r+p*i*l-e*f*l-a*i*m+e*s*m)*A,t[11]=(c*s*r-a*h*r-c*i*l+e*h*l+a*i*d-e*s*d)*A,t[12]=x*A,t[13]=(c*f*n-p*h*n+p*i*u-e*f*u-c*i*g+e*h*g)*A,t[14]=(p*s*n-a*f*n-p*i*o+e*f*o+a*i*g-e*s*g)*A,t[15]=(a*h*n-c*s*n+c*i*o-e*h*o-a*i*u+e*s*u)*A,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,a=t.x,s=t.y,o=t.z,l=r*a,c=r*s;return this.set(l*a+i,l*s-n*o,l*o+n*s,0,l*s+n*o,c*s+i,c*o-n*a,0,l*o-n*s,c*o+n*a,r*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,a){return this.set(1,i,r,0,t,1,a,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,a=e._y,s=e._z,o=e._w,l=r+r,c=a+a,h=s+s,u=r*l,d=r*c,p=r*h,f=a*c,g=a*h,m=s*h,b=o*l,y=o*c,v=o*h,x=i.x,_=i.y,A=i.z;return n[0]=(1-(f+m))*x,n[1]=(d+v)*x,n[2]=(p-y)*x,n[3]=0,n[4]=(d-v)*_,n[5]=(1-(u+m))*_,n[6]=(g+b)*_,n[7]=0,n[8]=(p+y)*A,n[9]=(g-b)*A,n[10]=(1-(u+f))*A,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=at.set(n[0],n[1],n[2]).length();const a=at.set(n[4],n[5],n[6]).length(),s=at.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],st.copy(this);const o=1/r,l=1/a,c=1/s;return st.elements[0]*=o,st.elements[1]*=o,st.elements[2]*=o,st.elements[4]*=l,st.elements[5]*=l,st.elements[6]*=l,st.elements[8]*=c,st.elements[9]*=c,st.elements[10]*=c,e.setFromRotationMatrix(st),i.x=r,i.y=a,i.z=s,this}makePerspective(t,e,i,n,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const s=this.elements,o=2*r/(e-t),l=2*r/(i-n),c=(e+t)/(e-t),h=(i+n)/(i-n),u=-(a+r)/(a-r),d=-2*a*r/(a-r);return s[0]=o,s[4]=0,s[8]=c,s[12]=0,s[1]=0,s[5]=l,s[9]=h,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,i,n,r,a){const s=this.elements,o=1/(e-t),l=1/(i-n),c=1/(a-r),h=(e+t)*o,u=(i+n)*l,d=(a+r)*c;return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-h,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=-2*c,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}rt.prototype.isMatrix4=!0;const at=new I,st=new rt,ot=new I(0,0,0),lt=new I(1,1,1),ct=new I,ht=new I,ut=new I,dt=new rt,pt=new E;class ft{constructor(t=0,e=0,i=0,n=ft.DefaultOrder){this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,r=n[0],a=n[4],s=n[8],o=n[1],l=n[5],h=n[9],u=n[2],d=n[6],p=n[10];switch(e){case"XYZ":this._y=Math.asin(c(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-c(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(c(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-c(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(c(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-c(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return dt.makeRotationFromQuaternion(t),this.setFromRotationMatrix(dt,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return pt.setFromEuler(this),this.setFromQuaternion(pt,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new I(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}ft.prototype.isEuler=!0,ft.DefaultOrder="XYZ",ft.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class gt{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}let mt=0;const bt=new I,yt=new E,vt=new rt,xt=new I,_t=new I,At=new I,wt=new E,Ct=new I(1,0,0),Mt=new I(0,1,0),Et=new I(0,0,1),It={type:"added"},St={type:"removed"};class Tt extends n{constructor(){super(),Object.defineProperty(this,"id",{value:mt++}),this.uuid=l(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Tt.DefaultUp.clone();const t=new I,e=new ft,i=new E,n=new I(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new rt},normalMatrix:{value:new g}}),this.matrix=new rt,this.matrixWorld=new rt,this.matrixAutoUpdate=Tt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new gt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return yt.setFromAxisAngle(t,e),this.quaternion.multiply(yt),this}rotateOnWorldAxis(t,e){return yt.setFromAxisAngle(t,e),this.quaternion.premultiply(yt),this}rotateX(t){return this.rotateOnAxis(Ct,t)}rotateY(t){return this.rotateOnAxis(Mt,t)}rotateZ(t){return this.rotateOnAxis(Et,t)}translateOnAxis(t,e){return bt.copy(t).applyQuaternion(this.quaternion),this.position.add(bt.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Ct,t)}translateY(t){return this.translateOnAxis(Mt,t)}translateZ(t){return this.translateOnAxis(Et,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(vt.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?xt.copy(t):xt.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),_t.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?vt.lookAt(_t,xt,this.up):vt.lookAt(xt,_t,this.up),this.quaternion.setFromRotationMatrix(vt),n&&(vt.extractRotation(n.matrixWorld),yt.setFromRotationMatrix(vt),this.quaternion.premultiply(yt.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(It)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(St)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(St)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),vt.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),vt.multiply(t.parent.matrixWorld)),t.applyMatrix4(vt),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_t,t,At),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_t,wt,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];r(t.shapes,n)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(r(t.materials,this.material[i]));n.material=e}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(r(t.animations,i))}}if(e){const e=a(t.geometries),n=a(t.materials),r=a(t.textures),s=a(t.images),o=a(t.shapes),l=a(t.skeletons),c=a(t.animations);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),s.length>0&&(i.images=s),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),c.length>0&&(i.animations=c)}return i.object=n,i;function a(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}Tt.DefaultUp=new I(0,1,0),Tt.DefaultMatrixAutoUpdate=!0,Tt.prototype.isObject3D=!0;const Bt=new I,Ft=new I,Lt=new I,Ut=new I,Rt=new I,Dt=new I,Nt=new I,kt=new I,Pt=new I,zt=new I;class Ot{constructor(t=new I,e=new I,i=new I){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),Bt.subVectors(t,e),n.cross(Bt);const r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){Bt.subVectors(n,e),Ft.subVectors(i,e),Lt.subVectors(t,e);const a=Bt.dot(Bt),s=Bt.dot(Ft),o=Bt.dot(Lt),l=Ft.dot(Ft),c=Ft.dot(Lt),h=a*l-s*s;if(0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*o-s*c)*u,p=(a*c-s*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,Ut),Ut.x>=0&&Ut.y>=0&&Ut.x+Ut.y<=1}static getUV(t,e,i,n,r,a,s,o){return this.getBarycoord(t,e,i,n,Ut),o.set(0,0),o.addScaledVector(r,Ut.x),o.addScaledVector(a,Ut.y),o.addScaledVector(s,Ut.z),o}static isFrontFacing(t,e,i,n){return Bt.subVectors(i,e),Ft.subVectors(t,e),Bt.cross(Ft).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,e,i,n){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Bt.subVectors(this.c,this.b),Ft.subVectors(this.a,this.b),.5*Bt.cross(Ft).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Ot.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Ot.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return Ot.getUV(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return Ot.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Ot.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,n=this.b,r=this.c;let a,s;Rt.subVectors(n,i),Dt.subVectors(r,i),kt.subVectors(t,i);const o=Rt.dot(kt),l=Dt.dot(kt);if(o<=0&&l<=0)return e.copy(i);Pt.subVectors(t,n);const c=Rt.dot(Pt),h=Dt.dot(Pt);if(c>=0&&h<=c)return e.copy(n);const u=o*h-c*l;if(u<=0&&o>=0&&c<=0)return a=o/(o-c),e.copy(i).addScaledVector(Rt,a);zt.subVectors(t,r);const d=Rt.dot(zt),p=Dt.dot(zt);if(p>=0&&d<=p)return e.copy(r);const f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),e.copy(i).addScaledVector(Dt,s);const g=c*p-d*h;if(g<=0&&h-c>=0&&d-p>=0)return Nt.subVectors(r,n),s=(h-c)/(h-c+(d-p)),e.copy(n).addScaledVector(Nt,s);const m=1/(g+f+u);return a=f*m,s=u*m,e.copy(i).addScaledVector(Rt,a).addScaledVector(Dt,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Qt=0;class Vt extends n{constructor(){super(),Object.defineProperty(this,"id",{value:Qt++}),this.uuid=l(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.format=1023,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i;continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenTint&&this.sheenTint.isColor&&(i.sheenTint=this.sheenTint.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularTint&&this.specularTint.isColor&&(i.specularTint=this.specularTint.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularTintMap&&this.specularTintMap.isTexture&&(i.specularTintMap=this.specularTintMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationTint&&(i.attenuationTint=this.attenuationTint.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),1023!==this.format&&(i.format=this.format),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.format=t.format,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}Vt.prototype.isMaterial=!0;const Ht={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Gt={h:0,s:0,l:0},jt={h:0,s:0,l:0};function Wt(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function qt(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Zt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Jt{constructor(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,i){return this.r=t,this.g=e,this.b=i,this}setHSL(t,e,i){if(t=h(t,1),e=c(e,0,1),i=c(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Wt(r,n,t+1/3),this.g=Wt(r,n,t),this.b=Wt(r,n,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const n=i[1],r=i[2];switch(n){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const i=parseFloat(t[1])/360,n=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(i,n,r)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=Ht[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=qt(t.r),this.g=qt(t.g),this.b=qt(t.b),this}copyLinearToSRGB(t){return this.r=Zt(t.r),this.g=Zt(t.g),this.b=Zt(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){const e=this.r,i=this.g,n=this.b,r=Math.max(e,i,n),a=Math.min(e,i,n);let s,o;const l=(a+r)/2;if(a===r)s=0,o=0;else{const t=r-a;switch(o=l<=.5?t/(r+a):t/(2-r-a),r){case e:s=(i-n)/t+(i<n?6:0);break;case i:s=(n-e)/t+2;break;case n:s=(e-i)/t+4}s/=6}return t.h=s,t.s=o,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,i){return this.getHSL(Gt),Gt.h+=t,Gt.s+=e,Gt.l+=i,this.setHSL(Gt.h,Gt.s,Gt.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Gt),t.getHSL(jt);const i=u(Gt.h,jt.h,e),n=u(Gt.s,jt.s,e),r=u(Gt.l,jt.l,e);return this.setHSL(i,n,r),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Jt.NAMES=Ht,Jt.prototype.isColor=!0,Jt.prototype.r=1,Jt.prototype.g=1,Jt.prototype.b=1;class Xt extends Vt{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new Jt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Xt.prototype.isMeshBasicMaterial=!0;const Yt=new I,Kt=new f;class $t{constructor(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),r=new Jt),e[i++]=r.r,e[i++]=r.g,e[i++]=r.b}return this}copyVector2sArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),r=new f),e[i++]=r.x,e[i++]=r.y}return this}copyVector3sArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),r=new I),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z}return this}copyVector4sArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),r=new w),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z,e[i++]=r.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Kt.fromBufferAttribute(this,e),Kt.applyMatrix3(t),this.setXY(e,Kt.x,Kt.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Yt.fromBufferAttribute(this,e),Yt.applyMatrix3(t),this.setXYZ(e,Yt.x,Yt.y,Yt.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Yt.x=this.getX(e),Yt.y=this.getY(e),Yt.z=this.getZ(e),Yt.applyMatrix4(t),this.setXYZ(e,Yt.x,Yt.y,Yt.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Yt.x=this.getX(e),Yt.y=this.getY(e),Yt.z=this.getZ(e),Yt.applyNormalMatrix(t),this.setXYZ(e,Yt.x,Yt.y,Yt.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Yt.x=this.getX(e),Yt.y=this.getY(e),Yt.z=this.getZ(e),Yt.transformDirection(t),this.setXYZ(e,Yt.x,Yt.y,Yt.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){return this.array[t*this.itemSize]}setX(t,e){return this.array[t*this.itemSize]=e,this}getY(t){return this.array[t*this.itemSize+1]}setY(t,e){return this.array[t*this.itemSize+1]=e,this}getZ(t){return this.array[t*this.itemSize+2]}setZ(t,e){return this.array[t*this.itemSize+2]=e,this}getW(t){return this.array[t*this.itemSize+3]}setW(t,e){return this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}$t.prototype.isBufferAttribute=!0;class te extends $t{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class ee extends $t{constructor(t,e,i){super(new Uint32Array(t),e,i)}}(class extends $t{constructor(t,e,i){super(new Uint16Array(t),e,i)}}).prototype.isFloat16BufferAttribute=!0;class ie extends $t{constructor(t,e,i){super(new Float32Array(t),e,i)}}let ne=0;const re=new rt,ae=new Tt,se=new I,oe=new B,le=new B,ce=new I;class he extends n{constructor(){super(),Object.defineProperty(this,"id",{value:ne++}),this.uuid=l(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(m(t)>65535?ee:te)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new g).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return re.makeRotationFromQuaternion(t),this.applyMatrix4(re),this}rotateX(t){return re.makeRotationX(t),this.applyMatrix4(re),this}rotateY(t){return re.makeRotationY(t),this.applyMatrix4(re),this}rotateZ(t){return re.makeRotationZ(t),this.applyMatrix4(re),this}translate(t,e,i){return re.makeTranslation(t,e,i),this.applyMatrix4(re),this}scale(t,e,i){return re.makeScale(t,e,i),this.applyMatrix4(re),this}lookAt(t){return ae.lookAt(t),ae.updateMatrix(),this.applyMatrix4(ae.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(se).negate(),this.translate(se.x,se.y,se.z),this}setFromPoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new ie(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new B);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];oe.setFromBufferAttribute(i),this.morphTargetsRelative?(ce.addVectors(this.boundingBox.min,oe.min),this.boundingBox.expandByPoint(ce),ce.addVectors(this.boundingBox.max,oe.max),this.boundingBox.expandByPoint(ce)):(this.boundingBox.expandByPoint(oe.min),this.boundingBox.expandByPoint(oe.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new J);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new I,1/0);if(t){const i=this.boundingSphere.center;if(oe.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];le.setFromBufferAttribute(i),this.morphTargetsRelative?(ce.addVectors(oe.min,le.min),oe.expandByPoint(ce),ce.addVectors(oe.max,le.max),oe.expandByPoint(ce)):(oe.expandByPoint(le.min),oe.expandByPoint(le.max))}oe.getCenter(i);let n=0;for(let e=0,r=t.count;e<r;e++)ce.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(ce));if(e)for(let r=0,a=e.length;r<a;r++){const a=e[r],s=this.morphTargetsRelative;for(let e=0,r=a.count;e<r;e++)ce.fromBufferAttribute(a,e),s&&(se.fromBufferAttribute(t,e),ce.add(se)),n=Math.max(n,i.distanceToSquared(ce))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=t.array,n=e.position.array,r=e.normal.array,a=e.uv.array,s=n.length/3;void 0===e.tangent&&this.setAttribute("tangent",new $t(new Float32Array(4*s),4));const o=e.tangent.array,l=[],c=[];for(let t=0;t<s;t++)l[t]=new I,c[t]=new I;const h=new I,u=new I,d=new I,p=new f,g=new f,m=new f,b=new I,y=new I;function v(t,e,i){h.fromArray(n,3*t),u.fromArray(n,3*e),d.fromArray(n,3*i),p.fromArray(a,2*t),g.fromArray(a,2*e),m.fromArray(a,2*i),u.sub(h),d.sub(h),g.sub(p),m.sub(p);const r=1/(g.x*m.y-m.x*g.y);isFinite(r)&&(b.copy(u).multiplyScalar(m.y).addScaledVector(d,-g.y).multiplyScalar(r),y.copy(d).multiplyScalar(g.x).addScaledVector(u,-m.x).multiplyScalar(r),l[t].add(b),l[e].add(b),l[i].add(b),c[t].add(y),c[e].add(y),c[i].add(y))}let x=this.groups;0===x.length&&(x=[{start:0,count:i.length}]);for(let t=0,e=x.length;t<e;++t){const e=x[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)v(i[t+0],i[t+1],i[t+2])}const _=new I,A=new I,w=new I,C=new I;function M(t){w.fromArray(r,3*t),C.copy(w);const e=l[t];_.copy(e),_.sub(w.multiplyScalar(w.dot(e))).normalize(),A.crossVectors(C,e);const i=A.dot(c[t])<0?-1:1;o[4*t]=_.x,o[4*t+1]=_.y,o[4*t+2]=_.z,o[4*t+3]=i}for(let t=0,e=x.length;t<e;++t){const e=x[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)M(i[t+0]),M(i[t+1]),M(i[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new $t(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new I,r=new I,a=new I,s=new I,o=new I,l=new I,c=new I,h=new I;if(t)for(let u=0,d=t.count;u<d;u+=3){const d=t.getX(u+0),p=t.getX(u+1),f=t.getX(u+2);n.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),a.fromBufferAttribute(e,f),c.subVectors(a,r),h.subVectors(n,r),c.cross(h),s.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,f),s.add(c),o.add(c),l.add(c),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,s=e.count;t<s;t+=3)n.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),a.fromBufferAttribute(e,t+2),c.subVectors(a,r),h.subVectors(n,r),c.cross(h),i.setXYZ(t+0,c.x,c.y,c.z),i.setXYZ(t+1,c.x,c.y,c.z),i.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const i=this.attributes;for(const n in i){if(void 0===t.attributes[n])continue;const r=i[n].array,a=t.attributes[n],s=a.array,o=a.itemSize*e,l=Math.min(s.length,r.length-o);for(let t=0,e=o;t<l;t++,e++)r[e]=s[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)ce.fromBufferAttribute(t,e),ce.normalize(),t.setXYZ(e,ce.x,ce.y,ce.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,r=t.normalized,a=new i.constructor(e.length*n);let s=0,o=0;for(let r=0,l=e.length;r<l;r++){s=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*n;for(let t=0;t<n;t++)a[o++]=i[s++]}return new $t(a,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new he,i=this.index.array,n=this.attributes;for(const r in n){const a=t(n[r],i);e.setAttribute(r,a)}const r=this.morphAttributes;for(const n in r){const a=[],s=r[n];for(let e=0,n=s.length;e<n;e++){const n=t(s[e],i);a.push(n)}e.morphAttributes[n]=a}e.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let t=0,i=a.length;t<i;t++){const i=a[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],a=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];a.push(n.toJSON(t.data))}a.length>0&&(n[e]=a,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],n=r[t];for(let t=0,r=n.length;t<r;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const a=t.groups;for(let t=0,e=a.length;t<e;t++){const e=a[t];this.addGroup(e.start,e.count,e.materialIndex)}const s=t.boundingBox;null!==s&&(this.boundingBox=s.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,void 0!==t.parameters&&(this.parameters=Object.assign({},t.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}he.prototype.isBufferGeometry=!0;const ue=new rt,de=new nt,pe=new J,fe=new I,ge=new I,me=new I,be=new I,ye=new I,ve=new I,xe=new I,_e=new I,Ae=new I,we=new f,Ce=new f,Me=new f,Ee=new I,Ie=new I;class Se extends Tt{constructor(t=new he,e=new Xt){super(),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(t,e){const i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0===n)return;if(null===i.boundingSphere&&i.computeBoundingSphere(),pe.copy(i.boundingSphere),pe.applyMatrix4(r),!1===t.ray.intersectsSphere(pe))return;if(ue.copy(r).invert(),de.copy(t.ray).applyMatrix4(ue),null!==i.boundingBox&&!1===de.intersectsBox(i.boundingBox))return;let a;if(i.isBufferGeometry){const r=i.index,s=i.attributes.position,o=i.morphAttributes.position,l=i.morphTargetsRelative,c=i.attributes.uv,h=i.attributes.uv2,u=i.groups,d=i.drawRange;if(null!==r)if(Array.isArray(n))for(let i=0,p=u.length;i<p;i++){const p=u[i],f=n[p.materialIndex];for(let i=Math.max(p.start,d.start),n=Math.min(r.count,Math.min(p.start+p.count,d.start+d.count));i<n;i+=3){const n=r.getX(i),u=r.getX(i+1),d=r.getX(i+2);a=Te(this,f,t,de,s,o,l,c,h,n,u,d),a&&(a.faceIndex=Math.floor(i/3),a.face.materialIndex=p.materialIndex,e.push(a))}}else{for(let i=Math.max(0,d.start),u=Math.min(r.count,d.start+d.count);i<u;i+=3){const u=r.getX(i),d=r.getX(i+1),p=r.getX(i+2);a=Te(this,n,t,de,s,o,l,c,h,u,d,p),a&&(a.faceIndex=Math.floor(i/3),e.push(a))}}else if(void 0!==s)if(Array.isArray(n))for(let i=0,r=u.length;i<r;i++){const r=u[i],p=n[r.materialIndex];for(let i=Math.max(r.start,d.start),n=Math.min(s.count,Math.min(r.start+r.count,d.start+d.count));i<n;i+=3){a=Te(this,p,t,de,s,o,l,c,h,i,i+1,i+2),a&&(a.faceIndex=Math.floor(i/3),a.face.materialIndex=r.materialIndex,e.push(a))}}else{for(let i=Math.max(0,d.start),r=Math.min(s.count,d.start+d.count);i<r;i+=3){a=Te(this,n,t,de,s,o,l,c,h,i,i+1,i+2),a&&(a.faceIndex=Math.floor(i/3),e.push(a))}}}else i.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function Te(t,e,i,n,r,a,s,o,l,c,h,u){fe.fromBufferAttribute(r,c),ge.fromBufferAttribute(r,h),me.fromBufferAttribute(r,u);const d=t.morphTargetInfluences;if(a&&d){xe.set(0,0,0),_e.set(0,0,0),Ae.set(0,0,0);for(let t=0,e=a.length;t<e;t++){const e=d[t],i=a[t];0!==e&&(be.fromBufferAttribute(i,c),ye.fromBufferAttribute(i,h),ve.fromBufferAttribute(i,u),s?(xe.addScaledVector(be,e),_e.addScaledVector(ye,e),Ae.addScaledVector(ve,e)):(xe.addScaledVector(be.sub(fe),e),_e.addScaledVector(ye.sub(ge),e),Ae.addScaledVector(ve.sub(me),e)))}fe.add(xe),ge.add(_e),me.add(Ae)}t.isSkinnedMesh&&(t.boneTransform(c,fe),t.boneTransform(h,ge),t.boneTransform(u,me));const p=function(t,e,i,n,r,a,s,o){let l;if(l=1===e.side?n.intersectTriangle(s,a,r,!0,o):n.intersectTriangle(r,a,s,2!==e.side,o),null===l)return null;Ie.copy(o),Ie.applyMatrix4(t.matrixWorld);const c=i.ray.origin.distanceTo(Ie);return c<i.near||c>i.far?null:{distance:c,point:Ie.clone(),object:t}}(t,e,i,n,fe,ge,me,Ee);if(p){o&&(we.fromBufferAttribute(o,c),Ce.fromBufferAttribute(o,h),Me.fromBufferAttribute(o,u),p.uv=Ot.getUV(Ee,fe,ge,me,we,Ce,Me,new f)),l&&(we.fromBufferAttribute(l,c),Ce.fromBufferAttribute(l,h),Me.fromBufferAttribute(l,u),p.uv2=Ot.getUV(Ee,fe,ge,me,we,Ce,Me,new f));const t={a:c,b:h,c:u,normal:new I,materialIndex:0};Ot.getNormal(fe,ge,me,t.normal),p.face=t}return p}Se.prototype.isMesh=!0;class Be extends he{constructor(t=1,e=1,i=1,n=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};const s=this;n=Math.floor(n),r=Math.floor(r),a=Math.floor(a);const o=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,i,n,r,a,p,f,g,m,b){const y=a/g,v=p/m,x=a/2,_=p/2,A=f/2,w=g+1,C=m+1;let M=0,E=0;const S=new I;for(let a=0;a<C;a++){const s=a*v-_;for(let o=0;o<w;o++){const u=o*y-x;S[t]=u*n,S[e]=s*r,S[i]=A,l.push(S.x,S.y,S.z),S[t]=0,S[e]=0,S[i]=f>0?1:-1,c.push(S.x,S.y,S.z),h.push(o/g),h.push(1-a/m),M+=1}}for(let t=0;t<m;t++)for(let e=0;e<g;e++){const i=u+e+w*t,n=u+e+w*(t+1),r=u+(e+1)+w*(t+1),a=u+(e+1)+w*t;o.push(i,n,a),o.push(n,r,a),E+=6}s.addGroup(d,E,b),d+=E,u+=M}p("z","y","x",-1,-1,i,e,t,a,r,0),p("z","y","x",1,-1,i,e,-t,a,r,1),p("x","z","y",1,1,t,i,e,n,a,2),p("x","z","y",1,-1,t,i,-e,n,a,3),p("x","y","z",1,-1,t,e,i,n,r,4),p("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(o),this.setAttribute("position",new ie(l,3)),this.setAttribute("normal",new ie(c,3)),this.setAttribute("uv",new ie(h,2))}static fromJSON(t){return new Be(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Fe(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function Le(t){const e={};for(let i=0;i<t.length;i++){const n=Fe(t[i]);for(const t in n)e[t]=n[t]}return e}const Ue={clone:Fe,merge:Le};class Re extends Vt{constructor(t){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Fe(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}Re.prototype.isShaderMaterial=!0;class De extends Tt{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new rt,this.projectionMatrix=new rt,this.projectionMatrixInverse=new rt}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}De.prototype.isCamera=!0;class Ne extends De{constructor(t=50,e=1,i=.1,n=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*a*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*r*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*a*Math.atan(Math.tan(.5*r*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,i,n,r,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*r*this.fov)/this.zoom,i=2*e,n=this.aspect*i,a=-.5*n;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,r=s.fullHeight;a+=s.offsetX*n/t,e-=s.offsetY*i/r,n*=s.width/t,i*=s.height/r}const o=this.filmOffset;0!==o&&(a+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+n,e,e-i,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}Ne.prototype.isPerspectiveCamera=!0;class ke extends Tt{constructor(t,e,i){if(super(),this.type="CubeCamera",!0!==i.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=i;const n=new Ne(90,1,t,e);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new I(1,0,0)),this.add(n);const r=new Ne(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new I(-1,0,0)),this.add(r);const a=new Ne(90,1,t,e);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new I(0,1,0)),this.add(a);const s=new Ne(90,1,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new I(0,-1,0)),this.add(s);const o=new Ne(90,1,t,e);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new I(0,0,1)),this.add(o);const l=new Ne(90,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new I(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const i=this.renderTarget,[n,r,a,s,o,l]=this.children,c=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const u=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0),t.render(e,n),t.setRenderTarget(i,1),t.render(e,r),t.setRenderTarget(i,2),t.render(e,a),t.setRenderTarget(i,3),t.render(e,s),t.setRenderTarget(i,4),t.render(e,o),i.texture.generateMipmaps=u,t.setRenderTarget(i,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c}}class Pe extends _{constructor(t,e,i,n,r,a,s,o,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:301,i,n,r,a,s,o,l,c),this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}Pe.prototype.isCubeTexture=!0;class ze extends C{constructor(t,e,i){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=i),super(t,t,e),e=e||{},this.texture=new Pe(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:1006,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=1023,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},n=new Be(5,5,5),r=new Re({name:"CubemapFromEquirect",uniforms:Fe(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const a=new Se(n,r),s=e.minFilter;1008===e.minFilter&&(e.minFilter=1006);return new ke(1,10,this).update(t,a),e.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(t,e,i,n){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,n);t.setRenderTarget(r)}}ze.prototype.isWebGLCubeRenderTarget=!0;const Oe=new I,Qe=new I,Ve=new g;class He{constructor(t=new I(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=Oe.subVectors(i,e).cross(Qe.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const i=t.delta(Oe),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:e.copy(i).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||Ve.getNormalMatrix(t),n=this.coplanarPoint(Oe).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}He.prototype.isPlane=!0;const Ge=new J,je=new I;class We{constructor(t=new He,e=new He,i=new He,n=new He,r=new He,a=new He){this.planes=[t,e,i,n,r,a]}set(t,e,i,n,r,a){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(i),s[3].copy(n),s[4].copy(r),s[5].copy(a),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t){const e=this.planes,i=t.elements,n=i[0],r=i[1],a=i[2],s=i[3],o=i[4],l=i[5],c=i[6],h=i[7],u=i[8],d=i[9],p=i[10],f=i[11],g=i[12],m=i[13],b=i[14],y=i[15];return e[0].setComponents(s-n,h-o,f-u,y-g).normalize(),e[1].setComponents(s+n,h+o,f+u,y+g).normalize(),e[2].setComponents(s+r,h+l,f+d,y+m).normalize(),e[3].setComponents(s-r,h-l,f-d,y-m).normalize(),e[4].setComponents(s-a,h-c,f-p,y-b).normalize(),e[5].setComponents(s+a,h+c,f+p,y+b).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ge.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ge)}intersectsSprite(t){return Ge.center.set(0,0,0),Ge.radius=.7071067811865476,Ge.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ge)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(i)<n)return!1}return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const n=e[i];if(je.x=n.normal.x>0?t.max.x:t.min.x,je.y=n.normal.y>0?t.max.y:t.min.y,je.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(je)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function qe(){let t=null,e=!1,i=null,n=null;function r(e,a){i(e,a),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Ze(t,e){const i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=n.get(e);return void((!t||t.version<e.version)&&n.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const a=n.get(e);void 0===a?n.set(e,function(e,n){const r=e.array,a=e.usage,s=t.createBuffer();t.bindBuffer(n,s),t.bufferData(n,r,a),e.onUploadCallback();let o=5126;return r instanceof Float32Array?o=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?e.isFloat16BufferAttribute?i?o=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):o=5123:r instanceof Int16Array?o=5122:r instanceof Uint32Array?o=5125:r instanceof Int32Array?o=5124:r instanceof Int8Array?o=5120:(r instanceof Uint8Array||r instanceof Uint8ClampedArray)&&(o=5121),{buffer:s,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):a.version<e.version&&(!function(e,n,r){const a=n.array,s=n.updateRange;t.bindBuffer(r,e),-1===s.count?t.bufferSubData(r,0,a):(i?t.bufferSubData(r,s.offset*a.BYTES_PER_ELEMENT,a,s.offset,s.count):t.bufferSubData(r,s.offset*a.BYTES_PER_ELEMENT,a.subarray(s.offset,s.offset+s.count)),s.count=-1)}(a.buffer,e,r),a.version=e.version)}}}class Je extends he{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};const r=t/2,a=e/2,s=Math.floor(i),o=Math.floor(n),l=s+1,c=o+1,h=t/s,u=e/o,d=[],p=[],f=[],g=[];for(let t=0;t<c;t++){const e=t*u-a;for(let i=0;i<l;i++){const n=i*h-r;p.push(n,-e,0),f.push(0,0,1),g.push(i/s),g.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<s;e++){const i=e+l*t,n=e+l*(t+1),r=e+1+l*(t+1),a=e+1+l*t;d.push(i,n,a),d.push(n,r,a)}this.setIndex(d),this.setAttribute("position",new ie(p,3)),this.setAttribute("normal",new ie(f,3)),this.setAttribute("uv",new ie(g,2))}static fromJSON(t){return new Je(t.width,t.height,t.widthSegments,t.heightSegments)}}const Xe={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenTint, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenTint * ( D * V );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec;\n\t\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\t\treflectVec = reflect( - viewDir, normal );\n\t\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\t#else\n\t\t\t\treflectVec = refract( - viewDir, normal, refractionRatio );\n\t\t\t#endif\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularTintFactor = specularTint;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARTINTMAP\n\t\t\tspecularTintFactor *= specularTintMapTexelToLinear( texture2D( specularTintMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularTintFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularTintFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenTint = sheenTint;\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenTint;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenTint, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform vec2 morphTargetsTextureSize;\n\t\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\n\t\t\tfloat texelIndex = float( vertexIndex * stride + offset );\n\t\t\tfloat y = floor( texelIndex / morphTargetsTextureSize.x );\n\t\t\tfloat x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tvec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );\n\t\t\treturn texture( morphTargetsTexture, morphUV ).xyz;\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\t#ifndef USE_MORPHNORMALS\n\t\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\t\t\t#else\n\t\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\t\t\t#endif\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationTint, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationTint;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( float roughness, float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 diffuseColor, vec3 specularColor, float specularF90,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularTint;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARTINTMAP\n\t\tuniform sampler2D specularTintMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenTint;\n\tuniform float sheenRoughness;\n#endif\nvarying vec3 vViewPosition;\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 <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 <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - clearcoat * Fcc ) + clearcoatSpecular * clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\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 <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},Ye={common:{diffuse:{value:new Jt(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new g},uv2Transform:{value:new g},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new f(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Jt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Jt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new g}},sprite:{diffuse:{value:new Jt(16777215)},opacity:{value:1},center:{value:new f(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new g}}},Ke={basic:{uniforms:Le([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.fog]),vertexShader:Xe.meshbasic_vert,fragmentShader:Xe.meshbasic_frag},lambert:{uniforms:Le([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.fog,Ye.lights,{emissive:{value:new Jt(0)}}]),vertexShader:Xe.meshlambert_vert,fragmentShader:Xe.meshlambert_frag},phong:{uniforms:Le([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,Ye.lights,{emissive:{value:new Jt(0)},specular:{value:new Jt(1118481)},shininess:{value:30}}]),vertexShader:Xe.meshphong_vert,fragmentShader:Xe.meshphong_frag},standard:{uniforms:Le([Ye.common,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.roughnessmap,Ye.metalnessmap,Ye.fog,Ye.lights,{emissive:{value:new Jt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Xe.meshphysical_vert,fragmentShader:Xe.meshphysical_frag},toon:{uniforms:Le([Ye.common,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.gradientmap,Ye.fog,Ye.lights,{emissive:{value:new Jt(0)}}]),vertexShader:Xe.meshtoon_vert,fragmentShader:Xe.meshtoon_frag},matcap:{uniforms:Le([Ye.common,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,{matcap:{value:null}}]),vertexShader:Xe.meshmatcap_vert,fragmentShader:Xe.meshmatcap_frag},points:{uniforms:Le([Ye.points,Ye.fog]),vertexShader:Xe.points_vert,fragmentShader:Xe.points_frag},dashed:{uniforms:Le([Ye.common,Ye.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Xe.linedashed_vert,fragmentShader:Xe.linedashed_frag},depth:{uniforms:Le([Ye.common,Ye.displacementmap]),vertexShader:Xe.depth_vert,fragmentShader:Xe.depth_frag},normal:{uniforms:Le([Ye.common,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,{opacity:{value:1}}]),vertexShader:Xe.meshnormal_vert,fragmentShader:Xe.meshnormal_frag},sprite:{uniforms:Le([Ye.sprite,Ye.fog]),vertexShader:Xe.sprite_vert,fragmentShader:Xe.sprite_frag},background:{uniforms:{uvTransform:{value:new g},t2D:{value:null}},vertexShader:Xe.background_vert,fragmentShader:Xe.background_frag},cube:{uniforms:Le([Ye.envmap,{opacity:{value:1}}]),vertexShader:Xe.cube_vert,fragmentShader:Xe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Xe.equirect_vert,fragmentShader:Xe.equirect_frag},distanceRGBA:{uniforms:Le([Ye.common,Ye.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Xe.distanceRGBA_vert,fragmentShader:Xe.distanceRGBA_frag},shadow:{uniforms:Le([Ye.lights,Ye.fog,{color:{value:new Jt(0)},opacity:{value:1}}]),vertexShader:Xe.shadow_vert,fragmentShader:Xe.shadow_frag}};function $e(t,e,i,n,r){const a=new Jt(0);let s,o,l=0,c=null,h=0,u=null;function d(t,e){i.buffers.color.setClear(t.r,t.g,t.b,e,r)}return{getClearColor:function(){return a},setClearColor:function(t,e=1){a.set(t),l=e,d(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,d(a,l)},render:function(i,r){let p=!1,f=!0===r.isScene?r.background:null;f&&f.isTexture&&(f=e.get(f));const g=t.xr,m=g.getSession&&g.getSession();m&&"additive"===m.environmentBlendMode&&(f=null),null===f?d(a,l):f&&f.isColor&&(d(f,1),p=!0),(t.autoClear||p)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||306===f.mapping)?(void 0===o&&(o=new Se(new Be(1,1,1),new Re({name:"BackgroundCubeMaterial",uniforms:Fe(Ke.cube.uniforms),vertexShader:Ke.cube.vertexShader,fragmentShader:Ke.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(o)),o.material.uniforms.envMap.value=f,o.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,c===f&&h===f.version&&u===t.toneMapping||(o.material.needsUpdate=!0,c=f,h=f.version,u=t.toneMapping),i.unshift(o,o.geometry,o.material,0,0,null)):f&&f.isTexture&&(void 0===s&&(s=new Se(new Je(2,2),new Re({name:"BackgroundMaterial",uniforms:Fe(Ke.background.uniforms),vertexShader:Ke.background.vertexShader,fragmentShader:Ke.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(s)),s.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),s.material.uniforms.uvTransform.value.copy(f.matrix),c===f&&h===f.version&&u===t.toneMapping||(s.material.needsUpdate=!0,c=f,h=f.version,u=t.toneMapping),i.unshift(s,s.geometry,s.material,0,0,null))}}}function ti(t,e,i,n){const r=t.getParameter(34921),a=n.isWebGL2?null:e.get("OES_vertex_array_object"),s=n.isWebGL2||null!==a,o={},l=d(null);let c=l;function h(e){return n.isWebGL2?t.bindVertexArray(e):a.bindVertexArrayOES(e)}function u(e){return n.isWebGL2?t.deleteVertexArray(e):a.deleteVertexArrayOES(e)}function d(t){const e=[],i=[],n=[];for(let t=0;t<r;t++)e[t]=0,i[t]=0,n[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:n,object:t,attributes:{},index:null}}function p(){const t=c.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function f(t){g(t,0)}function g(i,r){const a=c.newAttributes,s=c.enabledAttributes,o=c.attributeDivisors;if(a[i]=1,0===s[i]&&(t.enableVertexAttribArray(i),s[i]=1),o[i]!==r){(n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),o[i]=r}}function m(){const e=c.newAttributes,i=c.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function b(e,i,r,a,s,o){!0!==n.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,i,r,a,s,o):t.vertexAttribIPointer(e,i,r,s,o)}function y(){v(),c!==l&&(c=l,h(c.object))}function v(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,u,y,v){let x=!1;if(s){const e=function(e,i,r){const s=!0===r.wireframe;let l=o[e.id];void 0===l&&(l={},o[e.id]=l);let c=l[i.id];void 0===c&&(c={},l[i.id]=c);let h=c[s];void 0===h&&(h=d(n.isWebGL2?t.createVertexArray():a.createVertexArrayOES()),c[s]=h);return h}(y,u,l);c!==e&&(c=e,h(c.object)),x=function(t,e){const i=c.attributes,n=t.attributes;let r=0;for(const t in n){const e=i[t],a=n[t];if(void 0===e)return!0;if(e.attribute!==a)return!0;if(e.data!==a.data)return!0;r++}return c.attributesNum!==r||c.index!==e}(y,v),x&&function(t,e){const i={},n=t.attributes;let r=0;for(const t in n){const e=n[t],a={};a.attribute=e,e.data&&(a.data=e.data),i[t]=a,r++}c.attributes=i,c.attributesNum=r,c.index=e}(y,v)}else{const t=!0===l.wireframe;c.geometry===y.id&&c.program===u.id&&c.wireframe===t||(c.geometry=y.id,c.program=u.id,c.wireframe=t,x=!0)}!0===r.isInstancedMesh&&(x=!0),null!==v&&i.update(v,34963),x&&(!function(r,a,s,o){if(!1===n.isWebGL2&&(r.isInstancedMesh||o.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=o.attributes,c=s.getAttributes(),h=a.defaultAttributeValues;for(const e in c){const n=c[e];if(n.location>=0){let a=l[e];if(void 0===a&&("instanceMatrix"===e&&r.instanceMatrix&&(a=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(a=r.instanceColor)),void 0!==a){const e=a.normalized,s=a.itemSize,l=i.get(a);if(void 0===l)continue;const c=l.buffer,h=l.type,u=l.bytesPerElement;if(a.isInterleavedBufferAttribute){const i=a.data,l=i.stride,d=a.offset;if(i&&i.isInstancedInterleavedBuffer){for(let t=0;t<n.locationSize;t++)g(n.location+t,i.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=i.meshPerAttribute*i.count)}else for(let t=0;t<n.locationSize;t++)f(n.location+t);t.bindBuffer(34962,c);for(let t=0;t<n.locationSize;t++)b(n.location+t,s/n.locationSize,h,e,l*u,(d+s/n.locationSize*t)*u)}else{if(a.isInstancedBufferAttribute){for(let t=0;t<n.locationSize;t++)g(n.location+t,a.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let t=0;t<n.locationSize;t++)f(n.location+t);t.bindBuffer(34962,c);for(let t=0;t<n.locationSize;t++)b(n.location+t,s/n.locationSize,h,e,s*u,s/n.locationSize*t*u)}}else if(void 0!==h){const i=h[e];if(void 0!==i)switch(i.length){case 2:t.vertexAttrib2fv(n.location,i);break;case 3:t.vertexAttrib3fv(n.location,i);break;case 4:t.vertexAttrib4fv(n.location,i);break;default:t.vertexAttrib1fv(n.location,i)}}}}m()}(r,l,u,y),null!==v&&t.bindBuffer(34963,i.get(v).buffer))},reset:y,resetDefaultState:v,dispose:function(){y();for(const t in o){const e=o[t];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete o[t]}},releaseStatesOfGeometry:function(t){if(void 0===o[t.id])return;const e=o[t.id];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete o[t.id]},releaseStatesOfProgram:function(t){for(const e in o){const i=o[e];if(void 0===i[t.id])continue;const n=i[t.id];for(const t in n)u(n[t].object),delete n[t];delete i[t.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:m}}function ei(t,e,i,n){const r=n.isWebGL2;let a;this.setMode=function(t){a=t},this.render=function(e,n){t.drawArrays(a,e,n),i.update(n,a,1)},this.renderInstances=function(n,s,o){if(0===o)return;let l,c;if(r)l=t,c="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](a,n,s,o),i.update(s,a,o)}}function ii(t,e,i){let n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let s=void 0!==i.precision?i.precision:"highp";const o=r(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);const l=a||e.has("WEBGL_draw_buffers"),c=!0===i.logarithmicDepthBuffer,h=t.getParameter(34930),u=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),f=t.getParameter(34921),g=t.getParameter(36347),m=t.getParameter(36348),b=t.getParameter(36349),y=u>0,v=a||e.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");n=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:g,maxVaryings:m,maxFragmentUniforms:b,vertexTextures:y,floatFragmentTextures:v,floatVertexTextures:y&&v,maxSamples:a?t.getParameter(36183):0}}function ni(t){const e=this;let i=null,n=0,r=!1,a=!1;const s=new He,o=new g,l={value:null,needsUpdate:!1};function c(){l.value!==i&&(l.value=i,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(t,i,n,r){const a=null!==t?t.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const e=n+4*a,r=i.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,i=n;e!==a;++e,i+=4)s.copy(t[e]).applyMatrix4(r,o),s.normal.toArray(c,i),c[i+3]=s.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,a){const s=0!==t.length||e||0!==n||r;return r=e,i=h(t,a,0),n=t.length,s},this.beginShadows=function(){a=!0,h(null)},this.endShadows=function(){a=!1,c()},this.setState=function(e,s,o){const u=e.clippingPlanes,d=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!r||null===u||0===u.length||a&&!p)a?h(null):c();else{const t=a?0:n,e=4*t;let r=f.clippingState||null;l.value=r,r=h(u,s,e,o);for(let t=0;t!==e;++t)r[t]=i[t];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function ri(t){let e=new WeakMap;function i(t,e){return 303===e?t.mapping=301:304===e&&(t.mapping=302),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const a=r.mapping;if(303===a||304===a){if(e.has(r)){return i(e.get(r).texture,r.mapping)}{const a=r.image;if(a&&a.height>0){const s=t.getRenderTarget(),o=new ze(a.height/2);return o.fromEquirectangularTexture(t,r),e.set(r,o),t.setRenderTarget(s),r.addEventListener("dispose",n),i(o.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}Ke.physical={uniforms:Le([Ke.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new f(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenTint:{value:new Jt(0)},sheenRoughness:{value:0},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new f},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationTint:{value:new Jt(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularTint:{value:new Jt(1,1,1)},specularTintMap:{value:null}}]),vertexShader:Xe.meshphysical_vert,fragmentShader:Xe.meshphysical_frag};class ai extends De{constructor(t=-1,e=1,i=1,n=-1,r=.1,a=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,n,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let r=i-t,a=i+t,s=n+e,o=n-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,a=r+t*this.view.width,s-=e*this.view.offsetY,o=s-e*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}ai.prototype.isOrthographicCamera=!0;class si extends Re{constructor(t){super(t),this.type="RawShaderMaterial"}}si.prototype.isRawShaderMaterial=!0;const oi=Math.pow(2,8),li=[.125,.215,.35,.446,.526,.582],ci=5+li.length,hi={3e3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6},ui=new ai,{_lodPlanes:di,_sizeLods:pi,_sigmas:fi}=Ai(),gi=new Jt;let mi=null;const bi=(1+Math.sqrt(5))/2,yi=1/bi,vi=[new I(1,1,1),new I(-1,1,1),new I(1,1,-1),new I(-1,1,-1),new I(0,bi,yi),new I(0,bi,-yi),new I(yi,0,bi),new I(-yi,0,bi),new I(bi,yi,0),new I(-bi,yi,0)];class xi{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=function(t){const e=new Float32Array(t),i=new I(0,1,0);return new si({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i},inputEncoding:{value:hi[3e3]},outputEncoding:{value:hi[3e3]}},vertexShader:Ii(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${Si()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}(20),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,i=.1,n=100){mi=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(t,i,n,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Ei(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Mi(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<di.length;t++)di[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(mi),t.scissorTest=!1,Ci(t,0,0,t.width,t.height)}_fromTexture(t){mi=this._renderer.getRenderTarget();const e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:1003,minFilter:1003,generateMipmaps:!1,type:1009,format:1023,encoding:_i(t)?t.encoding:3002,depthBuffer:!1},i=wi(e);return i.depthBuffer=!t,this._pingPongRenderTarget=wi(e),i}_compileMaterial(t){const e=new Se(di[0],t);this._renderer.compile(e,ui)}_sceneToCubeUV(t,e,i,n){const r=new Ne(90,1,e,i),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.outputEncoding,h=o.toneMapping;o.getClearColor(gi),o.toneMapping=0,o.outputEncoding=3e3,o.autoClear=!1;const u=new Xt({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new Se(new Be,u);let p=!1;const f=t.background;f?f.isColor&&(u.color.copy(f),t.background=null,p=!0):(u.color.copy(gi),p=!0);for(let e=0;e<6;e++){const i=e%3;0==i?(r.up.set(0,a[e],0),r.lookAt(s[e],0,0)):1==i?(r.up.set(0,0,a[e]),r.lookAt(0,s[e],0)):(r.up.set(0,a[e],0),r.lookAt(0,0,s[e])),Ci(n,i*oi,e>2?oi:0,oi,oi),o.setRenderTarget(n),p&&o.render(d,r),o.render(t,r)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=h,o.outputEncoding=c,o.autoClear=l,t.background=f}_setEncoding(t,e){!0===this._renderer.capabilities.isWebGL2&&1023===e.format&&1009===e.type&&3001===e.encoding?t.value=hi[3e3]:t.value=hi[e.encoding]}_textureToCubeUV(t,e){const i=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Ei()):null==this._equirectShader&&(this._equirectShader=Mi());const n=t.isCubeTexture?this._cubemapShader:this._equirectShader,r=new Se(di[0],n),a=n.uniforms;a.envMap.value=t,t.isCubeTexture||a.texelSize.value.set(1/t.image.width,1/t.image.height),this._setEncoding(a.inputEncoding,t),this._setEncoding(a.outputEncoding,e.texture),Ci(e,0,0,3*oi,2*oi),i.setRenderTarget(e),i.render(r,ui)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let e=1;e<ci;e++){const i=Math.sqrt(fi[e]*fi[e]-fi[e-1]*fi[e-1]),n=vi[(e-1)%vi.length];this._blur(t,e-1,e,i,n)}e.autoClear=i}_blur(t,e,i,n,r){const a=this._pingPongRenderTarget;this._halfBlur(t,a,e,i,n,"latitudinal",r),this._halfBlur(a,t,i,i,n,"longitudinal",r)}_halfBlur(t,e,i,n,r,a,s){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Se(di[n],l),h=l.uniforms,u=pi[i]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const g=[];let m=0;for(let t=0;t<20;++t){const e=t/p,i=Math.exp(-e*e/2);g.push(i),0==t?m+=i:t<f&&(m+=2*i)}for(let t=0;t<g.length;t++)g[t]=g[t]/m;h.envMap.value=t.texture,h.samples.value=f,h.weights.value=g,h.latitudinal.value="latitudinal"===a,s&&(h.poleAxis.value=s),h.dTheta.value=d,h.mipInt.value=8-i,this._setEncoding(h.inputEncoding,t.texture),this._setEncoding(h.outputEncoding,t.texture);const b=pi[n];Ci(e,3*Math.max(0,oi-2*b),(0===n?0:2*oi)+2*b*(n>4?n-8+4:0),3*b,2*b),o.setRenderTarget(e),o.render(c,ui)}}function _i(t){return void 0!==t&&1009===t.type&&(3e3===t.encoding||3001===t.encoding||3007===t.encoding)}function Ai(){const t=[],e=[],i=[];let n=8;for(let r=0;r<ci;r++){const a=Math.pow(2,n);e.push(a);let s=1/a;r>4?s=li[r-8+4-1]:0==r&&(s=0),i.push(s);const o=1/(a-1),l=-o/2,c=1+o/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,d=6,p=3,f=2,g=1,m=new Float32Array(p*d*u),b=new Float32Array(f*d*u),y=new Float32Array(g*d*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];m.set(n,p*d*t),b.set(h,f*d*t);const r=[t,t,t,t,t,t];y.set(r,g*d*t)}const v=new he;v.setAttribute("position",new $t(m,p)),v.setAttribute("uv",new $t(b,f)),v.setAttribute("faceIndex",new $t(y,g)),t.push(v),n>4&&n--}return{_lodPlanes:t,_sizeLods:e,_sigmas:i}}function wi(t){const e=new C(3*oi,3*oi,t);return e.texture.mapping=306,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Ci(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function Mi(){const t=new f(1,1);return new si({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:hi[3e3]},outputEncoding:{value:hi[3e3]}},vertexShader:Ii(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${Si()}\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}function Ei(){return new si({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:hi[3e3]},outputEncoding:{value:hi[3e3]}},vertexShader:Ii(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${Si()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}function Ii(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Si(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}function Ti(t){let e=new WeakMap,i=null;function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const a=r.mapping,s=303===a||304===a,o=301===a||302===a;if(s||o){if(e.has(r))return e.get(r).texture;{const a=r.image;if(s&&a&&a.height>0||o&&a&&function(t){let e=0;for(let i=0;i<6;i++)void 0!==t[i]&&e++;return 6===e}(a)){const a=t.getRenderTarget();null===i&&(i=new xi(t));const o=s?i.fromEquirectangular(r):i.fromCubemap(r);return e.set(r,o),t.setRenderTarget(a),r.addEventListener("dispose",n),o.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function Bi(t){const e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(t){t.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("EXT_multisampled_render_to_texture")},get:function(t){const e=i(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function Fi(t,e,i,n){const r={},a=new WeakMap;function s(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);o.removeEventListener("dispose",s),delete r[o.id];const l=a.get(o);l&&(e.remove(l),a.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(t){const i=[],n=t.index,r=t.attributes.position;let s=0;if(null!==n){const t=n.array;s=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],r=t[e+1],a=t[e+2];i.push(n,r,r,a,a,n)}}else{const t=r.array;s=r.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,r=e+2;i.push(t,n,n,r,r,t)}}const o=new(m(i)>65535?ee:te)(i,1);o.version=s;const l=a.get(t);l&&e.remove(l),a.set(t,o)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",s),r[e.id]=!0,i.memory.geometries++),e},update:function(t){const i=t.attributes;for(const t in i)e.update(i[t],34962);const n=t.morphAttributes;for(const t in n){const i=n[t];for(let t=0,n=i.length;t<n;t++)e.update(i[t],34962)}},getWireframeAttribute:function(t){const e=a.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&o(t)}else o(t);return a.get(t)}}}function Li(t,e,i,n){const r=n.isWebGL2;let a,s,o;this.setMode=function(t){a=t},this.setIndex=function(t){s=t.type,o=t.bytesPerElement},this.render=function(e,n){t.drawElements(a,n,s,e*o),i.update(n,a,1)},this.renderInstances=function(n,l,c){if(0===c)return;let h,u;if(r)h=t,u="drawElementsInstanced";else if(h=e.get("ANGLE_instanced_arrays"),u="drawElementsInstancedANGLE",null===h)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[u](a,l,s,n*o,c),i.update(l,a,c)}}function Ui(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}class Ri extends _{constructor(t=null,e=1,i=1,n=1){super(null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}function Di(t,e){return t[0]-e[0]}function Ni(t,e){return Math.abs(e[1])-Math.abs(t[1])}function ki(t,e){let i=1;const n=e.isInterleavedBufferAttribute?e.data.array:e.array;n instanceof Int8Array?i=127:n instanceof Int16Array?i=32767:n instanceof Int32Array?i=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",n),t.divideScalar(i)}function Pi(t,e,i){const n={},r=new Float32Array(8),a=new WeakMap,s=new I,o=[];for(let t=0;t<8;t++)o[t]=[t,0];return{update:function(l,c,h,u){const d=l.morphTargetInfluences;if(!0===e.isWebGL2){const n=c.morphAttributes.position.length;let r=a.get(c);if(void 0===r||r.count!==n){void 0!==r&&r.texture.dispose();const t=void 0!==c.morphAttributes.normal,i=c.morphAttributes.position,o=c.morphAttributes.normal||[],l=!0===t?2:1;let h=c.attributes.position.count*l,u=1;h>e.maxTextureSize&&(u=Math.ceil(h/e.maxTextureSize),h=e.maxTextureSize);const d=new Float32Array(h*u*4*n),p=new Ri(d,h,u,n);p.format=1023,p.type=1015;const g=4*l;for(let e=0;e<n;e++){const n=i[e],r=o[e],a=h*u*4*e;for(let e=0;e<n.count;e++){s.fromBufferAttribute(n,e),!0===n.normalized&&ki(s,n);const i=e*g;d[a+i+0]=s.x,d[a+i+1]=s.y,d[a+i+2]=s.z,d[a+i+3]=0,!0===t&&(s.fromBufferAttribute(r,e),!0===r.normalized&&ki(s,r),d[a+i+4]=s.x,d[a+i+5]=s.y,d[a+i+6]=s.z,d[a+i+7]=0)}}r={count:n,texture:p,size:new f(h,u)},a.set(c,r)}let o=0;for(let t=0;t<d.length;t++)o+=d[t];const l=c.morphTargetsRelative?1:1-o;u.getUniforms().setValue(t,"morphTargetBaseInfluence",l),u.getUniforms().setValue(t,"morphTargetInfluences",d),u.getUniforms().setValue(t,"morphTargetsTexture",r.texture,i),u.getUniforms().setValue(t,"morphTargetsTextureSize",r.size)}else{const e=void 0===d?0:d.length;let i=n[c.id];if(void 0===i||i.length!==e){i=[];for(let t=0;t<e;t++)i[t]=[t,0];n[c.id]=i}for(let t=0;t<e;t++){const e=i[t];e[0]=t,e[1]=d[t]}i.sort(Ni);for(let t=0;t<8;t++)t<e&&i[t][1]?(o[t][0]=i[t][0],o[t][1]=i[t][1]):(o[t][0]=Number.MAX_SAFE_INTEGER,o[t][1]=0);o.sort(Di);const a=c.morphAttributes.position,s=c.morphAttributes.normal;let l=0;for(let t=0;t<8;t++){const e=o[t],i=e[0],n=e[1];i!==Number.MAX_SAFE_INTEGER&&n?(a&&c.getAttribute("morphTarget"+t)!==a[i]&&c.setAttribute("morphTarget"+t,a[i]),s&&c.getAttribute("morphNormal"+t)!==s[i]&&c.setAttribute("morphNormal"+t,s[i]),r[t]=n,l+=n):(a&&!0===c.hasAttribute("morphTarget"+t)&&c.deleteAttribute("morphTarget"+t),s&&!0===c.hasAttribute("morphNormal"+t)&&c.deleteAttribute("morphNormal"+t),r[t]=0)}const h=c.morphTargetsRelative?1:1-l;u.getUniforms().setValue(t,"morphTargetBaseInfluence",h),u.getUniforms().setValue(t,"morphTargetInfluences",r)}}}}function zi(t,e,i,n){let r=new WeakMap;function a(t){const e=t.target;e.removeEventListener("dispose",a),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(t){const s=n.render.frame,o=t.geometry,l=e.get(t,o);return r.get(l)!==s&&(e.update(l),r.set(l,s)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",a)&&t.addEventListener("dispose",a),i.update(t.instanceMatrix,34962),null!==t.instanceColor&&i.update(t.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}Ri.prototype.isDataTexture2DArray=!0;class Oi extends _{constructor(t=null,e=1,i=1,n=1){super(null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Oi.prototype.isDataTexture3D=!0;const Qi=new _,Vi=new Ri,Hi=new Oi,Gi=new Pe,ji=[],Wi=[],qi=new Float32Array(16),Zi=new Float32Array(9),Ji=new Float32Array(4);function Xi(t,e,i){const n=t[0];if(n<=0||n>0)return t;const r=e*i;let a=ji[r];if(void 0===a&&(a=new Float32Array(r),ji[r]=a),0!==e){n.toArray(a,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(a,r)}return a}function Yi(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function Ki(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function $i(t,e){let i=Wi[e];void 0===i&&(i=new Int32Array(e),Wi[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function tn(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function en(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Yi(i,e))return;t.uniform2fv(this.addr,e),Ki(i,e)}}function nn(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(Yi(i,e))return;t.uniform3fv(this.addr,e),Ki(i,e)}}function rn(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Yi(i,e))return;t.uniform4fv(this.addr,e),Ki(i,e)}}function an(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Yi(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Ki(i,e)}else{if(Yi(i,n))return;Ji.set(n),t.uniformMatrix2fv(this.addr,!1,Ji),Ki(i,n)}}function sn(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Yi(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Ki(i,e)}else{if(Yi(i,n))return;Zi.set(n),t.uniformMatrix3fv(this.addr,!1,Zi),Ki(i,n)}}function on(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Yi(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Ki(i,e)}else{if(Yi(i,n))return;qi.set(n),t.uniformMatrix4fv(this.addr,!1,qi),Ki(i,n)}}function ln(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function cn(t,e){const i=this.cache;Yi(i,e)||(t.uniform2iv(this.addr,e),Ki(i,e))}function hn(t,e){const i=this.cache;Yi(i,e)||(t.uniform3iv(this.addr,e),Ki(i,e))}function un(t,e){const i=this.cache;Yi(i,e)||(t.uniform4iv(this.addr,e),Ki(i,e))}function dn(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function pn(t,e){const i=this.cache;Yi(i,e)||(t.uniform2uiv(this.addr,e),Ki(i,e))}function fn(t,e){const i=this.cache;Yi(i,e)||(t.uniform3uiv(this.addr,e),Ki(i,e))}function gn(t,e){const i=this.cache;Yi(i,e)||(t.uniform4uiv(this.addr,e),Ki(i,e))}function mn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTexture2D(e||Qi,r)}function bn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||Hi,r)}function yn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTextureCube(e||Gi,r)}function vn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||Vi,r)}function xn(t,e){t.uniform1fv(this.addr,e)}function _n(t,e){const i=Xi(e,this.size,2);t.uniform2fv(this.addr,i)}function An(t,e){const i=Xi(e,this.size,3);t.uniform3fv(this.addr,i)}function wn(t,e){const i=Xi(e,this.size,4);t.uniform4fv(this.addr,i)}function Cn(t,e){const i=Xi(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function Mn(t,e){const i=Xi(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function En(t,e){const i=Xi(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function In(t,e){t.uniform1iv(this.addr,e)}function Sn(t,e){t.uniform2iv(this.addr,e)}function Tn(t,e){t.uniform3iv(this.addr,e)}function Bn(t,e){t.uniform4iv(this.addr,e)}function Fn(t,e){t.uniform1uiv(this.addr,e)}function Ln(t,e){t.uniform2uiv(this.addr,e)}function Un(t,e){t.uniform3uiv(this.addr,e)}function Rn(t,e){t.uniform4uiv(this.addr,e)}function Dn(t,e,i){const n=e.length,r=$i(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTexture2D(e[t]||Qi,r[t])}function Nn(t,e,i){const n=e.length,r=$i(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTextureCube(e[t]||Gi,r[t])}function kn(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return tn;case 35664:return en;case 35665:return nn;case 35666:return rn;case 35674:return an;case 35675:return sn;case 35676:return on;case 5124:case 35670:return ln;case 35667:case 35671:return cn;case 35668:case 35672:return hn;case 35669:case 35673:return un;case 5125:return dn;case 36294:return pn;case 36295:return fn;case 36296:return gn;case 35678:case 36198:case 36298:case 36306:case 35682:return mn;case 35679:case 36299:case 36307:return bn;case 35680:case 36300:case 36308:case 36293:return yn;case 36289:case 36303:case 36311:case 36292:return vn}}(e.type)}function Pn(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return xn;case 35664:return _n;case 35665:return An;case 35666:return wn;case 35674:return Cn;case 35675:return Mn;case 35676:return En;case 5124:case 35670:return In;case 35667:case 35671:return Sn;case 35668:case 35672:return Tn;case 35669:case 35673:return Bn;case 5125:return Fn;case 36294:return Ln;case 36295:return Un;case 36296:return Rn;case 35678:case 36198:case 36298:case 36306:case 35682:return Dn;case 35680:case 36300:case 36308:case 36293:return Nn}}(e.type)}function zn(t){this.id=t,this.seq=[],this.map={}}Pn.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Ki(e,t)},zn.prototype.setValue=function(t,e,i){const n=this.seq;for(let r=0,a=n.length;r!==a;++r){const a=n[r];a.setValue(t,e[a.id],i)}};const On=/(\w+)(\])?(\[|\.)?/g;function Qn(t,e){t.seq.push(e),t.map[e.id]=e}function Vn(t,e,i){const n=t.name,r=n.length;for(On.lastIndex=0;;){const a=On.exec(n),s=On.lastIndex;let o=a[1];const l="]"===a[2],c=a[3];if(l&&(o|=0),void 0===c||"["===c&&s+2===r){Qn(i,void 0===c?new kn(o,t,e):new Pn(o,t,e));break}{let t=i.map[o];void 0===t&&(t=new zn(o),Qn(i,t)),i=t}}}function Hn(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,35718);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);Vn(i,t.getUniformLocation(e,i.name),this)}}function Gn(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}Hn.prototype.setValue=function(t,e,i,n){const r=this.map[e];void 0!==r&&r.setValue(t,i,n)},Hn.prototype.setOptional=function(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)},Hn.upload=function(t,e,i,n){for(let r=0,a=e.length;r!==a;++r){const a=e[r],s=i[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,n)}},Hn.seqWithValue=function(t,e){const i=[];for(let n=0,r=t.length;n!==r;++n){const r=t[n];r.id in e&&i.push(r)}return i};let jn=0;function Wn(t){switch(t){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function qn(t,e,i){const n=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();return n&&""===r?"":i.toUpperCase()+"\n\n"+r+"\n\n"+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function Zn(t,e){const i=Wn(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function Jn(t,e){const i=Wn(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function Xn(t,e){let i;switch(e){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Yn(t){return""!==t}function Kn(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function $n(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const tr=/^[ \t]*#include +<([\w\d./]+)>/gm;function er(t){return t.replace(tr,ir)}function ir(t,e){const i=Xe[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return er(i)}const nr=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,rr=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function ar(t){return t.replace(rr,or).replace(nr,sr)}function sr(t,e,i,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),or(t,e,i,n)}function or(t,e,i,n){let r="";for(let t=parseInt(e);t<parseInt(i);t++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function lr(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function cr(t,e,i,n){const r=t.getContext(),a=i.defines;let s=i.vertexShader,o=i.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(i),c=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case 301:case 302:e="ENVMAP_TYPE_CUBE";break;case 306:case 307:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),h=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case 302:case 307:e="ENVMAP_MODE_REFRACTION"}return e}(i),u=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(i),d=t.gammaFactor>0?t.gammaFactor:1,p=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Yn).join("\n")}(i),f=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(a),g=r.createProgram();let m,b,y=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(m=[f].filter(Yn).join("\n"),m.length>0&&(m+="\n"),b=[p,f].filter(Yn).join("\n"),b.length>0&&(b+="\n")):(m=[lr(i),"#define SHADER_NAME "+i.shaderName,f,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularTintMap?"#define USE_SPECULARTINTMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphTargets&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargets&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Yn).join("\n"),b=[p,lr(i),"#define SHADER_NAME "+i.shaderName,f,"#define GAMMA_FACTOR "+d,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.envMap?"#define "+h:"",i.envMap?"#define "+u:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularTintMap?"#define USE_SPECULARTINTMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.sheen?"#define USE_SHEEN":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(i.extensionShaderTextureLOD||i.envMap)&&i.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?Xe.tonemapping_pars_fragment:"",0!==i.toneMapping?Xn("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",1022===i.format?"#define OPAQUE":"",Xe.encodings_pars_fragment,i.map?Zn("mapTexelToLinear",i.mapEncoding):"",i.matcap?Zn("matcapTexelToLinear",i.matcapEncoding):"",i.envMap?Zn("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMap?Zn("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.specularTintMap?Zn("specularTintMapTexelToLinear",i.specularTintMapEncoding):"",i.lightMap?Zn("lightMapTexelToLinear",i.lightMapEncoding):"",Jn("linearToOutputTexel",i.outputEncoding),i.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Yn).join("\n")),s=er(s),s=Kn(s,i),s=$n(s,i),o=er(o),o=Kn(o,i),o=$n(o,i),s=ar(s),o=ar(o),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(y="#version 300 es\n",m=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,b=["#define varying in","300 es"===i.glslVersion?"":"out highp vec4 pc_fragColor;","300 es"===i.glslVersion?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+b);const v=y+b+o,x=Gn(r,35633,y+m+s),_=Gn(r,35632,v);if(r.attachShader(g,x),r.attachShader(g,_),void 0!==i.index0AttributeName?r.bindAttribLocation(g,0,i.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(g,0,"position"),r.linkProgram(g),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(g).trim(),e=r.getShaderInfoLog(x).trim(),i=r.getShaderInfoLog(_).trim();let n=!0,a=!0;if(!1===r.getProgramParameter(g,35714)){n=!1;const e=qn(r,x,"vertex"),i=qn(r,_,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(g,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+i)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==i||(a=!1);a&&(this.diagnostics={runnable:n,programLog:t,vertexShader:{log:e,prefix:m},fragmentShader:{log:i,prefix:b}})}let A,w;return r.deleteShader(x),r.deleteShader(_),this.getUniforms=function(){return void 0===A&&(A=new Hn(r,g)),A},this.getAttributes=function(){return void 0===w&&(w=function(t,e){const i={},n=t.getProgramParameter(e,35721);for(let r=0;r<n;r++){const n=t.getActiveAttrib(e,r),a=n.name;let s=1;35674===n.type&&(s=2),35675===n.type&&(s=3),35676===n.type&&(s=4),i[a]={type:n.type,location:t.getAttribLocation(e,a),locationSize:s}}return i}(r,g)),w},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(g),this.program=void 0},this.name=i.shaderName,this.id=jn++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=x,this.fragmentShader=_,this}function hr(t,e,i,n,r,a,s){const o=[],l=r.isWebGL2,c=r.logarithmicDepthBuffer,h=r.floatVertexTextures,u=r.maxVertexUniforms,d=r.vertexTextures;let p=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},g=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoat","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","specularIntensityMap","specularTintMap","specularTintMapEncoding","roughnessMap","metalnessMap","gradientMap","alphaMap","alphaTest","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","morphTargetsCount","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","format","sheen","transmission","transmissionMap","thicknessMap"];function m(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=3e3,l&&t&&t.isTexture&&1023===t.format&&1009===t.type&&3001===t.encoding&&(e=3e3),e}return{getParameters:function(a,o,g,b,y){const v=b.fog,x=a.isMeshStandardMaterial?b.environment:null,_=(a.isMeshStandardMaterial?i:e).get(a.envMap||x),A=f[a.type],w=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(h)return 1024;{const t=u,i=Math.floor((t-20)/4),n=Math.min(i,e.length);return n<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+n+"."),0):n}}(y):0;let C,M;if(null!==a.precision&&(p=r.getMaxPrecision(a.precision),p!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.")),A){const t=Ke[A];C=t.vertexShader,M=t.fragmentShader}else C=a.vertexShader,M=a.fragmentShader;const E=t.getRenderTarget(),I=a.alphaTest>0,S=a.clearcoat>0;return{isWebGL2:l,shaderID:A,shaderName:a.type,vertexShader:C,fragmentShader:M,defines:a.defines,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:d,outputEncoding:null!==E?m(E.texture):t.outputEncoding,map:!!a.map,mapEncoding:m(a.map),matcap:!!a.matcap,matcapEncoding:m(a.matcap),envMap:!!_,envMapMode:_&&_.mapping,envMapEncoding:m(_),envMapCubeUV:!!_&&(306===_.mapping||307===_.mapping),lightMap:!!a.lightMap,lightMapEncoding:m(a.lightMap),aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,emissiveMapEncoding:m(a.emissiveMap),bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:1===a.normalMapType,tangentSpaceNormalMap:0===a.normalMapType,clearcoat:S,clearcoatMap:S&&!!a.clearcoatMap,clearcoatRoughnessMap:S&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:S&&!!a.clearcoatNormalMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularTintMap:!!a.specularTintMap,specularTintMapEncoding:m(a.specularTintMap),alphaMap:!!a.alphaMap,alphaTest:I,gradientMap:!!a.gradientMap,sheen:a.sheen>0,transmission:a.transmission>0,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!y.geometry&&!!y.geometry.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!y.geometry&&!!y.geometry.attributes.color&&4===y.geometry.attributes.color.itemSize,vertexUvs:!!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatMap||a.clearcoatRoughnessMap||a.clearcoatNormalMap||a.displacementMap||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularTintMap),uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.transmission>0||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularTintMap||!a.displacementMap),fog:!!v,useFog:a.fog,fogExp2:v&&v.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:c,skinning:!0===y.isSkinnedMesh&&w>0,maxBones:w,useVertexTexture:h,morphTargets:!!y.geometry&&!!y.geometry.morphAttributes.position,morphNormals:!!y.geometry&&!!y.geometry.morphAttributes.normal,morphTargetsCount:y.geometry&&y.geometry.morphAttributes.position?y.geometry.morphAttributes.position.length:0,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,format:a.format,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&g.length>0,shadowMapType:t.shadowMap.type,toneMapping:a.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,depthPacking:void 0!==a.depthPacking&&a.depthPacking,index0AttributeName:a.index0AttributeName,extensionDerivatives:a.extensions&&a.extensions.derivatives,extensionFragDepth:a.extensions&&a.extensions.fragDepth,extensionDrawBuffers:a.extensions&&a.extensions.drawBuffers,extensionShaderTextureLOD:a.extensions&&a.extensions.shaderTextureLOD,rendererExtensionFragDepth:l||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:l||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:l||n.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<g.length;t++)i.push(e[g[t]]);i.push(t.outputEncoding),i.push(t.gammaFactor)}return i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=f[t.type];let i;if(e){const t=Ke[e];i=Ue.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=o.length;t<e;t++){const e=o[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new cr(t,i,e,a),o.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=o.indexOf(t);o[e]=o[o.length-1],o.pop(),t.destroy()}},programs:o}}function ur(){let t=new WeakMap;return{get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function dr(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function pr(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function fr(t){const e=[];let i=0;const n=[],r=[],a=[],s={id:-1};function o(n,r,a,o,l,c){let h=e[i];const u=t.get(a);return void 0===h?(h={id:n.id,object:n,geometry:r,material:a,program:u.program||s,groupOrder:o,renderOrder:n.renderOrder,z:l,group:c},e[i]=h):(h.id=n.id,h.object=n,h.geometry=r,h.material=a,h.program=u.program||s,h.groupOrder=o,h.renderOrder=n.renderOrder,h.z=l,h.group=c),i++,h}return{opaque:n,transmissive:r,transparent:a,init:function(){i=0,n.length=0,r.length=0,a.length=0},push:function(t,e,i,s,l,c){const h=o(t,e,i,s,l,c);i.transmission>0?r.push(h):!0===i.transparent?a.push(h):n.push(h)},unshift:function(t,e,i,s,l,c){const h=o(t,e,i,s,l,c);i.transmission>0?r.unshift(h):!0===i.transparent?a.unshift(h):n.unshift(h)},finish:function(){for(let t=i,n=e.length;t<n;t++){const i=e[t];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}},sort:function(t,e){n.length>1&&n.sort(t||dr),r.length>1&&r.sort(e||pr),a.length>1&&a.sort(e||pr)}}}function gr(t){let e=new WeakMap;return{get:function(i,n){let r;return!1===e.has(i)?(r=new fr(t),e.set(i,[r])):n>=e.get(i).length?(r=new fr(t),e.get(i).push(r)):r=e.get(i)[n],r},dispose:function(){e=new WeakMap}}}function mr(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new I,color:new Jt};break;case"SpotLight":i={position:new I,direction:new I,color:new Jt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new I,color:new Jt,distance:0,decay:0};break;case"HemisphereLight":i={direction:new I,skyColor:new Jt,groundColor:new Jt};break;case"RectAreaLight":i={color:new Jt,position:new I,halfWidth:new I,halfHeight:new I}}return t[e.id]=i,i}}}let br=0;function yr(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function vr(t,e){const i=new mr,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new f};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new f,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new I);const a=new I,s=new rt,o=new rt;return{setup:function(a,s){let o=0,l=0,c=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let h=0,u=0,d=0,p=0,f=0,g=0,m=0,b=0;a.sort(yr);const y=!0!==s?Math.PI:1;for(let t=0,e=a.length;t<e;t++){const e=a[t],s=e.color,v=e.intensity,x=e.distance,_=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)o+=s.r*v*y,l+=s.g*v*y,c+=s.b*v*y;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],v);else if(e.isDirectionalLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*y),e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.directionalShadow[h]=i,r.directionalShadowMap[h]=_,r.directionalShadowMatrix[h]=e.shadow.matrix,g++}r.directional[h]=t,h++}else if(e.isSpotLight){const t=i.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(s).multiplyScalar(v*y),t.distance=x,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.spotShadow[d]=i,r.spotShadowMap[d]=_,r.spotShadowMatrix[d]=e.shadow.matrix,b++}r.spot[d]=t,d++}else if(e.isRectAreaLight){const t=i.get(e);t.color.copy(s).multiplyScalar(v),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[p]=t,p++}else if(e.isPointLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*y),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,i.shadowCameraNear=t.camera.near,i.shadowCameraFar=t.camera.far,r.pointShadow[u]=i,r.pointShadowMap[u]=_,r.pointShadowMatrix[u]=e.shadow.matrix,m++}r.point[u]=t,u++}else if(e.isHemisphereLight){const t=i.get(e);t.skyColor.copy(e.color).multiplyScalar(v*y),t.groundColor.copy(e.groundColor).multiplyScalar(v*y),r.hemi[f]=t,f++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Ye.LTC_FLOAT_1,r.rectAreaLTC2=Ye.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Ye.LTC_HALF_1,r.rectAreaLTC2=Ye.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=c;const v=r.hash;v.directionalLength===h&&v.pointLength===u&&v.spotLength===d&&v.rectAreaLength===p&&v.hemiLength===f&&v.numDirectionalShadows===g&&v.numPointShadows===m&&v.numSpotShadows===b||(r.directional.length=h,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=f,r.directionalShadow.length=g,r.directionalShadowMap.length=g,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=b,r.spotShadowMap.length=b,r.directionalShadowMatrix.length=g,r.pointShadowMatrix.length=m,r.spotShadowMatrix.length=b,v.directionalLength=h,v.pointLength=u,v.spotLength=d,v.rectAreaLength=p,v.hemiLength=f,v.numDirectionalShadows=g,v.numPointShadows=m,v.numSpotShadows=b,r.version=br++)},setupView:function(t,e){let i=0,n=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=r.directional[i];t.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(u),i++}else if(d.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(u),l++}else if(d.isRectAreaLight){const t=r.rectArea[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),o.identity(),s.copy(d.matrixWorld),s.premultiply(u),o.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(o),t.halfHeight.applyMatrix4(o),c++}else if(d.isPointLight){const t=r.point[n];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),n++}else if(d.isHemisphereLight){const t=r.hemi[h];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),t.direction.normalize(),h++}}},state:r}}function xr(t,e){const i=new vr(t,e),n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:i},setupLights:function(t){i.setup(n,t)},setupLightsView:function(t){i.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){r.push(t)}}}function _r(t,e){let i=new WeakMap;return{get:function(n,r=0){let a;return!1===i.has(n)?(a=new xr(t,e),i.set(n,[a])):r>=i.get(n).length?(a=new xr(t,e),i.get(n).push(a)):a=i.get(n)[r],a},dispose:function(){i=new WeakMap}}}class Ar extends Vt{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}Ar.prototype.isMeshDepthMaterial=!0;class wr extends Vt{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new I,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}wr.prototype.isMeshDistanceMaterial=!0;function Cr(t,e,i){let n=new We;const r=new f,a=new f,s=new w,o=new Ar({depthPacking:3201}),l=new wr,c={},h=i.maxTextureSize,u={0:1,1:0,2:2},d=new Re({uniforms:{shadow_pass:{value:null},resolution:{value:new f},radius:{value:4},samples:{value:8}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nuniform float samples;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const g=new he;g.setAttribute("position",new $t(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Se(g,d),b=this;function y(i,n){const r=e.update(m);d.uniforms.shadow_pass.value=i.map.texture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,d.uniforms.samples.value=i.blurSamples,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,d,m,null),p.uniforms.shadow_pass.value=i.mapPass.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,p.uniforms.samples.value=i.blurSamples,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,p,m,null)}function v(e,i,n,r,a,s,h){let d=null;const p=!0===r.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(d=void 0!==p?p:!0===r.isPointLight?l:o,t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){const t=d.uuid,e=n.uuid;let i=c[t];void 0===i&&(i={},c[t]=i);let r=i[e];void 0===r&&(r=d.clone(),i[e]=r),d=r}return d.visible=n.visible,d.wireframe=n.wireframe,d.side=3===h?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:u[n.side],d.alphaMap=n.alphaMap,d.alphaTest=n.alphaTest,d.clipShadows=n.clipShadows,d.clippingPlanes=n.clippingPlanes,d.clipIntersection=n.clipIntersection,d.displacementMap=n.displacementMap,d.displacementScale=n.displacementScale,d.displacementBias=n.displacementBias,d.wireframeLinewidth=n.wireframeLinewidth,d.linewidth=n.linewidth,!0===r.isPointLight&&!0===d.isMeshDistanceMaterial&&(d.referencePosition.setFromMatrixPosition(r.matrixWorld),d.nearDistance=a,d.farDistance=s),d}function x(i,r,a,s,o){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===o)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,i.matrixWorld);const n=e.update(i),r=i.material;if(Array.isArray(r)){const e=n.groups;for(let l=0,c=e.length;l<c;l++){const c=e[l],h=r[c.materialIndex];if(h&&h.visible){const e=v(i,0,h,s,a.near,a.far,o);t.renderBufferDirect(a,null,n,e,i,c)}}}else if(r.visible){const e=v(i,0,r,s,a.near,a.far,o);t.renderBufferDirect(a,null,n,e,i,null)}}const l=i.children;for(let t=0,e=l.length;t<e;t++)x(l[t],r,a,s,o)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,i,o){if(!1===b.enabled)return;if(!1===b.autoUpdate&&!1===b.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),c=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let l=0,c=e.length;l<c;l++){const c=e[l],u=c.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const p=u.getFrameExtents();if(r.multiply(p),a.copy(u.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(a.x=Math.floor(h/p.x),r.x=a.x*p.x,u.mapSize.x=a.x),r.y>h&&(a.y=Math.floor(h/p.y),r.y=a.y*p.y,u.mapSize.y=a.y)),null===u.map&&!u.isPointLightShadow&&3===this.type){const t={minFilter:1006,magFilter:1006,format:1023};u.map=new C(r.x,r.y,t),u.map.texture.name=c.name+".shadowMap",u.mapPass=new C(r.x,r.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:1003,magFilter:1003,format:1023};u.map=new C(r.x,r.y,t),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const f=u.getViewportCount();for(let t=0;t<f;t++){const e=u.getViewport(t);s.set(a.x*e.x,a.y*e.y,a.x*e.z,a.y*e.w),d.viewport(s),u.updateMatrices(c,t),n=u.getFrustum(),x(i,o,u.camera,c,this.type)}u.isPointLightShadow||3!==this.type||y(u,o),u.needsUpdate=!1}b.needsUpdate=!1,t.setRenderTarget(l,c,u)}}function Mr(t,e,i){const n=i.isWebGL2;const r=new function(){let e=!1;const i=new w;let n=null;const r=new w(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,a,s,o){!0===o&&(e*=s,n*=s,a*=s),i.set(e,n,a,s),!1===r.equals(i)&&(t.clearColor(e,n,a,s),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},a=new function(){let e=!1,i=null,n=null,r=null;return{setTest:function(t){t?P(2929):z(2929)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},s=new function(){let e=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,c=null;return{setTest:function(t){e||(t?P(2960):z(2960))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,s){n===e&&r===i&&a===s||(t.stencilFunc(e,i,s),n=e,r=i,a=s)},setOp:function(e,i,n){s===e&&o===i&&l===n||(t.stencilOp(e,i,n),s=e,o=i,l=n)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,c=null}}};let o={},l=null,c={},h=null,u=!1,d=null,p=null,f=null,g=null,m=null,b=null,y=null,v=!1,x=null,_=null,A=null,C=null,M=null;const E=t.getParameter(35661);let I=!1,S=0;const T=t.getParameter(7938);-1!==T.indexOf("WebGL")?(S=parseFloat(/^WebGL (\d)/.exec(T)[1]),I=S>=1):-1!==T.indexOf("OpenGL ES")&&(S=parseFloat(/^OpenGL ES (\d)/.exec(T)[1]),I=S>=2);let B=null,F={};const L=t.getParameter(3088),U=t.getParameter(2978),R=(new w).fromArray(L),D=(new w).fromArray(U);function N(e,i,n){const r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<n;e++)t.texImage2D(i+e,0,6408,1,1,0,6408,5121,r);return a}const k={};function P(e){!0!==o[e]&&(t.enable(e),o[e]=!0)}function z(e){!1!==o[e]&&(t.disable(e),o[e]=!1)}k[3553]=N(3553,3553,1),k[34067]=N(34067,34069,6),r.setClear(0,0,0,1),a.setClear(1),s.setClear(0),P(2929),a.setFunc(3),H(!1),G(1),P(2884),V(0);const O={100:32774,101:32778,102:32779};if(n)O[103]=32775,O[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(O[103]=t.MIN_EXT,O[104]=t.MAX_EXT)}const Q={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function V(e,i,n,r,a,s,o,l){if(0!==e){if(!1===u&&(P(3042),u=!0),5===e)a=a||i,s=s||n,o=o||r,i===p&&a===m||(t.blendEquationSeparate(O[i],O[a]),p=i,m=a),n===f&&r===g&&s===b&&o===y||(t.blendFuncSeparate(Q[n],Q[r],Q[s],Q[o]),f=n,g=r,b=s,y=o),d=e,v=null;else if(e!==d||l!==v){if(100===p&&100===m||(t.blendEquation(32774),p=100,m=100),l)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,0,769,771);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFunc(0,769);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}f=null,g=null,b=null,y=null,d=e,v=l}}else!0===u&&(z(3042),u=!1)}function H(e){x!==e&&(e?t.frontFace(2304):t.frontFace(2305),x=e)}function G(e){0!==e?(P(2884),e!==_&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):z(2884),_=e}function j(e,i,n){e?(P(32823),C===i&&M===n||(t.polygonOffset(i,n),C=i,M=n)):z(32823)}function W(e){void 0===e&&(e=33984+E-1),B!==e&&(t.activeTexture(e),B=e)}return{buffers:{color:r,depth:a,stencil:s},enable:P,disable:z,bindFramebuffer:function(e,i){return null===i&&null!==l&&(i=l),c[e]!==i&&(t.bindFramebuffer(e,i),c[e]=i,n&&(36009===e&&(c[36160]=i),36160===e&&(c[36009]=i)),!0)},bindXRFramebuffer:function(e){e!==l&&(t.bindFramebuffer(36160,e),l=e)},useProgram:function(e){return h!==e&&(t.useProgram(e),h=e,!0)},setBlending:V,setMaterial:function(t,e){2===t.side?z(2884):P(2884);let i=1===t.side;e&&(i=!i),H(i),1===t.blending&&!1===t.transparent?V(0):V(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),a.setFunc(t.depthFunc),a.setTest(t.depthTest),a.setMask(t.depthWrite),r.setMask(t.colorWrite);const n=t.stencilWrite;s.setTest(n),n&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),j(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?P(32926):z(32926)},setFlipSided:H,setCullFace:G,setLineWidth:function(e){e!==A&&(I&&t.lineWidth(e),A=e)},setPolygonOffset:j,setScissorTest:function(t){t?P(3089):z(3089)},activeTexture:W,bindTexture:function(e,i){null===B&&W();let n=F[B];void 0===n&&(n={type:void 0,texture:void 0},F[B]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||k[e]),n.type=e,n.texture=i)},unbindTexture:function(){const e=F[B];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===R.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),R.copy(e))},viewport:function(e){!1===D.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),D.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===n&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),o={},B=null,F={},l=null,c={},h=null,u=!1,d=null,p=null,f=null,g=null,m=null,b=null,y=null,v=!1,x=null,_=null,A=null,C=null,M=null,R.set(0,0,t.canvas.width,t.canvas.height),D.set(0,0,t.canvas.width,t.canvas.height),r.reset(),a.reset(),s.reset()}}}function Er(t,e,i,n,r,a,s){const o=r.isWebGL2,l=r.maxTextures,c=r.maxCubemapSize,h=r.maxTextureSize,u=r.maxSamples,f=new WeakMap;let g,m=!1;try{m="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function y(t,e){return m?new OffscreenCanvas(t,e):b("canvas")}function v(t,e,i,n){let r=1;if((t.width>n||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=e?p:Math.floor,a=n(r*t.width),s=n(r*t.height);void 0===g&&(g=y(a,s));const o=i?y(a,s):g;o.width=a,o.height=s;return o.getContext("2d").drawImage(t,0,0,a,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+a+"x"+s+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return d(t.width)&&d(t.height)}function _(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function A(e,i,r,a,s=1){t.generateMipmap(e);n.get(i).__maxMipLevel=Math.log2(Math.max(r,a,s))}function w(i,n,r,a){if(!1===o)return n;if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let s=n;return 6403===n&&(5126===r&&(s=33326),5131===r&&(s=33325),5121===r&&(s=33321)),6407===n&&(5126===r&&(s=34837),5131===r&&(s=34843),5121===r&&(s=32849)),6408===n&&(5126===r&&(s=34836),5131===r&&(s=34842),5121===r&&(s=3001===a?35907:32856)),33325!==s&&33326!==s&&34842!==s&&34836!==s||e.get("EXT_color_buffer_float"),s}function C(t){return 1003===t||1004===t||1005===t?9728:9729}function M(e){const i=e.target;i.removeEventListener("dispose",M),function(e){const i=n.get(e);if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture),n.remove(e)}(i),i.isVideoTexture&&f.delete(i),s.memory.textures--}function E(e){const i=e.target;i.removeEventListener("dispose",E),function(e){const i=e.texture,r=n.get(e),a=n.get(i);if(!e)return;void 0!==a.__webglTexture&&(t.deleteTexture(a.__webglTexture),s.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);r.__webglTexture&&(t.deleteTexture(r.__webglTexture),s.memory.textures--),n.remove(i[e])}n.remove(i),n.remove(e)}(i)}let I=0;function S(t,e){const r=n.get(t);if(t.isVideoTexture&&function(t){const e=s.render.frame;f.get(t)!==e&&(f.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){const i=t.image;if(void 0===i)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==i.complete)return void R(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+e),i.bindTexture(3553,r.__webglTexture)}function T(e,r){const s=n.get(e);e.version>0&&s.__version!==e.version?function(e,n,r){if(6!==n.image.length)return;U(e,n),i.activeTexture(33984+r),i.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const s=n&&(n.isCompressedTexture||n.image[0].isCompressedTexture),l=n.image[0]&&n.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=s||l?l?n.image[t].image:n.image[t]:v(n.image[t],!1,!0,c);const u=h[0],d=x(u)||o,p=a.convert(n.format),f=a.convert(n.type),g=w(n.internalFormat,p,f,n.encoding);let m;if(L(34067,n,d),s){for(let t=0;t<6;t++){m=h[t].mipmaps;for(let e=0;e<m.length;e++){const r=m[e];1023!==n.format&&1022!==n.format?null!==p?i.compressedTexImage2D(34069+t,e,g,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(34069+t,e,g,r.width,r.height,0,p,f,r.data)}}e.__maxMipLevel=m.length-1}else{m=n.mipmaps;for(let t=0;t<6;t++)if(l){i.texImage2D(34069+t,0,g,h[t].width,h[t].height,0,p,f,h[t].data);for(let e=0;e<m.length;e++){const n=m[e].image[t].image;i.texImage2D(34069+t,e+1,g,n.width,n.height,0,p,f,n.data)}}else{i.texImage2D(34069+t,0,g,p,f,h[t]);for(let e=0;e<m.length;e++){const n=m[e];i.texImage2D(34069+t,e+1,g,p,f,n.image[t])}}e.__maxMipLevel=m.length}_(n,d)&&A(34067,n,u.width,u.height);e.__version=n.version,n.onUpdate&&n.onUpdate(n)}(s,e,r):(i.activeTexture(33984+r),i.bindTexture(34067,s.__webglTexture))}const B={1e3:10497,1001:33071,1002:33648},F={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function L(i,a,s){if(s?(t.texParameteri(i,10242,B[a.wrapS]),t.texParameteri(i,10243,B[a.wrapT]),32879!==i&&35866!==i||t.texParameteri(i,32882,B[a.wrapR]),t.texParameteri(i,10240,F[a.magFilter]),t.texParameteri(i,10241,F[a.minFilter])):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879!==i&&35866!==i||t.texParameteri(i,32882,33071),1001===a.wrapS&&1001===a.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,10240,C(a.magFilter)),t.texParameteri(i,10241,C(a.minFilter)),1003!==a.minFilter&&1006!==a.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const s=e.get("EXT_texture_filter_anisotropic");if(1015===a.type&&!1===e.has("OES_texture_float_linear"))return;if(!1===o&&1016===a.type&&!1===e.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||n.get(a).__currentAnisotropy)&&(t.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}}function U(e,i){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",M),e.__webglTexture=t.createTexture(),s.memory.textures++)}function R(e,n,r){let s=3553;n.isDataTexture2DArray&&(s=35866),n.isDataTexture3D&&(s=32879),U(e,n),i.activeTexture(33984+r),i.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!o&&(1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.minFilter)}(n)&&!1===x(n.image),c=v(n.image,l,!1,h),u=x(c)||o,d=a.convert(n.format);let p,f=a.convert(n.type),g=w(n.internalFormat,d,f,n.encoding);L(s,n,u);const m=n.mipmaps;if(n.isDepthTexture)g=6402,o?g=1015===n.type?36012:1014===n.type?33190:1020===n.type?35056:33189:1015===n.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===n.format&&6402===g&&1012!==n.type&&1014!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=1012,f=a.convert(n.type)),1027===n.format&&6402===g&&(g=34041,1020!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=1020,f=a.convert(n.type))),i.texImage2D(3553,0,g,c.width,c.height,0,d,f,null);else if(n.isDataTexture)if(m.length>0&&u){for(let t=0,e=m.length;t<e;t++)p=m[t],i.texImage2D(3553,t,g,p.width,p.height,0,d,f,p.data);n.generateMipmaps=!1,e.__maxMipLevel=m.length-1}else i.texImage2D(3553,0,g,c.width,c.height,0,d,f,c.data),e.__maxMipLevel=0;else if(n.isCompressedTexture){for(let t=0,e=m.length;t<e;t++)p=m[t],1023!==n.format&&1022!==n.format?null!==d?i.compressedTexImage2D(3553,t,g,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(3553,t,g,p.width,p.height,0,d,f,p.data);e.__maxMipLevel=m.length-1}else if(n.isDataTexture2DArray)i.texImage3D(35866,0,g,c.width,c.height,c.depth,0,d,f,c.data),e.__maxMipLevel=0;else if(n.isDataTexture3D)i.texImage3D(32879,0,g,c.width,c.height,c.depth,0,d,f,c.data),e.__maxMipLevel=0;else if(m.length>0&&u){for(let t=0,e=m.length;t<e;t++)p=m[t],i.texImage2D(3553,t,g,d,f,p);n.generateMipmaps=!1,e.__maxMipLevel=m.length-1}else i.texImage2D(3553,0,g,d,f,c),e.__maxMipLevel=0;_(n,u)&&A(s,n,c.width,c.height),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function D(e,r,s,o,l){const c=a.convert(s.format),h=a.convert(s.type),u=w(s.internalFormat,c,h,s.encoding);32879===l||35866===l?i.texImage3D(l,0,u,r.width,r.height,r.depth,0,c,h,null):i.texImage2D(l,0,u,r.width,r.height,0,c,h,null),i.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,o,l,n.get(s).__webglTexture,0),i.bindFramebuffer(36160,null)}function N(e,i,n){if(t.bindRenderbuffer(36161,e),i.depthBuffer&&!i.stencilBuffer){let r=33189;if(n){const e=i.depthTexture;e&&e.isDepthTexture&&(1015===e.type?r=36012:1014===e.type&&(r=33190));const n=P(i);t.renderbufferStorageMultisample(36161,n,r,i.width,i.height)}else t.renderbufferStorage(36161,r,i.width,i.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(i.depthBuffer&&i.stencilBuffer){if(n){const e=P(i);t.renderbufferStorageMultisample(36161,e,35056,i.width,i.height)}else t.renderbufferStorage(36161,34041,i.width,i.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===i.isWebGLMultipleRenderTargets?i.texture[0]:i.texture,r=a.convert(e.format),s=a.convert(e.type),o=w(e.internalFormat,r,s,e.encoding);if(n){const e=P(i);t.renderbufferStorageMultisample(36161,e,o,i.width,i.height)}else t.renderbufferStorage(36161,o,i.width,i.height)}t.bindRenderbuffer(36161,null)}function k(e){const r=n.get(e),a=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),S(r.depthTexture,0);const a=n.get(r.depthTexture).__webglTexture;if(1026===r.depthTexture.format)t.framebufferTexture2D(36160,36096,3553,a,0);else{if(1027!==r.depthTexture.format)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,a,0)}}(r.__webglFramebuffer,e)}else if(a){r.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(36160,r.__webglFramebuffer[n]),r.__webglDepthbuffer[n]=t.createRenderbuffer(),N(r.__webglDepthbuffer[n],e,!1)}else i.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),N(r.__webglDepthbuffer,e,!1);i.bindFramebuffer(36160,null)}function P(t){return o&&t.isWebGLMultisampleRenderTarget?Math.min(u,t.samples):0}let z=!1,O=!1;this.allocateTextureUnit=function(){const t=I;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),I+=1,t},this.resetTextureUnits=function(){I=0},this.setTexture2D=S,this.setTexture2DArray=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?R(r,t,e):(i.activeTexture(33984+e),i.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?R(r,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,r.__webglTexture))},this.setTextureCube=T,this.setupRenderTarget=function(e){const l=e.texture,c=n.get(e),h=n.get(l);e.addEventListener("dispose",E),!0!==e.isWebGLMultipleRenderTargets&&(h.__webglTexture=t.createTexture(),h.__version=l.version,s.memory.textures++);const u=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,p=!0===e.isWebGLMultisampleRenderTarget,f=l.isDataTexture3D||l.isDataTexture2DArray,g=x(e)||o;if(!o||1022!==l.format||1015!==l.type&&1016!==l.type||(l.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),u){c.__webglFramebuffer=[];for(let e=0;e<6;e++)c.__webglFramebuffer[e]=t.createFramebuffer()}else if(c.__webglFramebuffer=t.createFramebuffer(),d)if(r.drawBuffers){const i=e.texture;for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(p)if(o){c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,c.__webglColorRenderbuffer);const n=a.convert(l.format),r=a.convert(l.type),s=w(l.internalFormat,n,r,l.encoding),o=P(e);t.renderbufferStorageMultisample(36161,o,s,e.width,e.height),i.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,c.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(c.__webglDepthRenderbuffer=t.createRenderbuffer(),N(c.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(u){i.bindTexture(34067,h.__webglTexture),L(34067,l,g);for(let t=0;t<6;t++)D(c.__webglFramebuffer[t],e,l,36064,34069+t);_(l,g)&&A(34067,l,e.width,e.height),i.unbindTexture()}else if(d){const t=e.texture;for(let r=0,a=t.length;r<a;r++){const a=t[r],s=n.get(a);i.bindTexture(3553,s.__webglTexture),L(3553,a,g),D(c.__webglFramebuffer,e,a,36064+r,3553),_(a,g)&&A(3553,a,e.width,e.height)}i.unbindTexture()}else{let t=3553;if(f)if(o){t=l.isDataTexture3D?32879:35866}else console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.");i.bindTexture(t,h.__webglTexture),L(t,l,g),D(c.__webglFramebuffer,e,l,36064,t),_(l,g)&&A(t,l,e.width,e.height,e.depth),i.unbindTexture()}e.depthBuffer&&k(e)},this.updateRenderTargetMipmap=function(t){const e=x(t)||o,r=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let a=0,s=r.length;a<s;a++){const s=r[a];if(_(s,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,r=n.get(s).__webglTexture;i.bindTexture(e,r),A(e,s,t.width,t.height),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(o){const r=e.width,a=e.height;let s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024);const o=n.get(e);i.bindFramebuffer(36008,o.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,o.__webglFramebuffer),t.blitFramebuffer(0,0,r,a,0,0,r,a,s,9728),i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,o.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===z&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),z=!0),t=t.texture),S(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===O&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),O=!0),t=t.texture),T(t,e)}}function Ir(t,e,i){const n=i.isWebGL2;return{convert:function(t){let i;if(1009===t)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(1012===t)return 5123;if(1013===t)return 5124;if(1014===t)return 5125;if(1015===t)return 5126;if(1016===t)return n?5131:(i=e.get("OES_texture_half_float"),null!==i?i.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(1022===t)return 6407;if(1023===t)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(1026===t)return 6402;if(1027===t)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(33776===t||33777===t||33778===t||33779===t){if(i=e.get("WEBGL_compressed_texture_s3tc"),null===i)return null;if(33776===t)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===t)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===t)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===t)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===t||35841===t||35842===t||35843===t){if(i=e.get("WEBGL_compressed_texture_pvrtc"),null===i)return null;if(35840===t)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===t)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===t)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===t)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return i=e.get("WEBGL_compressed_texture_etc1"),null!==i?i.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===t||37496===t)&&(i=e.get("WEBGL_compressed_texture_etc"),null!==i)){if(37492===t)return i.COMPRESSED_RGB8_ETC2;if(37496===t)return i.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?(i=e.get("WEBGL_compressed_texture_astc"),null!==i?t:null):36492===t?(i=e.get("EXT_texture_compression_bptc"),null!==i?t:null):1020===t?n?34042:(i=e.get("WEBGL_depth_texture"),null!==i?i.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class Sr extends Ne{constructor(t=[]){super(),this.cameras=t}}Sr.prototype.isArrayCamera=!0;class Tr extends Tt{constructor(){super(),this.type="Group"}}Tr.prototype.isGroup=!0;const Br={type:"move"};class Fr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Tr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Tr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Tr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let n=null,r=null,a=null;const s=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==s&&(n=e.getPose(t.targetRaySpace,i),null!==n&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(Br))),l&&t.hand){a=!0;for(const n of t.hand.values()){const t=e.getJointPose(n,i);if(void 0===l.joints[n.jointName]){const t=new Tr;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[n.jointName]=t,l.add(t)}const r=l.joints[n.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=n.position.distanceTo(r.position),o=.02,c=.005;l.inputState.pinching&&s>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&s<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));return null!==s&&(s.visible=null!==n),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}}class Lr extends n{constructor(t,e){super();const i=this,n=t.state;let r=null,a=1,s=null,o="local-floor",l=null,c=null,h=null,u=null,d=null,p=!1,f=null,g=null,m=null,b=null,y=null,v=null;const x=t.extensions.has("EXT_multisampled_render_to_texture");let _=null;const A=[],C=new Map,M=new Ne;M.layers.enable(1),M.viewport=new w;const E=new Ne;E.layers.enable(2),E.viewport=new w;const S=[M,E],T=new Sr;T.layers.enable(1),T.layers.enable(2);let B=null,F=null;function L(t){const e=C.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function U(){C.forEach((function(t,e){t.disconnect(e)})),C.clear(),B=null,F=null,n.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),h&&e.deleteFramebuffer(h),f&&e.deleteFramebuffer(f),g&&e.deleteRenderbuffer(g),m&&e.deleteRenderbuffer(m),h=null,f=null,g=null,m=null,d=null,u=null,c=null,r=null,z.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function R(t){const e=r.inputSources;for(let t=0;t<A.length;t++)C.set(e[t],A[t]);for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=C.get(i);n&&(n.dispatchEvent({type:"disconnected",data:i}),C.delete(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e],n=C.get(i);n&&n.dispatchEvent({type:"connected",data:i})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=A[t];return void 0===e&&(e=new Fr,A[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=A[t];return void 0===e&&(e=new Fr,A[t]=e),e.getGripSpace()},this.getHand=function(t){let e=A[t];return void 0===e&&(e=new Fr,A[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){a=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return c},this.getFrame=function(){return b},this.getSession=function(){return r},this.setSession=async function(l){if(r=l,null!==r){r.addEventListener("select",L),r.addEventListener("selectstart",L),r.addEventListener("selectend",L),r.addEventListener("squeeze",L),r.addEventListener("squeezestart",L),r.addEventListener("squeezeend",L),r.addEventListener("end",U),r.addEventListener("inputsourceschange",R);const l=e.getContextAttributes();if(!0!==l.xrCompatible&&await e.makeXRCompatible(),void 0===r.renderState.layers){const t={antialias:l.antialias,alpha:l.alpha,depth:l.depth,stencil:l.stencil,framebufferScaleFactor:a};d=new XRWebGLLayer(r,e,t),r.updateRenderState({baseLayer:d})}else if(e instanceof WebGLRenderingContext){const t={antialias:!0,alpha:l.alpha,depth:l.depth,stencil:l.stencil,framebufferScaleFactor:a};d=new XRWebGLLayer(r,e,t),r.updateRenderState({layers:[d]})}else{p=l.antialias;let i=null;l.depth&&(v=256,l.stencil&&(v|=1024),y=l.stencil?33306:36096,i=l.stencil?35056:33190);const s={colorFormat:l.alpha?32856:32849,depthFormat:i,scaleFactor:a};c=new XRWebGLBinding(r,e),u=c.createProjectionLayer(s),h=e.createFramebuffer(),r.updateRenderState({layers:[u]}),p&&x?_=t.extensions.get("EXT_multisampled_render_to_texture"):p&&(f=e.createFramebuffer(),g=e.createRenderbuffer(),e.bindRenderbuffer(36161,g),e.renderbufferStorageMultisample(36161,4,32856,u.textureWidth,u.textureHeight),n.bindFramebuffer(36160,f),e.framebufferRenderbuffer(36160,36064,36161,g),e.bindRenderbuffer(36161,null),null!==i&&(m=e.createRenderbuffer(),e.bindRenderbuffer(36161,m),e.renderbufferStorageMultisample(36161,4,i,u.textureWidth,u.textureHeight),e.framebufferRenderbuffer(36160,y,36161,m),e.bindRenderbuffer(36161,null)),n.bindFramebuffer(36160,null))}s=await r.requestReferenceSpace(o),z.setContext(r),z.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};const D=new I,N=new I;function k(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===r)return;T.near=E.near=M.near=t.near,T.far=E.far=M.far=t.far,B===T.near&&F===T.far||(r.updateRenderState({depthNear:T.near,depthFar:T.far}),B=T.near,F=T.far);const e=t.parent,i=T.cameras;k(T,e);for(let t=0;t<i.length;t++)k(i[t],e);T.matrixWorld.decompose(T.position,T.quaternion,T.scale),t.position.copy(T.position),t.quaternion.copy(T.quaternion),t.scale.copy(T.scale),t.matrix.copy(T.matrix),t.matrixWorld.copy(T.matrixWorld);const n=t.children;for(let t=0,e=n.length;t<e;t++)n[t].updateMatrixWorld(!0);2===i.length?function(t,e,i){D.setFromMatrixPosition(e.matrixWorld),N.setFromMatrixPosition(i.matrixWorld);const n=D.distanceTo(N),r=e.projectionMatrix.elements,a=i.projectionMatrix.elements,s=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(a[8]+1)/a[0],d=s*h,p=s*u,f=n/(-h+u),g=f*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(g),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const m=s+f,b=o+f,y=d-g,v=p+(n-g),x=l*o/b*m,_=c*o/b*m;t.projectionMatrix.makePerspective(y,v,x,_,m,b)}(T,M,E):T.projectionMatrix.copy(M.projectionMatrix)},this.getCamera=function(){return T},this.getFoveation=function(){return null!==u?u.fixedFoveation:null!==d?d.fixedFoveation:void 0},this.setFoveation=function(t){null!==u&&(u.fixedFoveation=t),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=t)};let P=null;const z=new qe;z.setAnimationLoop((function(t,i){if(l=i.getViewerPose(s),b=i,null!==l){const t=l.views;null!==d&&n.bindXRFramebuffer(d.framebuffer);let i=!1;t.length!==T.cameras.length&&(T.cameras.length=0,i=!0);for(let r=0;r<t.length;r++){const a=t[r];let s=null;if(null!==d)s=d.getViewport(a);else{const t=c.getViewSubImage(u,a);n.bindXRFramebuffer(h),p&&x?(void 0!==t.depthStencilTexture&&_.framebufferTexture2DMultisampleEXT(36160,y,3553,t.depthStencilTexture,0,4),_.framebufferTexture2DMultisampleEXT(36160,36064,3553,t.colorTexture,0,4)):(void 0!==t.depthStencilTexture&&e.framebufferTexture2D(36160,y,3553,t.depthStencilTexture,0),e.framebufferTexture2D(36160,36064,3553,t.colorTexture,0)),s=t.viewport}const o=S[r];o.matrix.fromArray(a.transform.matrix),o.projectionMatrix.fromArray(a.projectionMatrix),o.viewport.set(s.x,s.y,s.width,s.height),0===r&&T.matrix.copy(o.matrix),!0===i&&T.cameras.push(o)}p&&!x&&(n.bindXRFramebuffer(f),null!==v&&e.clear(v))}const a=r.inputSources;for(let t=0;t<A.length;t++){const e=A[t],n=a[t];e.update(n,i,s)}if(P&&P(t,i),p&&!x){const t=u.textureWidth,i=u.textureHeight;n.bindFramebuffer(36008,f),n.bindFramebuffer(36009,h),e.invalidateFramebuffer(36008,[y]),e.invalidateFramebuffer(36009,[y]),e.blitFramebuffer(0,0,t,i,0,0,t,i,16384,9728),e.invalidateFramebuffer(36008,[36064]),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,null),n.bindFramebuffer(36160,f)}b=null})),this.setAnimationLoop=function(t){P=t},this.dispose=function(){}}}function Ur(t){function e(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map),i.alphaMap&&(e.alphaMap.value=i.alphaMap),i.specularMap&&(e.specularMap.value=i.specularMap),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);const n=t.get(i).envMap;if(n){e.envMap.value=n,e.flipEnvMap.value=n.isCubeTexture&&!1===n.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio;const r=t.get(n).__maxMipLevel;void 0!==r&&(e.maxMipLevel.value=r)}let r,a;i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity),i.map?r=i.map:i.specularMap?r=i.specularMap:i.displacementMap?r=i.displacementMap:i.normalMap?r=i.normalMap:i.bumpMap?r=i.bumpMap:i.roughnessMap?r=i.roughnessMap:i.metalnessMap?r=i.metalnessMap:i.alphaMap?r=i.alphaMap:i.emissiveMap?r=i.emissiveMap:i.clearcoatMap?r=i.clearcoatMap:i.clearcoatNormalMap?r=i.clearcoatNormalMap:i.clearcoatRoughnessMap?r=i.clearcoatRoughnessMap:i.specularIntensityMap?r=i.specularIntensityMap:i.specularTintMap?r=i.specularTintMap:i.transmissionMap?r=i.transmissionMap:i.thicknessMap&&(r=i.thicknessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),i.aoMap?a=i.aoMap:i.lightMap&&(a=i.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),e.uv2Transform.value.copy(a.matrix))}function i(e,i){e.roughness.value=i.roughness,e.metalness.value=i.metalness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap),i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap),i.bumpMap&&(e.bumpMap.value=i.bumpMap,e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias);t.get(i).envMap&&(e.envMapIntensity.value=i.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,n,r,a,s){n.isMeshBasicMaterial?e(t,n):n.isMeshLambertMaterial?(e(t,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,n)):n.isMeshToonMaterial?(e(t,n),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshPhongMaterial?(e(t,n),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshStandardMaterial?(e(t,n),n.isMeshPhysicalMaterial?function(t,e,n){i(t,e),t.ior.value=e.ior,e.sheen>0&&(t.sheenTint.value.copy(e.sheenTint).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness);e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate()));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationTint.value.copy(e.attenuationTint));t.specularIntensity.value=e.specularIntensity,t.specularTint.value.copy(e.specularTint),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap);e.specularTintMap&&(t.specularTintMap.value=e.specularTintMap)}(t,n,s):i(t,n)):n.isMeshMatcapMaterial?(e(t,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDepthMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDistanceMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,n)):n.isMeshNormalMaterial?(e(t,n),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,n)):n.isPointsMaterial?function(t,e,i,n){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*n,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,n,r,a):n.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,n):n.isShadowMaterial?(t.color.value.copy(n.color),t.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function Rr(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=b("canvas");return t.style.display="block",t}(),i=void 0!==t.context?t.context:null,n=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,s=void 0!==t.antialias&&t.antialias,o=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,c=void 0!==t.powerPreference?t.powerPreference:"default",h=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let u=null,d=null;const p=[],f=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const g=this;let m=!1,y=0,v=0,x=null,_=-1,A=null;const E=new w,S=new w;let T=null,B=e.width,F=e.height,L=1,U=null,R=null;const D=new w(0,0,B,F),N=new w(0,0,B,F);let k=!1;const P=[],z=new We;let O=!1,Q=!1,V=null;const H=new rt,G=new I,j={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function W(){return null===x?L:1}let q,Z,J,X,Y,K,$,tt,et,it,nt,at,st,ot,lt,ct,ht,ut,dt,pt,ft,gt,mt,bt=i;function yt(t,i){for(let n=0;n<t.length;n++){const r=t[n],a=e.getContext(r,i);if(null!==a)return a}return null}try{const t={alpha:n,depth:r,stencil:a,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if(e.addEventListener("webglcontextlost",_t,!1),e.addEventListener("webglcontextrestored",At,!1),null===bt){const e=["webgl2","webgl","experimental-webgl"];if(!0===g.isWebGL1Renderer&&e.shift(),bt=yt(e,t),null===bt)throw yt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===bt.getShaderPrecisionFormat&&(bt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function vt(){q=new Bi(bt),Z=new ii(bt,q,t),q.init(Z),gt=new Ir(bt,q,Z),J=new Mr(bt,q,Z),P[0]=1029,X=new Ui(bt),Y=new ur,K=new Er(bt,q,J,Y,Z,gt,X),$=new ri(g),tt=new Ti(g),et=new Ze(bt,Z),mt=new ti(bt,q,et,Z),it=new Fi(bt,et,X,mt),nt=new zi(bt,it,et,X),dt=new Pi(bt,Z,K),ct=new ni(Y),at=new hr(g,$,tt,q,Z,mt,ct),st=new Ur(Y),ot=new gr(Y),lt=new _r(q,Z),ut=new $e(g,$,J,nt,o),ht=new Cr(g,nt,Z),pt=new ei(bt,q,X,Z),ft=new Li(bt,q,X,Z),X.programs=at.programs,g.capabilities=Z,g.extensions=q,g.properties=Y,g.renderLists=ot,g.shadowMap=ht,g.state=J,g.info=X}vt();const xt=new Lr(g,bt);function _t(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),m=!0}function At(){console.log("THREE.WebGLRenderer: Context Restored."),m=!1;const t=X.autoReset,e=ht.enabled,i=ht.autoUpdate,n=ht.needsUpdate,r=ht.type;vt(),X.autoReset=t,ht.enabled=e,ht.autoUpdate=i,ht.needsUpdate=n,ht.type=r}function wt(t){const e=t.target;e.removeEventListener("dispose",wt),function(t){(function(t){const e=Y.get(t).programs;void 0!==e&&e.forEach((function(t){at.releaseProgram(t)}))})(t),Y.remove(t)}(e)}this.xr=xt,this.getContext=function(){return bt},this.getContextAttributes=function(){return bt.getContextAttributes()},this.forceContextLoss=function(){const t=q.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=q.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return L},this.setPixelRatio=function(t){void 0!==t&&(L=t,this.setSize(B,F,!1))},this.getSize=function(t){return t.set(B,F)},this.setSize=function(t,i,n){xt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(B=t,F=i,e.width=Math.floor(t*L),e.height=Math.floor(i*L),!1!==n&&(e.style.width=t+"px",e.style.height=i+"px"),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return t.set(B*L,F*L).floor()},this.setDrawingBufferSize=function(t,i,n){B=t,F=i,L=n,e.width=Math.floor(t*n),e.height=Math.floor(i*n),this.setViewport(0,0,t,i)},this.getCurrentViewport=function(t){return t.copy(E)},this.getViewport=function(t){return t.copy(D)},this.setViewport=function(t,e,i,n){t.isVector4?D.set(t.x,t.y,t.z,t.w):D.set(t,e,i,n),J.viewport(E.copy(D).multiplyScalar(L).floor())},this.getScissor=function(t){return t.copy(N)},this.setScissor=function(t,e,i,n){t.isVector4?N.set(t.x,t.y,t.z,t.w):N.set(t,e,i,n),J.scissor(S.copy(N).multiplyScalar(L).floor())},this.getScissorTest=function(){return k},this.setScissorTest=function(t){J.setScissorTest(k=t)},this.setOpaqueSort=function(t){U=t},this.setTransparentSort=function(t){R=t},this.getClearColor=function(t){return t.copy(ut.getClearColor())},this.setClearColor=function(){ut.setClearColor.apply(ut,arguments)},this.getClearAlpha=function(){return ut.getClearAlpha()},this.setClearAlpha=function(){ut.setClearAlpha.apply(ut,arguments)},this.clear=function(t,e,i){let n=0;(void 0===t||t)&&(n|=16384),(void 0===e||e)&&(n|=256),(void 0===i||i)&&(n|=1024),bt.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",_t,!1),e.removeEventListener("webglcontextrestored",At,!1),ot.dispose(),lt.dispose(),Y.dispose(),$.dispose(),tt.dispose(),nt.dispose(),mt.dispose(),xt.dispose(),xt.removeEventListener("sessionstart",Mt),xt.removeEventListener("sessionend",Et),V&&(V.dispose(),V=null),It.stop()},this.renderBufferImmediate=function(t,e){mt.initAttributes();const i=Y.get(t);t.hasPositions&&!i.position&&(i.position=bt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=bt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=bt.createBuffer()),t.hasColors&&!i.color&&(i.color=bt.createBuffer());const n=e.getAttributes();t.hasPositions&&(bt.bindBuffer(34962,i.position),bt.bufferData(34962,t.positionArray,35048),mt.enableAttribute(n.position.location),bt.vertexAttribPointer(n.position.location,3,5126,!1,0,0)),t.hasNormals&&(bt.bindBuffer(34962,i.normal),bt.bufferData(34962,t.normalArray,35048),mt.enableAttribute(n.normal.location),bt.vertexAttribPointer(n.normal.location,3,5126,!1,0,0)),t.hasUvs&&(bt.bindBuffer(34962,i.uv),bt.bufferData(34962,t.uvArray,35048),mt.enableAttribute(n.uv.location),bt.vertexAttribPointer(n.uv.location,2,5126,!1,0,0)),t.hasColors&&(bt.bindBuffer(34962,i.color),bt.bufferData(34962,t.colorArray,35048),mt.enableAttribute(n.color.location),bt.vertexAttribPointer(n.color.location,3,5126,!1,0,0)),mt.disableUnusedAttributes(),bt.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,i,n,r,a){null===e&&(e=j);const s=r.isMesh&&r.matrixWorld.determinant()<0,o=Ut(t,e,n,r);J.setMaterial(n,s);let l=i.index;const c=i.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;let h,u=1;!0===n.wireframe&&(l=it.getWireframeAttribute(i),u=2),void 0===i.morphAttributes.position&&void 0===i.morphAttributes.normal||dt.update(r,i,n,o),mt.setup(r,n,o,i,l);let d=pt;null!==l&&(h=et.get(l),d=ft,d.setIndex(h));const p=null!==l?l.count:c.count,f=i.drawRange.start*u,g=i.drawRange.count*u,m=null!==a?a.start*u:0,b=null!==a?a.count*u:1/0,y=Math.max(f,m),v=Math.min(p,f+g,m+b)-1,x=Math.max(0,v-y+1);if(0!==x){if(r.isMesh)!0===n.wireframe?(J.setLineWidth(n.wireframeLinewidth*W()),d.setMode(1)):d.setMode(4);else if(r.isLine){let t=n.linewidth;void 0===t&&(t=1),J.setLineWidth(t*W()),r.isLineSegments?d.setMode(1):r.isLineLoop?d.setMode(2):d.setMode(3)}else r.isPoints?d.setMode(0):r.isSprite&&d.setMode(4);if(r.isInstancedMesh)d.renderInstances(y,x,r.count);else if(i.isInstancedBufferGeometry){const t=Math.min(i.instanceCount,i._maxInstanceCount);d.renderInstances(y,x,t)}else d.render(y,x)}},this.compile=function(t,e){d=lt.get(t),d.init(),f.push(d),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(g.physicallyCorrectLights),t.traverse((function(e){const i=e.material;if(i)if(Array.isArray(i))for(let n=0;n<i.length;n++){Ft(i[n],t,e)}else Ft(i,t,e)})),f.pop(),d=null};let Ct=null;function Mt(){It.stop()}function Et(){It.start()}const It=new qe;function St(t,e,i,n){const r=t.opaque,a=t.transmissive,o=t.transparent;d.setupLightsView(i),a.length>0&&function(t,e,i){if(null===V){const t=!0===s&&!0===Z.isWebGL2;V=new(t?M:C)(1024,1024,{generateMipmaps:!0,type:null!==gt.convert(1016)?1016:1009,minFilter:1008,magFilter:1003,wrapS:1001,wrapT:1001})}const n=g.getRenderTarget();g.setRenderTarget(V),g.clear();const r=g.toneMapping;g.toneMapping=0,Tt(t,e,i),g.toneMapping=r,K.updateMultisampleRenderTarget(V),K.updateRenderTargetMipmap(V),g.setRenderTarget(n)}(r,e,i),n&&J.viewport(E.copy(n)),r.length>0&&Tt(r,e,i),a.length>0&&Tt(a,e,i),o.length>0&&Tt(o,e,i)}function Tt(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,a=t.length;r<a;r++){const a=t[r],s=a.object,o=a.geometry,l=null===n?a.material:n,c=a.group;s.layers.test(i.layers)&&Bt(s,e,i,o,l,c)}}function Bt(t,e,i,n,r,a){if(t.onBeforeRender(g,e,i,n,r,a),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(g,e,i,n,t,a),t.isImmediateRenderObject){const n=Ut(i,e,r,t);J.setMaterial(r),mt.reset(),function(t,e){t.render((function(t){g.renderBufferImmediate(t,e)}))}(t,n)}else!0===r.transparent&&2===r.side?(r.side=1,r.needsUpdate=!0,g.renderBufferDirect(i,e,n,r,t,a),r.side=0,r.needsUpdate=!0,g.renderBufferDirect(i,e,n,r,t,a),r.side=2):g.renderBufferDirect(i,e,n,r,t,a);t.onAfterRender(g,e,i,n,r,a)}function Ft(t,e,i){!0!==e.isScene&&(e=j);const n=Y.get(t),r=d.state.lights,a=d.state.shadowsArray,s=r.state.version,o=at.getParameters(t,r.state,a,e,i),l=at.getProgramCacheKey(o);let c=n.programs;n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=(t.isMeshStandardMaterial?tt:$).get(t.envMap||n.environment),void 0===c&&(t.addEventListener("dispose",wt),c=new Map,n.programs=c);let h=c.get(l);if(void 0!==h){if(n.currentProgram===h&&n.lightsStateVersion===s)return Lt(t,o),h}else o.uniforms=at.getUniforms(t),t.onBuild(o,g),t.onBeforeCompile(o,g),h=at.acquireProgram(o,l),c.set(l,h),n.uniforms=o.uniforms;const u=n.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(u.clippingPlanes=ct.uniform),Lt(t,o),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=s,n.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotShadowMatrix.value=r.state.spotShadowMatrix,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix);const p=h.getUniforms(),f=Hn.seqWithValue(p.seq,u);return n.currentProgram=h,n.uniformsList=f,h}function Lt(t,e){const i=Y.get(t);i.outputEncoding=e.outputEncoding,i.instancing=e.instancing,i.skinning=e.skinning,i.morphTargets=e.morphTargets,i.morphNormals=e.morphNormals,i.morphTargetsCount=e.morphTargetsCount,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas,i.vertexTangents=e.vertexTangents}function Ut(t,e,i,n){!0!==e.isScene&&(e=j),K.resetTextureUnits();const r=e.fog,a=i.isMeshStandardMaterial?e.environment:null,s=null===x?g.outputEncoding:x.texture.encoding,o=(i.isMeshStandardMaterial?tt:$).get(i.envMap||a),l=!0===i.vertexColors&&!!n.geometry&&!!n.geometry.attributes.color&&4===n.geometry.attributes.color.itemSize,c=!!i.normalMap&&!!n.geometry&&!!n.geometry.attributes.tangent,h=!!n.geometry&&!!n.geometry.morphAttributes.position,u=!!n.geometry&&!!n.geometry.morphAttributes.normal,p=n.geometry&&n.geometry.morphAttributes.position?n.geometry.morphAttributes.position.length:0,f=Y.get(i),m=d.state.lights;if(!0===O&&(!0===Q||t!==A)){const e=t===A&&i.id===_;ct.setState(i,t,e)}let b=!1;i.version===f.__version?f.needsLights&&f.lightsStateVersion!==m.state.version||f.outputEncoding!==s||n.isInstancedMesh&&!1===f.instancing?b=!0:n.isInstancedMesh||!0!==f.instancing?n.isSkinnedMesh&&!1===f.skinning?b=!0:n.isSkinnedMesh||!0!==f.skinning?f.envMap!==o||i.fog&&f.fog!==r?b=!0:void 0===f.numClippingPlanes||f.numClippingPlanes===ct.numPlanes&&f.numIntersection===ct.numIntersection?(f.vertexAlphas!==l||f.vertexTangents!==c||f.morphTargets!==h||f.morphNormals!==u||!0===Z.isWebGL2&&f.morphTargetsCount!==p)&&(b=!0):b=!0:b=!0:b=!0:(b=!0,f.__version=i.version);let y=f.currentProgram;!0===b&&(y=Ft(i,e,n));let v=!1,w=!1,C=!1;const M=y.getUniforms(),E=f.uniforms;if(J.useProgram(y.program)&&(v=!0,w=!0,C=!0),i.id!==_&&(_=i.id,w=!0),v||A!==t){if(M.setValue(bt,"projectionMatrix",t.projectionMatrix),Z.logarithmicDepthBuffer&&M.setValue(bt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),A!==t&&(A=t,w=!0,C=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){const e=M.map.cameraPosition;void 0!==e&&e.setValue(bt,G.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&M.setValue(bt,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||n.isSkinnedMesh)&&M.setValue(bt,"viewMatrix",t.matrixWorldInverse)}if(n.isSkinnedMesh){M.setOptional(bt,n,"bindMatrix"),M.setOptional(bt,n,"bindMatrixInverse");const t=n.skeleton;t&&(Z.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),M.setValue(bt,"boneTexture",t.boneTexture,K),M.setValue(bt,"boneTextureSize",t.boneTextureSize)):M.setOptional(bt,t,"boneMatrices"))}var I,S;return(w||f.receiveShadow!==n.receiveShadow)&&(f.receiveShadow=n.receiveShadow,M.setValue(bt,"receiveShadow",n.receiveShadow)),w&&(M.setValue(bt,"toneMappingExposure",g.toneMappingExposure),f.needsLights&&(S=C,(I=E).ambientLightColor.needsUpdate=S,I.lightProbe.needsUpdate=S,I.directionalLights.needsUpdate=S,I.directionalLightShadows.needsUpdate=S,I.pointLights.needsUpdate=S,I.pointLightShadows.needsUpdate=S,I.spotLights.needsUpdate=S,I.spotLightShadows.needsUpdate=S,I.rectAreaLights.needsUpdate=S,I.hemisphereLights.needsUpdate=S),r&&i.fog&&st.refreshFogUniforms(E,r),st.refreshMaterialUniforms(E,i,L,F,V),Hn.upload(bt,f.uniformsList,E,K)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Hn.upload(bt,f.uniformsList,E,K),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&M.setValue(bt,"center",n.center),M.setValue(bt,"modelViewMatrix",n.modelViewMatrix),M.setValue(bt,"normalMatrix",n.normalMatrix),M.setValue(bt,"modelMatrix",n.matrixWorld),y}It.setAnimationLoop((function(t){Ct&&Ct(t)})),"undefined"!=typeof window&&It.setContext(window),this.setAnimationLoop=function(t){Ct=t,xt.setAnimationLoop(t),null===t?It.stop():It.start()},xt.addEventListener("sessionstart",Mt),xt.addEventListener("sessionend",Et),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===m)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===xt.enabled&&!0===xt.isPresenting&&(!0===xt.cameraAutoUpdate&&xt.updateCamera(e),e=xt.getCamera()),!0===t.isScene&&t.onBeforeRender(g,t,e,x),d=lt.get(t,f.length),d.init(),f.push(d),H.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),z.setFromProjectionMatrix(H),Q=this.localClippingEnabled,O=ct.init(this.clippingPlanes,Q,e),u=ot.get(t,p.length),u.init(),p.push(u),function t(e,i,n,r){if(!1===e.visible)return;if(e.layers.test(i.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(i);else if(e.isLight)d.pushLight(e),e.castShadow&&d.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||z.intersectsSprite(e)){r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H);const t=nt.update(e),i=e.material;i.visible&&u.push(e,t,i,n,G.z,null)}}else if(e.isImmediateRenderObject)r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H),u.push(e,null,e.material,n,G.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==X.render.frame&&(e.skeleton.update(),e.skeleton.frame=X.render.frame),!e.frustumCulled||z.intersectsObject(e))){r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H);const t=nt.update(e),i=e.material;if(Array.isArray(i)){const r=t.groups;for(let a=0,s=r.length;a<s;a++){const s=r[a],o=i[s.materialIndex];o&&o.visible&&u.push(e,t,o,n,G.z,s)}}else i.visible&&u.push(e,t,i,n,G.z,null)}const a=e.children;for(let e=0,s=a.length;e<s;e++)t(a[e],i,n,r)}(t,e,0,g.sortObjects),u.finish(),!0===g.sortObjects&&u.sort(U,R),!0===O&&ct.beginShadows();const i=d.state.shadowsArray;if(ht.render(i,t,e),!0===O&&ct.endShadows(),!0===this.info.autoReset&&this.info.reset(),ut.render(u,t),d.setupLights(g.physicallyCorrectLights),e.isArrayCamera){const i=e.cameras;for(let e=0,n=i.length;e<n;e++){const n=i[e];St(u,t,n,n.viewport)}}else St(u,t,e);null!==x&&(K.updateMultisampleRenderTarget(x),K.updateRenderTargetMipmap(x)),!0===t.isScene&&t.onAfterRender(g,t,e),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1),mt.resetDefaultState(),_=-1,A=null,f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),u=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return v},this.getRenderTarget=function(){return x},this.setRenderTarget=function(t,e=0,i=0){x=t,y=e,v=i,t&&void 0===Y.get(t).__webglFramebuffer&&K.setupRenderTarget(t);let n=null,r=!1,a=!1;if(t){const i=t.texture;(i.isDataTexture3D||i.isDataTexture2DArray)&&(a=!0);const s=Y.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(n=s[e],r=!0):n=t.isWebGLMultisampleRenderTarget?Y.get(t).__webglMultisampledFramebuffer:s,E.copy(t.viewport),S.copy(t.scissor),T=t.scissorTest}else E.copy(D).multiplyScalar(L).floor(),S.copy(N).multiplyScalar(L).floor(),T=k;if(J.bindFramebuffer(36160,n)&&Z.drawBuffers){let e=!1;if(t)if(t.isWebGLMultipleRenderTargets){const i=t.texture;if(P.length!==i.length||36064!==P[0]){for(let t=0,e=i.length;t<e;t++)P[t]=36064+t;P.length=i.length,e=!0}}else 1===P.length&&36064===P[0]||(P[0]=36064,P.length=1,e=!0);else 1===P.length&&1029===P[0]||(P[0]=1029,P.length=1,e=!0);e&&(Z.isWebGL2?bt.drawBuffers(P):q.get("WEBGL_draw_buffers").drawBuffersWEBGL(P))}if(J.viewport(E),J.scissor(S),J.setScissorTest(T),r){const n=Y.get(t.texture);bt.framebufferTexture2D(36160,36064,34069+e,n.__webglTexture,i)}else if(a){const n=Y.get(t.texture),r=e||0;bt.framebufferTextureLayer(36160,36064,n.__webglTexture,i||0,r)}_=-1},this.readRenderTargetPixels=function(t,e,i,n,r,a,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=Y.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){J.bindFramebuffer(36160,o);try{const s=t.texture,o=s.format,l=s.type;if(1023!==o&>.convert(o)!==bt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=1016===l&&(q.has("EXT_color_buffer_half_float")||Z.isWebGL2&&q.has("EXT_color_buffer_float"));if(!(1009===l||gt.convert(l)===bt.getParameter(35738)||1015===l&&(Z.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===bt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&bt.readPixels(e,i,n,r,gt.convert(o),gt.convert(l),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==x?Y.get(x).__webglFramebuffer:null;J.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,i=0){const n=Math.pow(2,-i),r=Math.floor(e.image.width*n),a=Math.floor(e.image.height*n);let s=gt.convert(e.format);Z.isWebGL2&&(6407===s&&(s=32849),6408===s&&(s=32856)),K.setTexture2D(e,0),bt.copyTexImage2D(3553,i,s,t.x,t.y,r,a,0),J.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const r=e.image.width,a=e.image.height,s=gt.convert(i.format),o=gt.convert(i.type);K.setTexture2D(i,0),bt.pixelStorei(37440,i.flipY),bt.pixelStorei(37441,i.premultiplyAlpha),bt.pixelStorei(3317,i.unpackAlignment),e.isDataTexture?bt.texSubImage2D(3553,n,t.x,t.y,r,a,s,o,e.image.data):e.isCompressedTexture?bt.compressedTexSubImage2D(3553,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):bt.texSubImage2D(3553,n,t.x,t.y,s,o,e.image),0===n&&i.generateMipmaps&&bt.generateMipmap(3553),J.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,r=0){if(g.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const a=t.max.x-t.min.x+1,s=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=gt.convert(n.format),c=gt.convert(n.type);let h;if(n.isDataTexture3D)K.setTexture3D(n,0),h=32879;else{if(!n.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(n,0),h=35866}bt.pixelStorei(37440,n.flipY),bt.pixelStorei(37441,n.premultiplyAlpha),bt.pixelStorei(3317,n.unpackAlignment);const u=bt.getParameter(3314),d=bt.getParameter(32878),p=bt.getParameter(3316),f=bt.getParameter(3315),m=bt.getParameter(32877),b=i.isCompressedTexture?i.mipmaps[0]:i.image;bt.pixelStorei(3314,b.width),bt.pixelStorei(32878,b.height),bt.pixelStorei(3316,t.min.x),bt.pixelStorei(3315,t.min.y),bt.pixelStorei(32877,t.min.z),i.isDataTexture||i.isDataTexture3D?bt.texSubImage3D(h,r,e.x,e.y,e.z,a,s,o,l,c,b.data):i.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),bt.compressedTexSubImage3D(h,r,e.x,e.y,e.z,a,s,o,l,b.data)):bt.texSubImage3D(h,r,e.x,e.y,e.z,a,s,o,l,c,b),bt.pixelStorei(3314,u),bt.pixelStorei(32878,d),bt.pixelStorei(3316,p),bt.pixelStorei(3315,f),bt.pixelStorei(32877,m),0===r&&n.generateMipmaps&&bt.generateMipmap(h),J.unbindTexture()},this.initTexture=function(t){K.setTexture2D(t,0),J.unbindTexture()},this.resetState=function(){y=0,v=0,x=null,J.reset(),mt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends Rr{}).prototype.isWebGL1Renderer=!0;class Dr{constructor(t,e=25e-5){this.name="",this.color=new Jt(t),this.density=e}clone(){return new Dr(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Dr.prototype.isFogExp2=!0;class Nr{constructor(t,e=1,i=1e3){this.name="",this.color=new Jt(t),this.near=e,this.far=i}clone(){return new Nr(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}Nr.prototype.isFog=!0;class kr extends Tt{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}kr.prototype.isScene=!0;class Pr{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=l()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=l()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=l()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}Pr.prototype.isInterleavedBuffer=!0;const zr=new I;class Or{constructor(t,e,i,n=!1){this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=!0===n}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)zr.x=this.getX(e),zr.y=this.getY(e),zr.z=this.getZ(e),zr.applyMatrix4(t),this.setXYZ(e,zr.x,zr.y,zr.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)zr.x=this.getX(e),zr.y=this.getY(e),zr.z=this.getZ(e),zr.applyNormalMatrix(t),this.setXYZ(e,zr.x,zr.y,zr.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)zr.x=this.getX(e),zr.y=this.getY(e),zr.z=this.getZ(e),zr.transformDirection(t),this.setXYZ(e,zr.x,zr.y,zr.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return new $t(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Or(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}Or.prototype.isInterleavedBufferAttribute=!0;class Qr extends Vt{constructor(t){super(),this.type="SpriteMaterial",this.color=new Jt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let Vr;Qr.prototype.isSpriteMaterial=!0;const Hr=new I,Gr=new I,jr=new I,Wr=new f,qr=new f,Zr=new rt,Jr=new I,Xr=new I,Yr=new I,Kr=new f,$r=new f,ta=new f;class ea extends Tt{constructor(t){if(super(),this.type="Sprite",void 0===Vr){Vr=new he;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new Pr(t,5);Vr.setIndex([0,1,2,0,2,3]),Vr.setAttribute("position",new Or(e,3,0,!1)),Vr.setAttribute("uv",new Or(e,2,3,!1))}this.geometry=Vr,this.material=void 0!==t?t:new Qr,this.center=new f(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Gr.setFromMatrixScale(this.matrixWorld),Zr.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),jr.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Gr.multiplyScalar(-jr.z);const i=this.material.rotation;let n,r;0!==i&&(r=Math.cos(i),n=Math.sin(i));const a=this.center;ia(Jr.set(-.5,-.5,0),jr,a,Gr,n,r),ia(Xr.set(.5,-.5,0),jr,a,Gr,n,r),ia(Yr.set(.5,.5,0),jr,a,Gr,n,r),Kr.set(0,0),$r.set(1,0),ta.set(1,1);let s=t.ray.intersectTriangle(Jr,Xr,Yr,!1,Hr);if(null===s&&(ia(Xr.set(-.5,.5,0),jr,a,Gr,n,r),$r.set(0,1),s=t.ray.intersectTriangle(Jr,Yr,Xr,!1,Hr),null===s))return;const o=t.ray.origin.distanceTo(Hr);o<t.near||o>t.far||e.push({distance:o,point:Hr.clone(),uv:Ot.getUV(Hr,Jr,Xr,Yr,Kr,$r,ta,new f),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function ia(t,e,i,n,r,a){Wr.subVectors(t,i).addScalar(.5).multiply(n),void 0!==r?(qr.x=a*Wr.x-r*Wr.y,qr.y=r*Wr.x+a*Wr.y):qr.copy(Wr),t.copy(e),t.x+=qr.x,t.y+=qr.y,t.applyMatrix4(Zr)}ea.prototype.isSprite=!0;const na=new I,ra=new w,aa=new w,sa=new I,oa=new rt;class la extends Se{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new rt,this.bindMatrixInverse=new rt}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new w,e=this.geometry.attributes.skinWeight;for(let i=0,n=e.count;i<n;i++){t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.w=e.getW(i);const n=1/t.manhattanLength();n!==1/0?t.multiplyScalar(n):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,e){const i=this.skeleton,n=this.geometry;ra.fromBufferAttribute(n.attributes.skinIndex,t),aa.fromBufferAttribute(n.attributes.skinWeight,t),na.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const n=aa.getComponent(t);if(0!==n){const r=ra.getComponent(t);oa.multiplyMatrices(i.bones[r].matrixWorld,i.boneInverses[r]),e.addScaledVector(sa.copy(na).applyMatrix4(oa),n)}}return e.applyMatrix4(this.bindMatrixInverse)}}la.prototype.isSkinnedMesh=!0;class ca extends Tt{constructor(){super(),this.type="Bone"}}ca.prototype.isBone=!0;class ha extends _{constructor(t=null,e=1,i=1,n,r,a,s,o,l=1003,c=1003,h,u){super(null,a,s,o,l,c,n,r,h,u),this.image={data:t,width:e,height:i},this.magFilter=l,this.minFilter=c,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}ha.prototype.isDataTexture=!0;class ua extends $t{constructor(t,e,i,n=1){"number"==typeof i&&(n=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,e,i),this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}ua.prototype.isInstancedBufferAttribute=!0;const da=new rt,pa=new rt,fa=[],ga=new Se;class ma extends Se{constructor(t,e,i){super(t,e),this.instanceMatrix=new ua(new Float32Array(16*i),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const i=this.matrixWorld,n=this.count;if(ga.geometry=this.geometry,ga.material=this.material,void 0!==ga.material)for(let r=0;r<n;r++){this.getMatrixAt(r,da),pa.multiplyMatrices(i,da),ga.matrixWorld=pa,ga.raycast(t,fa);for(let t=0,i=fa.length;t<i;t++){const i=fa[t];i.instanceId=r,i.object=this,e.push(i)}fa.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new ua(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}ma.prototype.isInstancedMesh=!0;class ba extends Vt{constructor(t){super(),this.type="LineBasicMaterial",this.color=new Jt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this}}ba.prototype.isLineBasicMaterial=!0;const ya=new I,va=new I,xa=new rt,_a=new nt,Aa=new J;class wa extends Tt{constructor(t=new he,e=new ba){super(),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)ya.fromBufferAttribute(e,t-1),va.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=ya.distanceTo(va);t.setAttribute("lineDistance",new ie(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Aa.copy(i.boundingSphere),Aa.applyMatrix4(n),Aa.radius+=r,!1===t.ray.intersectsSphere(Aa))return;xa.copy(n).invert(),_a.copy(t.ray).applyMatrix4(xa);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=new I,c=new I,h=new I,u=new I,d=this.isLineSegments?2:1;if(i.isBufferGeometry){const n=i.index,r=i.attributes.position;if(null!==n){for(let i=Math.max(0,a.start),s=Math.min(n.count,a.start+a.count)-1;i<s;i+=d){const a=n.getX(i),s=n.getX(i+1);l.fromBufferAttribute(r,a),c.fromBufferAttribute(r,s);if(_a.distanceSqToSegment(l,c,u,h)>o)continue;u.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(u);d<t.near||d>t.far||e.push({distance:d,point:h.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else{for(let i=Math.max(0,a.start),n=Math.min(r.count,a.start+a.count)-1;i<n;i+=d){l.fromBufferAttribute(r,i),c.fromBufferAttribute(r,i+1);if(_a.distanceSqToSegment(l,c,u,h)>o)continue;u.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(u);n<t.near||n>t.far||e.push({distance:n,point:h.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}}else i.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}wa.prototype.isLine=!0;const Ca=new I,Ma=new I;class Ea extends wa{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,n=e.count;t<n;t+=2)Ca.fromBufferAttribute(e,t),Ma.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+Ca.distanceTo(Ma);t.setAttribute("lineDistance",new ie(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}Ea.prototype.isLineSegments=!0;class Ia extends wa{constructor(t,e){super(t,e),this.type="LineLoop"}}Ia.prototype.isLineLoop=!0;class Sa extends Vt{constructor(t){super(),this.type="PointsMaterial",this.color=new Jt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this}}Sa.prototype.isPointsMaterial=!0;const Ta=new rt,Ba=new nt,Fa=new J,La=new I;class Ua extends Tt{constructor(t=new he,e=new Sa){super(),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Points.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Fa.copy(i.boundingSphere),Fa.applyMatrix4(n),Fa.radius+=r,!1===t.ray.intersectsSphere(Fa))return;Ta.copy(n).invert(),Ba.copy(t.ray).applyMatrix4(Ta);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s;if(i.isBufferGeometry){const r=i.index,s=i.attributes.position;if(null!==r){for(let i=Math.max(0,a.start),l=Math.min(r.count,a.start+a.count);i<l;i++){const a=r.getX(i);La.fromBufferAttribute(s,a),Ra(La,a,o,n,t,e,this)}}else{for(let i=Math.max(0,a.start),r=Math.min(s.count,a.start+a.count);i<r;i++)La.fromBufferAttribute(s,i),Ra(La,i,o,n,t,e,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function Ra(t,e,i,n,r,a,s){const o=Ba.distanceSqToPoint(t);if(o<i){const i=new I;Ba.closestPointToPoint(t,i),i.applyMatrix4(n);const l=r.ray.origin.distanceTo(i);if(l<r.near||l>r.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,object:s})}}Ua.prototype.isPoints=!0;(class extends _{constructor(t,e,i,n,r,a,s,o,l){super(t,e,i,n,r,a,s,o,l),this.format=void 0!==s?s:1022,this.minFilter=void 0!==a?a:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}).prototype.isVideoTexture=!0;class Da extends _{constructor(t,e,i,n,r,a,s,o,l,c,h,u){super(null,a,s,o,l,c,n,r,h,u),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}Da.prototype.isCompressedTexture=!0;(class extends _{constructor(t,e,i,n,r,a,s,o,l){super(t,e,i,n,r,a,s,o,l),this.needsUpdate=!0}}).prototype.isCanvasTexture=!0;(class extends _{constructor(t,e,i,n,r,a,s,o,l,c){if(1026!==(c=void 0!==c?c:1026)&&1027!==c)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===c&&(i=1012),void 0===i&&1027===c&&(i=1020),super(null,n,r,a,s,o,c,i,l),this.image={width:t,height:e},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==o?o:1003,this.flipY=!1,this.generateMipmaps=!1}}).prototype.isDepthTexture=!0;class Na extends he{constructor(t=1,e=1,i=1,n=8,r=1,a=!1,s=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:s,thetaLength:o};const l=this;n=Math.floor(n),r=Math.floor(r);const c=[],h=[],u=[],d=[];let p=0;const g=[],m=i/2;let b=0;function y(i){const r=p,a=new f,g=new I;let y=0;const v=!0===i?t:e,x=!0===i?1:-1;for(let t=1;t<=n;t++)h.push(0,m*x,0),u.push(0,x,0),d.push(.5,.5),p++;const _=p;for(let t=0;t<=n;t++){const e=t/n*o+s,i=Math.cos(e),r=Math.sin(e);g.x=v*r,g.y=m*x,g.z=v*i,h.push(g.x,g.y,g.z),u.push(0,x,0),a.x=.5*i+.5,a.y=.5*r*x+.5,d.push(a.x,a.y),p++}for(let t=0;t<n;t++){const e=r+t,n=_+t;!0===i?c.push(n,n+1,e):c.push(n+1,n,e),y+=3}l.addGroup(b,y,!0===i?1:2),b+=y}!function(){const a=new I,f=new I;let y=0;const v=(e-t)/i;for(let l=0;l<=r;l++){const c=[],b=l/r,y=b*(e-t)+t;for(let t=0;t<=n;t++){const e=t/n,r=e*o+s,l=Math.sin(r),g=Math.cos(r);f.x=y*l,f.y=-b*i+m,f.z=y*g,h.push(f.x,f.y,f.z),a.set(l,v,g).normalize(),u.push(a.x,a.y,a.z),d.push(e,1-b),c.push(p++)}g.push(c)}for(let t=0;t<n;t++)for(let e=0;e<r;e++){const i=g[e][t],n=g[e+1][t],r=g[e+1][t+1],a=g[e][t+1];c.push(i,n,a),c.push(n,r,a),y+=6}l.addGroup(b,y,0),b+=y}(),!1===a&&(t>0&&y(!0),e>0&&y(!1)),this.setIndex(c),this.setAttribute("position",new ie(h,3)),this.setAttribute("normal",new ie(u,3)),this.setAttribute("uv",new ie(d,2))}static fromJSON(t){return new Na(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ka extends Na{constructor(t=1,e=1,i=8,n=1,r=!1,a=0,s=2*Math.PI){super(0,t,e,i,n,r,a,s),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:s}}static fromJSON(t){return new ka(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}new I,new I,new I,new Ot;class Pa{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),r=0;e.push(0);for(let a=1;a<=t;a++)i=this.getPoint(a/t),r+=i.distanceTo(n),e.push(r),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const i=this.getLengths();let n=0;const r=i.length;let a;a=e||t*i[r-1];let s,o=0,l=r-1;for(;o<=l;)if(n=Math.floor(o+(l-o)/2),s=i[n]-a,s<0)o=n+1;else{if(!(s>0)){l=n;break}l=n-1}if(n=l,i[n]===a)return n/(r-1);const c=i[n];return(n+(a-c)/(i[n+1]-c))/(r-1)}getTangent(t,e){let i=t-1e-4,n=t+1e-4;i<0&&(i=0),n>1&&(n=1);const r=this.getPoint(i),a=this.getPoint(n),s=e||(r.isVector2?new f:new I);return s.copy(a).sub(r).normalize(),s}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){const i=new I,n=[],r=[],a=[],s=new I,o=new rt;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new I)}r[0]=new I,a[0]=new I;let l=Number.MAX_VALUE;const h=Math.abs(n[0].x),u=Math.abs(n[0].y),d=Math.abs(n[0].z);h<=l&&(l=h,i.set(1,0,0)),u<=l&&(l=u,i.set(0,1,0)),d<=l&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],s),a[0].crossVectors(n[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),a[e]=a[e-1].clone(),s.crossVectors(n[e-1],n[e]),s.length()>Number.EPSILON){s.normalize();const t=Math.acos(c(n[e-1].dot(n[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(s,t))}a[e].crossVectors(n[e],r[e])}if(!0===e){let e=Math.acos(c(r[0].dot(r[t]),-1,1));e/=t,n[0].dot(s.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(o.makeRotationAxis(n[i],e*i)),a[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:a}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class za extends Pa{constructor(t=0,e=0,i=1,n=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(t,e){const i=e||new f,n=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=a?0:n),!0!==this.aClockwise||a||(r===n?r=-n:r-=n);const s=this.aStartAngle+t*r;let o=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=o-this.aX,n=l-this.aY;o=i*t-n*e+this.aX,l=i*e+n*t+this.aY}return i.set(o,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}za.prototype.isEllipseCurve=!0;class Oa extends za{constructor(t,e,i,n,r,a){super(t,e,i,i,n,r,a),this.type="ArcCurve"}}function Qa(){let t=0,e=0,i=0,n=0;function r(r,a,s,o){t=r,e=s,i=-3*r+3*a-2*s-o,n=2*r-2*a+s+o}return{initCatmullRom:function(t,e,i,n,a){r(e,i,a*(i-t),a*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,a,s,o){let l=(e-t)/a-(i-t)/(a+s)+(i-e)/s,c=(i-e)/s-(n-e)/(s+o)+(n-i)/o;l*=s,c*=s,r(e,i,l,c)},calc:function(r){const a=r*r;return t+e*r+i*a+n*(a*r)}}}Oa.prototype.isArcCurve=!0;const Va=new I,Ha=new Qa,Ga=new Qa,ja=new Qa;class Wa extends Pa{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new I){const i=e,n=this.points,r=n.length,a=(r-(this.closed?0:1))*t;let s,o,l=Math.floor(a),c=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?s=n[(l-1)%r]:(Va.subVectors(n[0],n[1]).add(n[0]),s=Va);const h=n[l%r],u=n[(l+1)%r];if(this.closed||l+2<r?o=n[(l+2)%r]:(Va.subVectors(n[r-1],n[r-2]).add(n[r-1]),o=Va),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(s.distanceToSquared(h),t),i=Math.pow(h.distanceToSquared(u),t),n=Math.pow(u.distanceToSquared(o),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),Ha.initNonuniformCatmullRom(s.x,h.x,u.x,o.x,e,i,n),Ga.initNonuniformCatmullRom(s.y,h.y,u.y,o.y,e,i,n),ja.initNonuniformCatmullRom(s.z,h.z,u.z,o.z,e,i,n)}else"catmullrom"===this.curveType&&(Ha.initCatmullRom(s.x,h.x,u.x,o.x,this.tension),Ga.initCatmullRom(s.y,h.y,u.y,o.y,this.tension),ja.initCatmullRom(s.z,h.z,u.z,o.z,this.tension));return i.set(Ha.calc(c),Ga.calc(c),ja.calc(c)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new I).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function qa(t,e,i,n,r){const a=.5*(n-e),s=.5*(r-i),o=t*t;return(2*i-2*n+a+s)*(t*o)+(-3*i+3*n-2*a-s)*o+a*t+i}function Za(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function Ja(t,e,i,n,r){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}Wa.prototype.isCatmullRomCurve3=!0;class Xa extends Pa{constructor(t=new f,e=new f,i=new f,n=new f){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new f){const i=e,n=this.v0,r=this.v1,a=this.v2,s=this.v3;return i.set(Ja(t,n.x,r.x,a.x,s.x),Ja(t,n.y,r.y,a.y,s.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Xa.prototype.isCubicBezierCurve=!0;class Ya extends Pa{constructor(t=new I,e=new I,i=new I,n=new I){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new I){const i=e,n=this.v0,r=this.v1,a=this.v2,s=this.v3;return i.set(Ja(t,n.x,r.x,a.x,s.x),Ja(t,n.y,r.y,a.y,s.y),Ja(t,n.z,r.z,a.z,s.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Ya.prototype.isCubicBezierCurve3=!0;class Ka extends Pa{constructor(t=new f,e=new f){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new f){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const i=e||new f;return i.copy(this.v2).sub(this.v1).normalize(),i}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Ka.prototype.isLineCurve=!0;class $a extends Pa{constructor(t=new f,e=new f,i=new f){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new f){const i=e,n=this.v0,r=this.v1,a=this.v2;return i.set(Za(t,n.x,r.x,a.x),Za(t,n.y,r.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}$a.prototype.isQuadraticBezierCurve=!0;class ts extends Pa{constructor(t=new I,e=new I,i=new I){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new I){const i=e,n=this.v0,r=this.v1,a=this.v2;return i.set(Za(t,n.x,r.x,a.x),Za(t,n.y,r.y,a.y),Za(t,n.z,r.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}ts.prototype.isQuadraticBezierCurve3=!0;class es extends Pa{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new f){const i=e,n=this.points,r=(n.length-1)*t,a=Math.floor(r),s=r-a,o=n[0===a?a:a-1],l=n[a],c=n[a>n.length-2?n.length-1:a+1],h=n[a>n.length-3?n.length-1:a+2];return i.set(qa(s,o.x,l.x,c.x,h.x),qa(s,o.y,l.y,c.y,h.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new f).fromArray(i))}return this}}es.prototype.isSplineCurve=!0;var is=Object.freeze({__proto__:null,ArcCurve:Oa,CatmullRomCurve3:Wa,CubicBezierCurve:Xa,CubicBezierCurve3:Ya,EllipseCurve:za,LineCurve:Ka,LineCurve3:class extends Pa{constructor(t=new I,e=new I){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new I){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:$a,QuadraticBezierCurve3:ts,SplineCurve:es});class ns extends Pa{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ka(e,t))}getPoint(t,e){const i=t*this.getLength(),n=this.getCurveLengths();let r=0;for(;r<n.length;){if(n[r]>=i){const t=n[r]-i,a=this.curves[r],s=a.getLength(),o=0===s?0:1-t/s;return a.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let n=0,r=this.curves;n<r.length;n++){const a=r[n],s=a&&a.isEllipseCurve?2*t:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?t*a.points.length:t,o=a.getPoints(s);for(let t=0;t<o.length;t++){const n=o[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new is[i.type]).fromJSON(i))}return this}}class rs extends ns{constructor(t){super(),this.type="Path",this.currentPoint=new f,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new Ka(this.currentPoint.clone(),new f(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const r=new $a(this.currentPoint.clone(),new f(t,e),new f(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,r,a){const s=new Xa(this.currentPoint.clone(),new f(t,e),new f(i,n),new f(r,a));return this.curves.push(s),this.currentPoint.set(r,a),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new es(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,r,a){const s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+s,e+o,i,n,r,a),this}absarc(t,e,i,n,r,a){return this.absellipse(t,e,i,i,n,r,a),this}ellipse(t,e,i,n,r,a,s,o){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,i,n,r,a,s,o),this}absellipse(t,e,i,n,r,a,s,o){const l=new za(t,e,i,n,r,a,s,o);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class as extends rs{constructor(t){super(t),this.uuid=l(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new rs).fromJSON(i))}return this}}const ss=function(t,e,i=2){const n=e&&e.length,r=n?e[0]*i:t.length;let a=os(t,0,r,i,!0);const s=[];if(!a||a.next===a.prev)return s;let o,l,c,h,u,d,p;if(n&&(a=function(t,e,i,n){const r=[];let a,s,o,l,c;for(a=0,s=e.length;a<s;a++)o=e[a]*n,l=a<s-1?e[a+1]*n:t.length,c=os(t,o,l,n,!1),c===c.next&&(c.steiner=!0),r.push(ys(c));for(r.sort(fs),a=0;a<r.length;a++)gs(r[a],i),i=ls(i,i.next);return i}(t,e,a,i)),t.length>80*i){o=c=t[0],l=h=t[1];for(let e=i;e<r;e+=i)u=t[e],d=t[e+1],u<o&&(o=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);p=Math.max(c-o,h-l),p=0!==p?1/p:0}return cs(a,s,i,o,l,p),s};function os(t,e,i,n,r){let a,s;if(r===function(t,e,i,n){let r=0;for(let a=e,s=i-n;a<i;a+=n)r+=(t[s]-t[a])*(t[a+1]+t[s+1]),s=a;return r}(t,e,i,n)>0)for(a=e;a<i;a+=n)s=Ss(a,t[a],t[a+1],s);else for(a=i-n;a>=e;a-=n)s=Ss(a,t[a],t[a+1],s);return s&&As(s,s.next)&&(Ts(s),s=s.next),s}function ls(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!As(n,n.next)&&0!==_s(n.prev,n,n.next))n=n.next;else{if(Ts(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function cs(t,e,i,n,r,a,s){if(!t)return;!s&&a&&function(t,e,i,n){let r=t;do{null===r.z&&(r.z=bs(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i,n,r,a,s,o,l,c=1;do{for(i=t,t=null,a=null,s=0;i;){for(s++,n=i,o=0,e=0;e<c&&(o++,n=n.nextZ,n);e++);for(l=c;o>0||l>0&&n;)0!==o&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,l--),a?a.nextZ=r:t=r,r.prevZ=a,a=r;i=n}a.nextZ=null,c*=2}while(s>1)}(r)}(t,n,r,a);let o,l,c=t;for(;t.prev!==t.next;)if(o=t.prev,l=t.next,a?us(t,n,r,a):hs(t))e.push(o.i/i),e.push(t.i/i),e.push(l.i/i),Ts(t),t=l.next,c=l.next;else if((t=l)===c){s?1===s?cs(t=ds(ls(t),e,i),e,i,n,r,a,2):2===s&&ps(t,e,i,n,r,a):cs(ls(t),e,i,n,r,a,1);break}}function hs(t){const e=t.prev,i=t,n=t.next;if(_s(e,i,n)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(vs(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&_s(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function us(t,e,i,n){const r=t.prev,a=t,s=t.next;if(_s(r,a,s)>=0)return!1;const o=r.x<a.x?r.x<s.x?r.x:s.x:a.x<s.x?a.x:s.x,l=r.y<a.y?r.y<s.y?r.y:s.y:a.y<s.y?a.y:s.y,c=r.x>a.x?r.x>s.x?r.x:s.x:a.x>s.x?a.x:s.x,h=r.y>a.y?r.y>s.y?r.y:s.y:a.y>s.y?a.y:s.y,u=bs(o,l,e,i,n),d=bs(c,h,e,i,n);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&vs(r.x,r.y,a.x,a.y,s.x,s.y,p.x,p.y)&&_s(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&vs(r.x,r.y,a.x,a.y,s.x,s.y,f.x,f.y)&&_s(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&vs(r.x,r.y,a.x,a.y,s.x,s.y,p.x,p.y)&&_s(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&vs(r.x,r.y,a.x,a.y,s.x,s.y,f.x,f.y)&&_s(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ds(t,e,i){let n=t;do{const r=n.prev,a=n.next.next;!As(r,a)&&ws(r,n,n.next,a)&&Es(r,a)&&Es(a,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(a.i/i),Ts(n),Ts(n.next),n=t=a),n=n.next}while(n!==t);return ls(n)}function ps(t,e,i,n,r,a){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&xs(s,t)){let o=Is(s,t);return s=ls(s,s.next),o=ls(o,o.next),cs(s,e,i,n,r,a),void cs(o,e,i,n,r,a)}t=t.next}s=s.next}while(s!==t)}function fs(t,e){return t.x-e.x}function gs(t,e){if(e=function(t,e){let i=e;const n=t.x,r=t.y;let a,s=-1/0;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>s){if(s=t,t===n){if(r===i.y)return i;if(r===i.next.y)return i.next}a=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!a)return null;if(n===s)return a;const o=a,l=a.x,c=a.y;let h,u=1/0;i=a;do{n>=i.x&&i.x>=l&&n!==i.x&&vs(r<c?n:s,r,l,c,r<c?s:n,r,i.x,i.y)&&(h=Math.abs(r-i.y)/(n-i.x),Es(i,t)&&(h<u||h===u&&(i.x>a.x||i.x===a.x&&ms(a,i)))&&(a=i,u=h)),i=i.next}while(i!==o);return a}(t,e)){const i=Is(e,t);ls(e,e.next),ls(i,i.next)}}function ms(t,e){return _s(t.prev,t,e.prev)<0&&_s(e.next,t,t.next)<0}function bs(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ys(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function vs(t,e,i,n,r,a,s,o){return(r-s)*(e-o)-(t-s)*(a-o)>=0&&(t-s)*(n-o)-(i-s)*(e-o)>=0&&(i-s)*(a-o)-(r-s)*(n-o)>=0}function xs(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&ws(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Es(t,e)&&Es(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&r<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(_s(t.prev,t,e.prev)||_s(t,e.prev,e))||As(t,e)&&_s(t.prev,t,t.next)>0&&_s(e.prev,e,e.next)>0)}function _s(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function As(t,e){return t.x===e.x&&t.y===e.y}function ws(t,e,i,n){const r=Ms(_s(t,e,i)),a=Ms(_s(t,e,n)),s=Ms(_s(i,n,t)),o=Ms(_s(i,n,e));return r!==a&&s!==o||(!(0!==r||!Cs(t,i,e))||(!(0!==a||!Cs(t,n,e))||(!(0!==s||!Cs(i,t,n))||!(0!==o||!Cs(i,e,n)))))}function Cs(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Ms(t){return t>0?1:t<0?-1:0}function Es(t,e){return _s(t.prev,t,t.next)<0?_s(t,e,t.next)>=0&&_s(t,t.prev,e)>=0:_s(t,e,t.prev)<0||_s(t,t.next,e)<0}function Is(t,e){const i=new Bs(t.i,t.x,t.y),n=new Bs(e.i,e.x,e.y),r=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,a.next=n,n.prev=a,n}function Ss(t,e,i,n){const r=new Bs(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Ts(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Bs(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Fs{static area(t){const e=t.length;let i=0;for(let n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i}static isClockWise(t){return Fs.area(t)<0}static triangulateShape(t,e){const i=[],n=[],r=[];Ls(t),Us(i,t);let a=t.length;e.forEach(Ls);for(let t=0;t<e.length;t++)n.push(a),a+=e[t].length,Us(i,e[t]);const s=ss(i,n);for(let t=0;t<s.length;t+=3)r.push(s.slice(t,t+3));return r}}function Ls(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Us(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class Rs extends he{constructor(t=new as([new f(.5,.5),new f(-.5,.5),new f(-.5,-.5),new f(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,n=[],r=[];for(let e=0,i=t.length;e<i;e++){a(t[e])}function a(t){const a=[],s=void 0!==e.curveSegments?e.curveSegments:12,o=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:1,c=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:.2,u=void 0!==e.bevelSize?e.bevelSize:h-.1,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const g=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:Ds;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let b,y,v,x,_,A=!1;g&&(b=g.getSpacedPoints(o),A=!0,c=!1,y=g.computeFrenetFrames(o,!1),v=new I,x=new I,_=new I),c||(p=0,h=0,u=0,d=0);const w=t.extractPoints(s);let C=w.shape;const M=w.holes;if(!Fs.isClockWise(C)){C=C.reverse();for(let t=0,e=M.length;t<e;t++){const e=M[t];Fs.isClockWise(e)&&(M[t]=e.reverse())}}const E=Fs.triangulateShape(C,M),S=C;for(let t=0,e=M.length;t<e;t++){const e=M[t];C=C.concat(e)}function T(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(i).add(t)}const B=C.length,F=E.length;function L(t,e,i){let n,r,a;const s=t.x-e.x,o=t.y-e.y,l=i.x-t.x,c=i.y-t.y,h=s*s+o*o,u=s*c-o*l;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-o/u,g=e.y+s/u,m=((i.x-c/d-p)*c-(i.y+l/d-g)*l)/(s*c-o*l);n=p+s*m-t.x,r=g+o*m-t.y;const b=n*n+r*r;if(b<=2)return new f(n,r);a=Math.sqrt(b/2)}else{let t=!1;s>Number.EPSILON?l>Number.EPSILON&&(t=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(c)&&(t=!0),t?(n=-o,r=s,a=Math.sqrt(h)):(n=s,r=o,a=Math.sqrt(h/2))}return new f(n/a,r/a)}const U=[];for(let t=0,e=S.length,i=e-1,n=t+1;t<e;t++,i++,n++)i===e&&(i=0),n===e&&(n=0),U[t]=L(S[t],S[i],S[n]);const R=[];let D,N=U.concat();for(let t=0,e=M.length;t<e;t++){const e=M[t];D=[];for(let t=0,i=e.length,n=i-1,r=t+1;t<i;t++,n++,r++)n===i&&(n=0),r===i&&(r=0),D[t]=L(e[t],e[n],e[r]);R.push(D),N=N.concat(D)}for(let t=0;t<p;t++){const e=t/p,i=h*Math.cos(e*Math.PI/2),n=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=S.length;t<e;t++){const e=T(S[t],U[t],n);z(e.x,e.y,-i)}for(let t=0,e=M.length;t<e;t++){const e=M[t];D=R[t];for(let t=0,r=e.length;t<r;t++){const r=T(e[t],D[t],n);z(r.x,r.y,-i)}}}const k=u+d;for(let t=0;t<B;t++){const e=c?T(C[t],N[t],k):C[t];A?(x.copy(y.normals[0]).multiplyScalar(e.x),v.copy(y.binormals[0]).multiplyScalar(e.y),_.copy(b[0]).add(x).add(v),z(_.x,_.y,_.z)):z(e.x,e.y,0)}for(let t=1;t<=o;t++)for(let e=0;e<B;e++){const i=c?T(C[e],N[e],k):C[e];A?(x.copy(y.normals[t]).multiplyScalar(i.x),v.copy(y.binormals[t]).multiplyScalar(i.y),_.copy(b[t]).add(x).add(v),z(_.x,_.y,_.z)):z(i.x,i.y,l/o*t)}for(let t=p-1;t>=0;t--){const e=t/p,i=h*Math.cos(e*Math.PI/2),n=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=S.length;t<e;t++){const e=T(S[t],U[t],n);z(e.x,e.y,l+i)}for(let t=0,e=M.length;t<e;t++){const e=M[t];D=R[t];for(let t=0,r=e.length;t<r;t++){const r=T(e[t],D[t],n);A?z(r.x,r.y+b[o-1].y,b[o-1].x+i):z(r.x,r.y,l+i)}}}function P(t,e){let i=t.length;for(;--i>=0;){const n=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=o+2*p;t<i;t++){const i=B*t,a=B*(t+1);Q(e+n+i,e+r+i,e+r+a,e+n+a)}}}function z(t,e,i){a.push(t),a.push(e),a.push(i)}function O(t,e,r){V(t),V(e),V(r);const a=n.length/3,s=m.generateTopUV(i,n,a-3,a-2,a-1);H(s[0]),H(s[1]),H(s[2])}function Q(t,e,r,a){V(t),V(e),V(a),V(e),V(r),V(a);const s=n.length/3,o=m.generateSideWallUV(i,n,s-6,s-3,s-2,s-1);H(o[0]),H(o[1]),H(o[3]),H(o[1]),H(o[2]),H(o[3])}function V(t){n.push(a[3*t+0]),n.push(a[3*t+1]),n.push(a[3*t+2])}function H(t){r.push(t.x),r.push(t.y)}!function(){const t=n.length/3;if(c){let t=0,e=B*t;for(let t=0;t<F;t++){const i=E[t];O(i[2]+e,i[1]+e,i[0]+e)}t=o+2*p,e=B*t;for(let t=0;t<F;t++){const i=E[t];O(i[0]+e,i[1]+e,i[2]+e)}}else{for(let t=0;t<F;t++){const e=E[t];O(e[2],e[1],e[0])}for(let t=0;t<F;t++){const e=E[t];O(e[0]+B*o,e[1]+B*o,e[2]+B*o)}}i.addGroup(t,n.length/3-t,0)}(),function(){const t=n.length/3;let e=0;P(S,e),e+=S.length;for(let t=0,i=M.length;t<i;t++){const i=M[t];P(i,e),e+=i.length}i.addGroup(t,n.length/3-t,1)}()}this.setAttribute("position",new ie(n,3)),this.setAttribute("uv",new ie(r,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(t,e,i){if(i.shapes=[],Array.isArray(t))for(let e=0,n=t.length;e<n;e++){const n=t[e];i.shapes.push(n.uuid)}else i.shapes.push(t.uuid);void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON());return i}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const i=[];for(let n=0,r=t.shapes.length;n<r;n++){const r=e[t.shapes[n]];i.push(r)}const n=t.options.extrudePath;return void 0!==n&&(t.options.extrudePath=(new is[n.type]).fromJSON(n)),new Rs(i,t.options)}}const Ds={generateTopUV:function(t,e,i,n,r){const a=e[3*i],s=e[3*i+1],o=e[3*n],l=e[3*n+1],c=e[3*r],h=e[3*r+1];return[new f(a,s),new f(o,l),new f(c,h)]},generateSideWallUV:function(t,e,i,n,r,a){const s=e[3*i],o=e[3*i+1],l=e[3*i+2],c=e[3*n],h=e[3*n+1],u=e[3*n+2],d=e[3*r],p=e[3*r+1],g=e[3*r+2],m=e[3*a],b=e[3*a+1],y=e[3*a+2];return Math.abs(o-h)<Math.abs(s-c)?[new f(s,1-l),new f(c,1-u),new f(d,1-g),new f(m,1-y)]:[new f(o,1-l),new f(h,1-u),new f(p,1-g),new f(b,1-y)]}};class Ns extends he{constructor(t=new as([new f(0,.5),new f(-.5,-.5),new f(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const i=[],n=[],r=[],a=[];let s=0,o=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(s,o,e),s+=o,o=0;function l(t){const s=n.length/3,l=t.extractPoints(e);let c=l.shape;const h=l.holes;!1===Fs.isClockWise(c)&&(c=c.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===Fs.isClockWise(e)&&(h[t]=e.reverse())}const u=Fs.triangulateShape(c,h);for(let t=0,e=h.length;t<e;t++){const e=h[t];c=c.concat(e)}for(let t=0,e=c.length;t<e;t++){const e=c[t];n.push(e.x,e.y,0),r.push(0,0,1),a.push(e.x,e.y)}for(let t=0,e=u.length;t<e;t++){const e=u[t],n=e[0]+s,r=e[1]+s,a=e[2]+s;i.push(n,r,a),o+=3}}this.setIndex(i),this.setAttribute("position",new ie(n,3)),this.setAttribute("normal",new ie(r,3)),this.setAttribute("uv",new ie(a,2))}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let i=0,n=t.length;i<n;i++){const n=t[i];e.shapes.push(n.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const i=[];for(let n=0,r=t.shapes.length;n<r;n++){const r=e[t.shapes[n]];i.push(r)}return new Ns(i,t.curveSegments)}}class ks extends he{constructor(t=1,e=32,i=16,n=0,r=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:s},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const o=Math.min(a+s,Math.PI);let l=0;const c=[],h=new I,u=new I,d=[],p=[],f=[],g=[];for(let d=0;d<=i;d++){const m=[],b=d/i;let y=0;0==d&&0==a?y=.5/e:d==i&&o==Math.PI&&(y=-.5/e);for(let i=0;i<=e;i++){const o=i/e;h.x=-t*Math.cos(n+o*r)*Math.sin(a+b*s),h.y=t*Math.cos(a+b*s),h.z=t*Math.sin(n+o*r)*Math.sin(a+b*s),p.push(h.x,h.y,h.z),u.copy(h).normalize(),f.push(u.x,u.y,u.z),g.push(o+y,1-b),m.push(l++)}c.push(m)}for(let t=0;t<i;t++)for(let n=0;n<e;n++){const e=c[t][n+1],r=c[t][n],s=c[t+1][n],l=c[t+1][n+1];(0!==t||a>0)&&d.push(e,r,l),(t!==i-1||o<Math.PI)&&d.push(r,s,l)}this.setIndex(d),this.setAttribute("position",new ie(p,3)),this.setAttribute("normal",new ie(f,3)),this.setAttribute("uv",new ie(g,2))}static fromJSON(t){return new ks(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Ps extends he{constructor(t=new ts(new I(-1,-1,0),new I(-1,1,0),new I(1,1,0)),e=64,i=1,n=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r};const a=t.computeFrenetFrames(e,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const s=new I,o=new I,l=new f;let c=new I;const h=[],u=[],d=[],p=[];function g(r){c=t.getPointAt(r/e,c);const l=a.normals[r],d=a.binormals[r];for(let t=0;t<=n;t++){const e=t/n*Math.PI*2,r=Math.sin(e),a=-Math.cos(e);o.x=a*l.x+r*d.x,o.y=a*l.y+r*d.y,o.z=a*l.z+r*d.z,o.normalize(),u.push(o.x,o.y,o.z),s.x=c.x+i*o.x,s.y=c.y+i*o.y,s.z=c.z+i*o.z,h.push(s.x,s.y,s.z)}}!function(){for(let t=0;t<e;t++)g(t);g(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let i=0;i<=n;i++)l.x=t/e,l.y=i/n,d.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=n;e++){const i=(n+1)*(t-1)+(e-1),r=(n+1)*t+(e-1),a=(n+1)*t+e,s=(n+1)*(t-1)+e;p.push(i,r,s),p.push(r,a,s)}}()}(),this.setIndex(p),this.setAttribute("position",new ie(h,3)),this.setAttribute("normal",new ie(u,3)),this.setAttribute("uv",new ie(d,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Ps((new is[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class zs extends Vt{constructor(t){super(),this.type="ShadowMaterial",this.color=new Jt(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}zs.prototype.isShadowMaterial=!0;class Os extends Vt{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Jt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Jt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Os.prototype.isMeshStandardMaterial=!0;class Qs extends Os{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new f(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return c(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenTint=new Jt(0),this.sheenRoughness=1,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationTint=new Jt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularTint=new Jt(1,1,1),this.specularTintMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(t)}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.sheen=t.sheen,this.sheenTint.copy(t.sheenTint),this.sheenRoughness=t.sheenRoughness,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationTint.copy(t.attenuationTint),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularTint.copy(t.specularTint),this.specularTintMap=t.specularTintMap,this}}Qs.prototype.isMeshPhysicalMaterial=!0;class Vs extends Vt{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new Jt(16777215),this.specular=new Jt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Jt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Vs.prototype.isMeshPhongMaterial=!0;class Hs extends Vt{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Jt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Jt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Hs.prototype.isMeshToonMaterial=!0;class Gs extends Vt{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}Gs.prototype.isMeshNormalMaterial=!0;class js extends Vt{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new Jt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Jt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}js.prototype.isMeshLambertMaterial=!0;class Ws extends Vt{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Jt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this}}Ws.prototype.isMeshMatcapMaterial=!0;class qs extends ba{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}qs.prototype.isLineDashedMaterial=!0;const Zs={arraySlice:function(t,e,i){return Zs.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort((function(e,i){return t[e]-t[i]})),i},sortedArray:function(t,e,i){const n=t.length,r=new t.constructor(n);for(let a=0,s=0;s!==n;++a){const n=i[a]*e;for(let i=0;i!==e;++i)r[s++]=t[n+i]}return r},flattenJSON:function(t,e,i,n){let r=1,a=t[0];for(;void 0!==a&&void 0===a[n];)a=t[r++];if(void 0===a)return;let s=a[n];if(void 0!==s)if(Array.isArray(s))do{s=a[n],void 0!==s&&(e.push(a.time),i.push.apply(i,s)),a=t[r++]}while(void 0!==a);else if(void 0!==s.toArray)do{s=a[n],void 0!==s&&(e.push(a.time),s.toArray(i,i.length)),a=t[r++]}while(void 0!==a);else do{s=a[n],void 0!==s&&(e.push(a.time),i.push(s)),a=t[r++]}while(void 0!==a)},subclip:function(t,e,i,n,r=30){const a=t.clone();a.name=e;const s=[];for(let t=0;t<a.tracks.length;++t){const e=a.tracks[t],o=e.getValueSize(),l=[],c=[];for(let t=0;t<e.times.length;++t){const a=e.times[t]*r;if(!(a<i||a>=n)){l.push(e.times[t]);for(let i=0;i<o;++i)c.push(e.values[t*o+i])}}0!==l.length&&(e.times=Zs.convertArray(l,e.times.constructor),e.values=Zs.convertArray(c,e.values.constructor),s.push(e))}a.tracks=s;let o=1/0;for(let t=0;t<a.tracks.length;++t)o>a.tracks[t].times[0]&&(o=a.tracks[t].times[0]);for(let t=0;t<a.tracks.length;++t)a.tracks[t].shift(-1*o);return a.resetDuration(),a},makeClipAdditive:function(t,e=0,i=t,n=30){n<=0&&(n=30);const r=i.tracks.length,a=e/n;for(let e=0;e<r;++e){const n=i.tracks[e],r=n.ValueTypeName;if("bool"===r||"string"===r)continue;const s=t.tracks.find((function(t){return t.name===n.name&&t.ValueTypeName===r}));if(void 0===s)continue;let o=0;const l=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(o=l/3);let c=0;const h=s.getValueSize();s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);const u=n.times.length-1;let d;if(a<=n.times[0]){const t=o,e=l-o;d=Zs.arraySlice(n.values,t,e)}else if(a>=n.times[u]){const t=u*l+o,e=t+l-o;d=Zs.arraySlice(n.values,t,e)}else{const t=n.createInterpolant(),e=o,i=l-o;t.evaluate(a),d=Zs.arraySlice(t.resultBuffer,e,i)}if("quaternion"===r){(new E).fromArray(d).normalize().conjugate().toArray(d)}const p=s.times.length;for(let t=0;t<p;++t){const e=t*h+c;if("quaternion"===r)E.multiplyQuaternionsFlat(s.values,e,d,0,s.values,e);else{const t=h-2*c;for(let i=0;i<t;++i)s.values[e+i]-=d[i]}}}return t.blendMode=2501,t}};class Js{constructor(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{let a;i:{n:if(!(t<n)){for(let a=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===a)break;if(r=n,n=e[++i],t<n)break e}a=e.length;break i}if(t>=r)break t;{const s=e[1];t<s&&(i=2,r=s);for(let a=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===a)break;if(n=r,r=e[--i-1],t>=r)break e}a=i,i=0}}for(;i<a;){const n=i+a>>>1;t<e[n]?a=n:i=n+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n;for(let t=0;t!==n;++t)e[t]=i[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Js.prototype.beforeStart_=Js.prototype.copySampleValue_,Js.prototype.afterEnd_=Js.prototype.copySampleValue_;class Xs extends Js{constructor(t,e,i,n){super(t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(t,e,i){const n=this.parameterPositions;let r=t-2,a=t+1,s=n[r],o=n[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:r=t,s=2*e-i;break;case 2402:r=n.length-2,s=e+n[r]-n[r+1];break;default:r=t,s=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=t,o=2*i-e;break;case 2402:a=1,o=i+n[1]-n[0];break;default:a=t-1,o=e}const l=.5*(i-e),c=this.valueSize;this._weightPrev=l/(e-s),this._weightNext=l/(o-i),this._offsetPrev=r*c,this._offsetNext=a*c}interpolate_(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=t*s,l=o-s,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),f=p*p,g=f*p,m=-u*g+2*u*f-u*p,b=(1+u)*g+(-1.5-2*u)*f+(-.5+u)*p+1,y=(-1-d)*g+(1.5+d)*f+.5*p,v=d*g-d*f;for(let t=0;t!==s;++t)r[t]=m*a[c+t]+b*a[l+t]+y*a[o+t]+v*a[h+t];return r}}class Ys extends Js{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=t*s,l=o-s,c=(i-e)/(n-e),h=1-c;for(let t=0;t!==s;++t)r[t]=a[l+t]*h+a[o+t]*c;return r}}class Ks extends Js{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}}class $s{constructor(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Zs.convertArray(e,this.TimeBufferType),this.values=Zs.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Zs.convertArray(t.times,Array),values:Zs.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Ks(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Ys(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Xs(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let r=0,a=n-1;for(;r!==n&&i[r]<t;)++r;for(;-1!==a&&i[a]>e;)--a;if(++a,0!==r||a!==n){r>=a&&(a=Math.max(a,1),r=a-1);const t=this.getValueSize();this.times=Zs.arraySlice(i,r,a),this.values=Zs.arraySlice(this.values,r*t,a*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let e=0;e!==r;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,n),t=!1;break}if(null!==a&&a>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,n,a),t=!1;break}a=n}if(void 0!==n&&Zs.isTypedArray(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){const t=Zs.arraySlice(this.times),e=Zs.arraySlice(this.values),i=this.getValueSize(),n=2302===this.getInterpolation(),r=t.length-1;let a=1;for(let s=1;s<r;++s){let r=!1;const o=t[s];if(o!==t[s+1]&&(1!==s||o!==t[0]))if(n)r=!0;else{const t=s*i,n=t-i,a=t+i;for(let s=0;s!==i;++s){const i=e[t+s];if(i!==e[n+s]||i!==e[a+s]){r=!0;break}}}if(r){if(s!==a){t[a]=t[s];const n=s*i,r=a*i;for(let t=0;t!==i;++t)e[r+t]=e[n+t]}++a}}if(r>0){t[a]=t[r];for(let t=r*i,n=a*i,s=0;s!==i;++s)e[n+s]=e[t+s];++a}return a!==t.length?(this.times=Zs.arraySlice(t,0,a),this.values=Zs.arraySlice(e,0,a*i)):(this.times=t,this.values=e),this}clone(){const t=Zs.arraySlice(this.times,0),e=Zs.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}$s.prototype.TimeBufferType=Float32Array,$s.prototype.ValueBufferType=Float32Array,$s.prototype.DefaultInterpolation=2301;class to extends $s{}to.prototype.ValueTypeName="bool",to.prototype.ValueBufferType=Array,to.prototype.DefaultInterpolation=2300,to.prototype.InterpolantFactoryMethodLinear=void 0,to.prototype.InterpolantFactoryMethodSmooth=void 0;class eo extends $s{}eo.prototype.ValueTypeName="color";class io extends $s{}io.prototype.ValueTypeName="number";class no extends Js{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(i-e)/(n-e);let l=t*s;for(let t=l+s;l!==t;l+=4)E.slerpFlat(r,0,a,l-s,a,l,o);return r}}class ro extends $s{InterpolantFactoryMethodLinear(t){return new no(this.times,this.values,this.getValueSize(),t)}}ro.prototype.ValueTypeName="quaternion",ro.prototype.DefaultInterpolation=2301,ro.prototype.InterpolantFactoryMethodSmooth=void 0;class ao extends $s{}ao.prototype.ValueTypeName="string",ao.prototype.ValueBufferType=Array,ao.prototype.DefaultInterpolation=2300,ao.prototype.InterpolantFactoryMethodLinear=void 0,ao.prototype.InterpolantFactoryMethodSmooth=void 0;class so extends $s{}so.prototype.ValueTypeName="vector";class oo{constructor(t,e=-1,i,n=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=n,this.uuid=l(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push(lo(i[t]).scale(n));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push($s.toJSON(i[t]));return n}static CreateFromMorphTargetSequence(t,e,i,n){const r=e.length,a=[];for(let t=0;t<r;t++){let s=[],o=[];s.push((t+r-1)%r,t,(t+1)%r),o.push(0,1,0);const l=Zs.getKeyframeOrder(s);s=Zs.sortedArray(s,1,l),o=Zs.sortedArray(o,1,l),n||0!==s[0]||(s.push(r),o.push(o[0])),a.push(new io(".morphTargetInfluences["+e[t].name+"]",s,o).scale(1/i))}return new this(t,-1,a)}static findByName(t,e){let i=t;if(!Array.isArray(t)){const e=t;i=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<i.length;t++)if(i[t].name===e)return i[t];return null}static CreateClipsFromMorphTargetSequences(t,e,i){const n={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,i=t.length;e<i;e++){const i=t[e],a=i.name.match(r);if(a&&a.length>1){const t=a[1];let e=n[t];e||(n[t]=e=[]),e.push(i)}}const a=[];for(const t in n)a.push(this.CreateFromMorphTargetSequence(t,n[t],e,i));return a}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(t,e,i,n,r){if(0!==i.length){const a=[],s=[];Zs.flattenJSON(i,a,s,n),0!==a.length&&r.push(new t(e,a,s))}},n=[],r=t.name||"default",a=t.fps||30,s=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let i=0;i<r[e].morphTargets.length;i++)t[r[e].morphTargets[i]]=-1;for(const i in t){const t=[],a=[];for(let n=0;n!==r[e].morphTargets.length;++n){const n=r[e];t.push(n.time),a.push(n.morphTarget===i?1:0)}n.push(new io(".morphTargetInfluence["+i+"]",t,a))}o=t.length*(a||1)}else{const a=".bones["+e[t].name+"]";i(so,a+".position",r,"pos",n),i(ro,a+".quaternion",r,"rot",n),i(so,a+".scale",r,"scl",n)}}if(0===n.length)return null;return new this(r,o,n,s)}resetDuration(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function lo(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return io;case"vector":case"vector2":case"vector3":case"vector4":return so;case"color":return eo;case"quaternion":return ro;case"bool":case"boolean":return to;case"string":return ao}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];Zs.flattenJSON(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const co={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class ho{constructor(t,e,i){const n=this;let r=!1,a=0,s=0,o=void 0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){s++,!1===r&&void 0!==n.onStart&&n.onStart(t,a,s),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,s),a===s&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return o?o(t):t},this.setURLModifier=function(t){return o=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=l.length;e<i;e+=2){const i=l[e],n=l[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}}const uo=new ho;class po{constructor(t){this.manager=void 0!==t?t:uo,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise((function(n,r){i.load(t,n,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const fo={};class go extends po{constructor(t){super(t)}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=co.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;if(void 0!==fo[t])return void fo[t].push({onLoad:e,onProgress:i,onError:n});const s=t.match(/^data:(.*?)(;base64)?,(.*)$/);let o;if(s){const i=s[1],a=!!s[2];let o=s[3];o=decodeURIComponent(o),a&&(o=atob(o));try{let n;const a=(this.responseType||"").toLowerCase();switch(a){case"arraybuffer":case"blob":const t=new Uint8Array(o.length);for(let e=0;e<o.length;e++)t[e]=o.charCodeAt(e);n="blob"===a?new Blob([t.buffer],{type:i}):t.buffer;break;case"document":const e=new DOMParser;n=e.parseFromString(o,i);break;case"json":n=JSON.parse(o);break;default:n=o}setTimeout((function(){e&&e(n),r.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}),0)}}else{fo[t]=[],fo[t].push({onLoad:e,onProgress:i,onError:n}),o=new XMLHttpRequest,o.open("GET",t,!0),o.addEventListener("load",(function(e){const i=this.response,n=fo[t];if(delete fo[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),co.add(t,i);for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onLoad&&e.onLoad(i)}r.manager.itemEnd(t)}else{for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}}),!1),o.addEventListener("progress",(function(e){const i=fo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onProgress&&n.onProgress(e)}}),!1),o.addEventListener("error",(function(e){const i=fo[t];delete fo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),o.addEventListener("abort",(function(e){const i=fo[t];delete fo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(o.responseType=this.responseType),void 0!==this.withCredentials&&(o.withCredentials=this.withCredentials),o.overrideMimeType&&o.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)o.setRequestHeader(t,this.requestHeader[t]);o.send(null)}return r.manager.itemStart(t),o}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class mo extends po{constructor(t){super(t)}load(t,e,i,n){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=co.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;const s=b("img");function o(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1),co.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1),n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(t),s.src=t,s}}class bo extends po{constructor(t){super(t)}load(t,e,i,n){const r=new Pe,a=new mo(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let s=0;function o(i){a.load(t[i],(function(t){r.images[i]=t,s++,6===s&&(r.needsUpdate=!0,e&&e(r))}),void 0,n)}for(let e=0;e<t.length;++e)o(e);return r}}class yo extends po{constructor(t){super(t)}load(t,e,i,n){const r=new _,a=new mo(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),i,n),r}}class vo extends Tt{constructor(t,e=1){super(),this.type="Light",this.color=new Jt(t),this.intensity=e}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}vo.prototype.isLight=!0;class xo extends vo{constructor(t,e,i){super(t,i),this.type="HemisphereLight",this.position.copy(Tt.DefaultUp),this.updateMatrix(),this.groundColor=new Jt(e)}copy(t){return vo.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}xo.prototype.isHemisphereLight=!0;const _o=new rt,Ao=new I,wo=new I;class Co{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new f(512,512),this.map=null,this.mapPass=null,this.matrix=new rt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new We,this._frameExtents=new f(1,1),this._viewportCount=1,this._viewports=[new w(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;Ao.setFromMatrixPosition(t.matrixWorld),e.position.copy(Ao),wo.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(wo),e.updateMatrixWorld(),_o.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_o),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(e.projectionMatrix),i.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Mo extends Co{constructor(){super(new Ne(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,i=2*a*t.angle*this.focus,n=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;i===e.fov&&n===e.aspect&&r===e.far||(e.fov=i,e.aspect=n,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}Mo.prototype.isSpotLightShadow=!0;class Eo extends vo{constructor(t,e,i=0,n=Math.PI/3,r=0,a=1){super(t,e),this.type="SpotLight",this.position.copy(Tt.DefaultUp),this.updateMatrix(),this.target=new Tt,this.distance=i,this.angle=n,this.penumbra=r,this.decay=a,this.shadow=new Mo}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Eo.prototype.isSpotLight=!0;const Io=new rt,So=new I,To=new I;class Bo extends Co{constructor(){super(new Ne(90,1,.5,500)),this._frameExtents=new f(4,2),this._viewportCount=6,this._viewports=[new w(2,1,1,1),new w(0,1,1,1),new w(3,1,1,1),new w(1,1,1,1),new w(3,0,1,1),new w(1,0,1,1)],this._cubeDirections=[new I(1,0,0),new I(-1,0,0),new I(0,0,1),new I(0,0,-1),new I(0,1,0),new I(0,-1,0)],this._cubeUps=[new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,0,1),new I(0,0,-1)]}updateMatrices(t,e=0){const i=this.camera,n=this.matrix,r=t.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),So.setFromMatrixPosition(t.matrixWorld),i.position.copy(So),To.copy(i.position),To.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt(To),i.updateMatrixWorld(),n.makeTranslation(-So.x,-So.y,-So.z),Io.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Io)}}Bo.prototype.isPointLightShadow=!0;class Fo extends vo{constructor(t,e,i=0,n=1){super(t,e),this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new Bo}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}Fo.prototype.isPointLight=!0;class Lo extends Co{constructor(){super(new ai(-5,5,5,-5,.5,500))}}Lo.prototype.isDirectionalLightShadow=!0;class Uo extends vo{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(Tt.DefaultUp),this.updateMatrix(),this.target=new Tt,this.shadow=new Lo}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Uo.prototype.isDirectionalLight=!0;class Ro extends vo{constructor(t,e){super(t,e),this.type="AmbientLight"}}Ro.prototype.isAmbientLight=!0;class Do extends vo{constructor(t,e,i=10,n=10){super(t,e),this.type="RectAreaLight",this.width=i,this.height=n}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}Do.prototype.isRectAreaLight=!0;class No{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new I)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const i=t.x,n=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.282095),e.addScaledVector(a[1],.488603*n),e.addScaledVector(a[2],.488603*r),e.addScaledVector(a[3],.488603*i),e.addScaledVector(a[4],i*n*1.092548),e.addScaledVector(a[5],n*r*1.092548),e.addScaledVector(a[6],.315392*(3*r*r-1)),e.addScaledVector(a[7],i*r*1.092548),e.addScaledVector(a[8],.546274*(i*i-n*n)),e}getIrradianceAt(t,e){const i=t.x,n=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.886227),e.addScaledVector(a[1],1.023328*n),e.addScaledVector(a[2],1.023328*r),e.addScaledVector(a[3],1.023328*i),e.addScaledVector(a[4],.858086*i*n),e.addScaledVector(a[5],.858086*n*r),e.addScaledVector(a[6],.743125*r*r-.247708),e.addScaledVector(a[7],.858086*i*r),e.addScaledVector(a[8],.429043*(i*i-n*n)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(t.coefficients[i],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let i=0;i<9;i++)this.coefficients[i].lerp(t.coefficients[i],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].fromArray(t,e+3*n);return this}toArray(t=[],e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].toArray(t,e+3*n);return t}static getBasisAt(t,e){const i=t.x,n=t.y,r=t.z;e[0]=.282095,e[1]=.488603*n,e[2]=.488603*r,e[3]=.488603*i,e[4]=1.092548*i*n,e[5]=1.092548*n*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*i*r,e[8]=.546274*(i*i-n*n)}}No.prototype.isSphericalHarmonics3=!0;class ko extends vo{constructor(t=new No,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}ko.prototype.isLightProbe=!0;class Po{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,n=t.length;i<n;i++)e+=String.fromCharCode(t[i]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}}class zo extends he{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}zo.prototype.isInstancedBufferGeometry=!0;let Oo;(class extends po{constructor(t){super(t),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=co.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(t,s).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(i){co.add(t,i),e&&e(i),r.manager.itemEnd(t)})).catch((function(e){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)}}).prototype.isImageBitmapLoader=!0;const Qo=function(){return void 0===Oo&&(Oo=new(window.AudioContext||window.webkitAudioContext)),Oo};class Vo extends po{constructor(t){super(t)}load(t,e,i,n){const r=this,a=new go(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(i){try{const t=i.slice(0);Qo().decodeAudioData(t,(function(t){e(t)}))}catch(e){n?n(e):console.error(e),r.manager.itemError(t)}}),i,n)}}(class extends ko{constructor(t,e,i=1){super(void 0,i);const n=(new Jt).set(t),r=(new Jt).set(e),a=new I(n.r,n.g,n.b),s=new I(r.r,r.g,r.b),o=Math.sqrt(Math.PI),l=o*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(s).multiplyScalar(o),this.sh.coefficients[1].copy(a).sub(s).multiplyScalar(l)}}).prototype.isHemisphereLightProbe=!0;(class extends ko{constructor(t,e=1){super(void 0,e);const i=(new Jt).set(t);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}).prototype.isAmbientLightProbe=!0;class Ho extends Tt{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}class Go{constructor(t,e,i){let n,r,a;switch(this.binding=t,this.valueSize=i,e){case"quaternion":n=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":n=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const i=this.buffer,n=this.valueSize,r=t*n+n;let a=this.cumulativeWeight;if(0===a){for(let t=0;t!==n;++t)i[r+t]=i[t];a=e}else{a+=e;const t=e/a;this._mixBufferRegion(i,r,0,t,n)}this.cumulativeWeight=a}accumulateAdditive(t){const e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(i,n,t,1-r,e)}a>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){s.setValue(i,n);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let t=i,r=n;t!==r;++t)e[t]=e[n+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,n,r){if(n>=.5)for(let n=0;n!==r;++n)t[e+n]=t[i+n]}_slerp(t,e,i,n){E.slerpFlat(t,e,t,e,t,i,n)}_slerpAdditive(t,e,i,n,r){const a=this._workIndex*r;E.multiplyQuaternionsFlat(t,a,t,e,t,i),E.slerpFlat(t,e,t,e,t,a,n)}_lerp(t,e,i,n,r){const a=1-n;for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]*a+t[i+s]*n}}_lerpAdditive(t,e,i,n,r){for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]+t[i+a]*n}}}const jo=new RegExp("[\\[\\]\\.:\\/]","g"),Wo="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",qo=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Zo=/(WCOD+)?/.source.replace("WCOD",Wo),Jo=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Xo=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Yo=new RegExp("^"+qo+Zo+Jo+Xo+"$"),Ko=["material","materials","bones"];class $o{constructor(t,e,i){this.path=e,this.parsedPath=i||$o.parseTrackName(e),this.node=$o.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new $o.Composite(t,e,i):new $o(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(jo,"")}static parseTrackName(t){const e=Yo.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==Ko.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.name===e||r.uuid===e)return r;const a=i(r.children);if(a)return a}return null},n=i(t.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let r=e.propertyIndex;if(t||(t=$o.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(i){let n=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==n){if(void 0===t[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[n]}}const a=t[n];if(void 0===a){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+n+" but it wasn't found.",t)}let s=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=n;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}$o.Composite=class{constructor(t,e,i){const n=i||$o.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},$o.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},$o.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},$o.prototype.GetterByBindingType=[$o.prototype._getValue_direct,$o.prototype._getValue_array,$o.prototype._getValue_arrayElement,$o.prototype._getValue_toArray],$o.prototype.SetterByBindingTypeAndVersioning=[[$o.prototype._setValue_direct,$o.prototype._setValue_direct_setNeedsUpdate,$o.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[$o.prototype._setValue_array,$o.prototype._setValue_array_setNeedsUpdate,$o.prototype._setValue_array_setMatrixWorldNeedsUpdate],[$o.prototype._setValue_arrayElement,$o.prototype._setValue_arrayElement_setNeedsUpdate,$o.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[$o.prototype._setValue_fromArray,$o.prototype._setValue_fromArray_setNeedsUpdate,$o.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];(class{constructor(){this.uuid=l(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,i=this._paths,n=this._parsedPaths,r=this._bindings,a=r.length;let s=void 0,o=t.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],u=h.uuid;let d=e[u];if(void 0===d){d=o++,e[u]=d,t.push(h);for(let t=0,e=a;t!==e;++t)r[t].push(new $o(h,i[t],n[t]))}else if(d<l){s=t[d];const o=--l,c=t[o];e[c.uuid]=d,t[d]=c,e[u]=o,t[o]=h;for(let t=0,e=a;t!==e;++t){const e=r[t],a=e[o];let s=e[d];e[d]=a,void 0===s&&(s=new $o(h,i[t],n[t])),e[o]=s}}else t[d]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let r=this.nCachedObjects_;for(let a=0,s=arguments.length;a!==s;++a){const s=arguments[a],o=s.uuid,l=e[o];if(void 0!==l&&l>=r){const a=r++,c=t[a];e[c.uuid]=l,t[l]=c,e[o]=a,t[a]=s;for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[a],r=e[l];e[l]=n,e[a]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let r=this.nCachedObjects_,a=t.length;for(let s=0,o=arguments.length;s!==o;++s){const o=arguments[s].uuid,l=e[o];if(void 0!==l)if(delete e[o],l<r){const s=--r,o=t[s],c=--a,h=t[c];e[o.uuid]=l,t[l]=o,e[h.uuid]=s,t[s]=h,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[s],r=e[c];e[l]=n,e[s]=r,e.pop()}}else{const r=--a,s=t[r];r>0&&(e[s.uuid]=l),t[l]=s,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const i=this._bindingsIndicesByPath;let n=i[t];const r=this._bindings;if(void 0!==n)return r[n];const a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,c=this.nCachedObjects_,h=new Array(l);n=r.length,i[t]=n,a.push(t),s.push(e),r.push(h);for(let i=c,n=o.length;i!==n;++i){const n=o[i];h[i]=new $o(n,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){const n=this._paths,r=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s];e[t[s]]=i,a[i]=o,a.pop(),r[i]=r[s],r.pop(),n[i]=n[s],n.pop()}}}).prototype.isAnimationObjectGroup=!0;class tl{constructor(t,e,i=null,n=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;const r=e.tracks,a=r.length,s=new Array(a),o={endingStart:2400,endingEnd:2400};for(let t=0;t!==a;++t){const e=r[t].createInterpolant(null);s[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){const i=this._clip.duration,n=t._clip.duration,r=n/i,a=i/n;t.warp(1,r,e),this.warp(a,1,e)}return this}crossFadeTo(t,e,i){return t.crossFadeFrom(this,e,i)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){const n=this._mixer,r=n.time,a=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=n._lendControlInterpolant(),this._timeScaleInterpolant=s);const o=s.parameterPositions,l=s.sampleValues;return o[0]=r,o[1]=r+i,l[0]=t/a,l[1]=e/a,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const n=(t-r)*i;if(n<0||0===i)return;this._startTime=null,e=i*n}e*=this._updateTimeScale(t);const a=this._updateTime(e),s=this._updateWeight(t);if(s>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case 2501:for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(a),e[i].accumulateAdditive(s);break;case 2500:default:for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(a),e[i].accumulate(n,s)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(null!==i){const n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let n=this.time+t,r=this._loopCount;const a=2202===i;if(0===t)return-1===r?n:a&&1==(1&r)?e-n:n;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),n>=e||n<0){const i=Math.floor(n/e);n-=e*i,r+=Math.abs(i);const s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){const e=t<0;this._setEndings(e,!e,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=n;if(a&&1==(1&r))return e-n}return n}_setEndings(t,e,i){const n=this._interpolantSettings;i?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)}_scheduleFading(t,e,i){const n=this._mixer,r=n.time;let a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);const s=a.parameterPositions,o=a.sampleValues;return s[0]=r,o[0]=e,s[1]=r+t,o[1]=i,this}}(class extends n{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,a=t._propertyBindings,s=t._interpolants,o=i.uuid,l=this._bindingsByRootAndName;let c=l[o];void 0===c&&(c={},l[o]=c);for(let t=0;t!==r;++t){const r=n[t],l=r.name;let h=c[l];if(void 0!==h)a[t]=h;else{if(h=a[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,o,l));continue}const n=e&&e._propertyBindings[t].binding.parsedPath;h=new Go($o.create(i,l,n),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,o,l),a[t]=h}s[t].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){const n=this._actions,r=this._actionsByClip;let a=r[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=a;else{const e=a.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=n.length,n.push(t),a.actionByRoot[i]=t}_removeInactiveAction(t){const e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,a=this._actionsByClip,s=a[r],o=s.knownActions,l=o[o.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,o[c]=l,o.pop(),t._byClipCacheIndex=null;delete s.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete a[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(t){const e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackAction(t){const e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_addInactiveBinding(t,e,i){const n=this._bindingsByRootAndName,r=this._bindings;let a=n[e];void 0===a&&(a={},n[e]=a),a[i]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,a=this._bindingsByRootAndName,s=a[n],o=e[e.length-1],l=t._cacheIndex;o._cacheIndex=l,e[l]=o,e.pop(),delete s[r],0===Object.keys(s).length&&delete a[n]}_lendBinding(t){const e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackBinding(t){const e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=t[e];return void 0===i&&(i=new Ys(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){const e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r}clipAction(t,e,i){const n=e||this._root,r=n.uuid;let a="string"==typeof t?oo.findByName(n,t):t;const s=null!==a?a.uuid:t,o=this._actionsByClip[s];let l=null;if(void 0===i&&(i=null!==a?a.blendMode:2500),void 0!==o){const t=o.actionByRoot[r];if(void 0!==t&&t.blendMode===i)return t;l=o.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;const c=new tl(this,a,e,i);return this._bindAction(c,l),this._addInactiveAction(c,s,r),c}existingAction(t,e){const i=e||this._root,n=i.uuid,r="string"==typeof t?oo.findByName(i,t):t,a=r?r.uuid:t,s=this._actionsByClip[a];return void 0!==s&&s.actionByRoot[n]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1;for(let s=0;s!==i;++s){e[s]._update(n,t,r,a)}const s=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)s[t].apply(a);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){const t=r.knownActions;for(let i=0,n=t.length;i!==n;++i){const n=t[i];this._deactivateAction(n);const r=n._cacheIndex,a=e[e.length-1];n._cacheIndex=null,n._byClipCacheIndex=null,a._cacheIndex=r,e[r]=a,e.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(t){const e=t.uuid,i=this._actionsByClip;for(const t in i){const n=i[t].actionByRoot[e];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}const n=this._bindingsByRootAndName[e];if(void 0!==n)for(const t in n){const e=n[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}).prototype._controlInterpolantsResultBuffer=new Float32Array(1);class el{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new el(void 0===this.value.clone?this.value:this.value.clone())}}(class extends Pr{constructor(t,e,i=1){super(t,e),this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}).prototype.isInstancedInterleavedBuffer=!0;(class{constructor(t,e,i,n,r){this.buffer=t,this.type=e,this.itemSize=i,this.elementSize=n,this.count=r,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}).prototype.isGLBufferAttribute=!0;const il=new f;class nl{constructor(t=new f(1/0,1/0),e=new f(-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=il.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return il.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}nl.prototype.isBox2=!0;const rl=new I,al=new I;(class extends Tt{constructor(t){super(),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}).prototype.isImmediateRenderObject=!0;const sl=new I,ol=new rt,ll=new rt;const cl=new Float32Array(1);new Int32Array(cl.buffer);Pa.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Pa.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},rs.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},class extends Ea{constructor(t=10,e=10,i=4473924,n=8947848){i=new Jt(i),n=new Jt(n);const r=e/2,a=t/e,s=t/2,o=[],l=[];for(let t=0,c=0,h=-s;t<=e;t++,h+=a){o.push(-s,0,h,s,0,h),o.push(h,0,-s,h,0,s);const e=t===r?i:n;e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3}const c=new he;c.setAttribute("position",new ie(o,3)),c.setAttribute("color",new ie(l,3));super(c,new ba({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},class extends Ea{constructor(t){const e=function t(e){const i=[];e&&e.isBone&&i.push(e);for(let n=0;n<e.children.length;n++)i.push.apply(i,t(e.children[n]));return i}(t),i=new he,n=[],r=[],a=new Jt(0,0,1),s=new Jt(0,1,0);for(let t=0;t<e.length;t++){const i=e[t];i.parent&&i.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),r.push(a.r,a.g,a.b),r.push(s.r,s.g,s.b))}i.setAttribute("position",new ie(n,3)),i.setAttribute("color",new ie(r,3));super(i,new ba({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,i=this.geometry,n=i.getAttribute("position");ll.copy(this.root.matrixWorld).invert();for(let t=0,i=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(ol.multiplyMatrices(ll,r.matrixWorld),sl.setFromMatrixPosition(ol),n.setXYZ(i,sl.x,sl.y,sl.z),ol.multiplyMatrices(ll,r.parent.matrixWorld),sl.setFromMatrixPosition(ol),n.setXYZ(i+1,sl.x,sl.y,sl.z),i+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},po.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Po.extractUrlBase(t)},po.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},nl.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},nl.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},nl.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},nl.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},B.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},B.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},B.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},B.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},B.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},J.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},We.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},class{constructor(t=new I,e=new I){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){rl.subVectors(t,this.start),al.subVectors(this.end,this.start);const i=al.dot(al);let n=al.dot(rl)/i;return e&&(n=c(n,0,1)),n}closestPointToPoint(t,e,i){const n=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(n).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},g.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},g.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},g.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},g.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},g.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},g.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},rt.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},rt.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},rt.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new I).setFromMatrixColumn(this,3)},rt.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},rt.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},rt.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rt.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},rt.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},rt.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rt.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rt.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rt.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},rt.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},rt.prototype.makeFrustum=function(t,e,i,n,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,i,r,a)},rt.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},He.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},E.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},E.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},nt.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},nt.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},nt.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Ot.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Ot.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},Ot.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},Ot.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},Ot.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},Ot.barycoordFromPoint=function(t,e,i,n,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Ot.getBarycoord(t,e,i,n,r)},Ot.normal=function(t,e,i,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Ot.getNormal(t,e,i,n)},as.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},as.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Rs(this,t)},as.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Ns(this,t)},f.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},f.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},f.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},I.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},I.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},I.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},I.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},I.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},I.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},I.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},I.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},I.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},w.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},w.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Tt.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Tt.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Tt.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Tt.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Tt.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Tt.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Se.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Se.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),la.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Ne.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(vo.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties($t.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(35048)}}}),$t.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},$t.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},$t.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},he.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},he.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new $t(arguments[1],arguments[2])))},he.prototype.addDrawCall=function(t,e,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},he.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},he.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},he.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},he.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(he.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Pr.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},Pr.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Rs.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Rs.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Rs.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},kr.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},el.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(Vt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Jt}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(Re.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Rr.prototype.clearTarget=function(t,e,i,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,i,n)},Rr.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},Rr.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Rr.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Rr.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Rr.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Rr.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Rr.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Rr.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Rr.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Rr.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Rr.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Rr.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Rr.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Rr.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},Rr.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Rr.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Rr.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Rr.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Rr.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Rr.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Rr.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Rr.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Rr.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Rr.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Rr.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?3001:3e3}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(Cr.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(C.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Ho.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Vo).load(t,(function(t){e.setBuffer(t)})),this},class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let i=0;i<e.length;i++)t+=e[i];return t/e.length}}.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ke.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},ke.prototype.clear=function(t,e,i,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,i,n)},v.crossOrigin=void 0,v.loadTexture=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new yo;r.setCrossOrigin(this.crossOrigin);const a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},v.loadTextureCube=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new bo;r.setCrossOrigin(this.crossOrigin);const a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},v.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},v.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"133"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="133");var hl={value:()=>{}};function ul(){for(var t,e=0,i=arguments.length,n={};e<i;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new dl(n)}function dl(t){this._=t}function pl(t,e){return t.trim().split(/^|\s+/).map((function(t){var i="",n=t.indexOf(".");if(n>=0&&(i=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:i}}))}function fl(t,e){for(var i,n=0,r=t.length;n<r;++n)if((i=t[n]).name===e)return i.value}function gl(t,e,i){for(var n=0,r=t.length;n<r;++n)if(t[n].name===e){t[n]=hl,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=i&&t.push({name:e,value:i}),t}dl.prototype=ul.prototype={constructor:dl,on:function(t,e){var i,n=this._,r=pl(t+"",n),a=-1,s=r.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(i=(t=r[a]).type)n[i]=gl(n[i],t.name,e);else if(null==e)for(i in n)n[i]=gl(n[i],t.name,null);return this}for(;++a<s;)if((i=(t=r[a]).type)&&(i=fl(n[i],t.name)))return i},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new dl(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var i,n,r=new Array(i),a=0;a<i;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,i=(n=this._[t]).length;a<i;++a)n[a].value.apply(e,r)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],r=0,a=n.length;r<a;++r)n[r].value.apply(e,i)}};var ml,bl,yl=ul,vl=0,xl=0,_l=0,Al=0,wl=0,Cl=0,Ml="object"==typeof performance&&performance.now?performance:Date,El="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Il(){return wl||(El(Sl),wl=Ml.now()+Cl)}function Sl(){wl=0}function Tl(){this._call=this._time=this._next=null}function Bl(t,e,i){var n=new Tl;return n.restart(t,e,i),n}function Fl(){wl=(Al=Ml.now())+Cl,vl=xl=0;try{!function(){Il(),++vl;for(var t,e=ml;e;)(t=wl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--vl}()}finally{vl=0,function(){var t,e,i=ml,n=1/0;for(;i;)i._call?(n>i._time&&(n=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:ml=e);bl=t,Ul(n)}(),wl=0}}function Ll(){var t=Ml.now(),e=t-Al;e>1e3&&(Cl-=e,Al=t)}function Ul(t){vl||(xl&&(xl=clearTimeout(xl)),t-wl>24?(t<1/0&&(xl=setTimeout(Fl,t-Ml.now()-Cl)),_l&&(_l=clearInterval(_l))):(_l||(Al=Ml.now(),_l=setInterval(Ll,1e3)),vl=1,El(Fl)))}Tl.prototype=Bl.prototype={constructor:Tl,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?Il():+i)+(null==e?0:+e),this._next||bl===this||(bl?bl._next=this:ml=this,bl=this),this._call=t,this._time=i,Ul()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ul())}};const Rl=4294967296;function Dl(t){return t.x}function Nl(t){return t.y}function kl(t){return t.z}var Pl=Math.PI*(3-Math.sqrt(5)),zl=20*Math.PI/(9+Math.sqrt(221)),Ol=function(t,e){e=e||2;var i,n=Math.min(3,Math.max(1,Math.round(e))),r=1,a=.001,s=1-Math.pow(a,1/300),o=0,l=.6,c=new Map,h=Bl(p),u=yl("tick","end"),d=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Rl)/Rl}();function p(){f(),u.call("tick",i),r<a&&(h.stop(),u.call("end",i))}function f(e){var a,h,u=t.length;void 0===e&&(e=1);for(var d=0;d<e;++d)for(r+=(o-r)*s,c.forEach((function(t){t(r)})),a=0;a<u;++a)null==(h=t[a]).fx?h.x+=h.vx*=l:(h.x=h.fx,h.vx=0),n>1&&(null==h.fy?h.y+=h.vy*=l:(h.y=h.fy,h.vy=0)),n>2&&(null==h.fz?h.z+=h.vz*=l:(h.z=h.fz,h.vz=0));return i}function g(){for(var e,i=0,r=t.length;i<r;++i){if((e=t[i]).index=i,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var a=10*(n>2?Math.cbrt(.5+i):n>1?Math.sqrt(.5+i):i),s=i*Pl,o=i*zl;1===n?e.x=a:2===n?(e.x=a*Math.cos(s),e.y=a*Math.sin(s)):(e.x=a*Math.sin(s)*Math.cos(o),e.y=a*Math.cos(s),e.z=a*Math.sin(s)*Math.sin(o))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function m(e){return e.initialize&&e.initialize(t,d,n),e}return null==t&&(t=[]),g(),i={tick:f,restart:function(){return h.restart(p),i},stop:function(){return h.stop(),i},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),c.forEach(m),i):n},nodes:function(e){return arguments.length?(t=e,g(),c.forEach(m),i):t},alpha:function(t){return arguments.length?(r=+t,i):r},alphaMin:function(t){return arguments.length?(a=+t,i):a},alphaDecay:function(t){return arguments.length?(s=+t,i):+s},alphaTarget:function(t){return arguments.length?(o=+t,i):o},velocityDecay:function(t){return arguments.length?(l=1-t,i):1-l},randomSource:function(t){return arguments.length?(d=t,c.forEach(m),i):d},force:function(t,e){return arguments.length>1?(null==e?c.delete(t):c.set(t,m(e)),i):c.get(t)},find:function(){var e,i,r,a,s,o,l=Array.prototype.slice.call(arguments),c=l.shift()||0,h=(n>1?l.shift():null)||0,u=(n>2?l.shift():null)||0,d=l.shift()||1/0,p=0,f=t.length;for(d*=d,p=0;p<f;++p)(a=(e=c-(s=t[p]).x)*e+(i=h-(s.y||0))*i+(r=u-(s.z||0))*r)<d&&(o=s,d=a);return o},on:function(t,e){return arguments.length>1?(u.on(t,e),i):u.on(t)}}},Ql=function(t){return function(){return t}},Vl=function(t){return 1e-6*(t()-.5)};function Hl(t){return t.index}function Gl(t,e){var i=t.get(e);if(!i)throw new Error("node not found: "+e);return i}var jl=function(t){var e,i,n,r,a,s,o,l=Hl,c=function(t){return 1/Math.min(a[t.source.index],a[t.target.index])},h=Ql(30),u=1;function d(n){for(var a=0,l=t.length;a<u;++a)for(var c,h,d,p,f,g=0,m=0,b=0,y=0;g<l;++g)h=(c=t[g]).source,m=(d=c.target).x+d.vx-h.x-h.vx||Vl(o),r>1&&(b=d.y+d.vy-h.y-h.vy||Vl(o)),r>2&&(y=d.z+d.vz-h.z-h.vz||Vl(o)),m*=p=((p=Math.sqrt(m*m+b*b+y*y))-i[g])/p*n*e[g],b*=p,y*=p,d.vx-=m*(f=s[g]),r>1&&(d.vy-=b*f),r>2&&(d.vz-=y*f),h.vx+=m*(f=1-f),r>1&&(h.vy+=b*f),r>2&&(h.vz+=y*f)}function p(){if(n){var r,o,c=n.length,h=t.length,u=new Map(n.map((t,e)=>[l(t,e,n),t]));for(r=0,a=new Array(c);r<h;++r)(o=t[r]).index=r,"object"!=typeof o.source&&(o.source=Gl(u,o.source)),"object"!=typeof o.target&&(o.target=Gl(u,o.target)),a[o.source.index]=(a[o.source.index]||0)+1,a[o.target.index]=(a[o.target.index]||0)+1;for(r=0,s=new Array(h);r<h;++r)o=t[r],s[r]=a[o.source.index]/(a[o.source.index]+a[o.target.index]);e=new Array(h),f(),i=new Array(h),g()}}function f(){if(n)for(var i=0,r=t.length;i<r;++i)e[i]=+c(t[i],i,t)}function g(){if(n)for(var e=0,r=t.length;e<r;++e)i[e]=+h(t[e],e,t)}return null==t&&(t=[]),d.initialize=function(t,...e){n=t,o=e.find(t=>"function"==typeof t)||Math.random,r=e.find(t=>[1,2,3].includes(t))||2,p()},d.links=function(e){return arguments.length?(t=e,p(),d):t},d.id=function(t){return arguments.length?(l=t,d):l},d.iterations=function(t){return arguments.length?(u=+t,d):u},d.strength=function(t){return arguments.length?(c="function"==typeof t?t:Ql(+t),f(),d):c},d.distance=function(t){return arguments.length?(h="function"==typeof t?t:Ql(+t),g(),d):h},d};function Wl(t,e,i){if(isNaN(e))return t;var n,r,a,s,o,l,c=t._root,h={data:i},u=t._x0,d=t._x1;if(!c)return t._root=h,t;for(;c.length;)if((s=e>=(r=(u+d)/2))?u=r:d=r,n=c,!(c=c[o=+s]))return n[o]=h,t;if(e===(a=+t._x.call(null,c.data)))return h.next=c,n?n[o]=h:t._root=h,t;do{n=n?n[o]=new Array(2):t._root=new Array(2),(s=e>=(r=(u+d)/2))?u=r:d=r}while((o=+s)==(l=+(a>=r)));return n[l]=c,n[o]=h,t}var ql=function(t,e,i){this.node=t,this.x0=e,this.x1=i};function Zl(t){return t[0]}function Jl(t,e){var i=new Xl(null==e?Zl:e,NaN,NaN);return null==t?i:i.addAll(t)}function Xl(t,e,i){this._x=t,this._x0=e,this._x1=i,this._root=void 0}function Yl(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var Kl=Jl.prototype=Xl.prototype;Kl.copy=function(){var t,e,i=new Xl(this._x,this._x0,this._x1),n=this._root;if(!n)return i;if(!n.length)return i._root=Yl(n),i;for(t=[{source:n,target:i._root=new Array(2)}];n=t.pop();)for(var r=0;r<2;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(2)}):n.target[r]=Yl(e));return i},Kl.add=function(t){var e=+this._x.call(null,t);return Wl(this.cover(e),e,t)},Kl.addAll=function(t){var e,i,n=t.length,r=new Array(n),a=1/0,s=-1/0;for(e=0;e<n;++e)isNaN(i=+this._x.call(null,t[e]))||(r[e]=i,i<a&&(a=i),i>s&&(s=i));if(a>s)return this;for(this.cover(a).cover(s),e=0;e<n;++e)Wl(this,r[e],t[e]);return this},Kl.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,i=this._x1;if(isNaN(e))i=(e=Math.floor(t))+1;else{for(var n,r,a=i-e||1,s=this._root;e>t||t>=i;)switch(r=+(t<e),(n=new Array(2))[r]=s,s=n,a*=2,r){case 0:i=e+a;break;case 1:e=i-a}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=i,this},Kl.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Kl.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},Kl.find=function(t,e){var i,n,r,a,s,o=this._x0,l=this._x1,c=[],h=this._root;for(h&&c.push(new ql(h,o,l)),null==e?e=1/0:(o=t-e,l=t+e);a=c.pop();)if(!(!(h=a.node)||(n=a.x0)>l||(r=a.x1)<o))if(h.length){var u=(n+r)/2;c.push(new ql(h[1],u,r),new ql(h[0],n,u)),(s=+(t>=u))&&(a=c[c.length-1],c[c.length-1]=c[c.length-1-s],c[c.length-1-s]=a)}else{var d=Math.abs(t-+this._x.call(null,h.data));d<e&&(e=d,o=t-d,l=t+d,i=h.data)}return i},Kl.remove=function(t){if(isNaN(a=+this._x.call(null,t)))return this;var e,i,n,r,a,s,o,l,c,h=this._root,u=this._x0,d=this._x1;if(!h)return this;if(h.length)for(;;){if((o=a>=(s=(u+d)/2))?u=s:d=s,e=h,!(h=h[l=+o]))return this;if(!h.length)break;e[l+1&1]&&(i=e,c=l)}for(;h.data!==t;)if(n=h,!(h=h.next))return this;return(r=h.next)&&delete h.next,n?(r?n.next=r:delete n.next,this):e?(r?e[l]=r:delete e[l],(h=e[0]||e[1])&&h===(e[1]||e[0])&&!h.length&&(i?i[c]=h:this._root=h),this):(this._root=r,this)},Kl.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},Kl.root=function(){return this._root},Kl.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Kl.visit=function(t){var e,i,n,r,a=[],s=this._root;for(s&&a.push(new ql(s,this._x0,this._x1));e=a.pop();)if(!t(s=e.node,n=e.x0,r=e.x1)&&s.length){var o=(n+r)/2;(i=s[1])&&a.push(new ql(i,o,r)),(i=s[0])&&a.push(new ql(i,n,o))}return this},Kl.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new ql(this._root,this._x0,this._x1));e=i.pop();){var r=e.node;if(r.length){var a,s=e.x0,o=e.x1,l=(s+o)/2;(a=r[0])&&i.push(new ql(a,s,l)),(a=r[1])&&i.push(new ql(a,l,o))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},Kl.x=function(t){return arguments.length?(this._x=t,this):this._x};function $l(t,e,i,n){if(isNaN(e)||isNaN(i))return t;var r,a,s,o,l,c,h,u,d,p=t._root,f={data:n},g=t._x0,m=t._y0,b=t._x1,y=t._y1;if(!p)return t._root=f,t;for(;p.length;)if((c=e>=(a=(g+b)/2))?g=a:b=a,(h=i>=(s=(m+y)/2))?m=s:y=s,r=p,!(p=p[u=h<<1|c]))return r[u]=f,t;if(o=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===o&&i===l)return f.next=p,r?r[u]=f:t._root=f,t;do{r=r?r[u]=new Array(4):t._root=new Array(4),(c=e>=(a=(g+b)/2))?g=a:b=a,(h=i>=(s=(m+y)/2))?m=s:y=s}while((u=h<<1|c)==(d=(l>=s)<<1|o>=a));return r[d]=p,r[u]=f,t}var tc=function(t,e,i,n,r){this.node=t,this.x0=e,this.y0=i,this.x1=n,this.y1=r};function ec(t){return t[0]}function ic(t){return t[1]}function nc(t,e,i){var n=new rc(null==e?ec:e,null==i?ic:i,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function rc(t,e,i,n,r,a){this._x=t,this._y=e,this._x0=i,this._y0=n,this._x1=r,this._y1=a,this._root=void 0}function ac(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var sc=nc.prototype=rc.prototype;sc.copy=function(){var t,e,i=new rc(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return i;if(!n.length)return i._root=ac(n),i;for(t=[{source:n,target:i._root=new Array(4)}];n=t.pop();)for(var r=0;r<4;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(4)}):n.target[r]=ac(e));return i},sc.add=function(t){const e=+this._x.call(null,t),i=+this._y.call(null,t);return $l(this.cover(e,i),e,i,t)},sc.addAll=function(t){var e,i,n,r,a=t.length,s=new Array(a),o=new Array(a),l=1/0,c=1/0,h=-1/0,u=-1/0;for(i=0;i<a;++i)isNaN(n=+this._x.call(null,e=t[i]))||isNaN(r=+this._y.call(null,e))||(s[i]=n,o[i]=r,n<l&&(l=n),n>h&&(h=n),r<c&&(c=r),r>u&&(u=r));if(l>h||c>u)return this;for(this.cover(l,c).cover(h,u),i=0;i<a;++i)$l(this,s[i],o[i],t[i]);return this},sc.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var i=this._x0,n=this._y0,r=this._x1,a=this._y1;if(isNaN(i))r=(i=Math.floor(t))+1,a=(n=Math.floor(e))+1;else{for(var s,o,l=r-i||1,c=this._root;i>t||t>=r||n>e||e>=a;)switch(o=(e<n)<<1|t<i,(s=new Array(4))[o]=c,c=s,l*=2,o){case 0:r=i+l,a=n+l;break;case 1:i=r-l,a=n+l;break;case 2:r=i+l,n=a-l;break;case 3:i=r-l,n=a-l}this._root&&this._root.length&&(this._root=c)}return this._x0=i,this._y0=n,this._x1=r,this._y1=a,this},sc.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},sc.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},sc.find=function(t,e,i){var n,r,a,s,o,l,c,h=this._x0,u=this._y0,d=this._x1,p=this._y1,f=[],g=this._root;for(g&&f.push(new tc(g,h,u,d,p)),null==i?i=1/0:(h=t-i,u=e-i,d=t+i,p=e+i,i*=i);l=f.pop();)if(!(!(g=l.node)||(r=l.x0)>d||(a=l.y0)>p||(s=l.x1)<h||(o=l.y1)<u))if(g.length){var m=(r+s)/2,b=(a+o)/2;f.push(new tc(g[3],m,b,s,o),new tc(g[2],r,b,m,o),new tc(g[1],m,a,s,b),new tc(g[0],r,a,m,b)),(c=(e>=b)<<1|t>=m)&&(l=f[f.length-1],f[f.length-1]=f[f.length-1-c],f[f.length-1-c]=l)}else{var y=t-+this._x.call(null,g.data),v=e-+this._y.call(null,g.data),x=y*y+v*v;if(x<i){var _=Math.sqrt(i=x);h=t-_,u=e-_,d=t+_,p=e+_,n=g.data}}return n},sc.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,i,n,r,a,s,o,l,c,h,u,d,p=this._root,f=this._x0,g=this._y0,m=this._x1,b=this._y1;if(!p)return this;if(p.length)for(;;){if((c=a>=(o=(f+m)/2))?f=o:m=o,(h=s>=(l=(g+b)/2))?g=l:b=l,e=p,!(p=p[u=h<<1|c]))return this;if(!p.length)break;(e[u+1&3]||e[u+2&3]||e[u+3&3])&&(i=e,d=u)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(r=p.next)&&delete p.next,n?(r?n.next=r:delete n.next,this):e?(r?e[u]=r:delete e[u],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(i?i[d]=p:this._root=p),this):(this._root=r,this)},sc.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},sc.root=function(){return this._root},sc.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},sc.visit=function(t){var e,i,n,r,a,s,o=[],l=this._root;for(l&&o.push(new tc(l,this._x0,this._y0,this._x1,this._y1));e=o.pop();)if(!t(l=e.node,n=e.x0,r=e.y0,a=e.x1,s=e.y1)&&l.length){var c=(n+a)/2,h=(r+s)/2;(i=l[3])&&o.push(new tc(i,c,h,a,s)),(i=l[2])&&o.push(new tc(i,n,h,c,s)),(i=l[1])&&o.push(new tc(i,c,r,a,h)),(i=l[0])&&o.push(new tc(i,n,r,c,h))}return this},sc.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new tc(this._root,this._x0,this._y0,this._x1,this._y1));e=i.pop();){var r=e.node;if(r.length){var a,s=e.x0,o=e.y0,l=e.x1,c=e.y1,h=(s+l)/2,u=(o+c)/2;(a=r[0])&&i.push(new tc(a,s,o,h,u)),(a=r[1])&&i.push(new tc(a,h,o,l,u)),(a=r[2])&&i.push(new tc(a,s,u,h,c)),(a=r[3])&&i.push(new tc(a,h,u,l,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},sc.x=function(t){return arguments.length?(this._x=t,this):this._x},sc.y=function(t){return arguments.length?(this._y=t,this):this._y};function oc(t,e,i,n,r){if(isNaN(e)||isNaN(i)||isNaN(n))return t;var a,s,o,l,c,h,u,d,p,f,g,m,b=t._root,y={data:r},v=t._x0,x=t._y0,_=t._z0,A=t._x1,w=t._y1,C=t._z1;if(!b)return t._root=y,t;for(;b.length;)if((d=e>=(s=(v+A)/2))?v=s:A=s,(p=i>=(o=(x+w)/2))?x=o:w=o,(f=n>=(l=(_+C)/2))?_=l:C=l,a=b,!(b=b[g=f<<2|p<<1|d]))return a[g]=y,t;if(c=+t._x.call(null,b.data),h=+t._y.call(null,b.data),u=+t._z.call(null,b.data),e===c&&i===h&&n===u)return y.next=b,a?a[g]=y:t._root=y,t;do{a=a?a[g]=new Array(8):t._root=new Array(8),(d=e>=(s=(v+A)/2))?v=s:A=s,(p=i>=(o=(x+w)/2))?x=o:w=o,(f=n>=(l=(_+C)/2))?_=l:C=l}while((g=f<<2|p<<1|d)==(m=(u>=l)<<2|(h>=o)<<1|c>=s));return a[m]=b,a[g]=y,t}var lc=function(t,e,i,n,r,a,s){this.node=t,this.x0=e,this.y0=i,this.z0=n,this.x1=r,this.y1=a,this.z1=s};function cc(t){return t[0]}function hc(t){return t[1]}function uc(t){return t[2]}function dc(t,e,i,n){var r=new pc(null==e?cc:e,null==i?hc:i,null==n?uc:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function pc(t,e,i,n,r,a,s,o,l){this._x=t,this._y=e,this._z=i,this._x0=n,this._y0=r,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this._root=void 0}function fc(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var gc=dc.prototype=pc.prototype;gc.copy=function(){var t,e,i=new pc(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return i;if(!n.length)return i._root=fc(n),i;for(t=[{source:n,target:i._root=new Array(8)}];n=t.pop();)for(var r=0;r<8;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(8)}):n.target[r]=fc(e));return i},gc.add=function(t){var e=+this._x.call(null,t),i=+this._y.call(null,t),n=+this._z.call(null,t);return oc(this.cover(e,i,n),e,i,n,t)},gc.addAll=function(t){var e,i,n,r,a,s=t.length,o=new Array(s),l=new Array(s),c=new Array(s),h=1/0,u=1/0,d=1/0,p=-1/0,f=-1/0,g=-1/0;for(i=0;i<s;++i)isNaN(n=+this._x.call(null,e=t[i]))||isNaN(r=+this._y.call(null,e))||isNaN(a=+this._z.call(null,e))||(o[i]=n,l[i]=r,c[i]=a,n<h&&(h=n),n>p&&(p=n),r<u&&(u=r),r>f&&(f=r),a<d&&(d=a),a>g&&(g=a));if(h>p||u>f||d>g)return this;for(this.cover(h,u,d).cover(p,f,g),i=0;i<s;++i)oc(this,o[i],l[i],c[i],t[i]);return this},gc.cover=function(t,e,i){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(i=+i))return this;var n=this._x0,r=this._y0,a=this._z0,s=this._x1,o=this._y1,l=this._z1;if(isNaN(n))s=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1,l=(a=Math.floor(i))+1;else{for(var c,h,u=s-n||1,d=this._root;n>t||t>=s||r>e||e>=o||a>i||i>=l;)switch(h=(i<a)<<2|(e<r)<<1|t<n,(c=new Array(8))[h]=d,d=c,u*=2,h){case 0:s=n+u,o=r+u,l=a+u;break;case 1:n=s-u,o=r+u,l=a+u;break;case 2:s=n+u,r=o-u,l=a+u;break;case 3:n=s-u,r=o-u,l=a+u;break;case 4:s=n+u,o=r+u,a=l-u;break;case 5:n=s-u,o=r+u,a=l-u;break;case 6:s=n+u,r=o-u,a=l-u;break;case 7:n=s-u,r=o-u,a=l-u}this._root&&this._root.length&&(this._root=d)}return this._x0=n,this._y0=r,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this},gc.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},gc.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},gc.find=function(t,e,i,n){var r,a,s,o,l,c,h,u,d,p=this._x0,f=this._y0,g=this._z0,m=this._x1,b=this._y1,y=this._z1,v=[],x=this._root;for(x&&v.push(new lc(x,p,f,g,m,b,y)),null==n?n=1/0:(p=t-n,f=e-n,g=i-n,m=t+n,b=e+n,y=i+n,n*=n);u=v.pop();)if(!(!(x=u.node)||(a=u.x0)>m||(s=u.y0)>b||(o=u.z0)>y||(l=u.x1)<p||(c=u.y1)<f||(h=u.z1)<g))if(x.length){var _=(a+l)/2,A=(s+c)/2,w=(o+h)/2;v.push(new lc(x[7],_,A,w,l,c,h),new lc(x[6],a,A,w,_,c,h),new lc(x[5],_,s,w,l,A,h),new lc(x[4],a,s,w,_,A,h),new lc(x[3],_,A,o,l,c,w),new lc(x[2],a,A,o,_,c,w),new lc(x[1],_,s,o,l,A,w),new lc(x[0],a,s,o,_,A,w)),(d=(i>=w)<<2|(e>=A)<<1|t>=_)&&(u=v[v.length-1],v[v.length-1]=v[v.length-1-d],v[v.length-1-d]=u)}else{var C=t-+this._x.call(null,x.data),M=e-+this._y.call(null,x.data),E=i-+this._z.call(null,x.data),I=C*C+M*M+E*E;if(I<n){var S=Math.sqrt(n=I);p=t-S,f=e-S,g=i-S,m=t+S,b=e+S,y=i+S,r=x.data}}return r},gc.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t))||isNaN(o=+this._z.call(null,t)))return this;var e,i,n,r,a,s,o,l,c,h,u,d,p,f,g,m=this._root,b=this._x0,y=this._y0,v=this._z0,x=this._x1,_=this._y1,A=this._z1;if(!m)return this;if(m.length)for(;;){if((u=a>=(l=(b+x)/2))?b=l:x=l,(d=s>=(c=(y+_)/2))?y=c:_=c,(p=o>=(h=(v+A)/2))?v=h:A=h,e=m,!(m=m[f=p<<2|d<<1|u]))return this;if(!m.length)break;(e[f+1&7]||e[f+2&7]||e[f+3&7]||e[f+4&7]||e[f+5&7]||e[f+6&7]||e[f+7&7])&&(i=e,g=f)}for(;m.data!==t;)if(n=m,!(m=m.next))return this;return(r=m.next)&&delete m.next,n?(r?n.next=r:delete n.next,this):e?(r?e[f]=r:delete e[f],(m=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&m===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!m.length&&(i?i[g]=m:this._root=m),this):(this._root=r,this)},gc.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},gc.root=function(){return this._root},gc.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},gc.visit=function(t){var e,i,n,r,a,s,o,l,c=[],h=this._root;for(h&&c.push(new lc(h,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=c.pop();)if(!t(h=e.node,n=e.x0,r=e.y0,a=e.z0,s=e.x1,o=e.y1,l=e.z1)&&h.length){var u=(n+s)/2,d=(r+o)/2,p=(a+l)/2;(i=h[7])&&c.push(new lc(i,u,d,p,s,o,l)),(i=h[6])&&c.push(new lc(i,n,d,p,u,o,l)),(i=h[5])&&c.push(new lc(i,u,r,p,s,d,l)),(i=h[4])&&c.push(new lc(i,n,r,p,u,d,l)),(i=h[3])&&c.push(new lc(i,u,d,a,s,o,p)),(i=h[2])&&c.push(new lc(i,n,d,a,u,o,p)),(i=h[1])&&c.push(new lc(i,u,r,a,s,d,p)),(i=h[0])&&c.push(new lc(i,n,r,a,u,d,p))}return this},gc.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new lc(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=i.pop();){var r=e.node;if(r.length){var a,s=e.x0,o=e.y0,l=e.z0,c=e.x1,h=e.y1,u=e.z1,d=(s+c)/2,p=(o+h)/2,f=(l+u)/2;(a=r[0])&&i.push(new lc(a,s,o,l,d,p,f)),(a=r[1])&&i.push(new lc(a,d,o,l,c,p,f)),(a=r[2])&&i.push(new lc(a,s,p,l,d,h,f)),(a=r[3])&&i.push(new lc(a,d,p,l,c,h,f)),(a=r[4])&&i.push(new lc(a,s,o,f,d,p,u)),(a=r[5])&&i.push(new lc(a,d,o,f,c,p,u)),(a=r[6])&&i.push(new lc(a,s,p,f,d,h,u)),(a=r[7])&&i.push(new lc(a,d,p,f,c,h,u))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},gc.x=function(t){return arguments.length?(this._x=t,this):this._x},gc.y=function(t){return arguments.length?(this._y=t,this):this._y},gc.z=function(t){return arguments.length?(this._z=t,this):this._z};var mc=function(){var t,e,i,n,r,a,s=Ql(-30),o=1,l=1/0,c=.81;function h(n){var a,s=t.length,o=(1===e?Jl(t,Dl):2===e?nc(t,Dl,Nl):3===e?dc(t,Dl,Nl,kl):null).visitAfter(d);for(r=n,a=0;a<s;++a)i=t[a],o.visit(p)}function u(){if(t){var e,i,n=t.length;for(a=new Array(n),e=0;e<n;++e)i=t[e],a[i.index]=+s(i,e,t)}}function d(t){var i,n,r,s,o,l,c=0,h=0,u=t.length;if(u){for(r=s=o=l=0;l<u;++l)(i=t[l])&&(n=Math.abs(i.value))&&(c+=i.value,h+=n,r+=n*(i.x||0),s+=n*(i.y||0),o+=n*(i.z||0));c*=Math.sqrt(4/u),t.x=r/h,e>1&&(t.y=s/h),e>2&&(t.z=o/h)}else{(i=t).x=i.data.x,e>1&&(i.y=i.data.y),e>2&&(i.z=i.data.z);do{c+=a[i.data.index]}while(i=i.next)}t.value=c}function p(t,s,h,u,d){if(!t.value)return!0;var p=[h,u,d][e-1],f=t.x-i.x,g=e>1?t.y-i.y:0,m=e>2?t.z-i.z:0,b=p-s,y=f*f+g*g+m*m;if(b*b/c<y)return y<l&&(0===f&&(y+=(f=Vl(n))*f),e>1&&0===g&&(y+=(g=Vl(n))*g),e>2&&0===m&&(y+=(m=Vl(n))*m),y<o&&(y=Math.sqrt(o*y)),i.vx+=f*t.value*r/y,e>1&&(i.vy+=g*t.value*r/y),e>2&&(i.vz+=m*t.value*r/y)),!0;if(!(t.length||y>=l)){(t.data!==i||t.next)&&(0===f&&(y+=(f=Vl(n))*f),e>1&&0===g&&(y+=(g=Vl(n))*g),e>2&&0===m&&(y+=(m=Vl(n))*m),y<o&&(y=Math.sqrt(o*y)));do{t.data!==i&&(b=a[t.data.index]*r/y,i.vx+=f*b,e>1&&(i.vy+=g*b),e>2&&(i.vz+=m*b))}while(t=t.next)}}return h.initialize=function(i,...r){t=i,n=r.find(t=>"function"==typeof t)||Math.random,e=r.find(t=>[1,2,3].includes(t))||2,u()},h.strength=function(t){return arguments.length?(s="function"==typeof t?t:Ql(+t),u(),h):s},h.distanceMin=function(t){return arguments.length?(o=t*t,h):Math.sqrt(o)},h.distanceMax=function(t){return arguments.length?(l=t*t,h):Math.sqrt(l)},h.theta=function(t){return arguments.length?(c=t*t,h):Math.sqrt(c)},h},bc=function(t,e,i){var n,r=1;function a(){var a,s,o=n.length,l=0,c=0,h=0;for(a=0;a<o;++a)l+=(s=n[a]).x||0,c+=s.y||0,h+=s.z||0;for(l=(l/o-t)*r,c=(c/o-e)*r,h=(h/o-i)*r,a=0;a<o;++a)s=n[a],l&&(s.x-=l),c&&(s.y-=c),h&&(s.z-=h)}return null==t&&(t=0),null==e&&(e=0),null==i&&(i=0),a.initialize=function(t){n=t},a.x=function(e){return arguments.length?(t=+e,a):t},a.y=function(t){return arguments.length?(e=+t,a):e},a.z=function(t){return arguments.length?(i=+t,a):i},a.strength=function(t){return arguments.length?(r=+t,a):r},a},yc=i(9),vc=i.n(yc),xc=i(10),_c=i.n(xc),Ac=i(11),wc=i.n(Ac);function Cc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==i)return;var n,r,a=[],s=!0,o=!1;try{for(i=i.call(t);!(s=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);s=!0);}catch(t){o=!0,r=t}finally{try{s||null==i.return||i.return()}finally{if(o)throw r}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Mc(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Mc(t,e)}(t,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.")}()}function Mc(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var Ec=function t(e,i){var n=i.default,r=void 0===n?null:n,a=i.triggerUpdate,s=void 0===a||a,o=i.onChange,l=void 0===o?function(t,e){}:o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name=e,this.defaultVal=r,this.triggerUpdate=s,this.onChange=l};var Ic=function(t){var e=t.stateInit,i=void 0===e?function(){return{}}:e,n=t.props,r=void 0===n?{}:n,a=t.methods,s=void 0===a?{}:a,o=t.aliases,l=void 0===o?{}:o,c=t.init,h=void 0===c?function(){}:c,u=t.update,d=void 0===u?function(){}:u,p=Object.keys(r).map((function(t){return new Ec(t,r[t])}));return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign({},i instanceof Function?i(t):i,{initialised:!1}),n={};function r(e){return a(e,t),o(),r}var a=function(t,i){h.call(r,t,e,i),e.initialised=!0},o=wc()((function(){e.initialised&&(d.call(r,e,n),n={})}),1);return p.forEach((function(t){r[t.name]=function(t){var i=t.name,a=t.triggerUpdate,s=void 0!==a&&a,l=t.onChange,c=void 0===l?function(t,e){}:l,h=t.defaultVal,u=void 0===h?null:h;return function(t){var a=e[i];if(!arguments.length)return a;var l=void 0===t?u:t;return e[i]=l,c.call(r,l,e,a),!n.hasOwnProperty(i)&&(n[i]=a),s&&o(),r}}(t)})),Object.keys(s).forEach((function(t){r[t]=function(){for(var i,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return(i=s[t]).call.apply(i,[r,e].concat(a))}})),Object.entries(l).forEach((function(t){var e=Cc(t,2),i=e[0],n=e[1];return r[i]=r[n]})),r.resetProps=function(){return p.forEach((function(t){r[t.name](t.defaultVal)})),r},r.resetProps(),e._rerender=o,r}},Sc=i(1);function Tc(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i>e||void 0===i&&e>=e)&&(i=e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(i>r||void 0===i&&r>=r)&&(i=r)}return i}function Bc(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i<e||void 0===i&&e>=e)&&(i=e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(i<r||void 0===i&&r>=r)&&(i=r)}return i}function Fc(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function Lc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==i)return;var n,r,a=[],s=!0,o=!1;try{for(i=i.call(t);!(s=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);s=!0);}catch(t){o=!0,r=t}finally{try{s||null==i.return||i.return()}finally{if(o)throw r}}return a}(t,e)||Rc(t,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.")}()}function Uc(t){return function(t){if(Array.isArray(t))return Dc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Rc(t)||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 Rc(t,e){if(t){if("string"==typeof t)return Dc(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Dc(t,e):void 0}}function Dc(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function Nc(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var kc=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=(e instanceof Array?e.length?e:[void 0]:[e]).map((function(t){return{keyAccessor:t,isProp:!(t instanceof Function)}})),a=t.reduce((function(t,e){var n=t,a=e;return r.forEach((function(t,e){var s,o=t.keyAccessor;if(t.isProp){var l=a,c=l[o],h=Fc(l,[o].map(Nc));s=c,a=h}else s=o(a,e);e+1<r.length?(n.hasOwnProperty(s)||(n[s]={}),n=n[s]):i?(n.hasOwnProperty(s)||(n[s]=[]),n[s].push(a)):n[s]=a})),t}),{});i instanceof Function&&function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;n===r.length?Object.keys(e).forEach((function(t){return e[t]=i(e[t])})):Object.values(e).forEach((function(e){return t(e,n+1)}))}(a);var s=a;return n&&(s=[],function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];i.length===r.length?s.push({keys:i,vals:e}):Object.entries(e).forEach((function(e){var n=Lc(e,2),r=n[0],a=n[1];return t(a,[].concat(Uc(i),[r]))}))}(a),e instanceof Array&&0===e.length&&1===s.length&&(s[0].keys=[])),s};function Pc(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function zc(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Oc(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function Qc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==i)return;var n,r,a=[],s=!0,o=!1;try{for(i=i.call(t);!(s=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);s=!0);}catch(t){o=!0,r=t}finally{try{s||null==i.return||i.return()}finally{if(o)throw r}}return a}(t,e)||Hc(t,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.")}()}function Vc(t){return function(t){if(Array.isArray(t))return Gc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Hc(t)||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 Hc(t,e){if(t){if("string"==typeof t)return Gc(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Gc(t,e):void 0}}function Gc(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function jc(t,e,i){var n=i.objBindAttr,r=void 0===n?"__obj":n,a=i.dataBindAttr,s=void 0===a?"__data":a,o=i.idAccessor,l=i.purge,c=void 0!==l&&l,h=function(t){return t.hasOwnProperty(s)},u=e.filter((function(t){return!h(t)})),d=e.filter(h).map((function(t){return t[s]})),p=c?{enter:t,exit:d,update:[]}:function(t,e,i){var n={enter:[],update:[],exit:[]};if(i){var r=kc(t,i,!1),a=kc(e,i,!1),s=Object.assign({},r,a);Object.entries(s).forEach((function(t){var e=Qc(t,2),i=e[0],s=e[1],o=r.hasOwnProperty(i)?a.hasOwnProperty(i)?"update":"exit":"enter";n[o].push("update"===o?[r[i],a[i]]:s)}))}else{var o=new Set(t),l=new Set(e);new Set([].concat(Vc(o),Vc(l))).forEach((function(t){var e=o.has(t)?l.has(t)?"update":"exit":"enter";n[e].push("update"===e?[t,t]:t)}))}return n}(d,t,o);return p.update=p.update.map((function(t){var e=Qc(t,2),i=e[0],n=e[1];return i!==n&&(n[r]=i[r],n[r][s]=n),n})),p.exit=p.exit.concat(u.map((function(t){return zc({},r,t)}))),p}var Wc=function(t,e,i,n,r){var a=r.createObj,s=void 0===a?function(t){return{}}:a,o=r.updateObj,l=void 0===o?function(t,e){}:o,c=r.exitObj,h=void 0===c?function(t){}:c,u=r.objBindAttr,d=void 0===u?"__obj":u,p=r.dataBindAttr,f=void 0===p?"__data":p,g=Oc(r,["createObj","updateObj","exitObj","objBindAttr","dataBindAttr"]),m=jc(t,e,function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Pc(Object(i),!0).forEach((function(e){zc(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Pc(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({objBindAttr:d,dataBindAttr:f},g)),b=m.enter,y=m.update;m.exit.forEach((function(t){var e=t[d];delete t[d],h(e),n(e)}));var v=function(t){var e=[];return t.forEach((function(t){var i=s(t);i&&(i[f]=t,t[d]=i,e.push(i))})),e}(b);!function(t){t.forEach((function(t){var e=t[d];e&&(e[f]=t,l(e,t))}))}([].concat(Vc(b),Vc(y))),v.forEach(i)};class qc extends Map{constructor(t,e=Yc){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,i]of t)this.set(e,i)}get(t){return super.get(Zc(this,t))}has(t){return super.has(Zc(this,t))}set(t,e){return super.set(Jc(this,t),e)}delete(t){return super.delete(Xc(this,t))}}Set;function Zc({_intern:t,_key:e},i){const n=e(i);return t.has(n)?t.get(n):i}function Jc({_intern:t,_key:e},i){const n=e(i);return t.has(n)?t.get(n):(t.set(n,i),i)}function Xc({_intern:t,_key:e},i){const n=e(i);return t.has(n)&&(i=t.get(n),t.delete(n)),i}function Yc(t){return null!==t&&"object"==typeof t?t.valueOf():t}function Kc(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}const $c=Symbol("implicit");var th=function(t){for(var e=t.length/6|0,i=new Array(e),n=0;n<e;)i[n]="#"+t.slice(6*n,6*++n);return i}("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),eh=i(5),ih=i.n(eh);function nh(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function rh(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?nh(Object(i),!0).forEach((function(e){oh(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):nh(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function ah(t){return(ah="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function sh(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function oh(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function lh(t,e){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}}),e&&hh(t,e)}function ch(t){return(ch=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function hh(t,e){return(hh=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function uh(){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(t){return!1}}function dh(t,e,i){return(dh=uh()?Reflect.construct:function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&hh(r,i.prototype),r}).apply(null,arguments)}function ph(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function fh(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function gh(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?fh(t):e}function mh(t){var e=uh();return function(){var i,n=ch(t);if(e){var r=ch(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return gh(this,i)}}function bh(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==i)return;var n,r,a=[],s=!0,o=!1;try{for(i=i.call(t);!(s=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);s=!0);}catch(t){o=!0,r=t}finally{try{s||null==i.return||i.return()}finally{if(o)throw r}}return a}(t,e)||vh(t,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.")}()}function yh(t){return function(t){if(Array.isArray(t))return xh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||vh(t)||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 vh(t,e){if(t){if("string"==typeof t)return xh(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?xh(t,e):void 0}}function xh(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var _h=function t(e){e.geometry&&e.geometry.dispose(),e.material&&function t(e){e instanceof Array?e.forEach(t):(e.map&&e.map.dispose(),e.dispose())}(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(t)},Ah=function(t){for(;t.children.length;){var e=t.children[0];t.remove(e),_h(e)}},wh=["objFilter"];function Ch(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.objFilter,r=void 0===n?function(){return!0}:n,a=ph(i,wh);return Wc(t,e.children.filter(r),(function(t){return e.add(t)}),(function(t){e.remove(t),Ah(t)}),rh({objBindAttr:"__threeObj"},a))}var Mh=function(t){return isNaN(t)?parseInt(ih()(t).toHex(),16):t},Eh=function(t){return isNaN(t)?ih()(t).getAlpha():1},Ih=function t(){var e=new qc,i=[],n=[],r=$c;function a(t){let a=e.get(t);if(void 0===a){if(r!==$c)return r;e.set(t,a=i.push(t)-1)}return n[a%n.length]}return a.domain=function(t){if(!arguments.length)return i.slice();i=[],e=new qc;for(const n of t)e.has(n)||e.set(n,i.push(n)-1);return a},a.range=function(t){return arguments.length?(n=Array.from(t),a):n.slice()},a.unknown=function(t){return arguments.length?(r=t,a):r},a.copy=function(){return t(i,n).unknown(r)},Kc.apply(a,arguments),a}(th);function Sh(t,e,i){e&&"string"==typeof i&&t.filter((function(t){return!t[i]})).forEach((function(t){t[i]=Ih(e(t))}))}var Th=window.THREE?window.THREE:{Group:Tr,Mesh:Se,MeshLambertMaterial:js,Color:Jt,BufferGeometry:he,BufferAttribute:$t,Matrix4:rt,Vector3:I,SphereBufferGeometry:ks,CylinderBufferGeometry:Na,TubeBufferGeometry:Ps,ConeBufferGeometry:ka,Line:wa,LineBasicMaterial:ba,QuadraticBezierCurve3:ts,CubicBezierCurve3:Ya,Box3:B},Bh={graph:vc.a,forcelayout:_c.a},Fh=(new Th.BufferGeometry).setAttribute?"setAttribute":"addAttribute",Lh=(new Th.BufferGeometry).applyMatrix4?"applyMatrix4":"applyMatrix";var Uh=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=function(e){lh(r,e);var n=mh(r);function r(){var e;sh(this,r);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return(e=n.call.apply(n,[this].concat(s))).__kapsuleInstance=t().apply(void 0,[].concat(yh(i?[fh(e)]:[]),s)),e}return r}(e);return Object.keys(t()).forEach((function(t){return n.prototype[t]=function(){var e,i=(e=this.__kapsuleInstance)[t].apply(e,arguments);return i===this.__kapsuleInstance?this:i}})),n}(Ic({props:{jsonUrl:{onChange:function(t,e){var i=this;t&&!e.fetchingJson&&(e.fetchingJson=!0,e.onLoading(),fetch(t).then((function(t){return t.json()})).then((function(t){e.fetchingJson=!1,e.onFinishLoading(t),i.graphData(t)})))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(t,e){e.engineRunning=!1}},numDimensions:{default:3,onChange:function(t,e){var i=e.d3ForceLayout.force("charge");function n(t,e){t.forEach((function(t){delete t[e],delete t["v".concat(e)]}))}i&&i.strength(t>2?-60:-30),t<3&&n(e.graphData.nodes,"z"),t<2&&n(e.graphData.nodes,"y")}},dagMode:{onChange:function(t,e){!t&&"d3"===e.forceEngine&&(e.graphData.nodes||[]).forEach((function(t){return t.fx=t.fy=t.fz=void 0}))}},dagLevelDistance:{},dagNodeFilter:{default:function(t){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.alphaDecay(t)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.alphaTarget(t)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.velocityDecay(t)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(t){return t._flushObjects=!0,t._rerender(),this},d3Force:function(t,e,i){return void 0===i?t.d3ForceLayout.force(e):(t.d3ForceLayout.force(e,i),this)},d3ReheatSimulation:function(t){return t.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(t){return t.cntTicks=0,t.startTickTime=new Date,t.engineRunning=!0,this},tickFrame:function(t){var e,i,n,r,a="ngraph"!==t.forceEngine;return t.engineRunning&&function(){++t.cntTicks>t.cooldownTicks||new Date-t.startTickTime>t.cooldownTime||a&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin?(t.engineRunning=!1,t.onEngineStop()):(t.layout[a?"tick":"step"](),t.onEngineTick());t.graphData.nodes.forEach((function(e){var i=e.__threeObj;if(i){var n=a?e:t.layout.getNodePosition(e[t.nodeId]);i.position.x=n.x,i.position.y=n.y||0,i.position.z=n.z||0}}));var e=Object(Sc.default)(t.linkWidth),i=Object(Sc.default)(t.linkCurvature),n=Object(Sc.default)(t.linkCurveRotation),r=Object(Sc.default)(t.linkThreeObjectExtend);t.graphData.links.forEach((function(s){var o=s.__lineObj;if(o){var l=a?s:t.layout.getLinkPosition(t.layout.graph.getLink(s.source,s.target).id),c=l[a?"source":"from"],h=l[a?"target":"to"];if(c&&h&&c.hasOwnProperty("x")&&h.hasOwnProperty("x")){!function(e){var r=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),s=r[a?"source":"from"],o=r[a?"target":"to"];if(s&&o&&s.hasOwnProperty("x")&&o.hasOwnProperty("x")){var l=i(e);if(l){var c,h=new Th.Vector3(s.x,s.y||0,s.z||0),u=new Th.Vector3(o.x,o.y||0,o.z||0),d=h.distanceTo(u),p=n(e);if(d>0){var f=o.x-s.x,g=o.y-s.y||0,m=(new Th.Vector3).subVectors(u,h),b=m.clone().multiplyScalar(l).cross(0!==f||0!==g?new Th.Vector3(0,0,1):new Th.Vector3(0,1,0)).applyAxisAngle(m.normalize(),p).add((new Th.Vector3).addVectors(h,u).divideScalar(2));c=new Th.QuadraticBezierCurve3(h,b,u)}else{var y=70*l,v=-p,x=v+Math.PI/2;c=new Th.CubicBezierCurve3(h,new Th.Vector3(y*Math.cos(x),y*Math.sin(x),0).add(h),new Th.Vector3(y*Math.cos(v),y*Math.sin(v),0).add(h),u)}e.__curve=c}else e.__curve=null}}(s);var u=r(s);if(!t.linkPositionUpdate||!t.linkPositionUpdate(u?o.children[1]:o,{start:{x:c.x,y:c.y,z:c.z},end:{x:h.x,y:h.y,z:h.z}},s)||u){var d=s.__curve,p=o.children.length?o.children[0]:o;if("Line"===p.type){if(d)p.geometry.setFromPoints(d.getPoints(30));else{var f=p.geometry.getAttribute("position");f&&f.array&&6===f.array.length||p.geometry[Fh]("position",f=new Th.BufferAttribute(new Float32Array(6),3)),f.array[0]=c.x,f.array[1]=c.y||0,f.array[2]=c.z||0,f.array[3]=h.x,f.array[4]=h.y||0,f.array[5]=h.z||0,f.needsUpdate=!0}p.geometry.computeBoundingSphere()}else if("Mesh"===p.type)if(d){p.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(p.position.set(0,0,0),p.rotation.set(0,0,0),p.scale.set(1,1,1));var g=Math.ceil(10*e(s))/10/2,m=new Th.TubeBufferGeometry(d,30,g,t.linkResolution,!1);p.geometry.dispose(),p.geometry=m}else{if(!p.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var b=Math.ceil(10*e(s))/10/2,y=new Th.CylinderBufferGeometry(b,b,1,t.linkResolution,1,!1);y[Lh]((new Th.Matrix4).makeTranslation(0,.5,0)),y[Lh]((new Th.Matrix4).makeRotationX(Math.PI/2)),p.geometry.dispose(),p.geometry=y}var v=new Th.Vector3(c.x,c.y||0,c.z||0),x=new Th.Vector3(h.x,h.y||0,h.z||0),_=v.distanceTo(x);p.position.x=v.x,p.position.y=v.y,p.position.z=v.z,p.scale.z=_,p.parent.localToWorld(x),p.lookAt(x)}}}}}))}(),e=Object(Sc.default)(t.linkDirectionalArrowRelPos),i=Object(Sc.default)(t.linkDirectionalArrowLength),n=Object(Sc.default)(t.nodeVal),t.graphData.links.forEach((function(r){var s=r.__arrowObj;if(s){var o=a?r:t.layout.getLinkPosition(t.layout.graph.getLink(r.source,r.target).id),l=o[a?"source":"from"],c=o[a?"target":"to"];if(l&&c&&l.hasOwnProperty("x")&&c.hasOwnProperty("x")){var h=Math.sqrt(Math.max(0,n(l)||1))*t.nodeRelSize,u=Math.sqrt(Math.max(0,n(c)||1))*t.nodeRelSize,d=i(r),p=e(r),f=r.__curve?function(t){return r.__curve.getPoint(t)}:function(t){var e=function(t,e,i,n){return e[t]+(i[t]-e[t])*n||0};return{x:e("x",l,c,t),y:e("y",l,c,t),z:e("z",l,c,t)}},g=r.__curve?r.__curve.getLength():Math.sqrt(["x","y","z"].map((function(t){return Math.pow((c[t]||0)-(l[t]||0),2)})).reduce((function(t,e){return t+e}),0)),m=h+d+(g-h-u-d)*p,b=f(m/g),y=f((m-d)/g);["x","y","z"].forEach((function(t){return s.position[t]=y[t]}));var v=dh(Th.Vector3,yh(["x","y","z"].map((function(t){return b[t]}))));s.parent.localToWorld(v),s.lookAt(v)}}})),r=Object(Sc.default)(t.linkDirectionalParticleSpeed),t.graphData.links.forEach((function(e){var i=e.__photonsObj&&e.__photonsObj.children,n=e.__singleHopPhotonsObj&&e.__singleHopPhotonsObj.children;if(n&&n.length||i&&i.length){var s=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),o=s[a?"source":"from"],l=s[a?"target":"to"];if(o&&l&&o.hasOwnProperty("x")&&l.hasOwnProperty("x")){var c=r(e),h=e.__curve?function(t){return e.__curve.getPoint(t)}:function(t){var e=function(t,e,i,n){return e[t]+(i[t]-e[t])*n||0};return{x:e("x",o,l,t),y:e("y",o,l,t),z:e("z",o,l,t)}};[].concat(yh(i||[]),yh(n||[])).forEach((function(t,e){var n="singleHopPhotons"===t.parent.__linkThreeObjType;if(t.hasOwnProperty("__progressRatio")||(t.__progressRatio=n?0:e/i.length),t.__progressRatio+=c,t.__progressRatio>=1){if(n)return t.parent.remove(t),void Ah(t);t.__progressRatio=t.__progressRatio%1}var r=t.__progressRatio,a=h(r);["x","y","z"].forEach((function(e){return t.position[e]=a[e]}))}))}}})),this},emitParticle:function(t,e){if(e){if(!e.__singleHopPhotonsObj){var i=new Th.Group;i.__linkThreeObjType="singleHopPhotons",e.__singleHopPhotonsObj=i,t.graphScene.add(i)}var n=Object(Sc.default)(t.linkDirectionalParticleWidth),r=Math.ceil(10*n(e))/10/2,a=t.linkDirectionalParticleResolution,s=new Th.SphereBufferGeometry(r,a,a),o=Object(Sc.default)(t.linkColor),l=Object(Sc.default)(t.linkDirectionalParticleColor)(e)||o(e)||"#f0f0f0",c=new Th.Color(Mh(l)),h=3*t.linkOpacity,u=new Th.MeshLambertMaterial({color:c,transparent:!0,opacity:h});e.__singleHopPhotonsObj.add(new Th.Mesh(s,u))}return this},getGraphBbox:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};if(!t.initialised)return null;var i=function t(i){var n=[];if(i.geometry){i.geometry.computeBoundingBox();var r=new Th.Box3;r.copy(i.geometry.boundingBox).applyMatrix4(i.matrixWorld),n.push(r)}return n.concat.apply(n,yh((i.children||[]).filter((function(t){return!t.hasOwnProperty("__graphObjType")||"node"===t.__graphObjType&&e(t.__data)})).map(t)))}(t.graphScene);return i.length?Object.assign.apply(Object,yh(["x","y","z"].map((function(t){return oh({},t,[Tc(i,(function(e){return e.min[t]})),Bc(i,(function(e){return e.max[t]}))])})))):null}},stateInit:function(){return{d3ForceLayout:Ol().force("link",jl()).force("charge",mc()).force("center",bc()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(t,e){e.graphScene=t},update:function(t,e){var i=function(t){return t.some((function(t){return e.hasOwnProperty(t)}))};if(t.engineRunning=!1,t.onUpdate(),null!==t.nodeAutoColorBy&&i(["nodeAutoColorBy","graphData","nodeColor"])&&Sh(t.graphData.nodes,Object(Sc.default)(t.nodeAutoColorBy),t.nodeColor),null!==t.linkAutoColorBy&&i(["linkAutoColorBy","graphData","linkColor"])&&Sh(t.graphData.links,Object(Sc.default)(t.linkAutoColorBy),t.linkColor),t._flushObjects||i(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var n=Object(Sc.default)(t.nodeThreeObject),r=Object(Sc.default)(t.nodeThreeObjectExtend),a=Object(Sc.default)(t.nodeVal),s=Object(Sc.default)(t.nodeColor),o=Object(Sc.default)(t.nodeVisibility),l={},c={};Ch(t.graphData.nodes.filter(o),t.graphScene,{purge:t._flushObjects||i(["nodeThreeObject","nodeThreeObjectExtend"]),objFilter:function(t){return"node"===t.__graphObjType},createObj:function(e){var i,a=n(e),s=r(e);return a&&t.nodeThreeObject===a&&(a=a.clone()),a&&!s?i=a:((i=new Th.Mesh).__graphDefaultObj=!0,a&&s&&i.add(a)),i.__graphObjType="node",i},updateObj:function(e,i){if(e.__graphDefaultObj){var n=a(i)||1,r=Math.cbrt(n)*t.nodeRelSize,o=t.nodeResolution;e.geometry.type.match(/^Sphere(Buffer)?Geometry$/)&&e.geometry.parameters.radius===r&&e.geometry.parameters.widthSegments===o||(l.hasOwnProperty(n)||(l[n]=new Th.SphereBufferGeometry(r,o,o)),e.geometry.dispose(),e.geometry=l[n]);var h=s(i),u=new Th.Color(Mh(h||"#ffffaa")),d=t.nodeOpacity*Eh(h);"MeshLambertMaterial"===e.material.type&&e.material.color.equals(u)&&e.material.opacity===d||(c.hasOwnProperty(h)||(c[h]=new Th.MeshLambertMaterial({color:u,transparent:!0,opacity:d})),e.material.dispose(),e.material=c[h])}}})}if(t._flushObjects||i(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution"])){var h=Object(Sc.default)(t.linkThreeObject),u=Object(Sc.default)(t.linkThreeObjectExtend),d=Object(Sc.default)(t.linkMaterial),p=Object(Sc.default)(t.linkVisibility),f=Object(Sc.default)(t.linkColor),g=Object(Sc.default)(t.linkWidth),m={},b={},y={},v=t.graphData.links.filter(p);if(Ch(v,t.graphScene,{objBindAttr:"__lineObj",purge:t._flushObjects||i(["linkThreeObject","linkThreeObjectExtend","linkWidth"]),objFilter:function(t){return"link"===t.__graphObjType},createObj:function(e){var i,n,r=h(e),a=u(e);if(r&&t.linkThreeObject===r&&(r=r.clone()),!r||a)if(!!g(e))i=new Th.Mesh;else{var s=new Th.BufferGeometry;s[Fh]("position",new Th.BufferAttribute(new Float32Array(6),3)),i=new Th.Line(s)}return r?a?((n=new Th.Group).__graphDefaultObj=!0,n.add(i),n.add(r)):n=r:(n=i).__graphDefaultObj=!0,n.renderOrder=10,n.__graphObjType="link",n},updateObj:function(e,i){if(e.__graphDefaultObj){var n=e.children.length?e.children[0]:e,r=Math.ceil(10*g(i))/10,a=!!r;if(a){var s=r/2,o=t.linkResolution;if(!n.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||n.geometry.parameters.radiusTop!==s||n.geometry.parameters.radialSegments!==o){if(!m.hasOwnProperty(r)){var l=new Th.CylinderBufferGeometry(s,s,1,o,1,!1);l[Lh]((new Th.Matrix4).makeTranslation(0,.5,0)),l[Lh]((new Th.Matrix4).makeRotationX(Math.PI/2)),m[r]=l}n.geometry.dispose(),n.geometry=m[r]}}var c=d(i);if(c)n.material=c;else{var h=f(i),u=new Th.Color(Mh(h||"#f0f0f0")),p=t.linkOpacity*Eh(h),v=a?"MeshLambertMaterial":"LineBasicMaterial";if(n.material.type!==v||!n.material.color.equals(u)||n.material.opacity!==p){var x=a?b:y;x.hasOwnProperty(h)||(x[h]=new Th[v]({color:u,transparent:p<1,opacity:p,depthWrite:p>=1})),n.material.dispose(),n.material=x[h]}}}}}),t.linkDirectionalArrowLength||e.hasOwnProperty("linkDirectionalArrowLength")){var x=Object(Sc.default)(t.linkDirectionalArrowLength),_=Object(Sc.default)(t.linkDirectionalArrowColor);Ch(v.filter(x),t.graphScene,{objBindAttr:"__arrowObj",objFilter:function(t){return"arrow"===t.__linkThreeObjType},createObj:function(){var t=new Th.Mesh(void 0,new Th.MeshLambertMaterial({transparent:!0}));return t.__linkThreeObjType="arrow",t},updateObj:function(e,i){var n=x(i),r=t.linkDirectionalArrowResolution;if(!e.geometry.type.match(/^Cone(Buffer)?Geometry$/)||e.geometry.parameters.height!==n||e.geometry.parameters.radialSegments!==r){var a=new Th.ConeBufferGeometry(.25*n,n,r);a.translate(0,n/2,0),a.rotateX(Math.PI/2),e.geometry.dispose(),e.geometry=a}e.material.color=new Th.Color(_(i)||f(i)||"#f0f0f0"),e.material.opacity=3*t.linkOpacity}})}if(t.linkDirectionalParticles||e.hasOwnProperty("linkDirectionalParticles")){var A=Object(Sc.default)(t.linkDirectionalParticles),w=Object(Sc.default)(t.linkDirectionalParticleWidth),C=Object(Sc.default)(t.linkDirectionalParticleColor),M={},E={};Ch(v.filter(A),t.graphScene,{objBindAttr:"__photonsObj",objFilter:function(t){return"photons"===t.__linkThreeObjType},createObj:function(){var t=new Th.Group;return t.__linkThreeObjType="photons",t},updateObj:function(e,i){var n,r=Math.round(Math.abs(A(i))),a=!!e.children.length&&e.children[0],s=Math.ceil(10*w(i))/10/2,o=t.linkDirectionalParticleResolution;a&&a.geometry.parameters.radius===s&&a.geometry.parameters.widthSegments===o?n=a.geometry:(E.hasOwnProperty(s)||(E[s]=new Th.SphereBufferGeometry(s,o,o)),n=E[s],a&&a.geometry.dispose());var l,c=C(i)||f(i)||"#f0f0f0",h=new Th.Color(Mh(c)),u=3*t.linkOpacity;a&&a.material.color.equals(h)&&a.material.opacity===u?l=a.material:(M.hasOwnProperty(c)||(M[c]=new Th.MeshLambertMaterial({color:h,transparent:!0,opacity:u})),l=M[c],a&&a.material.dispose()),Ch(yh(new Array(r)).map((function(t,e){return{idx:e}})),e,{idAccessor:function(t){return t.idx},createObj:function(){return new Th.Mesh(n,l)},updateObj:function(t){t.geometry=n,t.material=l}})}})}}if(t._flushObjects=!1,i(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach((function(e){e.source=e[t.linkSource],e.target=e[t.linkTarget]}));var I,S="ngraph"!==t.forceEngine;if(S){(I=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var T=t.d3ForceLayout.force("link");T&&T.id((function(e){return e[t.nodeId]})).links(t.graphData.links);var B=t.dagMode&&function(t,e){var i=t.nodes,n=t.links,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.nodeFilter,s=void 0===a?function(){return!0}:a,o=r.onLoopError,l=void 0===o?function(t){throw"Invalid DAG structure! Found cycle in node path: ".concat(t.join(" -> "),".")}:o,c={};i.forEach((function(t){return c[e(t)]={data:t,out:[],depth:-1,skip:!s(t)}})),n.forEach((function(t){var i=t.source,n=t.target,r=l(i),a=l(n);if(!c.hasOwnProperty(r))throw"Missing source node with id: ".concat(r);if(!c.hasOwnProperty(a))throw"Missing target node with id: ".concat(a);var s=c[r],o=c[a];function l(t){return"object"===ah(t)?e(t):t}s.out.push(o)}));var h=[];d(Object.values(c));var u=Object.assign.apply(Object,[{}].concat(yh(Object.entries(c).filter((function(t){return!bh(t,2)[1].skip})).map((function(t){var e=bh(t,2);return oh({},e[0],e[1].depth)})))));return u;function d(t){for(var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=0,a=t.length;r<a;r++){var s=t[r];if(-1!==i.indexOf(s)){var o=function(){var t=[].concat(yh(i.slice(i.indexOf(s))),[s]).map((function(t){return e(t.data)}));return h.some((function(e){return e.length===t.length&&e.every((function(e,i){return e===t[i]}))}))||(h.push(t),l(t)),"continue"}();if("continue"===o)continue}n>s.depth&&(s.depth=n,d(s.out,[].concat(yh(i),[s]),n+(s.skip?0:1)))}}}(t.graphData,(function(e){return e[t.nodeId]}),{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),F=Math.max.apply(Math,yh(Object.values(B||[]))),L=t.dagLevelDistance||t.graphData.nodes.length/(F||1)*2*(-1!==["radialin","radialout"].indexOf(t.dagMode)?.7:1);if(t.dagMode){var U=function(e,i){return function(n){return e?(B[n[t.nodeId]]-F/2)*L*(i?-1:1):void 0}},R=U(-1!==["lr","rl"].indexOf(t.dagMode),"rl"===t.dagMode),D=U(-1!==["td","bu"].indexOf(t.dagMode),"td"===t.dagMode),N=U(-1!==["zin","zout"].indexOf(t.dagMode),"zout"===t.dagMode);t.graphData.nodes.filter(t.dagNodeFilter).forEach((function(t){t.fx=R(t),t.fy=D(t),t.fz=N(t)}))}t.d3ForceLayout.force("dagRadial",-1!==["radialin","radialout"].indexOf(t.dagMode)?function(t,e,i,n){var r,a,s,o,l=Ql(.1);function c(t){for(var l=0,c=r.length;l<c;++l){var h=r[l],u=h.x-e||1e-6,d=(h.y||0)-i||1e-6,p=(h.z||0)-n||1e-6,f=Math.sqrt(u*u+d*d+p*p),g=(o[l]-f)*s[l]*t/f;h.vx+=u*g,a>1&&(h.vy+=d*g),a>2&&(h.vz+=p*g)}}function h(){if(r){var e,i=r.length;for(s=new Array(i),o=new Array(i),e=0;e<i;++e)o[e]=+t(r[e],e,r),s[e]=isNaN(o[e])?0:+l(r[e],e,r)}}return"function"!=typeof t&&(t=Ql(+t)),null==e&&(e=0),null==i&&(i=0),null==n&&(n=0),c.initialize=function(t,...e){r=t,a=e.find(t=>[1,2,3].includes(t))||2,h()},c.strength=function(t){return arguments.length?(l="function"==typeof t?t:Ql(+t),h(),c):l},c.radius=function(e){return arguments.length?(t="function"==typeof e?e:Ql(+e),h(),c):t},c.x=function(t){return arguments.length?(e=+t,c):e},c.y=function(t){return arguments.length?(i=+t,c):i},c.z=function(t){return arguments.length?(n=+t,c):n},c}((function(e){var i=B[e[t.nodeId]]||-1;return("radialin"===t.dagMode?F-i:i)*L})).strength((function(e){return t.dagNodeFilter(e)?1:0})):null)}else{var k=Bh.graph();t.graphData.nodes.forEach((function(e){k.addNode(e[t.nodeId])})),t.graphData.links.forEach((function(t){k.addLink(t.source,t.target)})),(I=Bh.forcelayout(k,rh({dimensions:t.numDimensions},t.ngraphPhysics))).graph=k}for(var P=0;P<t.warmupTicks&&!(S&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);P++)I[S?"tick":"step"]();t.layout=I,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}}),(window.THREE?window.THREE:{Group:Tr}).Group,!0);e.default=Uh}]);
|
|
2
8
|
//# sourceMappingURL=aframe-babia-components.min.js.map
|