aframe-babia-components 1.2.5 → 1.2.6
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-treebuilder.js +17 -12
- package/components/others/babia-camera.js +52 -40
- package/components/others/babia-experiment.js +457 -0
- package/components/others/babia-poster.js +383 -0
- package/components/others/babia-task.js +247 -0
- package/components/others/babia-ui.js +312 -147
- package/components/others/common.js +36 -5
- package/components/visualizers/babia-boats.js +708 -87
- package/components/visualizers/babia-network.js +268 -212
- package/dist/aframe-babia-components.js +20590 -18317
- package/dist/aframe-babia-components.min.js +3 -3
- package/dist/aframe-babia-components.min.js.map +1 -1
- package/docs/APIs/CHARTS.md +233 -207
- package/docs/APIs/OTHERS.md +143 -56
- package/docs/RELEASE_NOTES.md +5 -0
- package/docs/Tutorials/how_to_prepare_an_experiment.md +148 -0
- package/examples/assets/palettes/bluetored.jpg +0 -0
- package/examples/assets/textures/360-panorama.jpg +0 -0
- package/examples/assets/textures/floor-texture.jpg +0 -0
- package/examples/assets/textures/metalic-texture.jpg +0 -0
- package/examples/boats/boats_dependency/dependencieslist_cloudinary.json +1 -0
- package/examples/boats/boats_dependency/dependencieslist_express.json +4376 -0
- package/examples/boats/boats_dependency/dependencieslist_filestash.json +39533 -0
- package/examples/boats/boats_dependency/dependencieslist_ghdesktop.json +127660 -0
- package/examples/boats/boats_dependency/dependencieslist_karma.json +1 -0
- package/examples/boats/boats_dependency/dependencieslist_pm2.json +13726 -0
- package/examples/boats/boats_dependency/dependencieslist_portainer.json +41818 -0
- package/examples/boats/boats_dependency/dependencieslist_sh.json +5194 -0
- package/examples/boats/boats_dependency/experiment.html +277 -0
- package/examples/boats/boats_dependency/index.html +300 -0
- package/examples/boats/boats_dependency/index_gradient.html +209 -0
- package/examples/boats/boats_dependency/index_normalcity.html +207 -0
- package/examples/boats/boats_dependency/index_quarter_levels_01.html +213 -0
- package/examples/boats/boats_dependency/index_quarter_levels_02.html +213 -0
- package/examples/boats/boats_dependency/index_quarter_levels_03.html +213 -0
- package/examples/boats/boats_dependency/index_quarter_levels_querystring.html +243 -0
- package/examples/boats/boats_dependency/index_tree.html +211 -0
- package/examples/boats/boats_dependency/index_tree_gradient.html +212 -0
- package/examples/boats/boats_dependency/index_tree_wireframe.html +243 -0
- package/examples/charts/network_chart/network_chart.html +10 -2
- package/examples/charts/pie/index.html +3 -4
- package/examples/codecityjs/perceval2021/index.html +1 -1
- package/examples/codecityjs/projects_analysis/argouml_landscape.html +1 -1
- package/examples/codecityjs/projects_analysis/argouml_numfuns.html +3 -3
- package/examples/codecityjs/projects_analysis/argouml_table.html +1 -1
- package/examples/codecityjs/projects_analysis/argouml_tokens.html +1 -1
- package/examples/codecityjs/projects_analysis/experiment_interface.html +1 -1
- package/examples/codecityjs/projects_analysis/experiment_interface_task5.html +1 -1
- package/examples/codecityjs/projects_analysis/experiment_interface_vr_2021.html +1 -1
- package/examples/codecityjs/projects_analysis/experiment_interface_vr_task5.html +1 -1
- package/examples/codecityjs/projects_analysis/perceval_landscape.html +1 -1
- package/examples/codecityjs/projects_analysis/perceval_table.html +1 -1
- package/examples/dashboard/chaoss-dashboards.html +1 -1
- package/examples/dashboard/chaoss-issues.html +1 -1
- package/examples/dashboard/chaoss-pr.html +1 -1
- package/examples/dashboard/range.html +1 -1
- package/examples/dashboard/template.html +1 -1
- package/examples/experiment/city.html +352 -0
- package/examples/experiment/index.html +527 -0
- package/examples/experiment/pie.html +90 -0
- package/examples/experiment/sample-3s.mp3 +0 -0
- package/examples/experiment/sample.mp4 +0 -0
- package/examples/experiment/staticdata/80-percent-open-time-issues2.json +1 -0
- package/examples/experiment/staticdata/80-percent-open-time-pr.json +1 -0
- package/examples/experiment/staticdata/issues-by-organization.json +1 -0
- package/examples/experiment/staticdata/issues.json +1 -0
- package/examples/experiment/staticdata/jetuml_code_data.json +1 -0
- package/examples/experiment/staticdata/median-open-time-issues.json +1 -0
- package/examples/experiment/staticdata/median-open-time-pr.json +1 -0
- package/examples/experiment/staticdata/organizations-issues.json +1 -0
- package/examples/experiment/staticdata/organizations-pr.json +1 -0
- package/examples/experiment/staticdata/projects-issues.json +1 -0
- package/examples/experiment/staticdata/projects-pr.json +1 -0
- package/examples/experiment/staticdata/pull-requests-by-organization.json +1 -0
- package/examples/experiment/staticdata/pull-requests.json +1 -0
- package/examples/experiment/staticdata/repositories-issues-asignees.json +1 -0
- package/examples/experiment/staticdata/repositories-issues-avgdays.json +1 -0
- package/examples/experiment/staticdata/repositories-issues-count.json +1 -0
- package/examples/experiment/staticdata/repositories-issues-submitters.json +1 -0
- package/examples/experiment/staticdata/repositories-pr-asignees.json +1 -0
- package/examples/experiment/staticdata/repositories-pr-avgdays.json +1 -0
- package/examples/experiment/staticdata/repositories-pr-count.json +1 -0
- package/examples/experiment/staticdata/repositories-pr-submitters.json +1 -0
- package/examples/experiment/staticdata/status-issues.json +1 -0
- package/examples/experiment/staticdata/status-pr.json +1 -0
- package/examples/experiment/staticdata/submitter-issues-avgdays.json +1 -0
- package/examples/experiment/staticdata/submitter-issues-count.json +1 -0
- package/examples/experiment/staticdata/submitter-issues-repo.json +1 -0
- package/examples/experiment/staticdata/submitter-pr-avgdays.json +1 -0
- package/examples/experiment/staticdata/submitter-pr-count.json +1 -0
- package/examples/experiment/staticdata/submitter-pr-repo.json +1 -0
- package/examples/experiment/staticdata/submitters-issues.json +1 -0
- package/examples/experiment/staticdata/submitters-pr.json +1 -0
- package/examples/multi_boats/jetuml_evolution_experiment.html +1 -1
- package/index.js +23 -9
- package/package.json +1 -1
- package/examples/charts_querier/network_chart_querier/data.json +0 -123
- package/examples/charts_querier/network_chart_querier/links.json +0 -13
- package/examples/charts_querier/network_chart_querier/network_chart_querier.html +0 -68
- package/examples/charts_querier/network_chart_querier/network_chart_querier_nodes_links.html +0 -74
- package/examples/charts_querier/network_chart_querier/nodes.json +0 -12
|
@@ -1,8 +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=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;
|
|
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"],categoric:["#ffb75f","#8e009a","#5c2800","#ff95ff","#a69fff","#da8800","#073479","#ffff00","#00d3ff","#b60026","#00a59d","#7e0000","#0099cc","#ff8080","#7491eb","#365e00","#743570","#00805e","#570000","#00629c","#6d4e00","#002c47","#95824d","#001b2b","#006020","#3d142e","#ffb75f","#8e009a"]},get:function(t,e){if(e in this.palettes){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 i=this.palettes.ubuntu.length;return this.palettes[e][t%i]}};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",{value:t.title}),t.titleColor&&i.setAttribute("material",{color:t.titleColor}),i.setAttribute("scale","10 10 10"),i.setAttribute("wrapCount","10"),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,d=r.max,h=r.random;function u(t,e){if(e=e||{},(t=t||"")instanceof u)return t;if(!(this instanceof u))return new u(t,e);var i=function(t){var e={r:0,g:0,b:0},i=1,n=null,o=null,l=null,h=!1,u=!1;"string"==typeof t&&(t=function(t){t=t.replace(a,"").replace(s,"").toLowerCase();var e,i=!1;if(F[t])t=F[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:R(e[1]),g:R(e[2]),b:R(e[3]),a:O(e[4]),format:i?"name":"hex8"};if(e=H.hex6.exec(t))return{r:R(e[1]),g:R(e[2]),b:R(e[3]),format:i?"name":"hex"};if(e=H.hex4.exec(t))return{r:R(e[1]+""+e[1]),g:R(e[2]+""+e[2]),b:R(e[3]+""+e[3]),a:O(e[4]+""+e[4]),format:i?"name":"hex8"};if(e=H.hex3.exec(t))return{r:R(e[1]+""+e[1]),g:R(e[2]+""+e[2]),b:R(e[3]+""+e[3]),format:i?"name":"hex"};return!1}(t));"object"==typeof t&&(j(t.r)&&j(t.g)&&j(t.b)?(p=t.r,f=t.g,g=t.b,e={r:255*L(p,255),g:255*L(f,255),b:255*L(g,255)},h=!0,u="%"===String(t.r).substr(-1)?"prgb":"rgb"):j(t.h)&&j(t.s)&&j(t.v)?(n=N(t.s),o=N(t.v),e=function(t,e,i){t=6*L(t,360),e=L(e,100),i=L(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),h=!0,u="hsv"):j(t.h)&&j(t.s)&&j(t.l)&&(n=N(t.s),l=N(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=L(t,360),e=L(e,100),i=L(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),h=!0,u="hsl"),t.hasOwnProperty("a")&&(i=t.a));var p,f,g;return i=U(i),{ok:h,format:t.format||u,r:c(255,d(e.r,0)),g:c(255,d(e.g,0)),b:c(255,d(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=L(t,255),e=L(e,255),i=L(i,255);var n,r,a=d(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=L(t,255),e=L(e,255),i=L(i,255);var n,r,a=d(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=[k(l(t).toString(16)),k(l(e).toString(16)),k(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[k(P(n)),k(l(t).toString(16)),k(l(e).toString(16)),k(l(i).toString(16))].join("")}function b(t,e){e=0===e?0:e||10;var i=u(t).toHsl();return i.s-=e/100,i.s=D(i.s),u(i)}function v(t,e){e=0===e?0:e||10;var i=u(t).toHsl();return i.s+=e/100,i.s=D(i.s),u(i)}function y(t){return u(t).desaturate(100)}function x(t,e){e=0===e?0:e||10;var i=u(t).toHsl();return i.l+=e/100,i.l=D(i.l),u(i)}function _(t,e){e=0===e?0:e||10;var i=u(t).toRgb();return i.r=d(0,c(255,i.r-l(-e/100*255))),i.g=d(0,c(255,i.g-l(-e/100*255))),i.b=d(0,c(255,i.b-l(-e/100*255))),u(i)}function A(t,e){e=0===e?0:e||10;var i=u(t).toHsl();return i.l-=e/100,i.l=D(i.l),u(i)}function C(t,e){var i=u(t).toHsl(),n=(i.h+e)%360;return i.h=n<0?360+n:n,u(i)}function w(t){var e=u(t).toHsl();return e.h=(e.h+180)%360,u(e)}function M(t){var e=u(t).toHsl(),i=e.h;return[u(t),u({h:(i+120)%360,s:e.s,l:e.l}),u({h:(i+240)%360,s:e.s,l:e.l})]}function I(t){var e=u(t).toHsl(),i=e.h;return[u(t),u({h:(i+90)%360,s:e.s,l:e.l}),u({h:(i+180)%360,s:e.s,l:e.l}),u({h:(i+270)%360,s:e.s,l:e.l})]}function E(t){var e=u(t).toHsl(),i=e.h;return[u(t),u({h:(i+72)%360,s:e.s,l:e.l}),u({h:(i+216)%360,s:e.s,l:e.l})]}function S(t,e,i){e=e||6,i=i||30;var n=u(t).toHsl(),r=360/i,a=[u(t)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,a.push(u(n));return a}function B(t,e){e=e||6;for(var i=u(t).toHsv(),n=i.h,r=i.s,a=i.v,s=[],o=1/e;e--;)s.push(u({h:n,s:r,v:a})),a=(a+o)%1;return s}u.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=U(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=[k(l(t).toString(16)),k(l(e).toString(16)),k(l(i).toString(16)),k(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*L(this._r,255))+"%",g:l(100*L(this._g,255))+"%",b:l(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+l(100*L(this._r,255))+"%, "+l(100*L(this._g,255))+"%, "+l(100*L(this._b,255))+"%)":"rgba("+l(100*L(this._r,255))+"%, "+l(100*L(this._g,255))+"%, "+l(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(T[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=u(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 u(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(v,arguments)},greyscale:function(){return this._applyModification(y,arguments)},spin:function(){return this._applyModification(C,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(w,arguments)},monochromatic:function(){return this._applyCombination(B,arguments)},splitcomplement:function(){return this._applyCombination(E,arguments)},triad:function(){return this._applyCombination(M,arguments)},tetrad:function(){return this._applyCombination(I,arguments)}},u.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 u(t,e)},u.equals=function(t,e){return!(!t||!e)&&u(t).toRgbString()==u(e).toRgbString()},u.random=function(){return u.fromRatio({r:h(),g:h(),b:h()})},u.mix=function(t,e,i){i=0===i?0:i||50;var n=u(t).toRgb(),r=u(e).toRgb(),a=i/100;return u({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})},u.readability=function(t,e){var i=u(t),n=u(e);return(r.max(i.getLuminance(),n.getLuminance())+.05)/(r.min(i.getLuminance(),n.getLuminance())+.05)},u.isReadable=function(t,e,i){var n,r,a=u.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},u.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=u.readability(t,e[c]))>l&&(l=n,o=u(e[c]));return u.isReadable(t,o,{level:a,size:s})||!r?o:(i.includeFallbackColors=!1,u.mostReadable(t,["#fff","#000"],i))};var F=u.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"},T=u.hexNames=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[t[i]]=i);return e}(F);function U(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(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,d(0,parseFloat(t))),i&&(t=parseInt(t*e,10)/100),r.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function D(t){return c(1,d(0,t))}function R(t){return parseInt(t,16)}function k(t){return 1==t.length?"0"+t:""+t}function N(t){return t<=1&&(t=100*t+"%"),t}function P(t){return r.round(255*parseFloat(t)).toString(16)}function O(t){return R(t)/255}var z,Q,V,H=(Q="[\\s|\\(]+("+(z="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+z+")[,|\\s]+("+z+")\\s*\\)?",V="[\\s|\\(]+("+z+")[,|\\s]+("+z+")[,|\\s]+("+z+")[,|\\s]+("+z+")\\s*\\)?",{CSS_UNIT:new RegExp(z),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 j(t){return!!H.CSS_UNIT.exec(t)}t.exports?t.exports=u:void 0===(n=function(){return u}.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=[],d=0;for(let i=0;i<t.length;i++){let n,r,h=t[i],u=h[e.x_axis];n=0==i?.5+h[e.radius]*this.radius_scale:c[i-1]+s+.5+h[e.radius]*this.radius_scale,a[u]&&!h._not?(r=a[u].el,a[u].found=!0):(r=document.createElement("a-entity"),r.setAttribute("babia-name",u),r.id=h[e.index],r.object3D.position.x=n,this.chartEl.appendChild(r)),o(this,r,e,h,d,u,n,0),l.push(u),c.push(n),d++,s=h[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(39),h=i(40),u=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=h(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,v=p.createDragForce,y=p.createSpringForce,x=p.integrate,_=i(41).random(42),A=[],C=[],w=m(t,_),M=b(A,t,_),I=y(t,_),E=v(t),S=[],B=new Map,F=0;L("nbody",(function(){if(0===A.length)return;w.insertBodies(A);var t=A.length;for(;t--;){var e=A[t];e.isPinned||(e.reset(),w.updateBodyForce(e),E.update(e))}})),L("spring",(function(){var t=C.length;for(;t--;)I.update(C[t])}));var T={bodies:A,quadTree:w,springs:C,settings:t,addForce:L,removeForce:function(t){var e=S.indexOf(B.get(t));if(e<0)return;S.splice(e,1),B.delete(t)},getForces:function(){return B},step:function(){for(var e=0;e<S.length;++e)S[e](F);var i=x(A,t.timeStep,t.adaptiveTimeStepWeight);return F+=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 C.push(a),a},getTotalMovement:function(){return 0},removeSpring:function(t){if(t){var e=C.indexOf(t);return e>-1?(C.splice(e,1),!0):void 0}},getBestNewBodyPosition:function(t){return M.getBestNewPosition(t)},getBBox:U,getBoundingBox:U,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(e){return void 0!==e?(t.gravity=e,w.options({gravity:e}),this):t.gravity},theta:function(e){return void 0!==e?(t.theta=e,w.options({theta:e}),this):t.theta},random:_};return function(t,e){for(var i in t)d(t,e,i)}(t,T),u(T),T;function U(){return M.update(),M.box}function L(t,e){if(B.has(t))throw new Error("Force "+t+" is already added");B.set(t,e),S.push(e)}};var n=i(33),r=i(34),a=i(35),s=i(36),o=i(37),l=i(38),c={};function d(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=new Map,l={},c=0,d=t.multigraph?function(t,e,i){var n=o(t,e),r=l.hasOwnProperty(n);if(r||M(t,e)){r||(l[n]=0);var a="@"+ ++l[n];n=o(t+a,e+a)}return new s(t,e,i,n)}:function(t,e,n){var r=o(t,e),a=i.get(r);if(a)return a.data=n,a;return new s(t,e,n,r)},h=[],u=I,p=I,f=I,g=I,m={version:20,addNode:y,addLink:function(t,e,n){f();var r=x(t)||y(t),s=x(e)||y(e),o=d(t,e,n),l=i.has(o.id);i.set(o.id,o),a(r,o),t!==e&&a(s,o);return u(o,l?"update":"add"),g(),o},removeLink:function(t,e){void 0!==e&&(t=M(t,e));return w(t)},removeNode:_,getNode:x,getNodeCount:A,getLinkCount:C,getEdgeCount:C,getLinksCount:C,getNodesCount:A,getLinks:function(t){var e=x(t);return e?e.links:null},forEachNode:B,forEachLinkedNode:function(t,i,n){var r=x(t);if(r&&r.links&&"function"==typeof i)return n?function(t,i,n){var r=t.values(),a=r.next();for(;!a.done;){var s=a.value;if(s.fromId===i&&n(e.get(s.toId),s))return!0;a=r.next()}}(r.links,t,i):function(t,i,n){var r=t.values(),a=r.next();for(;!a.done;){var s=a.value,o=s.fromId===i?s.toId:s.fromId;if(n(e.get(o),s))return!0;a=r.next()}}(r.links,t,i)},forEachLink:function(t){if("function"==typeof t)for(var e=i.values(),n=e.next();!n.done;){if(t(n.value))return!0;n=e.next()}},beginUpdate:f,endUpdate:g,clear:function(){f(),B((function(t){_(t.id)})),g()},hasLink:M,hasNode:x,getLink:M};return n(m),function(){var t=m.on;m.on=function(){return m.beginUpdate=f=E,m.endUpdate=g=S,u=b,p=v,m.on=t,t.apply(m,arguments)}}(),m;function b(t,e){h.push({link:t,changeType:e})}function v(t,e){h.push({node:t,changeType:e})}function y(t,i){if(void 0===t)throw new Error("Invalid node identifier");f();var n=x(t);return n?(n.data=i,p(n,"update")):(n=new r(t,i),p(n,"add")),e.set(t,n),g(),n}function x(t){return e.get(t)}function _(t){var i=x(t);if(!i)return!1;f();var n=i.links;return n&&(n.forEach(w),i.links=null),e.delete(t),p(i,"remove"),g(),!0}function A(){return e.size}function C(){return i.size}function w(t){if(!t)return!1;if(!i.get(t.id))return!1;f(),i.delete(t.id);var e=x(t.fromId),n=x(t.toId);return e&&e.links.delete(t),n&&n.links.delete(t),u(t,"remove"),g(),!0}function M(t,e){if(void 0!==t&&void 0!==e)return i.get(o(t,e))}function I(){}function E(){c+=1}function S(){0===(c-=1)&&h.length>0&&(m.fire("changed",h),h.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){this.id=t,this.links=null,this.data=e}function a(t,e){t.links?t.links.add(e):t.links=new Set([e])}function s(t,e,i,n){this.fromId=t,this.toId=e,this.data=i,this.id=n}function o(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,d=a.settings.springTransform||r;c=0,t.forEachNode((function(t){m(t.id),c+=1})),t.forEachLink(v),t.on("changed",g);var h=!1,u={step:function(){if(0===c)return p(!0),!0;var t=a.step();u.lastMove=t,u.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),u.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(u),u;function p(t){var e;h!==t&&(h=t,e=t,u.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&&v(n.link)):"remove"===n.changeType&&(n.node&&b(n.node),n.link&&y(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 v(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);d(t,n),l[t.id]=n}function y(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(6),i(28),i(29),i(30),i(31),i(32),i(42),i(43),i(44),i(45),i(46),i(47),i(48),i(49),i(50),i(0),i(51),i(52),i(53),i(54),i(55),i(56),i(57),i(58),i(59),i(61),i(62),i(2),pauseButton=i(63),playButton=i(64),skipButton=i(65),rewindButton=i(66),tooltip=i(67)},,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
2
|
/* @license
|
|
3
3
|
Papa Parse
|
|
4
|
-
v5.3.
|
|
4
|
+
v5.3.2
|
|
5
5
|
https://github.com/mholt/PapaParse
|
|
6
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}]);
|
|
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 h(n):!0===i.readable&&_(i.read)&&_(i.on)?p=new u(n):(e.File&&i instanceof File||i instanceof Object)&&(p=new d(n)),p.stream(i)},unparse:function(t,e){var i=!1,n=!0,r=",",a="\r\n",o='"',l=o+o,c=!1,d=null,h=!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");d=e.columns}void 0!==e.escapeChar&&(l=e.escapeChar+o),("boolean"==typeof e.escapeFormulae||e.escapeFormulae instanceof RegExp)&&(h=e.escapeFormulae instanceof RegExp?e.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var u=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(d||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||d),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 d=0;d<e.length;d++){var h=o?t.length:e[d].length,u=!1,p=o?0===Object.keys(e[d]).length:0===e[d].length;if(i&&!o&&(u="greedy"===i?""===e[d].join("").trim():1===e[d].length&&0===e[d][0].length),"greedy"===i&&o){for(var f=[],m=0;m<h;m++){var b=l?t[m]:m;f.push(e[d][b])}u=""===f.join("").trim()}if(!u){for(var v=0;v<h;v++){0<v&&!p&&(s+=r);var y=o&&l?t[v]:v;s+=g(e[d][y],v)}d<e.length-1&&(!i||0<h&&!p)&&(s+=a)}}return s}function g(t,e){if(null==t)return"";if(t.constructor===Date)return JSON.stringify(t).slice(1,25);var n=!1;h&&"string"==typeof t&&h.test(t)&&(t="'"+t,n=!0);var a=t.toString().replace(u,l);return(n=n||!0===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}(a,s.BAD_DELIMITERS)||-1<a.indexOf(r)||" "===a.charAt(0)||" "===a.charAt(a.length-1))?o+a+o:a}}};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=d,s.StringStreamer=h,s.ReadableStreamStreamer=u,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 d=l.instanceConfig.complete;l.instanceConfig.complete=function(t){_(d)&&d(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=y(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 d(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 h(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 u(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,d=0,h=0,u=!1,p=!1,m=[],b={data:[],errors:[],meta:{}};if(_(t.step)){var v=t.step;t.step=function(e){if(b=e,C())A();else{if(A(),0===b.data.length)return;d+=e.data.length,t.preview&&d>t.preview?i.abort():(b.data=b.data[0],v(b,c))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function A(){return b&&n&&(M("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),n=!1),t.skipEmptyLines&&(b.data=b.data.filter((function(t){return!x(t)}))),C()&&function(){if(b)if(Array.isArray(b.data[0])){for(var e=0;C()&&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=w(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,h+i):n<m.length&&M("FieldMismatch","TooFewFields","Too few fields: expected "+m.length+" fields but parsed "+n,h+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),h+=i,b}()}function C(){return t.header&&0===m.length}function w(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,d;a=a||[",","\t","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var h=0;h<a.length;h++){var u=a[h],p=0,f=0,m=0;c=void 0;for(var b=new g({comments:r,delimiter:u,newline:i,preview:10}).parse(e),v=0;v<b.data.length;v++)if(n&&x(b.data[v]))m++;else{var y=b.data[v].length;f+=y,void 0!==c?0<y&&(p+=Math.abs(y-c),c=y):c=y}0<b.data.length&&(f/=b.data.length-m),(void 0===l||p<=l)&&(void 0===d||d<f)&&1.99<f&&(l=p,o=u,d=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 d=y(t);return t.preview&&t.header&&d.preview++,e=r,i=new g(d),b=i.parse(e,a,o),A(),u?{meta:{paused:!0}}:b||{meta:{paused:!1}}},this.paused=function(){return u},this.pause=function(){u=!0,i.abort(),e=_(t.chunk)?"":e.substring(i.getCharIndex())},this.resume=function(){c.streamer._halted?(u=!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||null===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 d=0,h=!1;this.parse=function(t,s,u){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,v=_(a),y=[],x=[],A=[],C=d=0;if(!t)return k();if(l||!1!==l&&-1===t.indexOf(e)){for(var w=t.split(n),M=0;M<w.length;M++){if(A=w[M],d+=A.length,M!==w.length-1)d+=n.length;else if(u)return k();if(!r||A.substring(0,b)!==r){if(v){if(y=[],U(A.split(i)),N(),h)return k()}else U(A.split(i));if(o&&o<=M)return y=y.slice(0,o),k(!0)}}return k()}for(var I=t.indexOf(i,d),E=t.indexOf(n,d),S=new RegExp(f(c)+f(e),"g"),B=t.indexOf(e,d);;)if(t[d]!==e)if(r&&0===A.length&&t.substring(d,d+b)===r){if(-1===E)return k();d=E+m,E=t.indexOf(n,d),I=t.indexOf(i,d)}else if(-1!==I&&(I<E||-1===E))A.push(t.substring(d,I)),d=I+g,I=t.indexOf(i,d);else{if(-1===E)break;if(A.push(t.substring(d,E)),R(E+m),v&&(N(),h))return k();if(o&&y.length>=o)return k(!0)}else for(B=d,d++;;){if(-1===(B=t.indexOf(e,B+1)))return u||x.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:y.length,index:d}),D();if(B===p-1)return D(t.substring(d,B).replace(S,e));if(e!==c||t[B+1]!==c){if(e===c||0===B||t[B-1]!==c){-1!==I&&I<B+1&&(I=t.indexOf(i,B+1)),-1!==E&&E<B+1&&(E=t.indexOf(n,B+1));var F=L(-1===E?I:Math.min(I,E));if(t.substr(B+1+F,g)===i){A.push(t.substring(d,B).replace(S,e)),t[d=B+1+F+g]!==e&&(B=t.indexOf(e,d)),I=t.indexOf(i,d),E=t.indexOf(n,d);break}var T=L(E);if(t.substring(B+1+T,B+1+T+m)===n){if(A.push(t.substring(d,B).replace(S,e)),R(B+1+T+m),I=t.indexOf(i,d),B=t.indexOf(e,d),v&&(N(),h))return k();if(o&&y.length>=o)return k(!0);break}x.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:y.length,index:d}),B++}}else B++}return D();function U(t){y.push(t),C=d}function L(e){var i=0;if(-1!==e){var n=t.substring(B+1,e);n&&""===n.trim()&&(i=n.length)}return i}function D(e){return u||(void 0===e&&(e=t.substring(d)),A.push(e),d=p,U(A),v&&N()),k()}function R(e){d=e,U(A),A=[],E=t.indexOf(n,d)}function k(t){return{data:y,errors:x,meta:{delimiter:i,linebreak:n,aborted:h,truncated:!!t,cursor:C+(s||0)}}}function N(){a(k()),y=[],x=[]}},this.abort=function(){h=!0},this.getCharIndex=function(){return d}}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:v,resume:v};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 v(){throw new Error("Not implemented.")}function y(t){if("object"!=typeof t||null===t)return t;var e=Array.isArray(t)?[]:{};for(var i in t)e[i]=y(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,(d.prototype=Object.create(l.prototype)).constructor=d,(h.prototype=Object.create(h.prototype)).constructor=h,(u.prototype=Object.create(l.prototype)).constructor=u,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).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=[];let l=t[n][e.field].split(e.split_by+s+e.split_by);if(l.length>1){l.pop()}o.uid=l.join(e.split_by+s+e.split_by)+e.split_by+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,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,d=0;for(let i of t)d+=i[e.size];this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl);let h=0;for(let u of t){let t;if(s=360*u[e.size]/d,n){let e=this.total_duration*s/360;this.slice_array.push({degreeLenght:s,duration:e,delay:h}),h+=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,u,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=[],d=0;for(let n=0;n<t.length;n++){let s,h=t[n],u=h[e.x_axis],p=n*this.widthBars*1.25;o[u]&&!h._not?(s=o[u].el,o[u].found=!0):(s=document.createElement("a-entity"),s.setAttribute("babia-name",u),s.id=h[e.index],s.object3D.position.x=p,a.appendChild(s)),s.setAttribute("babia-bar",{height:h[e.height]*this.lengthY/this.maxValue,width:this.widthBars,depth:this.widthBars,color:r.get(d,i),label:"events",animation:e.animation}),e.legend&&s.setAttribute("babia-bar",{labelText:u+": "+h[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(h[e.x_axis]),c.push(p),d++}for(let t in o)o[t].found||o[t].el.remove();const h=this.widthBars*(1.25*t.length);this.updateAxis(l,c,h,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 d=0;d<t.length;d++){let h,u,p=t[d],f=p[e.x_axis],g=p[e.z_axis];r.includes(f)||(r.push(f),h=(r.length-1)*this.widthBars*1.25,s.push(h+this.widthBars/2)),h||(h=r.indexOf(f)*this.widthBars*1.25),o.includes(g)||(o.push(g),u=(o.length-1)*this.widthBars*1.25,l.push(u+this.widthBars/2)),u||(u=o.indexOf(g)*this.widthBars*1.25),console.log(f+" "+g+" "+h+" "+u);let m,b=r.indexOf(f);m||(m=document.createElement("a-entity"),m.id=f+g,m.classList.add("babiaxraycasterclass"),m.object3D.position.x=h,m.object3D.position.z=u,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 d=this.widthBars*(1.25*r.length+.75),h=this.widthBars*(1.25*o.length+.75);this.updateAxis(r,s,d,n,o,l,h),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,d)=>{let h,u,p=i[e.x_axis],f=i[e.z_axis];o.includes(p)||(o.push(p),h=(o.length-1)*n.widthBars*1.25,c.push(h+n.widthBars/2)),h||(h=o.indexOf(p)*n.widthBars*1.25),l.includes(f)||(l.push(f),u=(l.length-1)*n.widthBars*1.25,d.push(u+n.widthBars/2)),u||(u=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=h,m.object3D.position.z=u,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=d,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,d){let h=r.get(i,n);console.log("Generating bubble..."),l?(t/=l,e/=l):(c||d)&&(c&&(t*=c),d&&(e*=d));let u=document.createElement("a-sphere");if(u.setAttribute("color",h),u.setAttribute("radius",e),o){let i=a.toString()+" "+e.toString()+" "+s.toString(),n=a.toString()+" "+(e+t).toString()+" "+s.toString();u.setAttribute("animation__position",{property:"position",from:i,to:n,dur:"3000",easing:"linear"})}else u.setAttribute("position",{x:a,y:e+t,z:s});return u}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,d=[],h=[],u=[],p=[],f=0,g=0,m=0,b=0,v=0,y=0,x={},_={},A=Math.max.apply(Math,t.map((function(t){return t[e.height]}))),C=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));a&&(A/=a,C/=a),s||(s=A),proportion=s/A,c||(c=C),radius_scale=c/C,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl),a?(v=C/a,y=C/a):(v=C*radius_scale,y=C*radius_scale);for(let s of t){let t=s[e.x_axis],c=s[e.z_axis],A=s[e.height],w=s[e.radius];x[t]?(m=x[t].posX,f=x[t].colorId):(m+=a?2*C/a+.5:2*C*radius_scale+.5,f=g,x[t]={posX:m,colorId:f},d.push(t),h.push(m),g++),_[c]?b=_[c].posZ:(b=a?y+2*C/a+.5:y+2*C*radius_scale+.5,_[c]={posZ:b},u.push(c),p.push(b)),m>v&&(v=m),b>y&&(y=b);let M=o(A,w,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=v,e=y,i=s;this.updateAxis(d,h,t,u,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 d=document.createElement("a-entity");this.chartEl.appendChild(d),d.setAttribute("babia-axis-z",{labels:n,ticks:r,length:a}),d.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),d.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;w=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,u=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(u.areas.canvas)*e.width/e.depth,o=u.areas.canvas/a):(a=e.width,o=e.depth);let b=new s({width:a,depth:o,x:0,z:0});u.add_rects({rect:b,split:e.split,relative:!1});let v=document.createElement("a-entity");this.base=v;u.draw_rects({ground:b,el:v,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(v),c&&(time_evolution_past_present=e.time_evolution_past_present,d=e.time_evolution_animation,h=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(_),D(t-x-1),f=t-x-1,e--,x--,I()})),document.addEventListener("babiaxrSkipPrev",(function(){time_evolution_past_present=!0,clearInterval(_),D(t-x-3),f=t-x-3,e++,x++,I()})),document.addEventListener("babiaxrShow",(function(i){clearInterval(_),eventData=i.detail.data,e=eventData.data,D(t-e-1),f=t-e-1,x=e-1,I(!0)})));let i=()=>{_=setTimeout((function(){p&&D(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:d="green",model:h=null,visible:u=!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:d,inner:!1,wireframe:l,visible:u,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=C(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:d,model:h,base_thick:o,wireframe:l,visible:u,titles:p})}}else{i.data[this.fheight];let t=i.rect.box({height:i.data[this.fheight],elevation:a,wireframe:l,color:c,model:h,visible:u,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=C(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,d=c,h=r+1;for(;c<l&&h<this.items.length;)d=c,c+=this.scaled_area(s,h),h++;let u=h;return h-1>r&&Math.abs(c-l)>Math.abs(d-l)&&(u=h-1),i=u-r-1,n=this.items.length-u,{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,d=0;e||(c+=r,d=a);let h=[];for(const e of t.items){let t=e*l,i=new s({width:t,depth:n,x:c+t/2,z:d});o&&i.reflect(),h.push(i),c+=t}return h}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:d,a3:h}=t.pivot_regions(i,n),u=t.pivot_region_width(c,i),p=t.pivot_region_width(d.concat(l),i),f=t.pivot_region_width(h,i),g=r-i/2+u/2,m=r-i/2+u+p/2,b=r-i/2+u+p+f/2,v=[],y=t.scaled_area(i*n,l)/p;v[l]=new s({width:p,depth:y,x:m,z:a+n/2-y/2});let x=[[c,u,n,g,a],[d,p,n-y,m,a-y/2],[h,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),d=0;for(const t of e)v[t]=c[d],d++}if(o)for(const t of v)t.reflect();return v}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 d,h;[d,h]=c?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let u=document.createElement("a-entity");return u.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:d,width:h,height:t}),u.setAttribute("material",{color:i}),u.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),u.setAttribute("id",o),u.setAttribute("babiaxr-rawarea",l),u}};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,u=e.time_evolution_commit_by_commit;let i=e.data_files.find(t=>"data_0_tree"===t.key_tree);e=i.data_0_tree,v=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=L(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,d=!0,h=!1,u=!1,p=void 0,f=void 0,g={},m=8e3,b={},v=void 0,y=[],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)},C=(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 w,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),o.setAttribute("text-geometry","value",n),y=[],h&&(E+=5,80!==E?w=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="#"+R(i[0])+R(i[1])+R(i[2])}(w,E):(B++,B>S.length-1&&(B=0),w=S[B],E=20)),g[i][e]?g[i][e].forEach(t=>{F(t)}):g[i][i].forEach(t=>{F(t)}),u||v.forEach(t=>{y.includes(t.id)||T(t.id)}),U()},E=20,S=["#000066","#006600","#666600","#660000"],B=0,F=t=>{if(null!=document.getElementById(t.id)&&0!=t.area){y.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)){h&&document.getElementById(t.id).setAttribute("material",{color:w});let c=!1,u=a/s;u<1&&(c=!0,u=s/a);let p=t.area*(s*a)/l,f=Math.sqrt(p*u),g=Math.sqrt(p/u);if(c&&(g=Math.sqrt(p*u),f=Math.sqrt(p/u)),document.getElementById(t.id).setAttribute("babiaxr-rawarea",t.area),d){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)T(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})}}},T=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)},U=()=>{console.log("Changing city")},L=(t,e)=>(t.forEach(t=>{t.children?L(t.children,e):e[t.id]=t}),e),D=t=>{let e=document.getElementsByClassName("babiaxrTimeBar")[0].children;if(f||0==f){e[f].emit("removeinfo")}e[t].emit("showinfo")};function R(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;h=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,d=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(d.areas.canvas)*i.width/i.depth,o=d.areas.canvas/a):(a=i.width,o=i.depth);let u=new l({width:a,depth:o,x:0,z:0});d.add_rects({rect:u,split:i.split,relative:!1});let p=document.createElement("a-entity");t.base=p;d.draw_rects({ground:u,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:h=null,visible:u=!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:u,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=d(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:h,base_thick:s,wireframe:o,visible:u,titles:p,rootCodecityEntity:f})}}else{let t=i.rect.box({height:i.data[this.fheight],elevation:r,wireframe:o,color:l,model:h,visible:u,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=d(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,d=c,h=r+1;for(;c<l&&h<this.items.length;)d=c,c+=this.scaled_area(a,h),h++;let u=h;return h-1>r&&Math.abs(c-l)>Math.abs(d-l)&&(u=h-1),i=u-r-1,n=this.items.length-u,{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,d=0;e||(c+=r,d=a);let h=[];for(const e of t.items){let t=e*o,i=new l({width:t,depth:n,x:c+t/2,z:d});s&&i.reflect(),h.push(i),c+=t}return h}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:d,a3:h}=t.pivot_regions(i,n),u=t.pivot_region_width(c,i),p=t.pivot_region_width(d.concat(o),i),f=t.pivot_region_width(h,i),g=r-i/2+u/2,m=r-i/2+u+p/2,b=r-i/2+u+p+f/2,v=[],y=t.scaled_area(i*n,o)/p;v[o]=new l({width:p,depth:y,x:m,z:a+n/2-y/2});let x=[[c,u,n,g,a],[d,p,n-y,m,a-y/2],[h,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),d=0;for(const t of e)v[t]=c[d],d++}if(s)for(const t of v)t.reflect();return v}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 d,h;[d,h]=c?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let u=document.createElement("a-entity");return u.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:d,width:h,height:t}),u.setAttribute("material",{color:i}),u.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),u.setAttribute("id",o),u.setAttribute("babiaxr-rawarea",l),u}};t.exports={Values:o,Rectangle:l,Zone:s};let c=8e3,d=(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 h},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=[],d=[];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 h=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=h;let u=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));for(this.radius_scale=e.radiusMax/u,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?d.push(rad_0*this.radius_scale):(rad_1=l(a,n.length,j-1),d.push(d[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],h=l[e.x_axis],u=l[e.z_axis],p=h+"-"+u,g=c[n.indexOf(h)],m=d[r.indexOf(u)];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(h),s(this,a,e,l,o,h,g,m,u)}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=d[d.length-1]+l(a,n.length,r.length-1)*this.radius_scale+.5;c+=.25,d+=.25,this.updateAxis(n,c,e,h,r,d,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,d=0;for(let i of t)d+=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 h=0;for(let u of t){let t;if(s=360*u[e.size]/d,n){let e=this.total_duration*s/360;this.slice_array.push({arc:s,duration:e,delay:h}),h+=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,u,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){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(module,exports,__webpack_require__){let findProdComponent=__webpack_require__(0).findProdComponent,updateFunction=__webpack_require__(0).updateFunction;const colorsArray=__webpack_require__(0).colors.palettes.categoric,NotiBuffer=__webpack_require__(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"},maxBuildingHeight:{type:"number",default:2},minBuildingHeight:{type:"number",default:.03},zone_elevation:{type:"number",default:.01},building_separation:{type:"number",default:.25},extra:{type:"number",default:1},levels:{type:"number"},building_color:{type:"string",default:"#E6B9A1"},buildingAlpha:{type:"number",default:1},gradientBaseColor:{type:"boolean",default:!1},base_color:{type:"color",default:"#98e690"},baseAlpha:{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]"},metricsInfoId:{type:"string",default:""},highlightQuarter:{type:"boolean",default:!1},field:{type:"string",default:"uid"},numericColorLegendId:{type:"string"},highlightBuildingByField:{type:"string"},highlightBuildingByFieldColor:{type:"string",default:"white"},wireframeByRepeatedField:{type:"string"},transparent80ByRepeatedField:{type:"string"},transparent20ByRepeatedField:{type:"string"},autoscale:{type:"boolean",default:!1},autoscaleSizeX:{type:"number",default:3},autoscaleSizeZ:{type:"number",default:3},treeLayout:{type:"boolean",default:!1},treeQuartersLevelHeight:{type:"number",default:.2},treeFixQuarterHeight:{type:"boolean",default:!1},treeHideOneSonQuarters:{type:"boolean",default:!1}},entitiesWithLegend:[],legendsActive:[],dataComponent:void 0,newData:void 0,babiaMetadata:{id:0},visProperties:["height","area","width","depth","color"],multiple:!1,duration:2e3,figures_del:[],figures_in:[],animation:!1,init:function(){this.notiBuffer=new NotiBuffer},update:function(t){updateFunction(this,t)},alreadyAutoscaled:!1,autoscaleBoats:function(){const self=this;let bbox=(new THREE.Box3).setFromObject(this.el.object3D),finalSizeX=bbox.max.x-bbox.min.x,finalSizeY=bbox.max.y-bbox.min.y,finalSizeZ=bbox.max.z-bbox.min.z,currentScale=this.el.getAttribute("scale");currentScale||(currentScale={x:1,y:1,z:1}),this.el.setAttribute("scale",{x:eval(this.data.autoscaleSizeX/finalSizeX)*currentScale.x,y:currentScale.y,z:eval(this.data.autoscaleSizeZ/finalSizeZ)*currentScale.z})},tick:function(t,e){let i=this;if(this.data.autoscale&&!this.alreadyAutoscaled){(new THREE.Box3).setFromObject(this.el.object3D).min.x!==1/0&&(this.autoscaleBoats(),this.alreadyAutoscaled=!0)}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.data.autoscale&&this.autoscaleBoats(),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=generateLegend(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=generateLegend(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.idsToNotRepeatWireframe=[],this.idsToNotRepeat20Transparent=[],this.idsToNotRepeat80Transparent=[],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&&setOpacity(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=getLevels(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())},categoricColorIndex:0,categoricColorMaps:{},generateElements:function(t,e,i,n){const r=this;var a=n,s=0,o=0,l=0,c=0,d=0,h=0,u=0,p=0,f=0,g=0,m=0,b=0,v=!1,y=!1,x=!1,_=!0;for(let i=0;i<t.length;i++){let w,M={};if(this.data.width&&(M.width=t[i][this.data.width]||.5),this.data.height&&(M.height=r.normalizeValues(r.babiaMetadata.heightMin,r.babiaMetadata.heightMax,r.data.minBuildingHeight,r.data.maxBuildingHeight,t[i][this.data.height])||this.data.minBuildingHeight),this.data.depth&&(M.depth=t[i][this.data.depth]||.5),this.data.area&&(M.area=t[i][this.data.area]||.5),t[i].children){M.children=t[i].children,this.quarter=!0;var A,C=[];let e=r.el.getAttribute("scale");e||(e={x:1,y:1,z:1}),M.height=this.data.zone_elevation/e.y,a-=this.data.border*this.data.extra,r.data.treeLayout&&M.children.forEach(t=>{t.children||(M.treeMetaphorHeight=t[r.data.height])}),[M.width,M.depth,A,C]=this.generateElements(M.children,C,A,a),A.y=M.height,a=n}if(0==i?(this.data.area&&!t[i].children?(s+=Math.sqrt(M.area)/2,o-=Math.sqrt(M.area)/2,l+=Math.sqrt(M.area)/2,c-=Math.sqrt(M.area)/2):(s+=M.depth/2,o-=M.depth/2,l+=M.width/2,c-=M.width/2),b=s+this.data.building_separation/2):M.height>0&&(v?([m,d,h,g]=this.UpSide(M,s,m,g),m>l&&(u=m+=this.data.building_separation/2,v=!1,_=!0,p<c&&(c=p),b=s+this.data.building_separation/2)):_?([b,d,h,u]=this.RightSide(M,l,b,u),b<o&&(f=b+=this.data.building_separation/2,_=!1,y=!0,g>s&&(s=g),m=l+this.data.building_separation/2)):y?([m,d,h,f]=this.DownSide(M,o,m,f),m<c&&(p=m-=this.data.building_separation/2,y=!1,x=!0,u>l&&(l=u),b=o-this.data.building_separation/2)):x&&([b,d,h,p]=this.LeftSide(M,c,b,p),b>s&&(g=b-=this.data.building_separation/2,x=!1,v=!0,f<o&&(o=f),m=c-this.data.building_separation/2))),t[i].children){w={id:"boat-"+t[i][this.data.field],name:t[i][this.data.field],posX:d,posY:h,width:M.width,height:M.height,depth:M.depth,children:C,alpha:r.data.baseAlpha,translate_matrix:A},r.data.treeLayout&&(w.treeMetaphorHeight=M.treeMetaphorHeight);let e=w.name.split("/").length-1;w.hierarchyLevel=e,w.renderOrder=e,r.data.gradientBaseColor?w.color=greenColorsurface(Math.round(r.normalizeValues(1,r.babiaMetadata.maxLevels,15,100,e))):w.color=r.data.base_color}else w=this.data.area?{id:"boat-"+t[i][this.data.field],name:t[i].name?t[i].name:t[i][this.data.field],posX:d,posY:h,width:Math.sqrt(M.area),height:M.height,alpha:r.data.buildingAlpha,depth:Math.sqrt(M.area)}:{id:"boat-"+t[i][this.data.field],name:t[i].name?t[i].name:t[i][this.data.field],posX:d,posY:h,width:M.width,height:M.height,alpha:r.data.buildingAlpha,depth:M.depth},"number"==typeof t[i][r.data.color]?w.color=heatMapColorforValue(t[i][r.data.color],r.babiaMetadata.color_max,r.babiaMetadata.color_min):"string"==typeof t[i][r.data.color]&&(t[i][r.data.color]in r.categoricColorMaps?w.color=r.categoricColorMaps[t[i][r.data.color]]:(r.categoricColorMaps[t[i][r.data.color]]=colorsArray[r.categoricColorIndex],w.color=colorsArray[r.categoricColorIndex],r.categoricColorIndex=r.categoricColorIndex+1,r.categoricColorIndex>=colorsArray.length&&(r.categoricColorIndex=0)));w.rawData=t[i],r.data.transparent80ByRepeatedField&&!w.children&&r.idsToNotRepeat80Transparent.includes(w.rawData[r.data.transparent80ByRepeatedField])?(w.alpha=.8,w.renderOrder=2e3):r.idsToNotRepeat80Transparent.push(w.rawData[r.data.transparent80ByRepeatedField]),r.data.transparent20ByRepeatedField&&!w.children&&r.idsToNotRepeat20Transparent.includes(w.rawData[r.data.transparent20ByRepeatedField])?(w.alpha=.45,w.renderOrder=2e3):r.idsToNotRepeat20Transparent.push(w.rawData[r.data.transparent20ByRepeatedField]),r.data.wireframeByRepeatedField&&!w.children&&r.idsToNotRepeatWireframe.includes(w.rawData[r.data.wireframeByRepeatedField])?w.wireframe=!0:(w.wireframe=!1,r.idsToNotRepeatWireframe.push(w.rawData[r.data.wireframeByRepeatedField])),e.push(w)}f<o&&(o=f),p<c&&(c=p),g>s&&(s=g),u>l&&(l=u),m<c&&(c=m+this.data.building_separation/2),m>l&&(l=m-this.data.building_separation/2),b>s&&(s=b-this.data.building_separation/2),b<o&&(o=b+this.data.building_separation/2);var w=Math.abs(c)+Math.abs(l),M=Math.abs(o)+Math.abs(s);return[w+=2*a,M+=2*a,{x:c+w/2-a,y:0,z:o+M/2-a},e]},idsToNotRepeatWireframe:[],idsToNotRepeat80Transparent:[],idsToNotRepeat20Transparent:[],drawElements:function(t,e,i){const n=this;for(let r in e){let a=e[r].height,s=e[r].posX,o=e[r].posY,l={x:s-i.x,y:a/2+i.y/2,z:-o+i.z};if(n.data.treeLayout)if(n.data.treeHideOneSonQuarters&&e[r].children&&1===e[r].children.length&&(e[r].alphaTest=1,e[r].dontAddEvents=!0,e[r].children[0].dontAddLine=!0),n.data.treeFixQuarterHeight){if(void 0!==e[r].treeMetaphorHeight)l.y=a/2+i.y/2+n.data.treeQuartersLevelHeight;else if(l.y=a/2+i.y/2-n.data.treeQuartersLevelHeight-n.data.zone_elevation,e[r].height<n.data.treeQuartersLevelHeight&&(!n.data.treeHideOneSonQuarters||!e[r].dontAddLine)){let e=l.y,i=l.y+(n.data.treeQuartersLevelHeight-a/2),r=document.createElement("a-entity");r.setAttribute("class","babiaboatstreelines"),r.setAttribute("line",{start:{x:l.x,y:e,z:l.z},end:{x:l.x,y:i,z:l.z},color:"yellow"}),t.appendChild(r)}}else void 0!==e[r].treeMetaphorHeight?l.y=n.normalizeValues(n.babiaMetadata.heightMin,n.babiaMetadata.heightMax,n.data.minBuildingHeight,n.data.maxBuildingHeight,e[r].treeMetaphorHeight):l.y=a/2+i.y/2-a-.001;let c=this.createElement(e[r],l);this.addEvents(c,e[r]),t.appendChild(c)}},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,o=this,l=Date.now();o.legendsActive.forEach(t=>{t.remove()}),o.legendsActive=[];for(let c in e)if(document.getElementById(e[c].id))if(s=document.getElementById(e[c].id),e[c].inserted){let t="id="+e[c].id;findIndex(o.figures_in,t)<0&&o.figures_in.push(e[c])}else{let t="id="+e[c].id,d=findIndex(i,t);if(d<0)e[c].inserted=!0,s.getAttribute("width")!=e[c].width&&s.setAttribute("width",e[c].width),s.getAttribute("height")!=e[c].height&&s.setAttribute("height",e[c].height),s.getAttribute("depth")!=e[c].depth&&s.setAttribute("depth",e[c].depth),s.getAttribute("color")!=e[c].color&&s.setAttribute("color",e[c].color),s.getAttribute("material").wireframe!=e[c].wireframe&&(s.setAttribute("material","wireframe",e[c].wireframe),s.setAttribute("material","wireframeLinewidth",.1));else if(this.resize(s,l,n,e[c],i[d]),this.traslate(s,l,n,e[c],i[d],r,a),s.getAttribute("color")==e[c].color||o.inEntitiesWithLegend(s)||s.setAttribute("color",e[c].color),s.getAttribute("material").wireframe!=e[c].wireframe&&(s.setAttribute("material","wireframe",e[c].wireframe),s.setAttribute("material","wireframeLinewidth",.1)),s.getAttribute("material").opacity!=e[c].alpha&&(s.setAttribute("material","opacity",e[c].alpha),s.object3D.renderOrder=e[c].renderOrder),e[c].children)this.Animation(s,e[c].children,i[d].children,n,e[c].translate_matrix,i[d].translate_matrix);else if(e[c].rawData[o.data.color]!==i[d].rawData[o.data.color]){let t;"number"==typeof e[c].rawData[o.data.color]?t=heatMapColorforValue(e[c].rawData[o.data.color],o.babiaMetadata.color_max,o.babiaMetadata.color_min):"string"==typeof e[c].rawData[o.data.color]&&(e[c].rawData[o.data.color]in o.categoricColorMaps?t=o.categoricColorMaps[e[c].rawData[o.data.color]]:(o.categoricColorMaps[e[c].rawData[o.data.color]]=colorsArray[o.categoricColorIndex],t=colorsArray[o.categoricColorIndex],o.categoricColorIndex=o.categoricColorIndex+1,o.categoricColorIndex>=colorsArray.length&&(o.categoricColorIndex=0))),t!==s.getAttribute("color")&&s.setAttribute("color",t)}}else{position={x:e[c].posX-r.x,y:e[c].height/2+r.y/2,z:-e[c].posY+r.z};let i=this.createElement(e[c],position);this.addEvents(i,e[c]),setOpacity(i,.5),t.appendChild(i),e[c].inserted=!0}this.duration;for(let t in i){let n="id="+i[t].id;if(findIndex(e,n)<0){findIndex(o.figures_del,n)<0&&o.figures_del.push(i[t]);let e=document.getElementById(i[t].id);e&&(e.object3D.visible=!1,e.remove())}}},inEntitiesWithLegend(t){let e;for(e=0;e<this.entitiesWithLegend.length;e++)if(this.entitiesWithLegend[e].entity===t)return!0;return!1},setFigures:function(t,e){const i=this;t.forEach(t=>{let n=document.getElementById(t.id);if(n){if(n.getAttribute("width")!=t.width&&n.setAttribute("width",t.width),n.getAttribute("height")!=t.height&&n.setAttribute("height",t.height),n.getAttribute("depth")!=t.depth&&n.setAttribute("depth",t.depth),i.inEntitiesWithLegend(n)?n.setAttribute("babiaxrFirstColor",t.color):n.getAttribute("color")!=t.color&&n.setAttribute("color",t.color),n.components.material.data.opacity<1&&setOpacity(n,1),n.getAttribute("material").opacity!=t.alpha&&n.setAttribute("material","opacity",t.alpha),i.data.treeLayout)if(i.data.treeHideOneSonQuarters&&t.children&&1===t.children.length&&(t.alphaTest=1,t.dontAddEvents=!0,t.children[0].dontAddLine=!0),i.data.treeFixQuarterHeight)if(void 0!==t.treeMetaphorHeight)n.object3D.position.set(t.posX-e.x,t.height/2+e.y/2+i.data.treeQuartersLevelHeight,-t.posY+e.z);else{let r=t.height/2+e.y/2-i.data.treeQuartersLevelHeight-i.data.zone_elevation,a=t.posX-e.x,s=-t.posY+e.z;if(n.object3D.position.set(a,r,s),t.height<i.data.treeQuartersLevelHeight&&(!i.data.treeHideOneSonQuarters||!t.dontAddLine)){let e=r,o=r+(i.treeQuartersLevelHeight-t.height/2),l=document.createElement("a-entity");l.setAttribute("class","babiaboatstreelines"),l.setAttribute("line",{start:{x:a,y:e,z:s},end:{x:a,y:o,z:s},color:"yellow"}),n.parentElement.appendChild(l)}}else void 0!==t.treeMetaphorHeight?n.object3D.position.set(t.posX-e.x,i.normalizeValues(i.babiaMetadata.heightMin,i.babiaMetadata.heightMax,i.data.minBuildingHeight,i.data.maxBuildingHeight,t.treeMetaphorHeight),-t.posY+e.z):n.object3D.position.set(t.posX-e.x,t.height/2+e.y/2-t.height-.001,-t.posY+e.z);else n.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),d=i*o/this.duration,h=i*l/this.duration,u=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-d:p+d,a=n.height-r.height<0?f-h:f+h,s=n.depth-r.depth<0?g-u:g+u,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,d=parseFloat(t.object3D.position.z)+r;t.object3D.position.set(a,s,d)}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;if(t.children){let e=t.name.split("/").length-1;t.hierarchyLevel=e,n.object3D.renderOrder=e,i.data.gradientBaseColor?color=greenColorsurface(Math.round(i.normalizeValues(1,i.babiaMetadata.maxLevels,15,100,e))):color=i.data.base_color}else i.data.color?"number"==typeof t.rawData[i.data.color]?color=heatMapColorforValue(t.rawData[i.data.color],i.babiaMetadata.color_max,i.babiaMetadata.color_min):"string"==typeof t.rawData[i.data.color]?t.rawData[i.data.color]in i.categoricColorMaps?color=i.categoricColorMaps[t.rawData[i.data.color]]:(i.categoricColorMaps[t.rawData[i.data.color]]=colorsArray[i.categoricColorIndex],color=colorsArray[i.categoricColorIndex],i.categoricColorIndex=i.categoricColorIndex+1,i.categoricColorIndex>=colorsArray.length&&(i.categoricColorIndex=0)):color=i.data.building_color:color=i.data.building_color;return n.setAttribute("color",color),n.setAttribute("width",r),n.setAttribute("height",a),n.setAttribute("depth",s),n.object3D.renderOrder=t.renderOrder,t.rawData&&(n.babiaRawData=t.rawData),i.data.highlightBuildingByField&&t.rawData&&n.setAttribute("babia-highlightbuildingbyfield",String(t.rawData[i.data.highlightBuildingByField]).replace("/","").replace("@","")),n.setAttribute("position",{x:e.x,y:e.y,z:e.z}),n.setAttribute("material","opacity",t.alpha),n.setAttribute("material","wireframe",t.wireframe),n.setAttribute("material","wireframeLinewidth",.1),t.alphaTest&&(n.setAttribute("material","alphaTest",t.alphaTest),n.removeAttribute("class")),n},processData:function(t){const e=this;console.log("processData",t);let i=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.categoricColorMaps={},this.categoricColorIndex=0,i.color){let[t,e,n]=getMaxMinValues(this.newData,i.color,[]);this.babiaMetadata.color_max=t,this.babiaMetadata.color_min=e;let r=Math.round(n.reduce((t,e)=>t+e,0)/n.length);this.babiaMetadata.colorAvg=r}let[n,r,a]=getMaxMinValues(this.newData,i.height,[]);this.babiaMetadata.heightMax=n,this.babiaMetadata.heightMin=r;let s=Math.round(a.reduce((t,e)=>t+e,0)/a.length);if(this.babiaMetadata.heightAvg=s,this.babiaMetadata.maxLevels=getLevels(this.newData,0),i.area){let[t,e,n]=getMaxMinValues(this.newData,i.area,[]);this.babiaMetadata.areaMax=t,this.babiaMetadata.areaMin=e,this.babiaMetadata.areaAvg=Math.round(n.reduce((t,e)=>t+e,0)/n.length)}else{let[t,e,n]=getMaxMinValues(this.newData,i.width,[]);this.babiaMetadata.widthMax=t,this.babiaMetadata.widthMin=e,this.babiaMetadata.widthAvg=Math.round(n.reduce((t,e)=>t+e,0)/n.length);let[r,a,s]=getMaxMinValues(this.newData,i.depth,[]);this.babiaMetadata.depthMax=r,this.babiaMetadata.depthMin=a,this.babiaMetadata.depthAvg=Math.round(s.reduce((t,e)=>t+e,0)/s.length)}if(this.data.metricsInfoId){let t=`Metrics information\nMETRIC (FIELD): MIN - MAX - AVG\n\nHeight (${i.height}) - ${r} - ${n} - ${s}`;this.data.area?t+=`\nArea (${i.area}) - ${this.babiaMetadata.areaMin} - ${this.babiaMetadata.areaMax} - ${this.babiaMetadata.areaAvg}`:(t+=`\nWidth (${i.width}) - ${this.babiaMetadata.widthMin} - ${this.babiaMetadata.widthMax} - ${this.babiaMetadata.widthAvg}`,t+=`\nDepth (${i.depth}) - ${this.babiaMetadata.depthMin} - ${this.babiaMetadata.depthMax} - ${this.babiaMetadata.depthAvg}`),this.data.color&&"string"!=typeof this.babiaMetadata.color_max&&(document.getElementById(this.data.numericColorLegendId).setAttribute("visible",!0),t+=`\nColor (${i.color}) - ${this.babiaMetadata.color_min} - ${this.babiaMetadata.color_max} - ${this.babiaMetadata.colorAvg}`),document.getElementById(this.data.metricsInfoId).setAttribute("text",{value:t,align:"center",width:3,color:"black",alphaTest:6,opacity:6,transparent:!1})}if(this.notiBuffer.set(this.newData),this.data.treeLayout&&this.data.treeFixQuarterHeight&&this.removeTreeLines(),this.updateChart(this.newData),this.data.metricsInfoId&&"number"!=typeof this.babiaMetadata.color_max){document.getElementById(e.data.numericColorLegendId).setAttribute("visible",!1),e.entityCatColorLegend&&(e.entityCatColorLegend.remove(),e.entityCatColorLegend=void 0);let t=document.getElementById(this.data.metricsInfoId);e.entityCatColorLegend=document.createElement("a-plane"),e.entityCatColorLegend.setAttribute("position","-3 0 0"),e.entityCatColorLegend.setAttribute("width",2.8),e.entityCatColorLegend.setAttribute("height",5),e.entityCatColorLegend.setAttribute("position","-3 0 0"),e.entityCatColorLegend.setAttribute("material","color","#B7B7B7");let i=2.2,n=`COLOR LEGEND (${this.data.color})`,r=document.createElement("a-entity");r.setAttribute("text",{value:n,align:"center",width:3,color:"black"}),r.setAttribute("position",{x:0,y:i,z:0}),i-=.2,e.entityCatColorLegend.appendChild(r);for(const[t,n]of Object.entries(this.categoricColorMaps)){let r=`${t}: ${n}`,a=document.createElement("a-entity");a.setAttribute("text",{value:r,align:"center",width:3,color:n}),a.setAttribute("position",{x:0,y:i,z:0}),i-=.15,e.entityCatColorLegend.appendChild(a)}t.appendChild(e.entityCatColorLegend)}else this.data.metricsInfoId&&"number"==typeof this.babiaMetadata.color_max&&e.entityCatColorLegend&&(e.entityCatColorLegend.remove(),e.entityCatColorLegend=void 0)},removeTreeLines:function(){let t=this.el.querySelectorAll(".babiaboatstreelines");for(line of t)line.remove()},normalizeValues:function(t,e,i,n,r){return(r-t)/(e-t)*(n-i)+i},addEvents:function(t,e){let i=this;if(e.children){if(!e.dontAddEvents){let n;t.addEventListener("click",(function(r){if(r.target===this)if(t.legend){i.el.parentElement.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")||{x:1,y:1,z:1},s=r.height*a.y+i.data.height_quarter_legend_box;n.setAttribute("geometry",{height:s,depth:r.depth*a.z,width:r.width*a.x}),n.setAttribute("material",{visible:!0,opacity:.4}),n.object3D.renderOrder=1e9;let o=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld);n.setAttribute("position",o),i.el.parentElement.appendChild(n);let l={x:o.x,y:i.data.height_quarter_legend_title,z:o.z};t.legend=generateLegend(e.name,i.data.legend_scale,i.data.legend_lookat,"black","white"),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)}}))}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){if(i.data.highlightQuarter)if(1==parseInt(t.parentElement.getAttribute("babiaxrHightlighted"))){let e=t.parentElement.getAttribute("position");t.parentElement.setAttribute("position",{x:e.x,y:t.parentElement.getAttribute("babiaxrFirstYPosition"),z:e.z}),t.parentElement.setAttribute("material",{color:t.parentElement.getAttribute("babiaxrFirstColor")}),t.parentElement.setAttribute("babiaxrHightlighted",0)}else{let e=parseInt(t.parentElement.getAttribute("babiaxrHightlighted"));t.parentElement.setAttribute("babiaxrHightlighted",e-1)}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);if(e>-1&&i.legendsActive.splice(r,1),i.data.highlightBuildingByField){let e=t.getAttribute("babia-highlightbuildingbyfield");document.querySelectorAll(`[babia-highlightbuildingbyfield=${e}]`).forEach(e=>{if(t!==e&&e.highlightbuildingbyfieldactive&&!e.alreadyActive){let t=e.getAttribute("babiaxrBeforeBuildingHighlight");e.setAttribute("material","color",t),e.highlightbuildingbyfieldactive=!1}})}t.legend=void 0,t.alreadyActive=!1}else{if(t.highlightbuildingbyfieldactive)return;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=generateLegend(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),s=(new THREE.Box3).setFromObject(t.object3D),o={x:a.x,y:s.max.y+1+i.data.height_building_legend,z:a.z};t.legend.setAttribute("position",o),t.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(t.legend)}if(i.data.highlightQuarter)if(t.parentElement.getAttribute("babiaxrHightlighted")&&0!=parseInt(t.parentElement.getAttribute("babiaxrHightlighted"))){let e=parseInt(t.parentElement.getAttribute("babiaxrHightlighted"));t.parentElement.setAttribute("babiaxrHightlighted",e+1)}else{let e=t.parentElement.getAttribute("position");t.parentElement.setAttribute("babiaxrFirstYPosition",e.y),t.parentElement.setAttribute("position",{x:e.x,y:e.y+.2,z:e.z}),t.parentElement.setAttribute("babiaxrFirstColor",t.parentElement.getAttribute("material").color),t.parentElement.setAttribute("material","color","#bfbfbf"),t.parentElement.setAttribute("babiaxrHightlighted",1)}if(i.data.highlightBuildingByField){let e=t.getAttribute("babia-highlightbuildingbyfield");document.querySelectorAll(`[babia-highlightbuildingbyfield=${e}]`).forEach(e=>{t===e||e.highlightbuildingbyfieldactive||e.alreadyActive||(e.highlightbuildingbyfieldactive=!0,e.setAttribute("babiaxrBeforeBuildingHighlight",e.getAttribute("material").color),e.setAttribute("material","color",i.data.highlightBuildingByFieldColor))})}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=generateLegend(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),s=(new THREE.Box3).setFromObject(t.object3D),o={x:a.x,y:s.max.y+1+i.data.height_building_legend,z:a.z};if(t.legend.setAttribute("position",o),t.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(t.legend),i.data.highlightBuildingByField){let e=t.getAttribute("babia-highlightbuildingbyfield");document.querySelectorAll(`[babia-highlightbuildingbyfield=${e}]`).forEach(e=>{t===e||e.highlightbuildingbyfieldactive||e.alreadyActive||(e.highlightbuildingbyfieldactive=!0,e.setAttribute("babiaxrBeforeBuildingHighlight",e.getAttribute("material").color),e.setAttribute("material","color",i.data.highlightBuildingByFieldColor))})}}})),t.addEventListener("mouseleave",(function(){if(!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),i.data.highlightBuildingByField&&!t.alreadyActive&&!t.highlightbuildingbyfieldactive){let e=t.getAttribute("babia-highlightbuildingbyfield");document.querySelectorAll(`[babia-highlightbuildingbyfield=${e}]`).forEach(e=>{if(t!==e&&e.highlightbuildingbyfieldactive&&!e.alreadyActive){let t=e.getAttribute("babiaxrBeforeBuildingHighlight");e.setAttribute("material","color",t),e.highlightbuildingbyfieldactive=!1}})}}))}}});let generateLegend=(t,e,i,n,r,a,s,o,l,c,d)=>{let h=2,u=1;if(t.length>16&&(h=t.length/5),a){let e="\n "+s+" (height): "+Math.round(100*a[s])/100;if(e.length>16&&(h=e.length/5),t+=e,o){let i="\n "+o+" (area): "+Math.round(100*a[o])/100;i.length>16&&i>e&&(h=i.length/5),t+=i}else{let i="\n "+l+" (depth): "+Math.round(100*a[l])/100;i.length>16&&i>e&&(h=i.length/5),t+=i;let n="\n "+c+" (width): "+Math.round(100*a[c])/100;n.length>16&&n>e&&n>i&&(h=n.length/5),t+=n,u=1.5}if(d){let i="\n "+d;"string"==typeof a[d]?i+=" (color): "+a[d]:i+=" (color): "+Math.round(100*a[d])/100,i.length>16&&i>e&&(h=i.length/5),t+=i,u+=.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",u),p.setAttribute("width",h),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 setOpacity(t,e){if(t.setAttribute("material","opacity",e),t.childNodes)for(let i=0;i<t.childNodes.length;i++)setOpacity(t.childNodes[i],e)}let getLevels=(t,e)=>{let i=e,n=e;for(let r in t)t[r].children&&(i++,n<(e=getLevels(t[r].children,i))&&(n=e),i--);return n},getMaxMinValues=(t,e,i,n,r)=>{for(let a=0;a<t.length;a++)t[a].children?[n,r]=getMaxMinValues(t[a].children,e,i,n,r):(("null"!==t[a][e]&&!n||t[a][e]>n)&&(n=t[a][e]),("null"!==t[a][e]&&void 0===r||t[a][e]<r)&&(r=t[a][e]),i.push(t[a][e]));return[n,r,i]};function heatMapColorforValue(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 findIndex=(t,e)=>{for(e=e.split("="),i=0;i<t.length;i++)if(t[i][e[0]]===e[1])return i;return-1},greenColorsurface=t=>"hsl(140, 100%,"+t+"%)"},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(68);"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)},d="";AFRAME.registerComponent("babia-network",{schema:{nodeLegend:{type:"boolean",default:!1},linkLegend:{type:"boolean",default:!1},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",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},linkDistance:{type:"number",default:30},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(){const t=this;this.isFirstTimeNodes=!0,this.isFirstTimeLinks=!0,this.notiBuffer=new a;let e=this.state={},i=document.querySelector("a-entity[camera], a-camera");e.cameraObj=i.object3D.children.filter((function(t){return"PerspectiveCamera"===t.type}))[0],this.el.sceneEl.addEventListener("camera-set-active",(function(t){e.cameraObj=t.detail.cameraEl.components.camera.camera})),this.forceGraph||(this.forceGraph=new o),this.el.object3D.add(this.forceGraph),this.data.linkDistance&&this.forceGraph.d3Force("link").distance((function(){return t.data.linkDistance})),d=document.querySelector("[cursor]"),document.addEventListener("controllerconnected",t=>{d=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){if(d){if(d.components.raycaster.raycaster){let t=d.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}})),e=t.length?t[0].object:null;if(e!==this.state.hoverObj){const t=this.state.hoverObj?this.state.hoverObj.__graphObjType:null,i=this.state.hoverObj?this.state.hoverObj.__data:null,n=e?e.__graphObjType:null,r=e?e.__data:null;t&&t!==n&&this.data["on"+("node"===t?"Node":"Link")+"CenterHover"](null,i),(this.data.nodeLegend&&"node"===t||this.data.linkLegend&&""!=this.data.linkLabel&&"link"===t)&&this.removeLegend(this),n&&this.data["on"+("node"===n?"Node":"Link")+"CenterHover"](r,t===n?i:null),this.state.hoverObj=e,e&&(this.data.nodeLegend&&"node"===e.__graphObjType?this.showLegend(e,e.__data,this.data.nodeLabel,this.el.getAttribute("scale")):this.data.linkLegend&&"link"===e.__graphObjType&&""!=this.data.linkLabel&&this.showLinkLegend(e,e.__data,this.data.linkLabel,this.el.getAttribute("scale")))}}}else d=document.querySelector("[cursor]");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,a){let s=e[i];if(s){let i=2,o=1;if(s.length>16&&(i=s.length/5),t){let n="\n "+t.nodeVal+" (radius): "+Math.round(100*e[t.nodeVal])/100;if(n.length>16&&(i=n.length/5),s+=n,t.nodeAutoColorBy){let r="\n "+t.nodeAutoColorBy+" (color): "+e[t.nodeAutoColorBy];r.length>16&&r>n&&(i=r.length/5),s+=r}else{let r="\n "+t.nodeAutoColorBy+" (color): "+e[t.nodeAutoColorBy];r.length>16&&r>n&&(i=r.length/5),s+=r}}let l=3,c=3,d=3;s.length>16&&(i=s.length/16),a&&(l=l*a.x*t.legend_scale,c=c*a.y*t.legend_scale,d=d*a.z*t.legend_scale,r=(r+3)*a.y*t.legend_scale);let h=document.createElement("a-plane");return h.setAttribute("position",{x:n.x,y:n.y+r,z:n.z}),h.setAttribute("babia-lookat",t.legend_lookat),h.setAttribute("width",i),h.setAttribute("height",o),h.setAttribute("color","white"),h.setAttribute("scale",{x:l*t.legend_scale,y:c*t.legend_scale,z:d*t.legend_scale}),h.setAttribute("material",{side:"double"}),h.setAttribute("text",{value:s,align:"center",width:6,color:"black",alphaTest:6,opacity:6,transparent:!1}),h.classList.add("babiaxrLegend"),h}}(this.data,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,a){let s=e[i];if(s){let o=2,l=3,c=3,d=3;s.length>16&&(o=s.length/8),a&&(l*=a.x,c*=a.y,d*=a.z,r=(r+3)*a.y);let h=document.createElement("a-plane");return h.setAttribute("position",{x:n.x,y:n.y+r,z:n.z}),h.setAttribute("babia-lookat",t.legend_lookat),h.setAttribute("width",o),h.setAttribute("height","1"),h.setAttribute("color","white"),h.setAttribute("scale",{x:l*t.legend_scale,y:c*t.legend_scale,z:d*t.legend_scale}),h.setAttribute("material",{side:"double"}),h.setAttribute("text",{value:e[i],align:"center",width:6,color:"black",alphaTest:6,opacity:6,transparent:!1}),h.classList.add("babiaxrLegend"),h}}(this.data,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${d()}\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 d(){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=d,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("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 d=document.createElement("a-plane");d.setAttribute("position",{x:e,y:i,z:n}),d.setAttribute("rotation",{x:0,y:r,z:0}),d.setAttribute("height",1),d.setAttribute("width",a),d.setAttribute("text",{value:c,align:"center",width:"10"}),d.setAttribute("color","white"),d.setAttribute("text",{color:"black"}),t.appendChild(d),i-=1,d.classList.add("babiaxraycasterclass"),d.addEventListener("click",(function(){let t=d.parentElement.id,e=d.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]===d?(d.setAttribute("color","black"),d.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){i=e,document.getElementById(i);var i;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,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"},hideFields:{type:"array"},hideRows:{type:"array"},showOnly:{type:"array"},maxPerRow:{type:"number",default:5},linesSeparation:{type:"number",default:.3},customQuerierLabel:{type:"string",default:"Data"},customAttributeSwitch:{type:"array"},customAttributeLabel:{type:"array"}},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.targetComponent.el.components["babia-boats"]?(this.dataQueriers=[],document.querySelectorAll("[babia-treebuilder]").forEach(t=>{this.dataQueriers.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)}))},hideAndInsertMetrics:function(t,e,i){const n=this;let r={property:e,metrics:i};if(0!=n.data.hideFields.length){let t=[];i.forEach(e=>{n.data.hideFields.includes(e)||t.push(e)}),r.metrics=t}if(n.data.showOnly.length>0){let t=[];for(let i=0;i<n.data.showOnly.length;i++){const r=n.data.showOnly[i].split(":");e==r[0]&&t.push(r[1])}r.metrics=t}n.data.hideRows.includes(e)||t.push(r)}});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}),p(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.hideAndInsertMetrics(t.dataMetrics.nodes,i,a):t.hideAndInsertMetrics(t.dataMetrics.nodes,i,Object.keys(e.nodes[0]))}),i.links1.forEach(i=>{r.includes(i)?t.hideAndInsertMetrics(t.dataMetrics.links,i,a):t.hideAndInsertMetrics(t.dataMetrics.links,i,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.hideAndInsertMetrics(t.dataMetrics,i,a):t.hideAndInsertMetrics(t.dataMetrics,i,Object.keys(e[0]))}),i.links0.forEach(i=>{r.includes(i)?t.hideAndInsertMetrics(t.dataMetrics,i,a):t.hideAndInsertMetrics(t.dataMetrics,i,Object.keys(e[0]))})}else{t.dataMetrics=[];let n,r=["height","radius","width","size","farea","fheight","area","depth","color"],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=>{if(r.includes(i)){if(t.hideAndInsertMetrics(t.dataMetrics,i,a),"color"===i&&"babia-boats"==t.targetComponent.attrName){let e=[];for(const[t,i]of Object.entries(n))"string"==typeof i&&e.push(t);t.data.showOnly||t.hideAndInsertMetrics(t.dataMetrics,i,e)}}else t.hideAndInsertMetrics(t.dataMetrics,i,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.data.customAttributeSwitch.length>0){t.data.customAttributeLabel&&(t.customAttributesLabel={},t.data.customAttributeLabel.forEach(e=>{let i=e.split(":");Object.defineProperty(t.customAttributesLabel,i[0],{value:i[1]})}));let e=d("Atrributes",r,n);t.interface.appendChild(e),t.data.customAttributeSwitch.forEach((e,i)=>{let a=e.split(":");r+=3.25;let s=u(t,a,r,n);s.classList.add("babiaxraycasterclass"),t.interface.appendChild(s),(i+1)%t.data.maxPerRow==0&&(--n,r=0)}),--n,--n,a<r&&(a=r),r=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=d("Nodes",r,n);t.interface.appendChild(e),t.nodesQueriers.forEach((e,i)=>{r+=3.25;let a=h(t,e,r,n,"nodes");a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a),(i+1)%t.data.maxPerRow==0&&(--n,r=0)})}if(--n,n-=t.data.linesSeparation,a<r&&(a=r),r=0,t.linksQueriers.length>1){let e=d("Links",r,n);t.interface.appendChild(e),t.linksQueriers.forEach((e,i)=>{r+=3.25;let a=h(t,e,r,n,"links");a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a),(i+1)%t.data.maxPerRow==0&&(--n,r=0)})}--n,n-=t.data.linesSeparation,a<r&&(a=r),r=0,e.nodes.forEach(e=>{let i=d(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach((i,a)=>{r+=3.25;let s=l(t,e.property,i,r,n);s.classList.add("babiaxraycasterclass"),t.interface.appendChild(s),(a+1)%t.data.maxPerRow==0&&(--n,r=0)}),--n,a<r&&(a=r),r=0}),e.links.forEach(e=>{let i=d(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach((i,a)=>{r+=3.25;let s=l(t,e.property,i,r,n);s.classList.add("babiaxraycasterclass"),t.interface.appendChild(s),(a+1)%t.data.maxPerRow==0&&(--n,r=0)}),--n,a<r&&(a=r),r=0})}else{if(t.dataQueriers.length>1){let e=d(t.data.customQuerierLabel,r,n);t.interface.appendChild(e),t.dataQueriers.forEach(e=>{r+=3.25;let i=h(t,e,r,n);i.classList.add("babiaxraycasterclass"),t.interface.appendChild(i)})}--n,n-=t.data.linesSeparation,a<r&&(a=r),r=0,e.forEach(e=>{let i=d(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach((i,a)=>{r+=3.25;let s=l(t,e.property,i,r,n);s.classList.add("babiaxraycasterclass"),t.interface.appendChild(s),(a+1)%t.data.maxPerRow==0&&(--n,r=0)}),--n,n-=t.data.linesSeparation,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)}))},d=(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},h=(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},u=(t,[e,i],n,r)=>{let a=document.createElement("a-box");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"),o=e;return t.customAttributesLabel&&t.customAttributesLabel[e]&&(o=t.customAttributesLabel[e]),s.setAttribute("text",{value:o,align:"center",width:"10",color:"white"}),s.setAttribute("position","0 0 0.01"),a.appendChild(s),a.setAttribute("color","blue"),a.addEventListener("click",(function(){let n=t.targetComponent.el.getAttribute(t.targetComponent.attrName);n[e]&&n[e]==i?t.targetComponent.el.removeAttribute("babia-boats",e):t.targetComponent.el.setAttribute("babia-boats",e,i)})),a},p=(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){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){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let n,r,a,s,o,l,c,d,h,u,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(){d=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:d}),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"}),d=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 v(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,h=t.to,u=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),v(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},d=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,wireframe:!1}),h=new THREE.ExtrudeGeometry(o,c),u=new THREE.ExtrudeGeometry(l,c),p=new THREE.Mesh(h,d);return p.updateMatrix(),u.merge(p.geometry,p.matrix),new THREE.Mesh(u,d)}([[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),v(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"==h&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255});return v(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"==h&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255});return v(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}),v(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),v(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==u&&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&&d){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;d=!1,function(){h(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"),h(c?s:a)})),document.addEventListener("babiaxrToPresent",(function(){console.log("TO PRESENT"),c=!1,i.emit("babiaxrStop"),h(a)})),document.addEventListener("babiaxrToPast",(function(){console.log("TO PAST"),c=!0,i.emit("babiaxrStop"),h(s)})),document.addEventListener("babiaxrSkipNext",(function(){console.log("SKIP NEXT"),i.emit("babiaxrStop"),u("next")})),document.addEventListener("babiaxrSkipPrev",(function(){console.log("SKIP PREV"),i.emit("babiaxrStop"),u("prev")}))}()}}(n)},remove:function(){},pause:function(){},play:function(){}});var s=[];let o,l,c=!1,d=!0;function h(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 u(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){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){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 d=0;d<t.length;++d){let h,u=document.createElement("a-entity"),p=i;r&&(p=n.get(d,r)),u.setAttribute("text",{value:e[d],align:"right",width:10,color:p,opacity:0}),"behind"!=a&&"right"!=a||u.setAttribute("text",{align:"left"}),"x"===s?h="behind"==a?{x:t[d],y:0,z:-5.15}:{x:t[d],y:0,z:5.25}:"y"===s?h="right"==a?{x:5.2,y:t[d],z:0}:{x:-5.2,y:t[d],z:0}:"z"===s&&(h="right"==a?{x:5.2,y:0,z:t[d]}:{x:-5.2,y:0,z:t[d]}),u.setAttribute("position",h),"x"===s?u.setAttribute("rotation",{x:-90,y:90,z:0}):"z"===s&&u.setAttribute("rotation",{x:-90,y:0,z:0}),l?u.setAttribute("animation",{property:"text.opacity",to:1,dur:c}):u.setAttribute("text",{opacity:1}),o.appendChild(u)}}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=[],d=[];for(let t=1;o*t<i;t++)vtick=o*t,c.push(vtick*s),d.push(vtick.toFixed(a));this.axis.updateLabels(c,d,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){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.cursor||this.leftHand||this.rightHand)&&(this.el.parentElement.removeChild(this.cursor),this.el.parentElement.removeChild(this.leftHand),this.el.parentElement.removeChild(this.rightHand),this.cursor=void 0,this.leftHand=void 0,this.rightHand=void 0),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,lineOpacity:1}),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,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){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function i(t){let e=t.el.sceneEl.camera.el;t.recordedData[Date.now()]={position:e.getAttribute("position"),rotation:e.getAttribute("rotation")}}function n(t,e){let i="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(t)),n=document.createElement("a");n.setAttribute("href",i),n.setAttribute("download",e+".json"),document.body.appendChild(n),n.click(),n.remove()}AFRAME.registerComponent("babia-experiment",{schema:{taskTitle:{type:"string",default:"Default task title"},taskDescription:{type:"string",default:"Default task text"},openTaskImg:{type:"string"},closeTaskImg:{type:"string"},timeLimitEnding:{type:"boolean",default:!1},timeLimitTime:{type:"number",default:300},forceFinishWhenTimeLimit:{type:"boolean",default:!1},finishButton:{type:"boolean",default:!0},recordDelta:{type:"number",default:3e3},recordAudio:{type:"boolean",default:!0},taskAudio:{type:"boolean",default:!1},taskAudioUrl:{type:"string",default:null},taskVideo:{type:"boolean",default:!1},taskVideoId:{type:"string",default:null},taskVideoWidth:{type:"number",default:3},taskVideoHeight:{type:"number",default:1.75},lookat:{type:"string",default:"[camera]"}},multiple:!0,recordedData:{},runningExperiment:!1,init:function(){},update:function(t){if(this.data!=this.oldData){let t=this.el.querySelectorAll("[babia-camera]");if(t.length>0){this.babiaCameraEl=t[0];let e=this.babiaCameraEl.getAttribute("babia-camera");this.babiaCameraEl.setAttribute("babia-camera",{raycasterMouse:e.raycasterMouse+", #babiaTaskPopup, #babiaTaskPopup--close-icon, #babiaStartButton, #babiaFinishButton, #babiaTaskAudio, #babiaTaskVideo",raycasterHand:e.raycasterHand+", #babiaTaskPopup, #babiaTaskPopup--close-icon, #babiaStartButton, #babiaFinishButton, #babiaTaskAudio, #babiaTaskVideo"})}else this.babiaCameraEl=this.el.sceneEl.camera.el;this.findBabiaCharts(),this.hideCharts(),0==this.el.querySelectorAll("[babia-task]").length&&(this.data.taskAudio?this.addAudioTask():this.data.taskVideo?this.addVideoTask():this.addTask()),this.addStartButton(),this.data.finishButton&&this.addFinishButton()}},findBabiaCharts:function(){this.babiaCharts=this.el.querySelectorAll("[babia-pie], [babia-bars], [babia-barsmap], [babia-bubbles], [babia-city], [babia-cyls], [babia-cylsmap], [babia-doughnut], [babia-terrain], [babia-boats], [babia-network], [babiaxr-codecity]")},hideCharts:function(){for(let t of this.babiaCharts)t.setAttribute("visible",!1)},showCharts:function(){for(let t of this.babiaCharts)t.setAttribute("visible",!0)},addTask:function(){this.taskEntity=document.createElement("a-entity"),this.taskEntity.setAttribute("class","babiaxrayscasterclass"),this.taskEntity.setAttribute("id","babiaTaskPopup"),this.taskEntity.setAttribute("babia-poster",{openIconImage:"../assets/popups/info.jpg",closeIconImage:"../assets/popups/close.jpg",title:this.data.taskTitle,titleWrapCount:30,titleColor:"black",bodyColor:"black",posterBoxColor:"white",bodyFont:"roboto",posterBoxHeight:4.5,body:this.data.taskDescription}),this.taskEntity.setAttribute("scale",{x:.5,y:.5,z:.5}),this.babiaCameraPosition=this.babiaCameraEl.getAttribute("position"),this.taskEntity.setAttribute("position",{x:this.babiaCameraPosition.x,y:this.babiaCameraPosition.y+1.5,z:this.babiaCameraPosition.z-4}),this.taskEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskEntity)},audioPlaying:!1,addAudioTask:function(){const t=this;this.taskAudioEntity=document.createElement("a-entity"),this.taskAudioEntity.setAttribute("class","babiaxrayscasterclass"),this.taskAudioEntity.setAttribute("geometry",{primitive:"plane",width:1.1,height:.5}),this.taskAudioEntity.setAttribute("text",{value:"Play audio!",color:"white",align:"center",wrapCount:30,width:3.6}),this.taskAudioEntity.setAttribute("id","babiaTaskAudio"),this.taskAudioEntity.setAttribute("sound",{src:`url(${t.data.taskAudioUrl})`}),this.taskAudioEntity.addEventListener("click",(function(e){t.audioPlaying?(t.audioPlaying=!1,t.taskAudioEntity.components.sound.stopSound(),t.taskAudioEntity.setAttribute("text","value","Play audio!")):(t.audioPlaying=!0,t.taskAudioEntity.components.sound.playSound(),t.taskAudioEntity.setAttribute("text","value","Stop audio!"))}),!1),this.taskAudioEntity.addEventListener("sound-ended",(function(e){t.audioPlaying=!1,t.taskAudioEntity.setAttribute("text","value","Play audio!")}),!1),this.babiaCameraPosition=this.babiaCameraEl.getAttribute("position"),this.taskAudioEntity.setAttribute("position",{x:this.babiaCameraPosition.x,y:this.babiaCameraPosition.y+1.5,z:this.babiaCameraPosition.z-4}),this.taskAudioEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskAudioEntity)},videoPlaying:!1,addVideoTask:function(){const t=this;this.taskVideoEntity=document.createElement("a-video"),this.taskVideoEntity.setAttribute("class","babiaxrayscasterclass"),this.taskVideoEntity.setAttribute("id","babiaTaskVideo"),this.taskVideoEntity.setAttribute("src",t.data.taskVideoId),this.taskVideoStream=document.querySelector(t.data.taskVideoId),this.taskVideoEntity.setAttribute("width",t.data.taskVideoWidth),this.taskVideoEntity.setAttribute("height",t.data.taskVideoHeight),this.taskVideoEntity.addEventListener("click",(function(e){t.videoPlaying?(t.videoPlaying=!1,t.taskVideoStream.pause()):(t.videoPlaying=!0,t.taskVideoStream.play())}),!1),this.babiaCameraPosition=this.babiaCameraEl.getAttribute("position"),this.taskVideoEntity.setAttribute("position",{x:this.babiaCameraPosition.x,y:this.babiaCameraPosition.y+1.5,z:this.babiaCameraPosition.z-4}),this.taskVideoEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskVideoEntity)},addStartButton:function(){const t=this;this.startButtonEntity=document.createElement("a-plane"),this.startButtonEntity.setAttribute("id","babiaStartButton"),this.startButtonEntity.setAttribute("scale",{x:.4,y:.4,z:.4}),this.startButtonEntity.setAttribute("babia-lookat",this.data.lookat),this.startButtonEntity.setAttribute("class",".babiaxrayscasterclass"),this.startButtonEntity.setAttribute("color","#3ac961"),this.startButtonEntity.setAttribute("geometry",{primitive:"plane",width:1.8,height:.5}),this.startButtonEntity.setAttribute("text",{value:"Start!",color:"white",align:"center",wrapCount:30,width:3.6}),this.babiaCameraPosition=this.babiaCameraEl.getAttribute("position"),this.startButtonEntity.setAttribute("position",{x:this.babiaCameraPosition.x-.5,y:this.babiaCameraPosition.y+1,z:this.babiaCameraPosition.z-1.5}),this.startButtonEntity.addEventListener("click",(async function(e){t.showCharts(),t.runningExperiment=!0,t.recordingData=window.setInterval((function(){i(t)}),t.data.recordDelta),t.recordedData.startTime=Date.now(),t.data.recordAudio&&(t.audioRecorder=await r(),t.audioRecorder.start()),t.startButtonEntity.setAttribute("visible",!1),t.data.finishButton&&t.finishButtonEntity.setAttribute("visible",!0),t.data.timeLimitEnding&&(t.recordedData.maxTime=t.recordedData.startTime+1e3*t.data.timeLimitTime)}),!1),this.el.parentElement.append(this.startButtonEntity)},addFinishButton:function(){const t=this;this.finishButtonEntity=document.createElement("a-plane"),this.finishButtonEntity.setAttribute("id","babiaFinishButton"),this.finishButtonEntity.setAttribute("scale",{x:.4,y:.4,z:.4}),this.finishButtonEntity.setAttribute("babia-lookat",this.data.lookat),this.finishButtonEntity.setAttribute("class","babiaxrayscasterclass"),this.finishButtonEntity.setAttribute("color","#9e0000"),this.finishButtonEntity.setAttribute("visible",!1),this.finishButtonEntity.setAttribute("geometry",{primitive:"plane",width:1.8,height:.5}),this.finishButtonEntity.setAttribute("text",{value:"Finish!",color:"white",align:"center",wrapCount:30,width:3.6}),this.finishButtonEntity.setAttribute("position",{x:this.babiaCameraPosition.x+.5,y:this.babiaCameraPosition.y+1,z:this.babiaCameraPosition.z-1.5}),this.finishButtonEntity.addEventListener("click",(function(e){t.hideCharts(),t.runningExperiment=!1,i(t),clearInterval(this.recordingData),t.audioRecorder&&t.stopAndDownloadAudio(),t.recordedData.finishTime=Date.now(),t.recordedData.totalDuration=t.recordedData.finishTime-t.recordedData.startTime,n(t.recordedData,"experimentdetails"),t.finishButtonEntity.setAttribute("visible",!1)}),!1),this.el.parentElement.append(this.finishButtonEntity)},stopAndDownloadAudio:async function(){let t=await this.audioRecorder.stop();const e=document.createElement("a");document.body.appendChild(e),e.style="display: none",e.href=t.audioUrl,e.download="audio.webm",e.click(),window.URL.revokeObjectURL(t.audioUrl)},tick:function(){const t=this;this.runningExperiment&&this.data.timeLimitEnding&&Date.now()>this.recordedData.maxTime&&(this.recordedData.finishTime=this.recordedData.maxTime,this.recordedData.totalDuration=this.recordedData.finishTime-this.recordedData.startTime,this.runningExperiment=!1,this.data.forceFinishWhenTimeLimit?(alert("The time limit is done! Thank you!"),this.hideCharts(),n(t.recordedData,"experimentdetails"),t.finishButtonEntity.setAttribute("visible",!1),i(t),clearInterval(this.recordingData),t.audioRecorder&&t.stopAndDownloadAudio()):alert("The time limit is done, but you can continue doing the experiment, please, click on Finish when done!"))}});const r=()=>new Promise(t=>{navigator.mediaDevices.getUserMedia({audio:!0}).then(e=>{const i=new MediaRecorder(e),n=[];i.addEventListener("dataavailable",t=>{n.push(t.data)});t({start:()=>{i.start()},stop:()=>new Promise(t=>{i.addEventListener("stop",()=>{const e=new Blob(n),i=URL.createObjectURL(e),r=new Audio(i);t({audioBlob:e,audioUrl:i,play:()=>{r.play()}})}),i.stop()})})})})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-poster",{schema:{title:{type:"string",default:"New Poster"},titleColor:{type:"string",default:"black"},titleFont:{type:"string",default:"mozillavr"},titleWrapCount:{type:"number",default:24},body:{type:"string",default:"This poster has no body yet."},bodyColor:{type:"string",default:"black"},bodyFont:{type:"string",default:"mozillavr"},bodyWrapCount:{type:"number",default:30},openOn:{type:"string",default:"click"},active:{type:"boolean",default:!0},openIconImage:{type:"asset",default:""},openIconRadius:{type:"number",default:.3},openIconColor:{type:"string",default:"white"},closeIconImage:{type:"asset",default:""},closeIconRadius:{type:"number",default:.3},closeIconColor:{type:"string",default:"white"},image:{type:"string",default:""},imageWidth:{type:"number",default:2},imageHeight:{type:"number",default:2},posterBoxWidth:{type:"number",default:4},posterBoxHeight:{type:"number",default:4},posterBoxColor:{type:"string",default:"white"},posterBoxPadding:{type:"number",default:.2}},multiple:!0,posterPlaneEl:null,closeIconEl:null,titleEl:null,bodyEl:null,imageEl:null,hasImage:!1,init(){this.cameraEl=document.querySelector("[camera]"),this.generateOpenIcon(),this.spawnEntities(),this.el.emit("loaded")},tick(){this.isOpen&&this.positionPosterPlane()},remove(){const{openOn:t}=this.data;this.el.removeEventListener(t,this.togglePosterOpen.bind(this)),this.closeIconEl.removeEventListener(t,this.togglePosterOpen.bind(this))},update(){this.generateTitle(),this.generateBody(),this.generateImage()},togglePosterOpen(t){t.target.getAttribute("id")===this.el.getAttribute("id")+"--close-icon"&&(this.posterPlaneEl.setAttribute("visible",!1),this.isOpen=!1),this.data.active&&t.target.getAttribute("id")===this.el.getAttribute("id")&&(this.positionPosterPlane(),this.posterPlaneEl.setAttribute("visible",!0),this.isOpen=!0)},generateOpenIcon(){const{openIconRadius:t,openIconColor:e,openIconImage:i,openOn:n}=this.data;this.el.setAttribute("geometry",{primitive:"circle",radius:t}),this.el.setAttribute("material",{color:e,src:i}),this.el.addEventListener(n,this.togglePosterOpen.bind(this))},generateCloseIcon(){const{closeIconRadius:t,closeIconColor:e,closeIconImage:i,posterBoxWidth:n,posterBoxHeight:r,openOn:a}=this.data,s=document.createElement("a-entity");return s.setAttribute("id",this.el.getAttribute("id")+"--close-icon"),s.setAttribute("position",{x:n/2,y:r/2,z:.01}),s.setAttribute("geometry",{primitive:"circle",radius:t}),s.setAttribute("material",{color:e,src:i}),s.addEventListener(a,this.togglePosterOpen.bind(this)),this.closeIconEl=s,s},generateTitle(){const{title:t,titleColor:e,titleFont:i,titleWrapCount:n,posterBoxWidth:r,posterBoxHeight:a,posterBoxPadding:s,imageHeight:o}=this.data,l=this.titleEl||document.createElement("a-entity");l.setAttribute("id",this.el.getAttribute("id")+"--title"),l.setAttribute("text",{value:t.substring(0,n),color:e,font:i,wrapCount:n,width:r-2*s,baseline:"top",anchor:"left"});let c=a/2-s;return this.hasImage&&(c-=o/2),l.setAttribute("position",{x:-r/2+s,y:c,z:.01}),this.titleEl=l,l},generateBody(){const{body:t,bodyColor:e,bodyFont:i,bodyWrapCount:n,posterBoxWidth:r,posterBoxHeight:a,posterBoxPadding:s,imageHeight:o}=this.data,l=this.bodyEl||document.createElement("a-entity");l.setAttribute("id",this.el.getAttribute("id")+"--title"),l.setAttribute("text",{value:t,color:e,font:i,wrapCount:n,width:r-2*s,baseline:"top",anchor:"left"});let c=a/2-3*s;return this.hasImage&&(c-=o/2),l.setAttribute("position",{x:-r/2+s,y:c,z:.01}),this.bodyEl=l,l},generateImage(){const{image:t,imageWidth:e,imageHeight:i,posterBoxHeight:n}=this.data;if(!t.length)return null;const r=this.imageEl||document.createElement("a-image");return r.setAttribute("id",this.el.getAttribute("id")+"--image"),r.setAttribute("src",t),r.setAttribute("width",e),r.setAttribute("height",i),r.setAttribute("position",{x:0,y:n/2,z:.01}),this.hasImage=!0,this.imageEl=r,r},generatePosterPlane(){const{posterBoxWidth:t,posterBoxHeight:e,posterBoxPadding:i,posterBoxColor:n}=this.data,r=this.posterPlaneEl||document.createElement("a-entity");r.setAttribute("id",this.el.getAttribute("id")+"--poster-plane"),r.setAttribute("position",{x:0,y:0,z:.5}),r.setAttribute("visible",!1),r.setAttribute("geometry",{primitive:"plane",width:t+i,height:e+i});return this.generateImage()&&r.appendChild(this.generateImage()),r.setAttribute("material",{color:n}),r.appendChild(this.generateCloseIcon()),r.appendChild(this.generateTitle()),r.appendChild(this.generateBody()),this.posterPlaneEl=r,r},positionPosterPlane(){if(this.posterPlaneEl){const t=this.posterPlaneEl.object3D.parent.worldToLocal(this.cameraEl.object3D.getWorldPosition());this.posterPlaneEl.object3D.lookAt(t)}},spawnEntities(){this.el.appendChild(this.generatePosterPlane())}})},function(t,e,i){const{randFloatSpread:n}=i(60);if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-task",{schema:{taskTitle:{type:"string",default:"Default task title"},taskDescription:{type:"string",default:"Default task text"},openTaskImg:{type:"string"},closeTaskImg:{type:"string"},taskAudio:{type:"boolean",default:!1},taskAudioUrl:{type:"string",default:null},taskVideo:{type:"boolean",default:!1},taskVideoId:{type:"string",default:null},taskVideoWidth:{type:"number",default:3},taskVideoHeight:{type:"number",default:1.75},offsetX:{type:"number",default:0},lookat:{type:"string",default:"[camera]"}},multiple:!0,recordedData:{},runningExperiment:!1,init:function(){},taskId:Math.random(),update:function(t){if(this.taskId=this.el.getAttribute("id"),this.data!=this.oldData){let t=this.el.sceneEl.querySelectorAll("[babia-camera]");if(t.length>0){this.babiaCameraEl=t[0];let e=this.babiaCameraEl.getAttribute("babia-camera");"string"==typeof e?this.babiaCameraEl.setAttribute("babia-camera",{raycasterMouse:e.split("raycasterMouse:")[1].split(";")[0]+`, #babiaTaskPopup${this.taskId}, #babiaTaskPopup${this.taskId}--close-icon, #babiaStartButton${this.taskId}, #babiaFinishButton${this.taskId}, #babiaTaskAudio${this.taskId}, #babiaTaskVideo${this.taskId}`,raycasterHand:e.split("raycasterHand:")[1].split(";")[0]+`, #babiaTaskPopup${this.taskId}, #babiaTaskPopup${this.taskId}--close-icon, #babiaStartButton${this.taskId}, #babiaFinishButton${this.taskId}, #babiaTaskAudio${this.taskId}, #babiaTaskVideo${this.taskId}`,teleportCollision:e.split("teleportCollision:")[1].split(";")[0]}):null==e&&this.babiaCameraEl.setAttribute("babia-camera",{raycasterMouse:this.babiaCameraEl.components["babia-camera"].attrValue.raycasterMouse+`, #babiaTaskPopup${this.taskId}, #babiaTaskPopup${this.taskId}--close-icon, #babiaStartButton${this.taskId}, #babiaFinishButton${this.taskId}, #babiaTaskAudio${this.taskId}, #babiaTaskVideo${this.taskId}`,raycasterHand:this.babiaCameraEl.components["babia-camera"].attrValue.raycasterHand+`, #babiaTaskPopup${this.taskId}, #babiaTaskPopup${this.taskId}--close-icon, #babiaStartButton${this.taskId}, #babiaFinishButton${this.taskId}, #babiaTaskAudio${this.taskId}, #babiaTaskVideo${this.taskId}`,teleportCollision:this.babiaCameraEl.components["babia-camera"].attrValue.teleportCollision})}else this.babiaCameraEl=this.el.sceneEl.camera.el;this.data.taskAudio?this.addAudioTask():this.data.taskVideo?this.addVideoTask():this.addTask()}},addTask:function(){let t,e,i;this.taskEntity=document.createElement("a-entity"),this.taskEntity.setAttribute("class","babiaxrayscasterclass"),this.taskEntity.setAttribute("id","babiaTaskPopup"+this.taskId),this.taskEntity.setAttribute("babia-poster",{openIconImage:"../assets/popups/info.jpg",closeIconImage:"../assets/popups/close.jpg",title:this.data.taskTitle,titleWrapCount:30,titleColor:"black",bodyColor:"black",posterBoxColor:"white",bodyFont:"roboto",posterBoxHeight:4.5,body:this.data.taskDescription}),this.babiaCameraEl.attributes.position?[t,e,i]=this.babiaCameraEl.attributes.position.value.split(" "):(t=0,e=0,i=0),this.taskEntity.setAttribute("position",{x:parseFloat(t)+this.data.offsetX,y:parseFloat(e)+1.5,z:parseFloat(i)-6}),this.taskEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskEntity)},audioPlaying:!1,addAudioTask:function(){const t=this;let e,i,n;this.taskAudioEntity=document.createElement("a-entity"),this.taskAudioEntity.setAttribute("class","babiaxrayscasterclass"),this.taskAudioEntity.setAttribute("geometry",{primitive:"plane",width:1.1,height:.5}),this.taskAudioEntity.setAttribute("text",{value:"Play audio!",color:"white",align:"center",wrapCount:30,width:3.6}),this.taskAudioEntity.setAttribute("id","babiaTaskAudio"+this.taskId),this.taskAudioEntity.setAttribute("sound",{src:`url(${t.data.taskAudioUrl})`}),this.taskAudioEntity.addEventListener("click",(function(e){t.audioPlaying?(t.audioPlaying=!1,t.taskAudioEntity.components.sound.stopSound(),t.taskAudioEntity.setAttribute("text","value","Play audio!")):(t.audioPlaying=!0,t.taskAudioEntity.components.sound.playSound(),t.taskAudioEntity.setAttribute("text","value","Stop audio!"))}),!1),this.taskAudioEntity.addEventListener("sound-ended",(function(e){t.audioPlaying=!1,t.taskAudioEntity.setAttribute("text","value","Play audio!")}),!1),this.babiaCameraEl.attributes.position?[e,i,n]=this.babiaCameraEl.attributes.position.value.split(" "):(e=0,i=0,n=0),this.taskAudioEntity.setAttribute("position",{x:parseFloat(e)+this.data.offsetX,y:parseFloat(i)+3,z:parseFloat(n)-6}),this.taskAudioEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskAudioEntity)},videoPlaying:!1,addVideoTask:function(){const t=this;let e,i,n;this.taskVideoEntity=document.createElement("a-video"),this.taskVideoEntity.setAttribute("class","babiaxrayscasterclass"),this.taskVideoEntity.setAttribute("id","babiaTaskVideo"+this.taskId),this.taskVideoEntity.setAttribute("src",t.data.taskVideoId),this.taskVideoStream=document.querySelector(t.data.taskVideoId),this.taskVideoEntity.setAttribute("width",t.data.taskVideoWidth),this.taskVideoEntity.setAttribute("height",t.data.taskVideoHeight),this.taskVideoEntity.addEventListener("click",(function(e){t.videoPlaying?(t.videoPlaying=!1,t.taskVideoStream.pause()):(t.videoPlaying=!0,t.taskVideoStream.play())}),!1),this.babiaCameraEl.attributes.position?[e,i,n]=this.babiaCameraEl.attributes.position.value.split(" "):(e=0,i=0,n=0),this.taskVideoEntity.setAttribute("position",{x:parseFloat(e)+this.data.offsetX,y:parseFloat(i)+3,z:parseFloat(n)-6}),this.taskVideoEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskVideoEntity)},tick:function(){}})},function(t,e,i){"use strict";i.r(e),i.d(e,"DEG2RAD",(function(){return a})),i.d(e,"RAD2DEG",(function(){return s})),i.d(e,"generateUUID",(function(){return o})),i.d(e,"clamp",(function(){return l})),i.d(e,"euclideanModulo",(function(){return c})),i.d(e,"mapLinear",(function(){return d})),i.d(e,"inverseLerp",(function(){return h})),i.d(e,"lerp",(function(){return u})),i.d(e,"damp",(function(){return p})),i.d(e,"pingpong",(function(){return f})),i.d(e,"smoothstep",(function(){return g})),i.d(e,"smootherstep",(function(){return m})),i.d(e,"randInt",(function(){return b})),i.d(e,"randFloat",(function(){return v})),i.d(e,"randFloatSpread",(function(){return y})),i.d(e,"seededRandom",(function(){return x})),i.d(e,"degToRad",(function(){return _})),i.d(e,"radToDeg",(function(){return A})),i.d(e,"isPowerOfTwo",(function(){return C})),i.d(e,"ceilPowerOfTwo",(function(){return w})),i.d(e,"floorPowerOfTwo",(function(){return M})),i.d(e,"setQuaternionFromProperEuler",(function(){return I})),i.d(e,"normalize",(function(){return S})),i.d(e,"denormalize",(function(){return E}));const n=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let r=1234567;const a=Math.PI/180,s=180/Math.PI;function o(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(n[255&t]+n[t>>8&255]+n[t>>16&255]+n[t>>24&255]+"-"+n[255&e]+n[e>>8&255]+"-"+n[e>>16&15|64]+n[e>>24&255]+"-"+n[63&i|128]+n[i>>8&255]+"-"+n[i>>16&255]+n[i>>24&255]+n[255&r]+n[r>>8&255]+n[r>>16&255]+n[r>>24&255]).toLowerCase()}function l(t,e,i){return Math.max(e,Math.min(i,t))}function c(t,e){return(t%e+e)%e}function d(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)}function h(t,e,i){return t!==e?(i-t)/(e-t):0}function u(t,e,i){return(1-i)*t+i*e}function p(t,e,i,n){return u(t,e,1-Math.exp(-i*n))}function f(t,e=1){return e-Math.abs(c(t,2*e)-e)}function g(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}function m(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)}function b(t,e){return t+Math.floor(Math.random()*(e-t+1))}function v(t,e){return t+Math.random()*(e-t)}function y(t){return t*(.5-Math.random())}function x(t){void 0!==t&&(r=t);let e=r+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}function _(t){return t*a}function A(t){return t*s}function C(t){return 0==(t&t-1)&&0!==t}function w(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function M(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function I(t,e,i,n,r){const a=Math.cos,s=Math.sin,o=a(i/2),l=s(i/2),c=a((e+n)/2),d=s((e+n)/2),h=a((e-n)/2),u=s((e-n)/2),p=a((n-e)/2),f=s((n-e)/2);switch(r){case"XYX":t.set(o*d,l*h,l*u,o*c);break;case"YZY":t.set(l*u,o*d,l*h,o*c);break;case"ZXZ":t.set(l*h,l*u,o*d,o*c);break;case"XZX":t.set(o*d,l*f,l*p,o*c);break;case"YXY":t.set(l*p,o*d,l*f,o*c);break;case"ZYZ":t.set(l*f,l*p,o*d,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function E(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function S(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}},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,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,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),i.d(e,"default",(function(){return gl}));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=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];const a=Math.PI/180,s=180/Math.PI;function o(){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]).toLowerCase()}function l(t,e,i){return Math.max(e,Math.min(i,t))}function c(t,e){return(t%e+e)%e}function d(t,e,i){return(1-i)*t+i*e}function h(t){return 0==(t&t-1)&&0!==t}function u(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function p(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function f(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}class g{constructor(t=0,e=0){g.prototype.isVector2=!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){return 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){return 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){return 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}}class m{constructor(){m.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}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],d=i[7],h=i[2],u=i[5],p=i[8],f=n[0],g=n[3],m=n[6],b=n[1],v=n[4],y=n[7],x=n[2],_=n[5],A=n[8];return r[0]=a*f+s*b+o*x,r[3]=a*g+s*v+o*_,r[6]=a*m+s*y+o*A,r[1]=l*f+c*b+d*x,r[4]=l*g+c*v+d*_,r[7]=l*m+c*y+d*A,r[2]=h*f+u*b+p*x,r[5]=h*g+u*v+p*_,r[8]=h*m+u*y+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],d=c*a-s*l,h=s*o-c*r,u=l*r-a*o,p=e*d+i*h+n*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=d*f,t[1]=(n*l-c*i)*f,t[2]=(s*i-n*a)*f,t[3]=h*f,t[4]=(c*e-n*o)*f,t[5]=(n*r-s*e)*f,t[6]=u*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 b(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function v(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function y(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function x(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const _={srgb:{"srgb-linear":y},"srgb-linear":{srgb:x}},A={legacyMode:!0,get workingColorSpace(){return"srgb-linear"},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,i){if(this.legacyMode||e===i||!e||!i)return t;if(_[e]&&void 0!==_[e][i]){const n=_[e][i];return t.r=n(t.r),t.g=n(t.g),t.b=n(t.b),t}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}},C={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},w={r:0,g:0,b:0},M={h:0,s:0,l:0},I={h:0,s:0,l:0};function E(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 S(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e}class B{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,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,e="srgb"){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,A.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n="srgb-linear"){return this.r=t,this.g=e,this.b=i,A.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n="srgb-linear"){if(t=c(t,1),e=l(e,0,1),i=l(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=E(r,n,t+1/3),this.g=E(r,n,t),this.b=E(r,n,t-1/3)}return A.toWorkingColorSpace(this,n),this}setStyle(t,e="srgb"){function i(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=n[1],a=n[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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,A.toWorkingColorSpace(this,e),i(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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,A.toWorkingColorSpace(this,e),i(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const n=parseFloat(t[1])/360,r=parseFloat(t[2])/100,a=parseFloat(t[3])/100;return i(t[4]),this.setHSL(n,r,a,e)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],i=t.length;if(3===i)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,A.toWorkingColorSpace(this,e),this;if(6===i)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,A.toWorkingColorSpace(this,e),this}return t&&t.length>0?this.setColorName(t,e):this}setColorName(t,e="srgb"){const i=C[t.toLowerCase()];return void 0!==i?this.setHex(i,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}copySRGBToLinear(t){return this.r=y(t.r),this.g=y(t.g),this.b=y(t.b),this}copyLinearToSRGB(t){return this.r=x(t.r),this.g=x(t.g),this.b=x(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t="srgb"){return A.fromWorkingColorSpace(S(this,w),t),l(255*w.r,0,255)<<16^l(255*w.g,0,255)<<8^l(255*w.b,0,255)<<0}getHexString(t="srgb"){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e="srgb-linear"){A.fromWorkingColorSpace(S(this,w),e);const i=w.r,n=w.g,r=w.b,a=Math.max(i,n,r),s=Math.min(i,n,r);let o,l;const c=(s+a)/2;if(s===a)o=0,l=0;else{const t=a-s;switch(l=c<=.5?t/(a+s):t/(2-a-s),a){case i:o=(n-r)/t+(n<r?6:0);break;case n:o=(r-i)/t+2;break;case r:o=(i-n)/t+4}o/=6}return t.h=o,t.s=l,t.l=c,t}getRGB(t,e="srgb-linear"){return A.fromWorkingColorSpace(S(this,w),e),t.r=w.r,t.g=w.g,t.b=w.b,t}getStyle(t="srgb"){return A.fromWorkingColorSpace(S(this,w),t),"srgb"!==t?`color(${t} ${w.r} ${w.g} ${w.b})`:`rgb(${255*w.r|0},${255*w.g|0},${255*w.b|0})`}offsetHSL(t,e,i){return this.getHSL(M),M.h+=t,M.s+=e,M.l+=i,this.setHSL(M.h,M.s,M.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(M),t.getHSL(I);const i=d(M.h,I.h,e),n=d(M.s,I.s,e),r=d(M.l,I.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),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}let F;B.NAMES=C;class T{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===F&&(F=v("canvas")),F.width=t.width,F.height=t.height;const i=F.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=F}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")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=v("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const n=i.getImageData(0,0,t.width,t.height),r=n.data;for(let t=0;t<r.length;t++)r[t]=255*y(r[t]/255);return i.putImageData(n,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*y(e[t]/255)):e[t]=y(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}class U{constructor(t=null){this.isSource=!0,this.uuid=o(),this.data=t,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let t;if(Array.isArray(n)){t=[];for(let e=0,i=n.length;e<i;e++)n[e].isDataTexture?t.push(L(n[e].image)):t.push(L(n[e]))}else t=L(n);i.url=t}return e||(t.images[this.uuid]=i),i}}function L(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?T.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let D=0;class R extends n{constructor(t=R.DEFAULT_IMAGE,e=R.DEFAULT_MAPPING,i=1001,n=1001,r=1006,a=1008,s=1023,l=1009,c=1,d=3e3){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:D++}),this.uuid=o(),this.name="",this.source=new U(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=l,this.offset=new g(0,0),this.repeat=new g(1,1),this.center=new g(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new m,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=d,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t){this.source.data=t}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.source=t.source,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.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,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,image:this.source.toJSON(t).uuid,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};return"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),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++,this.source.needsUpdate=!0)}}R.DEFAULT_IMAGE=null,R.DEFAULT_MAPPING=300;class k{constructor(t=0,e=0,i=0,n=1){k.prototype.isVector4=!0,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){return 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){return 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],d=a[5],h=a[9],u=a[2],p=a[6],f=a[10];if(Math.abs(o-c)<.01&&Math.abs(l-u)<.01&&Math.abs(h-p)<.01){if(Math.abs(o+c)<.1&&Math.abs(l+u)<.1&&Math.abs(h+p)<.1&&Math.abs(s+d+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(s+1)/2,a=(d+1)/2,g=(f+1)/2,m=(o+c)/4,b=(l+u)/4,v=(h+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=v/n):g<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(g),i=b/r,n=v/r),this.set(i,n,r,e),this}let g=Math.sqrt((p-h)*(p-h)+(l-u)*(l-u)+(c-o)*(c-o));return Math.abs(g)<.001&&(g=1),this.x=(p-h)/g,this.y=(l-u)/g,this.z=(c-o)/g,this.w=Math.acos((s+d+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){return 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}}class N extends n{constructor(t,e,i={}){super(),this.isWebGLRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new k(0,0,t,e),this.scissorTest=!1,this.viewport=new k(0,0,t,e);const n={width:t,height:e,depth:1};this.texture=new R(n,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!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,this.samples=void 0!==i.samples?i.samples:0}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){this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new U(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class P extends R{constructor(t=null,e=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,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}}class O extends R{constructor(t=null,e=1,i=1,n=1){super(null),this.isData3DTexture=!0,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}}class z{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,r,a,s){let o=i[n+0],l=i[n+1],c=i[n+2],d=i[n+3];const h=r[a+0],u=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]=d);if(1===s)return t[e+0]=h,t[e+1]=u,t[e+2]=p,void(t[e+3]=f);if(d!==f||o!==h||l!==u||c!==p){let t=1-s;const e=o*h+l*u+c*p+d*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+h*r,l=l*t+u*r,c=c*t+p*r,d=d*t+f*r,t===1-s){const t=1/Math.sqrt(o*o+l*l+c*c+d*d);o*=t,l*=t,c*=t,d*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=d}static multiplyQuaternionsFlat(t,e,i,n,r,a){const s=i[n],o=i[n+1],l=i[n+2],c=i[n+3],d=r[a],h=r[a+1],u=r[a+2],p=r[a+3];return t[e]=s*p+c*d+o*u-l*h,t[e+1]=o*p+c*h+l*d-s*u,t[e+2]=l*p+c*u+s*h-o*d,t[e+3]=c*p-s*d-o*h-l*u,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){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),d=s(r/2),h=o(i/2),u=o(n/2),p=o(r/2);switch(a){case"XYZ":this._x=h*c*d+l*u*p,this._y=l*u*d-h*c*p,this._z=l*c*p+h*u*d,this._w=l*c*d-h*u*p;break;case"YXZ":this._x=h*c*d+l*u*p,this._y=l*u*d-h*c*p,this._z=l*c*p-h*u*d,this._w=l*c*d+h*u*p;break;case"ZXY":this._x=h*c*d-l*u*p,this._y=l*u*d+h*c*p,this._z=l*c*p+h*u*d,this._w=l*c*d-h*u*p;break;case"ZYX":this._x=h*c*d-l*u*p,this._y=l*u*d+h*c*p,this._z=l*c*p-h*u*d,this._w=l*c*d+h*u*p;break;case"YZX":this._x=h*c*d+l*u*p,this._y=l*u*d+h*c*p,this._z=l*c*p-h*u*d,this._w=l*c*d-h*u*p;break;case"XZY":this._x=h*c*d-l*u*p,this._y=l*u*d-h*c*p,this._z=l*c*p+h*u*d,this._w=l*c*d+h*u*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],d=e[10],h=i+s+d;if(h>0){const t=.5/Math.sqrt(h+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>d){const t=2*Math.sqrt(1+i-s-d);this._w=(c-o)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(r+l)/t}else if(s>d){const t=2*Math.sqrt(1+s-i-d);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+d-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(l(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){return 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),d=Math.sin((1-e)*c)/l,h=Math.sin(e*c)/l;return this._w=a*d+this._w*h,this._x=i*d+this._x*h,this._y=n*d+this._y*h,this._z=r*d+this._z*h,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return 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(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Q{constructor(t=0,e=0,i=0){Q.prototype.isVector3=!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){return 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){return 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){return 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 this.applyQuaternion(H.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(H.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,d=o*n+r*i-a*e,h=-r*e-a*i-s*n;return this.x=l*o+h*-r+c*-s-d*-a,this.y=c*o+h*-a+d*-r-l*-s,this.z=d*o+h*-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){return 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 V.copy(this).projectOnVector(t),this.sub(V)}reflect(t){return this.sub(V.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(l(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)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}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){return 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}}const V=new Q,H=new z;class j{constructor(t=new Q(1/0,1/0,1/0),e=new Q(-1/0,-1/0,-1/0)){this.isBox3=!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],d=t[o+2];l<e&&(e=l),c<i&&(i=c),d<n&&(n=d),l>r&&(r=l),c>a&&(a=c),d>s&&(s=d)}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),d=t.getZ(o);l<e&&(e=l),c<i&&(i=c),d<n&&(n=d),l>r&&(r=l),c>a&&(a=c),d>s&&(s=d)}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=W.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}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,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i)if(e&&null!=i.attributes&&void 0!==i.attributes.position){const e=i.attributes.position;for(let i=0,n=e.count;i<n;i++)W.fromBufferAttribute(e,i).applyMatrix4(t.matrixWorld),this.expandByPoint(W)}else null===i.boundingBox&&i.computeBoundingBox(),q.copy(i.boundingBox),q.applyMatrix4(t.matrixWorld),this.union(q);const n=t.children;for(let t=0,i=n.length;t<i;t++)this.expandByObject(n[t],e);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,W),W.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(tt),et.subVectors(this.max,tt),Z.subVectors(t.a,tt),X.subVectors(t.b,tt),J.subVectors(t.c,tt),Y.subVectors(X,Z),K.subVectors(J,X),$.subVectors(Z,J);let e=[0,-Y.z,Y.y,0,-K.z,K.y,0,-$.z,$.y,Y.z,0,-Y.x,K.z,0,-K.x,$.z,0,-$.x,-Y.y,Y.x,0,-K.y,K.x,0,-$.y,$.x,0];return!!rt(e,Z,X,J,et)&&(e=[1,0,0,0,1,0,0,0,1],!!rt(e,Z,X,J,et)&&(it.crossVectors(Y,K),e=[it.x,it.y,it.z],rt(e,Z,X,J,et)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return W.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(W).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()||(G[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),G[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),G[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),G[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),G[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),G[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),G[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),G[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(G)),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)}}const G=[new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q],W=new Q,q=new j,Z=new Q,X=new Q,J=new Q,Y=new Q,K=new Q,$=new Q,tt=new Q,et=new Q,it=new Q,nt=new Q;function rt(t,e,i,n,r){for(let a=0,s=t.length-3;a<=s;a+=3){nt.fromArray(t,a);const s=r.x*Math.abs(nt.x)+r.y*Math.abs(nt.y)+r.z*Math.abs(nt.z),o=e.dot(nt),l=i.dot(nt),c=n.dot(nt);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}const at=new j,st=new Q,ot=new Q,lt=new Q;class ct{constructor(t=new Q,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):at.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){lt.subVectors(t,this.center);const e=lt.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.add(lt.multiplyScalar(i/t)),this.radius+=i}return this}union(t){return!0===this.center.equals(t.center)?ot.set(0,0,1).multiplyScalar(t.radius):ot.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(st.copy(t.center).add(ot)),this.expandByPoint(st.copy(t.center).sub(ot)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const dt=new Q,ht=new Q,ut=new Q,pt=new Q,ft=new Q,gt=new Q,mt=new Q;class bt{constructor(t=new Q,e=new Q(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,dt)),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=dt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(dt.copy(this.direction).multiplyScalar(e).add(this.origin),dt.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){ht.copy(t).add(e).multiplyScalar(.5),ut.copy(e).sub(t).normalize(),pt.copy(this.origin).sub(ht);const r=.5*t.distanceTo(e),a=-this.direction.dot(ut),s=pt.dot(this.direction),o=-pt.dot(ut),l=pt.lengthSq(),c=Math.abs(1-a*a);let d,h,u,p;if(c>0)if(d=a*o-s,h=a*s-o,p=r*c,d>=0)if(h>=-p)if(h<=p){const t=1/c;d*=t,h*=t,u=d*(d+a*h+2*s)+h*(a*d+h+2*o)+l}else h=r,d=Math.max(0,-(a*h+s)),u=-d*d+h*(h+2*o)+l;else h=-r,d=Math.max(0,-(a*h+s)),u=-d*d+h*(h+2*o)+l;else h<=-p?(d=Math.max(0,-(-a*r+s)),h=d>0?-r:Math.min(Math.max(-r,-o),r),u=-d*d+h*(h+2*o)+l):h<=p?(d=0,h=Math.min(Math.max(-r,-o),r),u=h*(h+2*o)+l):(d=Math.max(0,-(a*r+s)),h=d>0?r:Math.min(Math.max(-r,-o),r),u=-d*d+h*(h+2*o)+l);else h=a>0?-r:r,d=Math.max(0,-(a*h+s)),u=-d*d+h*(h+2*o)+l;return i&&i.copy(this.direction).multiplyScalar(d).add(this.origin),n&&n.copy(ut).multiplyScalar(h).add(ht),u}intersectSphere(t,e){dt.subVectors(t.center,this.origin);const i=dt.dot(this.direction),n=dt.dot(dt)-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,d=1/this.direction.z,h=this.origin;return l>=0?(i=(t.min.x-h.x)*l,n=(t.max.x-h.x)*l):(i=(t.max.x-h.x)*l,n=(t.min.x-h.x)*l),c>=0?(r=(t.min.y-h.y)*c,a=(t.max.y-h.y)*c):(r=(t.max.y-h.y)*c,a=(t.min.y-h.y)*c),i>a||r>n?null:((r>i||i!=i)&&(i=r),(a<n||n!=n)&&(n=a),d>=0?(s=(t.min.z-h.z)*d,o=(t.max.z-h.z)*d):(s=(t.max.z-h.z)*d,o=(t.min.z-h.z)*d),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,dt)}intersectTriangle(t,e,i,n,r){ft.subVectors(e,t),gt.subVectors(i,t),mt.crossVectors(ft,gt);let a,s=this.direction.dot(mt);if(s>0){if(n)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}pt.subVectors(this.origin,t);const o=a*this.direction.dot(gt.crossVectors(pt,gt));if(o<0)return null;const l=a*this.direction.dot(ft.cross(pt));if(l<0)return null;if(o+l>s)return null;const c=-a*pt.dot(mt);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 vt{constructor(){vt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(t,e,i,n,r,a,s,o,l,c,d,h,u,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]=d,m[14]=h,m[3]=u,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 vt).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/yt.setFromMatrixColumn(t,0).length(),r=1/yt.setFromMatrixColumn(t,1).length(),a=1/yt.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){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),d=Math.sin(r);if("XYZ"===t.order){const t=a*c,i=a*d,n=s*c,r=s*d;e[0]=o*c,e[4]=-o*d,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*d,n=l*c,r=l*d;e[0]=t+r*s,e[4]=n*s-i,e[8]=a*l,e[1]=a*d,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*d,n=l*c,r=l*d;e[0]=t-r*s,e[4]=-a*d,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*d,n=s*c,r=s*d;e[0]=o*c,e[4]=n*l-i,e[8]=t*l+r,e[1]=o*d,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*d,e[8]=n*d+i,e[1]=d,e[5]=a*c,e[9]=-s*c,e[2]=-l*c,e[6]=i*d+n,e[10]=t-r*d}else if("XZY"===t.order){const t=a*o,i=a*l,n=s*o,r=s*l;e[0]=o*c,e[4]=-d,e[8]=l*c,e[1]=t*d+r,e[5]=a*c,e[9]=i*d-n,e[2]=n*d-i,e[6]=s*c,e[10]=r*d+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(_t,t,At)}lookAt(t,e,i){const n=this.elements;return Mt.subVectors(t,e),0===Mt.lengthSq()&&(Mt.z=1),Mt.normalize(),Ct.crossVectors(i,Mt),0===Ct.lengthSq()&&(1===Math.abs(i.z)?Mt.x+=1e-4:Mt.z+=1e-4,Mt.normalize(),Ct.crossVectors(i,Mt)),Ct.normalize(),wt.crossVectors(Mt,Ct),n[0]=Ct.x,n[4]=wt.x,n[8]=Mt.x,n[1]=Ct.y,n[5]=wt.y,n[9]=Mt.y,n[2]=Ct.z,n[6]=wt.z,n[10]=Mt.z,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[4],o=i[8],l=i[12],c=i[1],d=i[5],h=i[9],u=i[13],p=i[2],f=i[6],g=i[10],m=i[14],b=i[3],v=i[7],y=i[11],x=i[15],_=n[0],A=n[4],C=n[8],w=n[12],M=n[1],I=n[5],E=n[9],S=n[13],B=n[2],F=n[6],T=n[10],U=n[14],L=n[3],D=n[7],R=n[11],k=n[15];return r[0]=a*_+s*M+o*B+l*L,r[4]=a*A+s*I+o*F+l*D,r[8]=a*C+s*E+o*T+l*R,r[12]=a*w+s*S+o*U+l*k,r[1]=c*_+d*M+h*B+u*L,r[5]=c*A+d*I+h*F+u*D,r[9]=c*C+d*E+h*T+u*R,r[13]=c*w+d*S+h*U+u*k,r[2]=p*_+f*M+g*B+m*L,r[6]=p*A+f*I+g*F+m*D,r[10]=p*C+f*E+g*T+m*R,r[14]=p*w+f*S+g*U+m*k,r[3]=b*_+v*M+y*B+x*L,r[7]=b*A+v*I+y*F+x*D,r[11]=b*C+v*E+y*T+x*R,r[15]=b*w+v*S+y*U+x*k,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],d=t[6],h=t[10],u=t[14];return t[3]*(+r*o*d-n*l*d-r*s*h+i*l*h+n*s*u-i*o*u)+t[7]*(+e*o*u-e*l*h+r*a*h-n*a*u+n*l*c-r*o*c)+t[11]*(+e*l*d-e*s*u-r*a*d+i*a*u+r*s*c-i*l*c)+t[15]*(-n*s*c-e*o*d+e*s*h+n*a*d-i*a*h+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],d=t[9],h=t[10],u=t[11],p=t[12],f=t[13],g=t[14],m=t[15],b=d*g*l-f*h*l+f*o*u-s*g*u-d*o*m+s*h*m,v=p*h*l-c*g*l-p*o*u+a*g*u+c*o*m-a*h*m,y=c*f*l-p*d*l+p*s*u-a*f*u-c*s*m+a*d*m,x=p*d*o-c*f*o-p*s*h+a*f*h+c*s*g-a*d*g,_=e*b+i*v+n*y+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*h*r-d*g*r-f*n*u+i*g*u+d*n*m-i*h*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]=(d*o*r-s*h*r-d*n*l+i*h*l+s*n*u-i*o*u)*A,t[4]=v*A,t[5]=(c*g*r-p*h*r+p*n*u-e*g*u-c*n*m+e*h*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*h*r-c*o*r+c*n*l-e*h*l-a*n*u+e*o*u)*A,t[8]=y*A,t[9]=(p*d*r-c*f*r-p*i*u+e*f*u+c*i*m-e*d*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*d*r-c*i*l+e*d*l+a*i*u-e*s*u)*A,t[12]=x*A,t[13]=(c*f*n-p*d*n+p*i*h-e*f*h-c*i*g+e*d*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*d*n-c*s*n+c*i*o-e*d*o-a*i*h+e*s*h)*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,d=s+s,h=r*l,u=r*c,p=r*d,f=a*c,g=a*d,m=s*d,b=o*l,v=o*c,y=o*d,x=i.x,_=i.y,A=i.z;return n[0]=(1-(f+m))*x,n[1]=(u+y)*x,n[2]=(p-v)*x,n[3]=0,n[4]=(u-y)*_,n[5]=(1-(h+m))*_,n[6]=(g+b)*_,n[7]=0,n[8]=(p+v)*A,n[9]=(g-b)*A,n[10]=(1-(h+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=yt.set(n[0],n[1],n[2]).length();const a=yt.set(n[4],n[5],n[6]).length(),s=yt.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],xt.copy(this);const o=1/r,l=1/a,c=1/s;return xt.elements[0]*=o,xt.elements[1]*=o,xt.elements[2]*=o,xt.elements[4]*=l,xt.elements[5]*=l,xt.elements[6]*=l,xt.elements[8]*=c,xt.elements[9]*=c,xt.elements[10]*=c,e.setFromRotationMatrix(xt),i.x=r,i.y=a,i.z=s,this}makePerspective(t,e,i,n,r,a){const s=this.elements,o=2*r/(e-t),l=2*r/(i-n),c=(e+t)/(e-t),d=(i+n)/(i-n),h=-(a+r)/(a-r),u=-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]=d,s[13]=0,s[2]=0,s[6]=0,s[10]=h,s[14]=u,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),d=(e+t)*o,h=(i+n)*l,u=(a+r)*c;return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-d,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-h,s[2]=0,s[6]=0,s[10]=-2*c,s[14]=-u,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}}const yt=new Q,xt=new vt,_t=new Q(0,0,0),At=new Q(1,1,1),Ct=new Q,wt=new Q,Mt=new Q,It=new vt,Et=new z;class St{constructor(t=0,e=0,i=0,n=St.DefaultOrder){this.isEuler=!0,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],c=n[5],d=n[9],h=n[2],u=n[6],p=n[10];switch(e){case"XYZ":this._y=Math.asin(l(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(u,c),this._z=0);break;case"YXZ":this._x=Math.asin(-l(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(o,c)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(l(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-l(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,p),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(l(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-l(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,c),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-d,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 It.makeRotationFromQuaternion(t),this.setFromRotationMatrix(It,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Et.setFromEuler(this),this.setFromQuaternion(Et,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}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}St.DefaultOrder="XYZ",St.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Bt{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>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)}isEnabled(t){return 0!=(this.mask&(1<<t|0))}}let Ft=0;const Tt=new Q,Ut=new z,Lt=new vt,Dt=new Q,Rt=new Q,kt=new Q,Nt=new z,Pt=new Q(1,0,0),Ot=new Q(0,1,0),zt=new Q(0,0,1),Qt={type:"added"},Vt={type:"removed"};class Ht extends n{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ft++}),this.uuid=o(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ht.DefaultUp.clone();const t=new Q,e=new St,i=new z,n=new Q(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 vt},normalMatrix:{value:new m}}),this.matrix=new vt,this.matrixWorld=new vt,this.matrixAutoUpdate=Ht.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=Ht.DefaultMatrixWorldAutoUpdate,this.layers=new Bt,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 Ut.setFromAxisAngle(t,e),this.quaternion.multiply(Ut),this}rotateOnWorldAxis(t,e){return Ut.setFromAxisAngle(t,e),this.quaternion.premultiply(Ut),this}rotateX(t){return this.rotateOnAxis(Pt,t)}rotateY(t){return this.rotateOnAxis(Ot,t)}rotateZ(t){return this.rotateOnAxis(zt,t)}translateOnAxis(t,e){return Tt.copy(t).applyQuaternion(this.quaternion),this.position.add(Tt.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Pt,t)}translateY(t){return this.translateOnAxis(Ot,t)}translateZ(t){return this.translateOnAxis(zt,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(Lt.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Dt.copy(t):Dt.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),Rt.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Lt.lookAt(Rt,Dt,this.up):Lt.lookAt(Dt,Rt,this.up),this.quaternion.setFromRotationMatrix(Lt),n&&(Lt.extractRotation(n.matrixWorld),Ut.setFromRotationMatrix(Lt),this.quaternion.premultiply(Ut.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(Qt)):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(Vt)),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(Vt)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),Lt.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Lt.multiply(t.parent.matrixWorld)),t.applyMatrix4(Lt),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(Rt,t,kt),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Rt,Nt,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++){const n=e[i];!0!==n.matrixWorldAutoUpdate&&!0!==t||n.updateMatrixWorld(t)}}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&!0===i.matrixWorldAutoUpdate&&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++){const i=t[e];!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},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&&!0!==this.environment.isRenderTargetTexture&&(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),d=a(t.nodes);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),d.length>0&&(i.nodes=d)}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.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,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}}Ht.DefaultUp=new Q(0,1,0),Ht.DefaultMatrixAutoUpdate=!0,Ht.DefaultMatrixWorldAutoUpdate=!0;const jt=new Q,Gt=new Q,Wt=new Q,qt=new Q,Zt=new Q,Xt=new Q,Jt=new Q,Yt=new Q,Kt=new Q,$t=new Q;class te{constructor(t=new Q,e=new Q,i=new Q){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),jt.subVectors(t,e),n.cross(jt);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){jt.subVectors(n,e),Gt.subVectors(i,e),Wt.subVectors(t,e);const a=jt.dot(jt),s=jt.dot(Gt),o=jt.dot(Wt),l=Gt.dot(Gt),c=Gt.dot(Wt),d=a*l-s*s;if(0===d)return r.set(-2,-1,-1);const h=1/d,u=(l*o-s*c)*h,p=(a*c-s*o)*h;return r.set(1-u-p,p,u)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,qt),qt.x>=0&&qt.y>=0&&qt.x+qt.y<=1}static getUV(t,e,i,n,r,a,s,o){return this.getBarycoord(t,e,i,n,qt),o.set(0,0),o.addScaledVector(r,qt.x),o.addScaledVector(a,qt.y),o.addScaledVector(s,qt.z),o}static isFrontFacing(t,e,i,n){return jt.subVectors(i,e),Gt.subVectors(t,e),jt.cross(Gt).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 jt.subVectors(this.c,this.b),Gt.subVectors(this.a,this.b),.5*jt.cross(Gt).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return te.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return te.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return te.getUV(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return te.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return te.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;Zt.subVectors(n,i),Xt.subVectors(r,i),Yt.subVectors(t,i);const o=Zt.dot(Yt),l=Xt.dot(Yt);if(o<=0&&l<=0)return e.copy(i);Kt.subVectors(t,n);const c=Zt.dot(Kt),d=Xt.dot(Kt);if(c>=0&&d<=c)return e.copy(n);const h=o*d-c*l;if(h<=0&&o>=0&&c<=0)return a=o/(o-c),e.copy(i).addScaledVector(Zt,a);$t.subVectors(t,r);const u=Zt.dot($t),p=Xt.dot($t);if(p>=0&&u<=p)return e.copy(r);const f=u*l-o*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),e.copy(i).addScaledVector(Xt,s);const g=c*p-u*d;if(g<=0&&d-c>=0&&u-p>=0)return Jt.subVectors(r,n),s=(d-c)/(d-c+(u-p)),e.copy(n).addScaledVector(Jt,s);const m=1/(g+f+h);return a=f*m,s=h*m,e.copy(i).addScaledVector(Zt,a).addScaledVector(Xt,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let ee=0;class ie extends n{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ee++}),this.uuid=o(),this.name="",this.type="Material",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.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}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.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.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.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.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()),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),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.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.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.attenuationColor&&(i.attenuationColor=this.attenuationColor.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),!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,void 0!==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),void 0!==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),!1===this.fog&&(i.fog=!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.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.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++}}class ne extends ie{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new B(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.fog=!0,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.fog=t.fog,this}}const re=new Q,ae=new g;class se{constructor(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,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}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)ae.fromBufferAttribute(this,e),ae.applyMatrix3(t),this.setXY(e,ae.x,ae.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)re.fromBufferAttribute(this,e),re.applyMatrix3(t),this.setXYZ(e,re.x,re.y,re.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)re.fromBufferAttribute(this,e),re.applyMatrix4(t),this.setXYZ(e,re.x,re.y,re.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)re.fromBufferAttribute(this,e),re.applyNormalMatrix(t),this.setXYZ(e,re.x,re.y,re.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)re.fromBufferAttribute(this,e),re.transformDirection(t),this.setXYZ(e,re.x,re.y,re.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=p(e,this.array)),e}setX(t,e){return this.normalized&&(e=f(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=p(e,this.array)),e}setY(t,e){return this.normalized&&(e=f(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=p(e,this.array)),e}setZ(t,e){return this.normalized&&(e=f(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=p(e,this.array)),e}setW(t,e){return this.normalized&&(e=f(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=f(e,this.array),i=f(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=f(e,this.array),i=f(i,this.array),n=f(n,this.array)),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.normalized&&(e=f(e,this.array),i=f(i,this.array),n=f(n,this.array),r=f(r,this.array)),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.from(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}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class oe extends se{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class le extends se{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class ce extends se{constructor(t,e,i){super(new Float32Array(t),e,i)}}let de=0;const he=new vt,ue=new Ht,pe=new Q,fe=new j,ge=new j,me=new Q;class be extends n{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:de++}),this.uuid=o(),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(b(t)?le:oe)(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 m).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 he.makeRotationFromQuaternion(t),this.applyMatrix4(he),this}rotateX(t){return he.makeRotationX(t),this.applyMatrix4(he),this}rotateY(t){return he.makeRotationY(t),this.applyMatrix4(he),this}rotateZ(t){return he.makeRotationZ(t),this.applyMatrix4(he),this}translate(t,e,i){return he.makeTranslation(t,e,i),this.applyMatrix4(he),this}scale(t,e,i){return he.makeScale(t,e,i),this.applyMatrix4(he),this}lookAt(t){return ue.lookAt(t),ue.updateMatrix(),this.applyMatrix4(ue.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(pe).negate(),this.translate(pe.x,pe.y,pe.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 ce(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new j);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 Q(-1/0,-1/0,-1/0),new Q(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];fe.setFromBufferAttribute(i),this.morphTargetsRelative?(me.addVectors(this.boundingBox.min,fe.min),this.boundingBox.expandByPoint(me),me.addVectors(this.boundingBox.max,fe.max),this.boundingBox.expandByPoint(me)):(this.boundingBox.expandByPoint(fe.min),this.boundingBox.expandByPoint(fe.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 ct);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 Q,1/0);if(t){const i=this.boundingSphere.center;if(fe.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];ge.setFromBufferAttribute(i),this.morphTargetsRelative?(me.addVectors(fe.min,ge.min),fe.expandByPoint(me),me.addVectors(fe.max,ge.max),fe.expandByPoint(me)):(fe.expandByPoint(ge.min),fe.expandByPoint(ge.max))}fe.getCenter(i);let n=0;for(let e=0,r=t.count;e<r;e++)me.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(me));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++)me.fromBufferAttribute(a,e),s&&(pe.fromBufferAttribute(t,e),me.add(pe)),n=Math.max(n,i.distanceToSquared(me))}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;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new se(new Float32Array(4*s),4));const o=this.getAttribute("tangent").array,l=[],c=[];for(let t=0;t<s;t++)l[t]=new Q,c[t]=new Q;const d=new Q,h=new Q,u=new Q,p=new g,f=new g,m=new g,b=new Q,v=new Q;function y(t,e,i){d.fromArray(n,3*t),h.fromArray(n,3*e),u.fromArray(n,3*i),p.fromArray(a,2*t),f.fromArray(a,2*e),m.fromArray(a,2*i),h.sub(d),u.sub(d),f.sub(p),m.sub(p);const r=1/(f.x*m.y-m.x*f.y);isFinite(r)&&(b.copy(h).multiplyScalar(m.y).addScaledVector(u,-f.y).multiplyScalar(r),v.copy(u).multiplyScalar(f.x).addScaledVector(h,-m.x).multiplyScalar(r),l[t].add(b),l[e].add(b),l[i].add(b),c[t].add(v),c[e].add(v),c[i].add(v))}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)y(i[t+0],i[t+1],i[t+2])}const _=new Q,A=new Q,C=new Q,w=new Q;function M(t){C.fromArray(r,3*t),w.copy(C);const e=l[t];_.copy(e),_.sub(C.multiplyScalar(C.dot(e))).normalize(),A.crossVectors(w,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 se(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 Q,r=new Q,a=new Q,s=new Q,o=new Q,l=new Q,c=new Q,d=new Q;if(t)for(let h=0,u=t.count;h<u;h+=3){const u=t.getX(h+0),p=t.getX(h+1),f=t.getX(h+2);n.fromBufferAttribute(e,u),r.fromBufferAttribute(e,p),a.fromBufferAttribute(e,f),c.subVectors(a,r),d.subVectors(n,r),c.cross(d),s.fromBufferAttribute(i,u),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,f),s.add(c),o.add(c),l.add(c),i.setXYZ(u,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),d.subVectors(n,r),c.cross(d),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(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)me.fromBufferAttribute(t,e),me.normalize(),t.setXYZ(e,me.x,me.y,me.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 se(a,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new be,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"})}}const ve=new vt,ye=new bt,xe=new ct,_e=new Q,Ae=new Q,Ce=new Q,we=new Q,Me=new Q,Ie=new Q,Ee=new Q,Se=new Q,Be=new Q,Fe=new g,Te=new g,Ue=new g,Le=new Q,De=new Q;class Re extends Ht{constructor(t=new be,e=new ne){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),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.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}raycast(t,e){const i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0===n)return;if(null===i.boundingSphere&&i.computeBoundingSphere(),xe.copy(i.boundingSphere),xe.applyMatrix4(r),!1===t.ray.intersectsSphere(xe))return;if(ve.copy(r).invert(),ye.copy(t.ray).applyMatrix4(ve),null!==i.boundingBox&&!1===ye.intersectsBox(i.boundingBox))return;let a;const s=i.index,o=i.attributes.position,l=i.morphAttributes.position,c=i.morphTargetsRelative,d=i.attributes.uv,h=i.attributes.uv2,u=i.groups,p=i.drawRange;if(null!==s)if(Array.isArray(n))for(let i=0,r=u.length;i<r;i++){const r=u[i],f=n[r.materialIndex];for(let i=Math.max(r.start,p.start),n=Math.min(s.count,Math.min(r.start+r.count,p.start+p.count));i<n;i+=3){const n=s.getX(i),u=s.getX(i+1),p=s.getX(i+2);a=ke(this,f,t,ye,o,l,c,d,h,n,u,p),a&&(a.faceIndex=Math.floor(i/3),a.face.materialIndex=r.materialIndex,e.push(a))}}else{for(let i=Math.max(0,p.start),r=Math.min(s.count,p.start+p.count);i<r;i+=3){const r=s.getX(i),u=s.getX(i+1),p=s.getX(i+2);a=ke(this,n,t,ye,o,l,c,d,h,r,u,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],s=n[r.materialIndex];for(let i=Math.max(r.start,p.start),n=Math.min(o.count,Math.min(r.start+r.count,p.start+p.count));i<n;i+=3){a=ke(this,s,t,ye,o,l,c,d,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,p.start),r=Math.min(o.count,p.start+p.count);i<r;i+=3){a=ke(this,n,t,ye,o,l,c,d,h,i,i+1,i+2),a&&(a.faceIndex=Math.floor(i/3),e.push(a))}}}}function ke(t,e,i,n,r,a,s,o,l,c,d,h){_e.fromBufferAttribute(r,c),Ae.fromBufferAttribute(r,d),Ce.fromBufferAttribute(r,h);const u=t.morphTargetInfluences;if(a&&u){Ee.set(0,0,0),Se.set(0,0,0),Be.set(0,0,0);for(let t=0,e=a.length;t<e;t++){const e=u[t],i=a[t];0!==e&&(we.fromBufferAttribute(i,c),Me.fromBufferAttribute(i,d),Ie.fromBufferAttribute(i,h),s?(Ee.addScaledVector(we,e),Se.addScaledVector(Me,e),Be.addScaledVector(Ie,e)):(Ee.addScaledVector(we.sub(_e),e),Se.addScaledVector(Me.sub(Ae),e),Be.addScaledVector(Ie.sub(Ce),e)))}_e.add(Ee),Ae.add(Se),Ce.add(Be)}t.isSkinnedMesh&&(t.boneTransform(c,_e),t.boneTransform(d,Ae),t.boneTransform(h,Ce));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;De.copy(o),De.applyMatrix4(t.matrixWorld);const c=i.ray.origin.distanceTo(De);return c<i.near||c>i.far?null:{distance:c,point:De.clone(),object:t}}(t,e,i,n,_e,Ae,Ce,Le);if(p){o&&(Fe.fromBufferAttribute(o,c),Te.fromBufferAttribute(o,d),Ue.fromBufferAttribute(o,h),p.uv=te.getUV(Le,_e,Ae,Ce,Fe,Te,Ue,new g)),l&&(Fe.fromBufferAttribute(l,c),Te.fromBufferAttribute(l,d),Ue.fromBufferAttribute(l,h),p.uv2=te.getUV(Le,_e,Ae,Ce,Fe,Te,Ue,new g));const t={a:c,b:d,c:h,normal:new Q,materialIndex:0};te.getNormal(_e,Ae,Ce,t.normal),p.face=t}return p}class Ne extends be{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=[],d=[];let h=0,u=0;function p(t,e,i,n,r,a,p,f,g,m,b){const v=a/g,y=p/m,x=a/2,_=p/2,A=f/2,C=g+1,w=m+1;let M=0,I=0;const E=new Q;for(let a=0;a<w;a++){const s=a*y-_;for(let o=0;o<C;o++){const h=o*v-x;E[t]=h*n,E[e]=s*r,E[i]=A,l.push(E.x,E.y,E.z),E[t]=0,E[e]=0,E[i]=f>0?1:-1,c.push(E.x,E.y,E.z),d.push(o/g),d.push(1-a/m),M+=1}}for(let t=0;t<m;t++)for(let e=0;e<g;e++){const i=h+e+C*t,n=h+e+C*(t+1),r=h+(e+1)+C*(t+1),a=h+(e+1)+C*t;o.push(i,n,a),o.push(n,r,a),I+=6}s.addGroup(u,I,b),u+=I,h+=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 ce(l,3)),this.setAttribute("normal",new ce(c,3)),this.setAttribute("uv",new ce(d,2))}static fromJSON(t){return new Ne(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Pe(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 Oe(t){const e={};for(let i=0;i<t.length;i++){const n=Pe(t[i]);for(const t in n)e[t]=n[t]}return e}const ze={clone:Pe,merge:Oe};class Qe extends ie{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],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&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Pe(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let i=0;i<t.length;i++)e.push(t[i].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,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}}class Ve extends Ht{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new vt,this.projectionMatrix=new vt,this.projectionMatrixInverse=new vt}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)}}class He extends Ve{constructor(t=50,e=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,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*s*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*a*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*s*Math.atan(Math.tan(.5*a*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*a*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*n/t,e-=s.offsetY*i/a,n*=s.width/t,i*=s.height/a}const o=this.filmOffset;0!==o&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+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}}class je extends Ht{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i;const n=new He(90,1,t,e);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new Q(1,0,0)),this.add(n);const r=new He(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Q(-1,0,0)),this.add(r);const a=new He(90,1,t,e);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new Q(0,1,0)),this.add(a);const s=new He(90,1,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new Q(0,-1,0)),this.add(s);const o=new He(90,1,t,e);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new Q(0,0,1)),this.add(o);const l=new He(90,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Q(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.getRenderTarget(),d=t.toneMapping,h=t.xr.enabled;t.toneMapping=0,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(c),t.toneMapping=d,t.xr.enabled=h,i.texture.needsPMREMUpdate=!0}}class Ge extends R{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.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class We extends N{constructor(t,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1},n=[i,i,i,i,i,i];this.texture=new Ge(n,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}fromEquirectangularTexture(t,e){this.texture.type=e.type,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 Ne(5,5,5),r=new Qe({name:"CubemapFromEquirect",uniforms:Pe(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const a=new Re(n,r),s=e.minFilter;1008===e.minFilter&&(e.minFilter=1006);return new je(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)}}const qe=new Q,Ze=new Q,Xe=new m;class Je{constructor(t=new Q(1,0,0),e=0){this.isPlane=!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=qe.subVectors(i,e).cross(Ze.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(qe),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||Xe.getNormalMatrix(t),n=this.coplanarPoint(qe).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)}}const Ye=new ct,Ke=new Q;class $e{constructor(t=new Je,e=new Je,i=new Je,n=new Je,r=new Je,a=new Je){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],d=i[7],h=i[8],u=i[9],p=i[10],f=i[11],g=i[12],m=i[13],b=i[14],v=i[15];return e[0].setComponents(s-n,d-o,f-h,v-g).normalize(),e[1].setComponents(s+n,d+o,f+h,v+g).normalize(),e[2].setComponents(s+r,d+l,f+u,v+m).normalize(),e[3].setComponents(s-r,d-l,f-u,v-m).normalize(),e[4].setComponents(s-a,d-c,f-p,v-b).normalize(),e[5].setComponents(s+a,d+c,f+p,v+b).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ye.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ye)}intersectsSprite(t){return Ye.center.set(0,0,0),Ye.radius=.7071067811865476,Ye.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ye)}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 ti(){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 ei(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();let o;if(t.bindBuffer(n,s),t.bufferData(n,r,a),e.onUploadCallback(),r instanceof Float32Array)o=5126;else if(r instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!i)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");o=5131}else o=5123;else if(r instanceof Int16Array)o=5122;else if(r instanceof Uint32Array)o=5125;else if(r instanceof Int32Array)o=5124;else if(r instanceof Int8Array)o=5120;else if(r instanceof Uint8Array)o=5121;else{if(!(r instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);o=5121}return{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 ii extends be{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,d=t/s,h=e/o,u=[],p=[],f=[],g=[];for(let t=0;t<c;t++){const e=t*h-a;for(let i=0;i<l;i++){const n=i*d-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;u.push(i,n,a),u.push(n,r,a)}this.setIndex(u),this.setAttribute("position",new ce(p,3)),this.setAttribute("normal",new ce(f,3)),this.setAttribute("uv",new ce(g,2))}static fromJSON(t){return new ii(t.width,t.height,t.widthSegments,t.heightSegments)}}const ni={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 F_Schlick( const in float 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}\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\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}\n#ifdef USE_IRIDESCENCE\n\tvec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\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 sheenColor, 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 sheenColor * ( D * V );\n}\n#endif",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\t return vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat R21 = R12;\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\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 = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\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; }\nvec3 pow2( const in vec3 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 v ) { return dot( v, vec3( 0.3333333 ) ); }\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 luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, 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_minMipLevel 4.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\tvec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\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\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_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 ), cubeUV_m0, CUBEUV_MAX_MIP );\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\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:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\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}",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#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\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 ) || defined( LAMBERT )\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 ) || defined( LAMBERT )\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\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 = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\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 vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial 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}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\n#define Material_LightProbeLOD( material )\t(0)",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\tmaterial.ior = ior;\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, 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 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, 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_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\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_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\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}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\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#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 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\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\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\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\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\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\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\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\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 ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\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, vSpotLightCoord[ 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 = lightMapTexel.rgb * lightMapIntensity;\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 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\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\tdiffuseColor *= texture2D( map, uv );\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",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\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 ).xyz * 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 ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\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\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\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 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\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",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.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:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#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\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:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#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\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:"#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 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_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ 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, vSpotLightCoord[ 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\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\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\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= 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, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\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( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in 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( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\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( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in 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( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in 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 ) || NUM_SPOT_LIGHT_COORDS > 0\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\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\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\tgl_FragColor = texture2D( tEquirect, sampleUV );\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 <morphcolor_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#include <morphcolor_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 <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 += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\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 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 <morphcolor_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}",meshlambert_frag:"#define LAMBERT\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_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_lambert_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 <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 <morphcolor_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#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 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\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\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 <morphcolor_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 <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 <morphcolor_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 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\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 <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\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_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\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 - material.clearcoat * Fcc ) + clearcoatSpecular * material.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 <morphcolor_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 <morphcolor_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}"},ri={common:{diffuse:{value:new B(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new m},uv2Transform:{value:new m},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}},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 g(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 B(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:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{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 B(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new m}},sprite:{diffuse:{value:new B(16777215)},opacity:{value:1},center:{value:new g(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new m}}},ai={basic:{uniforms:Oe([ri.common,ri.specularmap,ri.envmap,ri.aomap,ri.lightmap,ri.fog]),vertexShader:ni.meshbasic_vert,fragmentShader:ni.meshbasic_frag},lambert:{uniforms:Oe([ri.common,ri.specularmap,ri.envmap,ri.aomap,ri.lightmap,ri.emissivemap,ri.bumpmap,ri.normalmap,ri.displacementmap,ri.fog,ri.lights,{emissive:{value:new B(0)}}]),vertexShader:ni.meshlambert_vert,fragmentShader:ni.meshlambert_frag},phong:{uniforms:Oe([ri.common,ri.specularmap,ri.envmap,ri.aomap,ri.lightmap,ri.emissivemap,ri.bumpmap,ri.normalmap,ri.displacementmap,ri.fog,ri.lights,{emissive:{value:new B(0)},specular:{value:new B(1118481)},shininess:{value:30}}]),vertexShader:ni.meshphong_vert,fragmentShader:ni.meshphong_frag},standard:{uniforms:Oe([ri.common,ri.envmap,ri.aomap,ri.lightmap,ri.emissivemap,ri.bumpmap,ri.normalmap,ri.displacementmap,ri.roughnessmap,ri.metalnessmap,ri.fog,ri.lights,{emissive:{value:new B(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ni.meshphysical_vert,fragmentShader:ni.meshphysical_frag},toon:{uniforms:Oe([ri.common,ri.aomap,ri.lightmap,ri.emissivemap,ri.bumpmap,ri.normalmap,ri.displacementmap,ri.gradientmap,ri.fog,ri.lights,{emissive:{value:new B(0)}}]),vertexShader:ni.meshtoon_vert,fragmentShader:ni.meshtoon_frag},matcap:{uniforms:Oe([ri.common,ri.bumpmap,ri.normalmap,ri.displacementmap,ri.fog,{matcap:{value:null}}]),vertexShader:ni.meshmatcap_vert,fragmentShader:ni.meshmatcap_frag},points:{uniforms:Oe([ri.points,ri.fog]),vertexShader:ni.points_vert,fragmentShader:ni.points_frag},dashed:{uniforms:Oe([ri.common,ri.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ni.linedashed_vert,fragmentShader:ni.linedashed_frag},depth:{uniforms:Oe([ri.common,ri.displacementmap]),vertexShader:ni.depth_vert,fragmentShader:ni.depth_frag},normal:{uniforms:Oe([ri.common,ri.bumpmap,ri.normalmap,ri.displacementmap,{opacity:{value:1}}]),vertexShader:ni.meshnormal_vert,fragmentShader:ni.meshnormal_frag},sprite:{uniforms:Oe([ri.sprite,ri.fog]),vertexShader:ni.sprite_vert,fragmentShader:ni.sprite_frag},background:{uniforms:{uvTransform:{value:new m},t2D:{value:null}},vertexShader:ni.background_vert,fragmentShader:ni.background_frag},cube:{uniforms:Oe([ri.envmap,{opacity:{value:1}}]),vertexShader:ni.cube_vert,fragmentShader:ni.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ni.equirect_vert,fragmentShader:ni.equirect_frag},distanceRGBA:{uniforms:Oe([ri.common,ri.displacementmap,{referencePosition:{value:new Q},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ni.distanceRGBA_vert,fragmentShader:ni.distanceRGBA_frag},shadow:{uniforms:Oe([ri.lights,ri.fog,{color:{value:new B(0)},opacity:{value:1}}]),vertexShader:ni.shadow_vert,fragmentShader:ni.shadow_frag}};function si(t,e,i,n,r,a){const s=new B(0);let o,l,c=!0===r?0:1,d=null,h=0,u=null;function p(t,e){i.buffers.color.setClear(t.r,t.g,t.b,e,a)}return{getClearColor:function(){return s},setClearColor:function(t,e=1){s.set(t),c=e,p(s,c)},getClearAlpha:function(){return c},setClearAlpha:function(t){c=t,p(s,c)},render:function(i,r){let a=!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?p(s,c):f&&f.isColor&&(p(f,1),a=!0),(t.autoClear||a)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||306===f.mapping)?(void 0===l&&(l=new Re(new Ne(1,1,1),new Qe({name:"BackgroundCubeMaterial",uniforms:Pe(ai.cube.uniforms),vertexShader:ai.cube.vertexShader,fragmentShader:ai.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=f,l.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,d===f&&h===f.version&&u===t.toneMapping||(l.material.needsUpdate=!0,d=f,h=f.version,u=t.toneMapping),l.layers.enableAll(),i.unshift(l,l.geometry,l.material,0,0,null)):f&&f.isTexture&&(void 0===o&&(o=new Re(new ii(2,2),new Qe({name:"BackgroundMaterial",uniforms:Pe(ai.background.uniforms),vertexShader:ai.background.vertexShader,fragmentShader:ai.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=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),o.material.uniforms.uvTransform.value.copy(f.matrix),d===f&&h===f.version&&u===t.toneMapping||(o.material.needsUpdate=!0,d=f,h=f.version,u=t.toneMapping),o.layers.enableAll(),i.unshift(o,o.geometry,o.material,0,0,null))}}}function oi(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=p(null);let c=l,d=!1;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 p(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 f(){const t=c.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function g(t){m(t,0)}function m(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 b(){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 v(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(){x(),d=!0,c!==l&&(c=l,h(c.object))}function x(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,u,y,x){let _=!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 d=c[s];void 0===d&&(d=p(n.isWebGL2?t.createVertexArray():a.createVertexArrayOES()),c[s]=d);return d}(y,u,l);c!==e&&(c=e,h(c.object)),_=function(t,e,i,n){const r=c.attributes,a=e.attributes;let s=0;const o=i.getAttributes();for(const e in o){if(o[e].location>=0){const i=r[e];let n=a[e];if(void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor)),void 0===i)return!0;if(i.attribute!==n)return!0;if(n&&i.data!==n.data)return!0;s++}}return c.attributesNum!==s||c.index!==n}(r,y,u,x),_&&function(t,e,i,n){const r={},a=e.attributes;let s=0;const o=i.getAttributes();for(const e in o){if(o[e].location>=0){let i=a[e];void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor));const n={};n.attribute=i,i&&i.data&&(n.data=i.data),r[e]=n,s++}}c.attributes=r,c.attributesNum=s,c.index=n}(r,y,u,x)}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,_=!0)}null!==x&&i.update(x,34963),(_||d)&&(d=!1,function(r,a,s,o){if(!1===n.isWebGL2&&(r.isInstancedMesh||o.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;f();const l=o.attributes,c=s.getAttributes(),d=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,d=l.type,h=l.bytesPerElement;if(a.isInterleavedBufferAttribute){const i=a.data,l=i.stride,u=a.offset;if(i.isInstancedInterleavedBuffer){for(let t=0;t<n.locationSize;t++)m(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++)g(n.location+t);t.bindBuffer(34962,c);for(let t=0;t<n.locationSize;t++)v(n.location+t,s/n.locationSize,d,e,l*h,(u+s/n.locationSize*t)*h)}else{if(a.isInstancedBufferAttribute){for(let t=0;t<n.locationSize;t++)m(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++)g(n.location+t);t.bindBuffer(34962,c);for(let t=0;t<n.locationSize;t++)v(n.location+t,s/n.locationSize,d,e,s*h,s/n.locationSize*t*h)}}else if(void 0!==d){const i=d[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)}}}}b()}(r,l,u,y),null!==x&&t.bindBuffer(34963,i.get(x).buffer))},reset:y,resetDefaultState:x,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:f,enableAttribute:g,disableUnusedAttributes:b}}function li(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 ci(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,d=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),f=t.getParameter(34921),g=t.getParameter(36347),m=t.getParameter(36348),b=t.getParameter(36349),v=h>0,y=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:d,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:g,maxVaryings:m,maxFragmentUniforms:b,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:a?t.getParameter(36183):0}}function di(t){const e=this;let i=null,n=0,r=!1,a=!1;const s=new Je,o=new m,l={value:null,needsUpdate:!1};function c(){l.value!==i&&(l.value=i,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(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=d(t,a,0),n=t.length,s},this.beginShadows=function(){a=!0,d(null)},this.endShadows=function(){a=!1,c()},this.setState=function(e,s,o){const h=e.clippingPlanes,u=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!r||null===h||0===h.length||a&&!p)a?d(null):c();else{const t=a?0:n,e=4*t;let r=f.clippingState||null;l.value=r,r=d(h,s,e,o);for(let t=0;t!==e;++t)r[t]=i[t];f.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=t}}}function hi(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=new We(a.height/2);return s.fromEquirectangularTexture(t,r),e.set(r,s),r.addEventListener("dispose",n),i(s.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}ai.physical={uniforms:Oe([ai.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new g(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new B(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new g},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new B(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new B(1,1,1)},specularColorMap:{value:null}}]),vertexShader:ni.meshphysical_vert,fragmentShader:ni.meshphysical_frag};class ui extends Ve{constructor(t=-1,e=1,i=1,n=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,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}}const pi=[.125,.215,.35,.446,.526,.582],fi=new ui,gi=new B;let mi=null;const bi=(1+Math.sqrt(5))/2,vi=1/bi,yi=[new Q(1,1,1),new Q(-1,1,1),new Q(1,1,-1),new Q(-1,1,-1),new Q(0,bi,vi),new Q(0,bi,-vi),new Q(vi,0,bi),new Q(-vi,0,bi),new Q(bi,vi,0),new Q(-bi,vi,0)];class xi{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,i=.1,n=100){mi=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,i,n,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=wi(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Ci(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(mi),t.scissorTest=!1,Ai(t,0,0,t.width,t.height)}_fromTexture(t,e){301===t.mapping||302===t.mapping?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),mi=this._renderer.getRenderTarget();const i=e||this._allocateTargets();return this._textureToCubeUV(t,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,encoding:3e3,depthBuffer:!1},n=_i(t,e,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=_i(t,e,i);const{_lodMax:n}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],i=[],n=[];let r=t;const a=t-4+1+pi.length;for(let s=0;s<a;s++){const a=Math.pow(2,r);i.push(a);let o=1/a;s>t-4?o=pi[s-t+4-1]:0===s&&(o=0),n.push(o);const l=1/(a-2),c=-l,d=1+l,h=[c,c,d,c,d,d,c,c,d,d,c,d],u=6,p=6,f=3,g=2,m=1,b=new Float32Array(f*p*u),v=new Float32Array(g*p*u),y=new Float32Array(m*p*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];b.set(n,f*p*t),v.set(h,g*p*t);const r=[t,t,t,t,t,t];y.set(r,m*p*t)}const x=new be;x.setAttribute("position",new se(b,f)),x.setAttribute("uv",new se(v,g)),x.setAttribute("faceIndex",new se(y,m)),e.push(x),r>4&&r--}return{lodPlanes:e,sizeLods:i,sigmas:n}}(n)),this._blurMaterial=function(t,e,i){const n=new Float32Array(20),r=new Q(0,1,0);return new Qe({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:t+".0"},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Mi(),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#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}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(n,t,e)}return n}_compileMaterial(t){const e=new Re(this._lodPlanes[0],t);this._renderer.compile(e,fi)}_sceneToCubeUV(t,e,i,n){const r=new He(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.toneMapping;o.getClearColor(gi),o.toneMapping=0,o.autoClear=!1;const d=new ne({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),h=new Re(new Ne,d);let u=!1;const p=t.background;p?p.isColor&&(d.color.copy(p),t.background=null,u=!0):(d.color.copy(gi),u=!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]));const l=this._cubeSize;Ai(n,i*l,e>2?l:0,l,l),o.setRenderTarget(n),u&&o.render(h,r),o.render(t,r)}h.geometry.dispose(),h.material.dispose(),o.toneMapping=c,o.autoClear=l,t.background=p}_textureToCubeUV(t,e){const i=this._renderer,n=301===t.mapping||302===t.mapping;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=wi()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Ci());const r=n?this._cubemapMaterial:this._equirectMaterial,a=new Re(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const s=this._cubeSize;Ai(e,0,0,3*s,2*s),i.setRenderTarget(e),i.render(a,fi)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let e=1;e<this._lodPlanes.length;e++){const i=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),n=yi[(e-1)%yi.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 Re(this._lodPlanes[n],l),d=l.uniforms,h=this._sizeLods[i]-1,u=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/u,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;d.envMap.value=t.texture,d.samples.value=f,d.weights.value=g,d.latitudinal.value="latitudinal"===a,s&&(d.poleAxis.value=s);const{_lodMax:b}=this;d.dTheta.value=u,d.mipInt.value=b-i;const v=this._sizeLods[n];Ai(e,3*v*(n>b-4?n-b+4:0),4*(this._cubeSize-v),3*v,2*v),o.setRenderTarget(e),o.render(c,fi)}}function _i(t,e,i){const n=new N(t,e,i);return n.texture.mapping=306,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ai(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function Ci(){return new Qe({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Mi(),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\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function wi(){return new Qe({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Mi(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Mi(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\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 Ii(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){const a=r.mapping,s=303===a||304===a,o=301===a||302===a;if(s||o){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let n=e.get(r);return null===i&&(i=new xi(t)),n=s?i.fromEquirectangular(r,n):i.fromCubemap(r,n),e.set(r,n),n.texture}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)){null===i&&(i=new xi(t));const a=s?i.fromEquirectangular(r):i.fromCubemap(r);return e.set(r,a),r.addEventListener("dispose",n),a.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==i&&(i.dispose(),i=null)}}}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"),i("WEBGL_multisampled_render_to_texture")},get:function(t){const e=i(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function Si(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(b(i)?le:oe)(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 Bi(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 d,h;if(r)d=t,h="drawElementsInstanced";else if(d=e.get("ANGLE_instanced_arrays"),h="drawElementsInstancedANGLE",null===d)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");d[h](a,l,s,n*o,c),i.update(l,a,c)}}function Fi(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 Ti(t,e){return t[0]-e[0]}function Ui(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Li(t,e,i){const n={},r=new Float32Array(8),a=new WeakMap,s=new k,o=[];for(let t=0;t<8;t++)o[t]=[t,0];return{update:function(l,c,d,h){const u=l.morphTargetInfluences;if(!0===e.isWebGL2){const n=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,r=void 0!==n?n.length:0;let o=a.get(c);if(void 0===o||o.count!==r){void 0!==o&&o.texture.dispose();const t=void 0!==c.morphAttributes.position,i=void 0!==c.morphAttributes.normal,n=void 0!==c.morphAttributes.color,l=c.morphAttributes.position||[],d=c.morphAttributes.normal||[],h=c.morphAttributes.color||[];let u=0;!0===t&&(u=1),!0===i&&(u=2),!0===n&&(u=3);let p=c.attributes.position.count*u,f=1;p>e.maxTextureSize&&(f=Math.ceil(p/e.maxTextureSize),p=e.maxTextureSize);const m=new Float32Array(p*f*4*r),b=new P(m,p,f,r);b.type=1015,b.needsUpdate=!0;const v=4*u;for(let e=0;e<r;e++){const r=l[e],a=d[e],o=h[e],c=p*f*4*e;for(let e=0;e<r.count;e++){const l=e*v;!0===t&&(s.fromBufferAttribute(r,e),m[c+l+0]=s.x,m[c+l+1]=s.y,m[c+l+2]=s.z,m[c+l+3]=0),!0===i&&(s.fromBufferAttribute(a,e),m[c+l+4]=s.x,m[c+l+5]=s.y,m[c+l+6]=s.z,m[c+l+7]=0),!0===n&&(s.fromBufferAttribute(o,e),m[c+l+8]=s.x,m[c+l+9]=s.y,m[c+l+10]=s.z,m[c+l+11]=4===o.itemSize?s.w:1)}}o={count:r,texture:b,size:new g(p,f)},a.set(c,o),c.addEventListener("dispose",(function t(){b.dispose(),a.delete(c),c.removeEventListener("dispose",t)}))}let l=0;for(let t=0;t<u.length;t++)l+=u[t];const d=c.morphTargetsRelative?1:1-l;h.getUniforms().setValue(t,"morphTargetBaseInfluence",d),h.getUniforms().setValue(t,"morphTargetInfluences",u),h.getUniforms().setValue(t,"morphTargetsTexture",o.texture,i),h.getUniforms().setValue(t,"morphTargetsTextureSize",o.size)}else{const e=void 0===u?0:u.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]=u[t]}i.sort(Ui);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(Ti);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 d=c.morphTargetsRelative?1:1-l;h.getUniforms().setValue(t,"morphTargetBaseInfluence",d),h.getUniforms().setValue(t,"morphTargetInfluences",r)}}}}function Di(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}}}const Ri=new R,ki=new P,Ni=new O,Pi=new Ge,Oi=[],zi=[],Qi=new Float32Array(16),Vi=new Float32Array(9),Hi=new Float32Array(4);function ji(t,e,i){const n=t[0];if(n<=0||n>0)return t;const r=e*i;let a=Oi[r];if(void 0===a&&(a=new Float32Array(r),Oi[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 Gi(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 Wi(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function qi(t,e){let i=zi[e];void 0===i&&(i=new Int32Array(e),zi[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function Zi(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Xi(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(Gi(i,e))return;t.uniform2fv(this.addr,e),Wi(i,e)}}function Ji(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(Gi(i,e))return;t.uniform3fv(this.addr,e),Wi(i,e)}}function Yi(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(Gi(i,e))return;t.uniform4fv(this.addr,e),Wi(i,e)}}function Ki(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Gi(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Wi(i,e)}else{if(Gi(i,n))return;Hi.set(n),t.uniformMatrix2fv(this.addr,!1,Hi),Wi(i,n)}}function $i(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Gi(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Wi(i,e)}else{if(Gi(i,n))return;Vi.set(n),t.uniformMatrix3fv(this.addr,!1,Vi),Wi(i,n)}}function tn(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Gi(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Wi(i,e)}else{if(Gi(i,n))return;Qi.set(n),t.uniformMatrix4fv(this.addr,!1,Qi),Wi(i,n)}}function en(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function nn(t,e){const i=this.cache;Gi(i,e)||(t.uniform2iv(this.addr,e),Wi(i,e))}function rn(t,e){const i=this.cache;Gi(i,e)||(t.uniform3iv(this.addr,e),Wi(i,e))}function an(t,e){const i=this.cache;Gi(i,e)||(t.uniform4iv(this.addr,e),Wi(i,e))}function sn(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function on(t,e){const i=this.cache;Gi(i,e)||(t.uniform2uiv(this.addr,e),Wi(i,e))}function ln(t,e){const i=this.cache;Gi(i,e)||(t.uniform3uiv(this.addr,e),Wi(i,e))}function cn(t,e){const i=this.cache;Gi(i,e)||(t.uniform4uiv(this.addr,e),Wi(i,e))}function dn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2D(e||Ri,r)}function hn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||Ni,r)}function un(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(e||Pi,r)}function pn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||ki,r)}function fn(t,e){t.uniform1fv(this.addr,e)}function gn(t,e){const i=ji(e,this.size,2);t.uniform2fv(this.addr,i)}function mn(t,e){const i=ji(e,this.size,3);t.uniform3fv(this.addr,i)}function bn(t,e){const i=ji(e,this.size,4);t.uniform4fv(this.addr,i)}function vn(t,e){const i=ji(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function yn(t,e){const i=ji(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function xn(t,e){const i=ji(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function _n(t,e){t.uniform1iv(this.addr,e)}function An(t,e){t.uniform2iv(this.addr,e)}function Cn(t,e){t.uniform3iv(this.addr,e)}function wn(t,e){t.uniform4iv(this.addr,e)}function Mn(t,e){t.uniform1uiv(this.addr,e)}function In(t,e){t.uniform2uiv(this.addr,e)}function En(t,e){t.uniform3uiv(this.addr,e)}function Sn(t,e){t.uniform4uiv(this.addr,e)}function Bn(t,e,i){const n=e.length,r=qi(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.setTexture2D(e[t]||Ri,r[t])}function Fn(t,e,i){const n=e.length,r=qi(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.setTexture3D(e[t]||Ni,r[t])}function Tn(t,e,i){const n=e.length,r=qi(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.setTextureCube(e[t]||Pi,r[t])}function Un(t,e,i){const n=e.length,r=qi(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.setTexture2DArray(e[t]||ki,r[t])}class Ln{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Zi;case 35664:return Xi;case 35665:return Ji;case 35666:return Yi;case 35674:return Ki;case 35675:return $i;case 35676:return tn;case 5124:case 35670:return en;case 35667:case 35671:return nn;case 35668:case 35672:return rn;case 35669:case 35673:return an;case 5125:return sn;case 36294:return on;case 36295:return ln;case 36296:return cn;case 35678:case 36198:case 36298:case 36306:case 35682:return dn;case 35679:case 36299:case 36307:return hn;case 35680:case 36300:case 36308:case 36293:return un;case 36289:case 36303:case 36311:case 36292:return pn}}(e.type)}}class Dn{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return fn;case 35664:return gn;case 35665:return mn;case 35666:return bn;case 35674:return vn;case 35675:return yn;case 35676:return xn;case 5124:case 35670:return _n;case 35667:case 35671:return An;case 35668:case 35672:return Cn;case 35669:case 35673:return wn;case 5125:return Mn;case 36294:return In;case 36295:return En;case 36296:return Sn;case 35678:case 36198:case 36298:case 36306:case 35682:return Bn;case 35679:case 36299:case 36307:return Fn;case 35680:case 36300:case 36308:case 36293:return Tn;case 36289:case 36303:case 36311:case 36292:return Un}}(e.type)}}class Rn{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(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 kn=/(\w+)(\])?(\[|\.)?/g;function Nn(t,e){t.seq.push(e),t.map[e.id]=e}function Pn(t,e,i){const n=t.name,r=n.length;for(kn.lastIndex=0;;){const a=kn.exec(n),s=kn.lastIndex;let o=a[1];const l="]"===a[2],c=a[3];if(l&&(o|=0),void 0===c||"["===c&&s+2===r){Nn(i,void 0===c?new Ln(o,t,e):new Dn(o,t,e));break}{let t=i.map[o];void 0===t&&(t=new Rn(o),Nn(i,t)),i=t}}}class On{constructor(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);Pn(i,t.getUniformLocation(e,i.name),this)}}setValue(t,e,i,n){const r=this.map[e];void 0!==r&&r.setValue(t,i,n)}setOptional(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)}static upload(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)}}static seqWithValue(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}}function zn(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}let Qn=0;function Vn(t,e,i){const n=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();if(n&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const n=parseInt(a[1]);return i.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){const i=t.split("\n"),n=[],r=Math.max(e-6,0),a=Math.min(e+6,i.length);for(let t=r;t<a;t++){const r=t+1;n.push(`${r===e?">":" "} ${r}: ${i[t]}`)}return n.join("\n")}(t.getShaderSource(e),n)}return r}function Hn(t,e){const i=function(t){switch(t){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function jn(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 Gn(t){return""!==t}function Wn(t,e){const i=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).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_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function qn(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Zn=/^[ \t]*#include +<([\w\d./]+)>/gm;function Xn(t){return t.replace(Zn,Jn)}function Jn(t,e){const i=ni[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return Xn(i)}const Yn=/#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 Kn(t){return t.replace(Yn,$n)}function $n(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 tr(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 er(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:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),d=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case 302:e="ENVMAP_MODE_REFRACTION"}return e}(i),h=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),u=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const i=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:n,maxMip:i}}(i),p=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||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(Gn).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,v=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(m=[f].filter(Gn).join("\n"),m.length>0&&(m+="\n"),b=[p,f].filter(Gn).join("\n"),b.length>0&&(b+="\n")):(m=[tr(i),"#define SHADER_NAME "+i.shaderName,f,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"",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 "+d:"",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.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",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.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",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.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&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(Gn).join("\n"),b=[p,tr(i),"#define SHADER_NAME "+i.shaderName,f,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 "+d:"",i.envMap?"#define "+h:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",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.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",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.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",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":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?ni.tonemapping_pars_fragment:"",0!==i.toneMapping?jn("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",ni.encodings_pars_fragment,Hn("linearToOutputTexel",i.outputEncoding),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Gn).join("\n")),s=Xn(s),s=Wn(s,i),s=qn(s,i),o=Xn(o),o=Wn(o,i),o=qn(o,i),s=Kn(s),o=Kn(o),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(v="#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?"":"layout(location = 0) 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 y=v+b+o,x=zn(r,35633,v+m+s),_=zn(r,35632,y);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=Vn(r,x,"vertex"),i=Vn(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,C;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===C&&(C=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)),C},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(g),this.program=void 0},this.name=i.shaderName,this.id=Qn++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=x,this.fragmentShader=_,this}let ir=0;class nr{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,i=t.fragmentShader,n=this._getShaderStage(e),r=this._getShaderStage(i),a=this._getShaderCacheForMaterial(t);return!1===a.has(n)&&(a.add(n),n.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let i=e.get(t);return void 0===i&&(i=new Set,e.set(t,i)),i}_getShaderStage(t){const e=this.shaderCache;let i=e.get(t);return void 0===i&&(i=new rr(t),e.set(t,i)),i}}class rr{constructor(t){this.id=ir++,this.code=t,this.usedTimes=0}}function ar(t,e,i,n,r,a,s){const o=new Bt,l=new nr,c=[],d=r.isWebGL2,h=r.logarithmicDepthBuffer,u=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"};return{getParameters:function(a,o,c,g,m){const b=g.fog,v=m.geometry,y=a.isMeshStandardMaterial?g.environment:null,x=(a.isMeshStandardMaterial?i:e).get(a.envMap||y),_=x&&306===x.mapping?x.image.height:null,A=f[a.type];null!==a.precision&&(p=r.getMaxPrecision(a.precision),p!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead."));const C=v.morphAttributes.position||v.morphAttributes.normal||v.morphAttributes.color,w=void 0!==C?C.length:0;let M,I,E,S,B=0;if(void 0!==v.morphAttributes.position&&(B=1),void 0!==v.morphAttributes.normal&&(B=2),void 0!==v.morphAttributes.color&&(B=3),A){const t=ai[A];M=t.vertexShader,I=t.fragmentShader}else M=a.vertexShader,I=a.fragmentShader,l.update(a),E=l.getVertexShaderID(a),S=l.getFragmentShaderID(a);const F=t.getRenderTarget(),T=a.alphaTest>0,U=a.clearcoat>0,L=a.iridescence>0;return{isWebGL2:d,shaderID:A,shaderName:a.type,vertexShader:M,fragmentShader:I,defines:a.defines,customVertexShaderID:E,customFragmentShaderID:S,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,instancing:!0===m.isInstancedMesh,instancingColor:!0===m.isInstancedMesh&&null!==m.instanceColor,supportsVertexTextures:u,outputEncoding:null===F?t.outputEncoding:!0===F.isXRRenderTarget?F.texture.encoding:3e3,map:!!a.map,matcap:!!a.matcap,envMap:!!x,envMapMode:x&&x.mapping,envMapCubeUVHeight:_,lightMap:!!a.lightMap,aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:1===a.normalMapType,tangentSpaceNormalMap:0===a.normalMapType,decodeVideoTexture:!!a.map&&!0===a.map.isVideoTexture&&3001===a.map.encoding,clearcoat:U,clearcoatMap:U&&!!a.clearcoatMap,clearcoatRoughnessMap:U&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:U&&!!a.clearcoatNormalMap,iridescence:L,iridescenceMap:L&&!!a.iridescenceMap,iridescenceThicknessMap:L&&!!a.iridescenceThicknessMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularColorMap:!!a.specularColorMap,opaque:!1===a.transparent&&1===a.blending,alphaMap:!!a.alphaMap,alphaTest:T,gradientMap:!!a.gradientMap,sheen:a.sheen>0,sheenColorMap:!!a.sheenColorMap,sheenRoughnessMap:!!a.sheenRoughnessMap,transmission:a.transmission>0,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!v.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!v.attributes.color&&4===v.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.iridescenceMap||a.iridescenceThicknessMap||a.displacementMap||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheenColorMap||a.sheenRoughnessMap),uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.iridescenceMap||a.iridescenceThicknessMap||a.transmission>0||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheen>0||a.sheenColorMap||a.sheenRoughnessMap||!a.displacementMap),fog:!!b,useFog:!0===a.fog,fogExp2:b&&b.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===m.isSkinnedMesh,morphTargets:void 0!==v.morphAttributes.position,morphNormals:void 0!==v.morphAttributes.normal,morphColors:void 0!==v.morphAttributes.color,morphTargetsCount:w,morphTextureStride:B,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&c.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,useDepthPacking:!!a.depthPacking,depthPacking:a.depthPacking||0,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:d||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||n.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.customVertexShaderID),i.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.combine),t.push(e.vertexUvs),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(i,e),function(t,e){o.disableAll(),e.isWebGL2&&o.enable(0);e.supportsVertexTextures&&o.enable(1);e.instancing&&o.enable(2);e.instancingColor&&o.enable(3);e.map&&o.enable(4);e.matcap&&o.enable(5);e.envMap&&o.enable(6);e.lightMap&&o.enable(7);e.aoMap&&o.enable(8);e.emissiveMap&&o.enable(9);e.bumpMap&&o.enable(10);e.normalMap&&o.enable(11);e.objectSpaceNormalMap&&o.enable(12);e.tangentSpaceNormalMap&&o.enable(13);e.clearcoat&&o.enable(14);e.clearcoatMap&&o.enable(15);e.clearcoatRoughnessMap&&o.enable(16);e.clearcoatNormalMap&&o.enable(17);e.iridescence&&o.enable(18);e.iridescenceMap&&o.enable(19);e.iridescenceThicknessMap&&o.enable(20);e.displacementMap&&o.enable(21);e.specularMap&&o.enable(22);e.roughnessMap&&o.enable(23);e.metalnessMap&&o.enable(24);e.gradientMap&&o.enable(25);e.alphaMap&&o.enable(26);e.alphaTest&&o.enable(27);e.vertexColors&&o.enable(28);e.vertexAlphas&&o.enable(29);e.vertexUvs&&o.enable(30);e.vertexTangents&&o.enable(31);e.uvsVertexOnly&&o.enable(32);t.push(o.mask),o.disableAll(),e.fog&&o.enable(0);e.useFog&&o.enable(1);e.flatShading&&o.enable(2);e.logarithmicDepthBuffer&&o.enable(3);e.skinning&&o.enable(4);e.morphTargets&&o.enable(5);e.morphNormals&&o.enable(6);e.morphColors&&o.enable(7);e.premultipliedAlpha&&o.enable(8);e.shadowMapEnabled&&o.enable(9);e.physicallyCorrectLights&&o.enable(10);e.doubleSided&&o.enable(11);e.flipSided&&o.enable(12);e.useDepthPacking&&o.enable(13);e.dithering&&o.enable(14);e.specularIntensityMap&&o.enable(15);e.specularColorMap&&o.enable(16);e.transmission&&o.enable(17);e.transmissionMap&&o.enable(18);e.thicknessMap&&o.enable(19);e.sheen&&o.enable(20);e.sheenColorMap&&o.enable(21);e.sheenRoughnessMap&&o.enable(22);e.decodeVideoTexture&&o.enable(23);e.opaque&&o.enable(24);t.push(o.mask)}(i,e),i.push(t.outputEncoding)),i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=f[t.type];let i;if(e){const t=ai[e];i=ze.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=c.length;t<e;t++){const e=c[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new er(t,i,e,a),c.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=c.indexOf(t);c[e]=c[c.length-1],c.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:c,dispose:function(){l.dispose()}}}function sr(){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 or(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder: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 lr(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 cr(){const t=[];let e=0;const i=[],n=[],r=[];function a(i,n,r,a,s,o){let l=t[e];return void 0===l?(l={id:i.id,object:i,geometry:n,material:r,groupOrder:a,renderOrder:i.renderOrder,z:s,group:o},t[e]=l):(l.id=i.id,l.object=i,l.geometry=n,l.material=r,l.groupOrder=a,l.renderOrder=i.renderOrder,l.z=s,l.group=o),e++,l}return{opaque:i,transmissive:n,transparent:r,init:function(){e=0,i.length=0,n.length=0,r.length=0},push:function(t,e,s,o,l,c){const d=a(t,e,s,o,l,c);s.transmission>0?n.push(d):!0===s.transparent?r.push(d):i.push(d)},unshift:function(t,e,s,o,l,c){const d=a(t,e,s,o,l,c);s.transmission>0?n.unshift(d):!0===s.transparent?r.unshift(d):i.unshift(d)},finish:function(){for(let i=e,n=t.length;i<n;i++){const e=t[i];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){i.length>1&&i.sort(t||or),n.length>1&&n.sort(e||lr),r.length>1&&r.sort(e||lr)}}}function dr(){let t=new WeakMap;return{get:function(e,i){const n=t.get(e);let r;return void 0===n?(r=new cr,t.set(e,[r])):i>=n.length?(r=new cr,n.push(r)):r=n[i],r},dispose:function(){t=new WeakMap}}}function hr(){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 Q,color:new B};break;case"SpotLight":i={position:new Q,direction:new Q,color:new B,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new Q,color:new B,distance:0,decay:0};break;case"HemisphereLight":i={direction:new Q,skyColor:new B,groundColor:new B};break;case"RectAreaLight":i={color:new B,position:new Q,halfWidth:new Q,halfHeight:new Q}}return t[e.id]=i,i}}}let ur=0;function pr(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function fr(t,e){const i=new hr,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 g};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new g,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,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let t=0;t<9;t++)r.probe.push(new Q);const a=new Q,s=new vt,o=new vt;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 d=0,h=0,u=0,p=0,f=0,g=0,m=0,b=0,v=0,y=0;a.sort(pr);const x=!0!==s?Math.PI:1;for(let t=0,e=a.length;t<e;t++){const e=a[t],s=e.color,_=e.intensity,A=e.distance,C=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)o+=s.r*_*x,l+=s.g*_*x,c+=s.b*_*x;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],_);else if(e.isDirectionalLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*x),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[d]=i,r.directionalShadowMap[d]=C,r.directionalShadowMatrix[d]=e.shadow.matrix,g++}r.directional[d]=t,d++}else if(e.isSpotLight){const t=i.get(e);t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(s).multiplyScalar(_*x),t.distance=A,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,r.spot[u]=t;const a=e.shadow;if(e.map&&(r.spotLightMap[v]=e.map,v++,a.updateMatrices(e),e.castShadow&&y++),r.spotLightMatrix[u]=a.matrix,e.castShadow){const t=n.get(e);t.shadowBias=a.bias,t.shadowNormalBias=a.normalBias,t.shadowRadius=a.radius,t.shadowMapSize=a.mapSize,r.spotShadow[u]=t,r.spotShadowMap[u]=C,b++}u++}else if(e.isRectAreaLight){const t=i.get(e);t.color.copy(s).multiplyScalar(_),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*x),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]=C,r.pointShadowMatrix[h]=e.shadow.matrix,m++}r.point[h]=t,h++}else if(e.isHemisphereLight){const t=i.get(e);t.skyColor.copy(e.color).multiplyScalar(_*x),t.groundColor.copy(e.groundColor).multiplyScalar(_*x),r.hemi[f]=t,f++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=ri.LTC_FLOAT_1,r.rectAreaLTC2=ri.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=ri.LTC_HALF_1,r.rectAreaLTC2=ri.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 _=r.hash;_.directionalLength===d&&_.pointLength===h&&_.spotLength===u&&_.rectAreaLength===p&&_.hemiLength===f&&_.numDirectionalShadows===g&&_.numPointShadows===m&&_.numSpotShadows===b&&_.numSpotMaps===v||(r.directional.length=d,r.spot.length=u,r.rectArea.length=p,r.point.length=h,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.spotLightMatrix.length=b+v-y,r.spotLightMap.length=v,r.numSpotLightShadowsWithMaps=y,_.directionalLength=d,_.pointLength=h,_.spotLength=u,_.rectAreaLength=p,_.hemiLength=f,_.numDirectionalShadows=g,_.numPointShadows=m,_.numSpotShadows=b,_.numSpotMaps=v,r.version=ur++)},setupView:function(t,e){let i=0,n=0,l=0,c=0,d=0;const h=e.matrixWorldInverse;for(let e=0,u=t.length;e<u;e++){const u=t[e];if(u.isDirectionalLight){const t=r.directional[i];t.direction.setFromMatrixPosition(u.matrixWorld),a.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(h),i++}else if(u.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(h),t.direction.setFromMatrixPosition(u.matrixWorld),a.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(h),l++}else if(u.isRectAreaLight){const t=r.rectArea[c];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(h),o.identity(),s.copy(u.matrixWorld),s.premultiply(h),o.extractRotation(s),t.halfWidth.set(.5*u.width,0,0),t.halfHeight.set(0,.5*u.height,0),t.halfWidth.applyMatrix4(o),t.halfHeight.applyMatrix4(o),c++}else if(u.isPointLight){const t=r.point[n];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(h),n++}else if(u.isHemisphereLight){const t=r.hemi[d];t.direction.setFromMatrixPosition(u.matrixWorld),t.direction.transformDirection(h),d++}}},state:r}}function gr(t,e){const i=new fr(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 mr(t,e){let i=new WeakMap;return{get:function(n,r=0){const a=i.get(n);let s;return void 0===a?(s=new gr(t,e),i.set(n,[s])):r>=a.length?(s=new gr(t,e),a.push(s)):s=a[r],s},dispose:function(){i=new WeakMap}}}class br extends ie{constructor(t){super(),this.isMeshDepthMaterial=!0,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.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}}class vr extends ie{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new Q,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,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}}function yr(t,e,i){let n=new $e;const r=new g,a=new g,s=new k,o=new br({depthPacking:3201}),l=new vr,c={},d=i.maxTextureSize,h={0:1,1:0,2:2},u=new Qe({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new g},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\tconst float samples = float( VSM_SAMPLES );\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=u.clone();p.defines.HORIZONTAL_PASS=1;const f=new be;f.setAttribute("position",new se(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Re(f,u),b=this;function v(i,n){const a=e.update(m);u.defines.VSM_SAMPLES!==i.blurSamples&&(u.defines.VSM_SAMPLES=i.blurSamples,p.defines.VSM_SAMPLES=i.blurSamples,u.needsUpdate=!0,p.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new N(r.x,r.y)),u.uniforms.shadow_pass.value=i.map.texture,u.uniforms.resolution.value=i.mapSize,u.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,a,u,m,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,a,p,m,null)}function y(e,i,n,r,a,s){let d=null;const u=!0===n.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(d=void 0!==u?u:!0===n.isPointLight?l:o,t.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0){const t=d.uuid,e=i.uuid;let n=c[t];void 0===n&&(n={},c[t]=n);let r=n[e];void 0===r&&(r=d.clone(),n[e]=r),d=r}return d.visible=i.visible,d.wireframe=i.wireframe,d.side=3===s?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:h[i.side],d.alphaMap=i.alphaMap,d.alphaTest=i.alphaTest,d.clipShadows=i.clipShadows,d.clippingPlanes=i.clippingPlanes,d.clipIntersection=i.clipIntersection,d.displacementMap=i.displacementMap,d.displacementScale=i.displacementScale,d.displacementBias=i.displacementBias,d.wireframeLinewidth=i.wireframeLinewidth,d.linewidth=i.linewidth,!0===n.isPointLight&&!0===d.isMeshDistanceMaterial&&(d.referencePosition.setFromMatrixPosition(n.matrixWorld),d.nearDistance=r,d.farDistance=a),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],d=r[c.materialIndex];if(d&&d.visible){const e=y(i,d,s,a.near,a.far,o);t.renderBufferDirect(a,null,n,e,i,c)}}}else if(r.visible){const e=y(i,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(),h=t.getActiveMipmapLevel(),u=t.state;u.setBlending(0),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);for(let l=0,c=e.length;l<c;l++){const c=e[l],h=c.shadow;if(void 0===h){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===h.autoUpdate&&!1===h.needsUpdate)continue;r.copy(h.mapSize);const p=h.getFrameExtents();if(r.multiply(p),a.copy(h.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(a.x=Math.floor(d/p.x),r.x=a.x*p.x,h.mapSize.x=a.x),r.y>d&&(a.y=Math.floor(d/p.y),r.y=a.y*p.y,h.mapSize.y=a.y)),null===h.map){const t=3!==this.type?{minFilter:1003,magFilter:1003}:{};h.map=new N(r.x,r.y,t),h.map.texture.name=c.name+".shadowMap",h.camera.updateProjectionMatrix()}t.setRenderTarget(h.map),t.clear();const f=h.getViewportCount();for(let t=0;t<f;t++){const e=h.getViewport(t);s.set(a.x*e.x,a.y*e.y,a.x*e.z,a.y*e.w),u.viewport(s),h.updateMatrices(c,t),n=h.getFrustum(),x(i,o,h.camera,c,this.type)}!0!==h.isPointLightShadow&&3===this.type&&v(h,o),h.needsUpdate=!1}b.needsUpdate=!1,t.setRenderTarget(l,c,h)}}function xr(t,e,i){const n=i.isWebGL2;const r=new function(){let e=!1;const i=new k;let n=null;const r=new k(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?Q(2929):V(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?Q(2960):V(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}}},o=new WeakMap,l=new WeakMap;let c={},d={},h=new WeakMap,u=[],p=null,f=!1,g=null,m=null,b=null,v=null,y=null,x=null,_=null,A=!1,C=null,w=null,M=null,I=null,E=null;const S=t.getParameter(35661);let B=!1,F=0;const T=t.getParameter(7938);-1!==T.indexOf("WebGL")?(F=parseFloat(/^WebGL (\d)/.exec(T)[1]),B=F>=1):-1!==T.indexOf("OpenGL ES")&&(F=parseFloat(/^OpenGL ES (\d)/.exec(T)[1]),B=F>=2);let U=null,L={};const D=t.getParameter(3088),R=t.getParameter(2978),N=(new k).fromArray(D),P=(new k).fromArray(R);function O(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 z={};function Q(e){!0!==c[e]&&(t.enable(e),c[e]=!0)}function V(e){!1!==c[e]&&(t.disable(e),c[e]=!1)}z[3553]=O(3553,3553,1),z[34067]=O(34067,34069,6),r.setClear(0,0,0,1),a.setClear(1),s.setClear(0),Q(2929),a.setFunc(3),W(!1),q(1),Q(2884),G(0);const H={100:32774,101:32778,102:32779};if(n)H[103]=32775,H[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(H[103]=t.MIN_EXT,H[104]=t.MAX_EXT)}const j={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function G(e,i,n,r,a,s,o,l){if(0!==e){if(!1===f&&(Q(3042),f=!0),5===e)a=a||i,s=s||n,o=o||r,i===m&&a===y||(t.blendEquationSeparate(H[i],H[a]),m=i,y=a),n===b&&r===v&&s===x&&o===_||(t.blendFuncSeparate(j[n],j[r],j[s],j[o]),b=n,v=r,x=s,_=o),g=e,A=null;else if(e!==g||l!==A){if(100===m&&100===y||(t.blendEquation(32774),m=100,y=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,769,0,1);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.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}b=null,v=null,x=null,_=null,g=e,A=l}}else!0===f&&(V(3042),f=!1)}function W(e){C!==e&&(e?t.frontFace(2304):t.frontFace(2305),C=e)}function q(e){0!==e?(Q(2884),e!==w&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):V(2884),w=e}function Z(e,i,n){e?(Q(32823),I===i&&E===n||(t.polygonOffset(i,n),I=i,E=n)):V(32823)}function X(e){void 0===e&&(e=33984+S-1),U!==e&&(t.activeTexture(e),U=e)}return{buffers:{color:r,depth:a,stencil:s},enable:Q,disable:V,bindFramebuffer:function(e,i){return d[e]!==i&&(t.bindFramebuffer(e,i),d[e]=i,n&&(36009===e&&(d[36160]=i),36160===e&&(d[36009]=i)),!0)},drawBuffers:function(n,r){let a=u,s=!1;if(n)if(a=h.get(r),void 0===a&&(a=[],h.set(r,a)),n.isWebGLMultipleRenderTargets){const t=n.texture;if(a.length!==t.length||36064!==a[0]){for(let e=0,i=t.length;e<i;e++)a[e]=36064+e;a.length=t.length,s=!0}}else 36064!==a[0]&&(a[0]=36064,s=!0);else 1029!==a[0]&&(a[0]=1029,s=!0);s&&(i.isWebGL2?t.drawBuffers(a):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(e){return p!==e&&(t.useProgram(e),p=e,!0)},setBlending:G,setMaterial:function(t,e){2===t.side?V(2884):Q(2884);let i=1===t.side;e&&(i=!i),W(i),1===t.blending&&!1===t.transparent?G(0):G(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)),Z(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?Q(32926):V(32926)},setFlipSided:W,setCullFace:q,setLineWidth:function(e){e!==M&&(B&&t.lineWidth(e),M=e)},setPolygonOffset:Z,setScissorTest:function(t){t?Q(3089):V(3089)},activeTexture:X,bindTexture:function(e,i){null===U&&X();let n=L[U];void 0===n&&(n={type:void 0,texture:void 0},L[U]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||z[e]),n.type=e,n.texture=i)},unbindTexture:function(){const e=L[U];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)}},updateUBOMapping:function(e,i){let n=l.get(i);void 0===n&&(n=new WeakMap,l.set(i,n));let r=n.get(e);void 0===r&&(r=t.getUniformBlockIndex(i,e.name),n.set(e,r))},uniformBlockBinding:function(e,i){const n=l.get(i).get(e);o.get(e)!==n&&(t.uniformBlockBinding(i,n,e.__bindingPointIndex),o.set(e,n))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===N.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),N.copy(e))},viewport:function(e){!1===P.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),P.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),c={},U=null,L={},d={},h=new WeakMap,u=[],p=null,f=!1,g=null,m=null,b=null,v=null,y=null,x=null,_=null,A=!1,C=null,w=null,M=null,I=null,E=null,N.set(0,0,t.canvas.width,t.canvas.height),P.set(0,0,t.canvas.width,t.canvas.height),r.reset(),a.reset(),s.reset()}}}function _r(t,e,i,n,r,a,s){const o=r.isWebGL2,l=r.maxTextures,c=r.maxCubemapSize,d=r.maxTextureSize,p=r.maxSamples,f=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,g=/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap;let b;const y=new WeakMap;let x=!1;try{x="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function _(t,e){return x?new OffscreenCanvas(t,e):v("canvas")}function A(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?u:Math.floor,a=n(r*t.width),s=n(r*t.height);void 0===b&&(b=_(a,s));const o=i?_(a,s):b;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 C(t){return h(t.width)&&h(t.height)}function w(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function M(e){t.generateMipmap(e)}function I(i,n,r,a,s=!1){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 l=n;return 6403===n&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===n&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===n&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=3001===a&&!1===s?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||e.get("EXT_color_buffer_float"),l}function E(t,e,i){return!0===w(t,i)||t.isFramebufferTexture&&1003!==t.minFilter&&1006!==t.minFilter?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function S(t){return 1003===t||1004===t||1005===t?9728:9729}function B(t){const e=t.target;e.removeEventListener("dispose",B),function(t){const e=n.get(t);if(void 0===e.__webglInit)return;const i=t.source,r=y.get(i);if(r){const n=r[e.__cacheKey];n.usedTimes--,0===n.usedTimes&&U(t),0===Object.keys(r).length&&y.delete(i)}n.remove(t)}(e),e.isVideoTexture&&m.delete(e)}function F(e){const i=e.target;i.removeEventListener("dispose",F),function(e){const i=e.texture,r=n.get(e),a=n.get(i);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{if(t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(let e=0;e<r.__webglColorRenderbuffer.length;e++)r.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(r.__webglColorRenderbuffer[e]);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)}function U(e){const i=n.get(e);t.deleteTexture(i.__webglTexture);const r=e.source;delete y.get(r)[i.__cacheKey],s.memory.textures--}let L=0;function D(t,e){const r=n.get(t);if(t.isVideoTexture&&function(t){const e=s.render.frame;m.get(t)!==e&&(m.set(t,e),t.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&r.__version!==t.version){const i=t.image;if(null===i)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==i.complete)return void O(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+e),i.bindTexture(3553,r.__webglTexture)}const R={1e3:10497,1001:33071,1002:33648},k={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function N(i,a,s){if(s?(t.texParameteri(i,10242,R[a.wrapS]),t.texParameteri(i,10243,R[a.wrapT]),32879!==i&&35866!==i||t.texParameteri(i,32882,R[a.wrapR]),t.texParameteri(i,10240,k[a.magFilter]),t.texParameteri(i,10241,k[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,S(a.magFilter)),t.texParameteri(i,10241,S(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 P(e,i){let n=!1;void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",B));const r=i.source;let a=y.get(r);void 0===a&&(a={},y.set(r,a));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.encoding),e.join()}(i);if(o!==e.__cacheKey){void 0===a[o]&&(a[o]={texture:t.createTexture(),usedTimes:0},s.memory.textures++,n=!0),a[o].usedTimes++;const r=a[e.__cacheKey];void 0!==r&&(a[e.__cacheKey].usedTimes--,0===r.usedTimes&&U(i)),e.__cacheKey=o,e.__webglTexture=a[o].texture}return n}function O(e,n,r){let s=3553;n.isDataArrayTexture&&(s=35866),n.isData3DTexture&&(s=32879);const l=P(e,n),c=n.source;if(i.activeTexture(33984+r),i.bindTexture(s,e.__webglTexture),c.version!==c.__currentVersion||!0===l){t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const e=function(t){return!o&&(1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.minFilter)}(n)&&!1===C(n.image);let r=A(n.image,e,!1,d);r=G(n,r);const h=C(r)||o,u=a.convert(n.format,n.encoding);let p,f=a.convert(n.type),g=I(n.internalFormat,u,f,n.encoding,n.isVideoTexture);N(s,n,h);const m=n.mipmaps,b=o&&!0!==n.isVideoTexture,v=void 0===c.__currentVersion||!0===l,y=E(n,r,h);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=1014,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))),v&&(b?i.texStorage2D(3553,1,g,r.width,r.height):i.texImage2D(3553,0,g,r.width,r.height,0,u,f,null));else if(n.isDataTexture)if(m.length>0&&h){b&&v&&i.texStorage2D(3553,y,g,m[0].width,m[0].height);for(let t=0,e=m.length;t<e;t++)p=m[t],b?i.texSubImage2D(3553,t,0,0,p.width,p.height,u,f,p.data):i.texImage2D(3553,t,g,p.width,p.height,0,u,f,p.data);n.generateMipmaps=!1}else b?(v&&i.texStorage2D(3553,y,g,r.width,r.height),i.texSubImage2D(3553,0,0,0,r.width,r.height,u,f,r.data)):i.texImage2D(3553,0,g,r.width,r.height,0,u,f,r.data);else if(n.isCompressedTexture){b&&v&&i.texStorage2D(3553,y,g,m[0].width,m[0].height);for(let t=0,e=m.length;t<e;t++)p=m[t],1023!==n.format?null!==u?b?i.compressedTexSubImage2D(3553,t,0,0,p.width,p.height,u,p.data):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()"):b?i.texSubImage2D(3553,t,0,0,p.width,p.height,u,f,p.data):i.texImage2D(3553,t,g,p.width,p.height,0,u,f,p.data)}else if(n.isDataArrayTexture)b?(v&&i.texStorage3D(35866,y,g,r.width,r.height,r.depth),i.texSubImage3D(35866,0,0,0,0,r.width,r.height,r.depth,u,f,r.data)):i.texImage3D(35866,0,g,r.width,r.height,r.depth,0,u,f,r.data);else if(n.isData3DTexture)b?(v&&i.texStorage3D(32879,y,g,r.width,r.height,r.depth),i.texSubImage3D(32879,0,0,0,0,r.width,r.height,r.depth,u,f,r.data)):i.texImage3D(32879,0,g,r.width,r.height,r.depth,0,u,f,r.data);else if(n.isFramebufferTexture){if(v)if(b)i.texStorage2D(3553,y,g,r.width,r.height);else{let t=r.width,e=r.height;for(let n=0;n<y;n++)i.texImage2D(3553,n,g,t,e,0,u,f,null),t>>=1,e>>=1}}else if(m.length>0&&h){b&&v&&i.texStorage2D(3553,y,g,m[0].width,m[0].height);for(let t=0,e=m.length;t<e;t++)p=m[t],b?i.texSubImage2D(3553,t,0,0,u,f,p):i.texImage2D(3553,t,g,u,f,p);n.generateMipmaps=!1}else b?(v&&i.texStorage2D(3553,y,g,r.width,r.height),i.texSubImage2D(3553,0,0,0,u,f,r)):i.texImage2D(3553,0,g,u,f,r);w(n,h)&&M(s),c.__currentVersion=c.version,n.onUpdate&&n.onUpdate(n)}e.__version=n.version}function z(e,r,s,o,l){const c=a.convert(s.format,s.encoding),d=a.convert(s.type),h=I(s.internalFormat,c,d,s.encoding);n.get(r).__hasExternalTextures||(32879===l||35866===l?i.texImage3D(l,0,h,r.width,r.height,r.depth,0,c,d,null):i.texImage2D(l,0,h,r.width,r.height,0,c,d,null)),i.bindFramebuffer(36160,e),j(r)?f.framebufferTexture2DMultisampleEXT(36160,o,l,n.get(s).__webglTexture,0,H(r)):t.framebufferTexture2D(36160,o,l,n.get(s).__webglTexture,0),i.bindFramebuffer(36160,null)}function Q(e,i,n){if(t.bindRenderbuffer(36161,e),i.depthBuffer&&!i.stencilBuffer){let r=33189;if(n||j(i)){const e=i.depthTexture;e&&e.isDepthTexture&&(1015===e.type?r=36012:1014===e.type&&(r=33190));const n=H(i);j(i)?f.renderbufferStorageMultisampleEXT(36161,n,r,i.width,i.height):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){const r=H(i);n&&!1===j(i)?t.renderbufferStorageMultisample(36161,r,35056,i.width,i.height):j(i)?f.renderbufferStorageMultisampleEXT(36161,r,35056,i.width,i.height):t.renderbufferStorage(36161,34041,i.width,i.height),t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===i.isWebGLMultipleRenderTargets?i.texture:[i.texture];for(let r=0;r<e.length;r++){const s=e[r],o=a.convert(s.format,s.encoding),l=a.convert(s.type),c=I(s.internalFormat,o,l,s.encoding),d=H(i);n&&!1===j(i)?t.renderbufferStorageMultisample(36161,d,c,i.width,i.height):j(i)?f.renderbufferStorageMultisampleEXT(36161,d,c,i.width,i.height):t.renderbufferStorage(36161,c,i.width,i.height)}}t.bindRenderbuffer(36161,null)}function V(e){const r=n.get(e),a=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!r.__autoAllocateDepthBuffer){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),D(r.depthTexture,0);const a=n.get(r.depthTexture).__webglTexture,s=H(r);if(1026===r.depthTexture.format)j(r)?f.framebufferTexture2DMultisampleEXT(36160,36096,3553,a,0,s):t.framebufferTexture2D(36160,36096,3553,a,0);else{if(1027!==r.depthTexture.format)throw new Error("Unknown depthTexture format");j(r)?f.framebufferTexture2DMultisampleEXT(36160,33306,3553,a,0,s):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(),Q(r.__webglDepthbuffer[n],e,!1)}else i.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),Q(r.__webglDepthbuffer,e,!1);i.bindFramebuffer(36160,null)}function H(t){return Math.min(p,t.samples)}function j(t){const i=n.get(t);return o&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function G(t,i){const n=t.encoding,r=t.format,a=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||1035===t.format||3e3!==n&&(3001===n?!1===o?!0===e.has("EXT_sRGB")&&1023===r?(t.format=1035,t.minFilter=1006,t.generateMipmaps=!1):i=T.sRGBToLinear(i):1023===r&&1009===a||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",n)),i}this.allocateTextureUnit=function(){const t=L;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),L+=1,t},this.resetTextureUnits=function(){L=0},this.setTexture2D=D,this.setTexture2DArray=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?O(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?O(r,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,r.__webglTexture))},this.setTextureCube=function(e,r){const s=n.get(e);e.version>0&&s.__version!==e.version?function(e,n,r){if(6!==n.image.length)return;const s=P(e,n),l=n.source;if(i.activeTexture(33984+r),i.bindTexture(34067,e.__webglTexture),l.version!==l.__currentVersion||!0===s){t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const e=n.isCompressedTexture||n.image[0].isCompressedTexture,r=n.image[0]&&n.image[0].isDataTexture,d=[];for(let t=0;t<6;t++)d[t]=e||r?r?n.image[t].image:n.image[t]:A(n.image[t],!1,!0,c),d[t]=G(n,d[t]);const h=d[0],u=C(h)||o,p=a.convert(n.format,n.encoding),f=a.convert(n.type),g=I(n.internalFormat,p,f,n.encoding),m=o&&!0!==n.isVideoTexture,b=void 0===l.__currentVersion||!0===s;let v,y=E(n,h,u);if(N(34067,n,u),e){m&&b&&i.texStorage2D(34067,y,g,h.width,h.height);for(let t=0;t<6;t++){v=d[t].mipmaps;for(let e=0;e<v.length;e++){const r=v[e];1023!==n.format?null!==p?m?i.compressedTexSubImage2D(34069+t,e,0,0,r.width,r.height,p,r.data):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()"):m?i.texSubImage2D(34069+t,e,0,0,r.width,r.height,p,f,r.data):i.texImage2D(34069+t,e,g,r.width,r.height,0,p,f,r.data)}}}else{v=n.mipmaps,m&&b&&(v.length>0&&y++,i.texStorage2D(34067,y,g,d[0].width,d[0].height));for(let t=0;t<6;t++)if(r){m?i.texSubImage2D(34069+t,0,0,0,d[t].width,d[t].height,p,f,d[t].data):i.texImage2D(34069+t,0,g,d[t].width,d[t].height,0,p,f,d[t].data);for(let e=0;e<v.length;e++){const n=v[e].image[t].image;m?i.texSubImage2D(34069+t,e+1,0,0,n.width,n.height,p,f,n.data):i.texImage2D(34069+t,e+1,g,n.width,n.height,0,p,f,n.data)}}else{m?i.texSubImage2D(34069+t,0,0,0,p,f,d[t]):i.texImage2D(34069+t,0,g,p,f,d[t]);for(let e=0;e<v.length;e++){const n=v[e];m?i.texSubImage2D(34069+t,e+1,0,0,p,f,n.image[t]):i.texImage2D(34069+t,e+1,g,p,f,n.image[t])}}}w(n,u)&&M(34067),l.__currentVersion=l.version,n.onUpdate&&n.onUpdate(n)}e.__version=n.version}(s,e,r):(i.activeTexture(33984+r),i.bindTexture(34067,s.__webglTexture))},this.rebindTextures=function(t,e,i){const r=n.get(t);void 0!==e&&z(r.__webglFramebuffer,t,t.texture,36064,3553),void 0!==i&&V(t)},this.setupRenderTarget=function(e){const l=e.texture,c=n.get(e),d=n.get(l);e.addEventListener("dispose",F),!0!==e.isWebGLMultipleRenderTargets&&(void 0===d.__webglTexture&&(d.__webglTexture=t.createTexture()),d.__version=l.version,s.memory.textures++);const h=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultipleRenderTargets,p=C(e)||o;if(h){c.__webglFramebuffer=[];for(let e=0;e<6;e++)c.__webglFramebuffer[e]=t.createFramebuffer()}else{if(c.__webglFramebuffer=t.createFramebuffer(),u)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.");if(o&&e.samples>0&&!1===j(e)){const n=u?l:[l];c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=[],i.bindFramebuffer(36160,c.__webglMultisampledFramebuffer);for(let i=0;i<n.length;i++){const r=n[i];c.__webglColorRenderbuffer[i]=t.createRenderbuffer(),t.bindRenderbuffer(36161,c.__webglColorRenderbuffer[i]);const s=a.convert(r.format,r.encoding),o=a.convert(r.type),l=I(r.internalFormat,s,o,r.encoding),d=H(e);t.renderbufferStorageMultisample(36161,d,l,e.width,e.height),t.framebufferRenderbuffer(36160,36064+i,36161,c.__webglColorRenderbuffer[i])}t.bindRenderbuffer(36161,null),e.depthBuffer&&(c.__webglDepthRenderbuffer=t.createRenderbuffer(),Q(c.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(36160,null)}}if(h){i.bindTexture(34067,d.__webglTexture),N(34067,l,p);for(let t=0;t<6;t++)z(c.__webglFramebuffer[t],e,l,36064,34069+t);w(l,p)&&M(34067),i.unbindTexture()}else if(u){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),N(3553,a,p),z(c.__webglFramebuffer,e,a,36064+r,3553),w(a,p)&&M(3553)}i.unbindTexture()}else{let t=3553;(e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(o?t=e.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),i.bindTexture(t,d.__webglTexture),N(t,l,p),z(c.__webglFramebuffer,e,l,36064,t),w(l,p)&&M(t),i.unbindTexture()}e.depthBuffer&&V(e)},this.updateRenderTargetMipmap=function(t){const e=C(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(w(s,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,r=n.get(s).__webglTexture;i.bindTexture(e,r),M(e),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(o&&e.samples>0&&!1===j(e)){const r=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],a=e.width,s=e.height;let o=16384;const l=[],c=e.stencilBuffer?33306:36096,d=n.get(e),h=!0===e.isWebGLMultipleRenderTargets;if(h)for(let e=0;e<r.length;e++)i.bindFramebuffer(36160,d.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+e,36161,null),i.bindFramebuffer(36160,d.__webglFramebuffer),t.framebufferTexture2D(36009,36064+e,3553,null,0);i.bindFramebuffer(36008,d.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,d.__webglFramebuffer);for(let i=0;i<r.length;i++){l.push(36064+i),e.depthBuffer&&l.push(c);const u=void 0!==d.__ignoreDepthValues&&d.__ignoreDepthValues;if(!1===u&&(e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024)),h&&t.framebufferRenderbuffer(36008,36064,36161,d.__webglColorRenderbuffer[i]),!0===u&&(t.invalidateFramebuffer(36008,[c]),t.invalidateFramebuffer(36009,[c])),h){const e=n.get(r[i]).__webglTexture;t.framebufferTexture2D(36009,36064,3553,e,0)}t.blitFramebuffer(0,0,a,s,0,0,a,s,o,9728),g&&t.invalidateFramebuffer(36008,l)}if(i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,null),h)for(let e=0;e<r.length;e++){i.bindFramebuffer(36160,d.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+e,36161,d.__webglColorRenderbuffer[e]);const a=n.get(r[e]).__webglTexture;i.bindFramebuffer(36160,d.__webglFramebuffer),t.framebufferTexture2D(36009,36064+e,3553,a,0)}i.bindFramebuffer(36009,d.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=V,this.setupFrameBufferTexture=z,this.useMultisampledRTT=j}function Ar(t,e,i){const n=i.isWebGL2;return{convert:function(i,r=null){let a;if(1009===i)return 5121;if(1017===i)return 32819;if(1018===i)return 32820;if(1010===i)return 5120;if(1011===i)return 5122;if(1012===i)return 5123;if(1013===i)return 5124;if(1014===i)return 5125;if(1015===i)return 5126;if(1016===i)return n?5131:(a=e.get("OES_texture_half_float"),null!==a?a.HALF_FLOAT_OES:null);if(1021===i)return 6406;if(1023===i)return 6408;if(1024===i)return 6409;if(1025===i)return 6410;if(1026===i)return 6402;if(1027===i)return 34041;if(1028===i)return 6403;if(1022===i)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(1035===i)return a=e.get("EXT_sRGB"),null!==a?a.SRGB_ALPHA_EXT:null;if(1029===i)return 36244;if(1030===i)return 33319;if(1031===i)return 33320;if(1033===i)return 36249;if(33776===i||33777===i||33778===i||33779===i)if(3001===r){if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===a)return null;if(33776===i)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===i)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===i)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===i)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(a=e.get("WEBGL_compressed_texture_s3tc"),null===a)return null;if(33776===i)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===i)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===i)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===i)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===i||35841===i||35842===i||35843===i){if(a=e.get("WEBGL_compressed_texture_pvrtc"),null===a)return null;if(35840===i)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i)return a=e.get("WEBGL_compressed_texture_etc1"),null!==a?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===i||37496===i){if(a=e.get("WEBGL_compressed_texture_etc"),null===a)return null;if(37492===i)return 3001===r?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(37496===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}if(37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i){if(a=e.get("WEBGL_compressed_texture_astc"),null===a)return null;if(37808===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return 3001===r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===i){if(a=e.get("EXT_texture_compression_bptc"),null===a)return null;if(36492===i)return 3001===r?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}return 1020===i?n?34042:(a=e.get("WEBGL_depth_texture"),null!==a?a.UNSIGNED_INT_24_8_WEBGL:null):void 0!==t[i]?t[i]:null}}}class Cr extends He{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class wr extends Ht{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Mr={type:"move"};class Ir{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new wr,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 wr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Q),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new wr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Q),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(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 wr;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));null!==s&&(n=e.getPose(t.targetRaySpace,i),null===n&&null!==r&&(n=r),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(Mr)))}return null!==s&&(s.visible=null!==n),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}}class Er extends R{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=1014),void 0===i&&1027===c&&(i=1020),super(null,n,r,a,s,o,c,i,l),this.isDepthTexture=!0,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}}class Sr extends n{constructor(t,e){super();const i=this;let n=null,r=1,a=null,s="local-floor",o=null,l=null,c=null,d=null,h=null,u=null;const p=e.getContextAttributes();let f=null,g=null;const m=[],b=[],v=new He;v.layers.enable(1),v.viewport=new k;const y=new He;y.layers.enable(2),y.viewport=new k;const x=[v,y],_=new Cr;_.layers.enable(1),_.layers.enable(2);let A=null,C=null;function w(t){const e=b.indexOf(t.inputSource);if(-1===e)return;const i=m[e];void 0!==i&&i.dispatchEvent({type:t.type,data:t.inputSource})}function M(){n.removeEventListener("select",w),n.removeEventListener("selectstart",w),n.removeEventListener("selectend",w),n.removeEventListener("squeeze",w),n.removeEventListener("squeezestart",w),n.removeEventListener("squeezeend",w),n.removeEventListener("end",M),n.removeEventListener("inputsourceschange",I);for(let t=0;t<m.length;t++){const e=b[t];null!==e&&(b[t]=null,m[t].disconnect(e))}A=null,C=null,t.setRenderTarget(f),h=null,d=null,c=null,n=null,g=null,T.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function I(t){for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=b.indexOf(i);n>=0&&(b[n]=null,m[n].dispatchEvent({type:"disconnected",data:i}))}for(let e=0;e<t.added.length;e++){const i=t.added[e];let n=b.indexOf(i);if(-1===n){for(let t=0;t<m.length;t++){if(t>=b.length){b.push(i),n=t;break}if(null===b[t]){b[t]=i,n=t;break}}if(-1===n)break}const r=m[n];r&&r.dispatchEvent({type:"connected",data:i})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=m[t];return void 0===e&&(e=new Ir,m[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=m[t];return void 0===e&&(e=new Ir,m[t]=e),e.getGripSpace()},this.getHand=function(t){let e=m[t];return void 0===e&&(e=new Ir,m[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){s=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o||a},this.setReferenceSpace=function(t){o=t},this.getBaseLayer=function(){return null!==d?d:h},this.getBinding=function(){return c},this.getFrame=function(){return u},this.getSession=function(){return n},this.setSession=async function(l){if(n=l,null!==n){if(f=t.getRenderTarget(),n.addEventListener("select",w),n.addEventListener("selectstart",w),n.addEventListener("selectend",w),n.addEventListener("squeeze",w),n.addEventListener("squeezestart",w),n.addEventListener("squeezeend",w),n.addEventListener("end",M),n.addEventListener("inputsourceschange",I),!0!==p.xrCompatible&&await e.makeXRCompatible(),void 0===n.renderState.layers||!1===t.capabilities.isWebGL2){const i={antialias:void 0!==n.renderState.layers||p.antialias,alpha:p.alpha,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:r};h=new XRWebGLLayer(n,e,i),n.updateRenderState({baseLayer:h}),g=new N(h.framebufferWidth,h.framebufferHeight,{format:1023,type:1009,encoding:t.outputEncoding,stencilBuffer:p.stencil})}else{let i=null,a=null,s=null;p.depth&&(s=p.stencil?35056:33190,i=p.stencil?1027:1026,a=p.stencil?1020:1014);const o={colorFormat:32856,depthFormat:s,scaleFactor:r};c=new XRWebGLBinding(n,e),d=c.createProjectionLayer(o),n.updateRenderState({layers:[d]}),g=new N(d.textureWidth,d.textureHeight,{format:1023,type:1009,depthTexture:new Er(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:p.stencil,encoding:t.outputEncoding,samples:p.antialias?4:0});t.properties.get(g).__ignoreDepthValues=d.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(1),o=null,a=await n.requestReferenceSpace(s),T.setContext(n),T.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};const E=new Q,S=new Q;function B(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===n)return;_.near=y.near=v.near=t.near,_.far=y.far=v.far=t.far,A===_.near&&C===_.far||(n.updateRenderState({depthNear:_.near,depthFar:_.far}),A=_.near,C=_.far);const e=t.parent,i=_.cameras;B(_,e);for(let t=0;t<i.length;t++)B(i[t],e);_.matrixWorld.decompose(_.position,_.quaternion,_.scale),t.matrix.copy(_.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);2===i.length?function(t,e,i){E.setFromMatrixPosition(e.matrixWorld),S.setFromMatrixPosition(i.matrixWorld);const n=E.distanceTo(S),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],d=(r[8]-1)/r[0],h=(a[8]+1)/a[0],u=s*d,p=s*h,f=n/(-d+h),g=f*-d;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,v=u-g,y=p+(n-g),x=l*o/b*m,_=c*o/b*m;t.projectionMatrix.makePerspective(v,y,x,_,m,b)}(_,v,y):_.projectionMatrix.copy(v.projectionMatrix)},this.getCamera=function(){return _},this.getFoveation=function(){return null!==d?d.fixedFoveation:null!==h?h.fixedFoveation:void 0},this.setFoveation=function(t){null!==d&&(d.fixedFoveation=t),null!==h&&void 0!==h.fixedFoveation&&(h.fixedFoveation=t)};let F=null;const T=new ti;T.setAnimationLoop((function(e,i){if(l=i.getViewerPose(o||a),u=i,null!==l){const e=l.views;null!==h&&(t.setRenderTargetFramebuffer(g,h.framebuffer),t.setRenderTarget(g));let i=!1;e.length!==_.cameras.length&&(_.cameras.length=0,i=!0);for(let n=0;n<e.length;n++){const r=e[n];let a=null;if(null!==h)a=h.getViewport(r);else{const e=c.getViewSubImage(d,r);a=e.viewport,0===n&&(t.setRenderTargetTextures(g,e.colorTexture,d.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(g))}let s=x[n];void 0===s&&(s=new He,s.layers.enable(n),s.viewport=new k,x[n]=s),s.matrix.fromArray(r.transform.matrix),s.projectionMatrix.fromArray(r.projectionMatrix),s.viewport.set(a.x,a.y,a.width,a.height),0===n&&_.matrix.copy(s.matrix),!0===i&&_.cameras.push(s)}}for(let t=0;t<m.length;t++){const e=b[t],n=m[t];null!==e&&void 0!==n&&n.update(e,i,o||a)}F&&F(e,i),u=null})),this.setAnimationLoop=function(t){F=t},this.dispose=function(){}}}function Br(t,e){function i(i,n){i.opacity.value=n.opacity,n.color&&i.diffuse.value.copy(n.color),n.emissive&&i.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(i.map.value=n.map),n.alphaMap&&(i.alphaMap.value=n.alphaMap),n.bumpMap&&(i.bumpMap.value=n.bumpMap,i.bumpScale.value=n.bumpScale,1===n.side&&(i.bumpScale.value*=-1)),n.displacementMap&&(i.displacementMap.value=n.displacementMap,i.displacementScale.value=n.displacementScale,i.displacementBias.value=n.displacementBias),n.emissiveMap&&(i.emissiveMap.value=n.emissiveMap),n.normalMap&&(i.normalMap.value=n.normalMap,i.normalScale.value.copy(n.normalScale),1===n.side&&i.normalScale.value.negate()),n.specularMap&&(i.specularMap.value=n.specularMap),n.alphaTest>0&&(i.alphaTest.value=n.alphaTest);const r=e.get(n).envMap;if(r&&(i.envMap.value=r,i.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,i.reflectivity.value=n.reflectivity,i.ior.value=n.ior,i.refractionRatio.value=n.refractionRatio),n.lightMap){i.lightMap.value=n.lightMap;const e=!0!==t.physicallyCorrectLights?Math.PI:1;i.lightMapIntensity.value=n.lightMapIntensity*e}let a,s;n.aoMap&&(i.aoMap.value=n.aoMap,i.aoMapIntensity.value=n.aoMapIntensity),n.map?a=n.map:n.specularMap?a=n.specularMap:n.displacementMap?a=n.displacementMap:n.normalMap?a=n.normalMap:n.bumpMap?a=n.bumpMap:n.roughnessMap?a=n.roughnessMap:n.metalnessMap?a=n.metalnessMap:n.alphaMap?a=n.alphaMap:n.emissiveMap?a=n.emissiveMap:n.clearcoatMap?a=n.clearcoatMap:n.clearcoatNormalMap?a=n.clearcoatNormalMap:n.clearcoatRoughnessMap?a=n.clearcoatRoughnessMap:n.iridescenceMap?a=n.iridescenceMap:n.iridescenceThicknessMap?a=n.iridescenceThicknessMap:n.specularIntensityMap?a=n.specularIntensityMap:n.specularColorMap?a=n.specularColorMap:n.transmissionMap?a=n.transmissionMap:n.thicknessMap?a=n.thicknessMap:n.sheenColorMap?a=n.sheenColorMap:n.sheenRoughnessMap&&(a=n.sheenRoughnessMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),i.uvTransform.value.copy(a.matrix)),n.aoMap?s=n.aoMap:n.lightMap&&(s=n.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),i.uv2Transform.value.copy(s.matrix))}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||n.isMeshLambertMaterial?i(t,n):n.isMeshToonMaterial?(i(t,n),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,n)):n.isMeshPhongMaterial?(i(t,n),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,n)):n.isMeshStandardMaterial?(i(t,n),function(t,i){t.roughness.value=i.roughness,t.metalness.value=i.metalness,i.roughnessMap&&(t.roughnessMap.value=i.roughnessMap);i.metalnessMap&&(t.metalnessMap.value=i.metalnessMap);e.get(i).envMap&&(t.envMapIntensity.value=i.envMapIntensity)}(t,n),n.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap));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.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.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.attenuationColor.value.copy(e.attenuationColor));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap);e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap)}(t,n,s)):n.isMeshMatcapMaterial?(i(t,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,n)):n.isMeshDepthMaterial?i(t,n):n.isMeshDistanceMaterial?(i(t,n),function(t,e){t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,n)):n.isMeshNormalMaterial?i(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 Fr(t,e,i,n){let r={},a={},s=[];const o=i.isWebGL2?t.getParameter(35375):0;function l(t,e,i){const n=t.value;if(void 0===i[e])return i[e]="number"==typeof n?n:n.clone(),!0;if("number"==typeof n){if(i[e]!==n)return i[e]=n,!0}else{const t=i[e];if(!1===t.equals(n))return t.copy(n),!0}return!1}function c(t){const e=t.value,i={boundary:0,storage:0};return"number"==typeof e?(i.boundary=4,i.storage=4):e.isVector2?(i.boundary=8,i.storage=8):e.isVector3||e.isColor?(i.boundary=16,i.storage=12):e.isVector4?(i.boundary=16,i.storage=16):e.isMatrix3?(i.boundary=48,i.storage=48):e.isMatrix4?(i.boundary=64,i.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),i}function d(e){const i=e.target;i.removeEventListener("dispose",d);const n=s.indexOf(i.__bindingPointIndex);s.splice(n,1),t.deleteBuffer(r[i.id]),delete r[i.id],delete a[i.id]}return{bind:function(t,e){const i=e.program;n.uniformBlockBinding(t,i)},update:function(i,h){let u=r[i.id];void 0===u&&(!function(t){const e=t.uniforms;let i=0;let n=0;for(let t=0,r=e.length;t<r;t++){const r=e[t],a=c(r);if(r.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),r.__offset=i,t>0){n=i%16;const t=16-n;0!==n&&t-a.boundary<0&&(i+=16-n,r.__offset=i)}i+=a.storage}n=i%16,n>0&&(i+=16-n);t.__size=i,t.__cache={}}(i),u=function(e){const i=function(){for(let t=0;t<o;t++)if(-1===s.indexOf(t))return s.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=i;const n=t.createBuffer(),r=e.__size,a=e.usage;return t.bindBuffer(35345,n),t.bufferData(35345,r,a),t.bindBuffer(35345,null),t.bindBufferBase(35345,i,n),n}(i),r[i.id]=u,i.addEventListener("dispose",d));const p=h.program;n.updateUBOMapping(i,p);const f=e.render.frame;a[i.id]!==f&&(!function(e){const i=r[e.id],n=e.uniforms,a=e.__cache;t.bindBuffer(35345,i);for(let e=0,i=n.length;e<i;e++){const i=n[e];if(!0===l(i,e,a)){const e=i.value,n=i.__offset;"number"==typeof e?(i.__data[0]=e,t.bufferSubData(35345,n,i.__data)):(i.value.isMatrix3?(i.__data[0]=i.value.elements[0],i.__data[1]=i.value.elements[1],i.__data[2]=i.value.elements[2],i.__data[3]=i.value.elements[0],i.__data[4]=i.value.elements[3],i.__data[5]=i.value.elements[4],i.__data[6]=i.value.elements[5],i.__data[7]=i.value.elements[0],i.__data[8]=i.value.elements[6],i.__data[9]=i.value.elements[7],i.__data[10]=i.value.elements[8],i.__data[11]=i.value.elements[0]):e.toArray(i.__data),t.bufferSubData(35345,n,i.__data))}}t.bindBuffer(35345,null)}(i),a[i.id]=f)},dispose:function(){for(const e in r)t.deleteBuffer(r[e]);s=[],r={},a={}}}}function Tr(t={}){this.isWebGLRenderer=!0;const e=void 0!==t.canvas?t.canvas:function(){const t=v("canvas");return t.style.display="block",t}(),i=void 0!==t.context?t.context:null,n=void 0===t.depth||t.depth,r=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,o=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,l=void 0!==t.powerPreference?t.powerPreference:"default",c=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let d;d=null!==i?i.getContextAttributes().alpha:void 0!==t.alpha&&t.alpha;let h=null,p=null;const f=[],m=[];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.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});const b=this;let y=!1,x=0,_=0,A=null,C=-1,w=null;const M=new k,I=new k;let E=null,S=e.width,B=e.height,F=1,T=null,U=null;const L=new k(0,0,S,B),D=new k(0,0,S,B);let R=!1;const P=new $e;let O=!1,z=!1,V=null;const H=new vt,j=new g,G=new Q,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function q(){return null===A?F:1}let Z,X,J,Y,K,$,tt,et,it,nt,rt,at,st,ot,lt,ct,dt,ht,ut,pt,ft,gt,mt,bt,yt=i;function xt(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:!0,depth:n,stencil:r,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:o,powerPreference:l,failIfMajorPerformanceCaveat:c};if("setAttribute"in e&&e.setAttribute("data-engine","three.js r144"),e.addEventListener("webglcontextlost",Ct,!1),e.addEventListener("webglcontextrestored",wt,!1),e.addEventListener("webglcontextcreationerror",Mt,!1),null===yt){const e=["webgl2","webgl","experimental-webgl"];if(!0===b.isWebGL1Renderer&&e.shift(),yt=xt(e,t),null===yt)throw xt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===yt.getShaderPrecisionFormat&&(yt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function _t(){Z=new Ei(yt),X=new ci(yt,Z,t),Z.init(X),gt=new Ar(yt,Z,X),J=new xr(yt,Z,X),Y=new Fi,K=new sr,$=new _r(yt,Z,J,K,X,gt,Y),tt=new hi(b),et=new Ii(b),it=new ei(yt,X),mt=new oi(yt,Z,it,X),nt=new Si(yt,it,Y,mt),rt=new Di(yt,nt,it,Y),ut=new Li(yt,X,$),ct=new di(K),at=new ar(b,tt,et,Z,X,mt,ct),st=new Br(b,K),ot=new dr,lt=new mr(Z,X),ht=new si(b,tt,J,rt,d,s),dt=new yr(b,rt,X),bt=new Fr(yt,Y,X,J),pt=new li(yt,Z,Y,X),ft=new Bi(yt,Z,Y,X),Y.programs=at.programs,b.capabilities=X,b.extensions=Z,b.properties=K,b.renderLists=ot,b.shadowMap=dt,b.state=J,b.info=Y}_t();const At=new Sr(b,yt);function Ct(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function wt(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const t=Y.autoReset,e=dt.enabled,i=dt.autoUpdate,n=dt.needsUpdate,r=dt.type;_t(),Y.autoReset=t,dt.enabled=e,dt.autoUpdate=i,dt.needsUpdate=n,dt.type=r}function Mt(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function It(t){const e=t.target;e.removeEventListener("dispose",It),function(t){(function(t){const e=K.get(t).programs;void 0!==e&&(e.forEach((function(t){at.releaseProgram(t)})),t.isShaderMaterial&&at.releaseShaderCache(t))})(t),K.remove(t)}(e)}this.xr=At,this.getContext=function(){return yt},this.getContextAttributes=function(){return yt.getContextAttributes()},this.forceContextLoss=function(){const t=Z.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=Z.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return F},this.setPixelRatio=function(t){void 0!==t&&(F=t,this.setSize(S,B,!1))},this.getSize=function(t){return t.set(S,B)},this.setSize=function(t,i,n){At.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(S=t,B=i,e.width=Math.floor(t*F),e.height=Math.floor(i*F),!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(S*F,B*F).floor()},this.setDrawingBufferSize=function(t,i,n){S=t,B=i,F=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(M)},this.getViewport=function(t){return t.copy(L)},this.setViewport=function(t,e,i,n){t.isVector4?L.set(t.x,t.y,t.z,t.w):L.set(t,e,i,n),J.viewport(M.copy(L).multiplyScalar(F).floor())},this.getScissor=function(t){return t.copy(D)},this.setScissor=function(t,e,i,n){t.isVector4?D.set(t.x,t.y,t.z,t.w):D.set(t,e,i,n),J.scissor(I.copy(D).multiplyScalar(F).floor())},this.getScissorTest=function(){return R},this.setScissorTest=function(t){J.setScissorTest(R=t)},this.setOpaqueSort=function(t){T=t},this.setTransparentSort=function(t){U=t},this.getClearColor=function(t){return t.copy(ht.getClearColor())},this.setClearColor=function(){ht.setClearColor.apply(ht,arguments)},this.getClearAlpha=function(){return ht.getClearAlpha()},this.setClearAlpha=function(){ht.setClearAlpha.apply(ht,arguments)},this.clear=function(t=!0,e=!0,i=!0){let n=0;t&&(n|=16384),e&&(n|=256),i&&(n|=1024),yt.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",Ct,!1),e.removeEventListener("webglcontextrestored",wt,!1),e.removeEventListener("webglcontextcreationerror",Mt,!1),ot.dispose(),lt.dispose(),K.dispose(),tt.dispose(),et.dispose(),rt.dispose(),mt.dispose(),bt.dispose(),at.dispose(),At.dispose(),At.removeEventListener("sessionstart",St),At.removeEventListener("sessionend",Bt),V&&(V.dispose(),V=null),Ft.stop()},this.renderBufferDirect=function(t,e,i,n,r,a){null===e&&(e=W);const s=r.isMesh&&r.matrixWorld.determinant()<0,o=function(t,e,i,n,r){!0!==e.isScene&&(e=W);$.resetTextureUnits();const a=e.fog,s=n.isMeshStandardMaterial?e.environment:null,o=null===A?b.outputEncoding:!0===A.isXRRenderTarget?A.texture.encoding:3e3,l=(n.isMeshStandardMaterial?et:tt).get(n.envMap||s),c=!0===n.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,d=!!n.normalMap&&!!i.attributes.tangent,h=!!i.morphAttributes.position,u=!!i.morphAttributes.normal,f=!!i.morphAttributes.color,g=n.toneMapped?b.toneMapping:0,m=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,v=void 0!==m?m.length:0,y=K.get(n),x=p.state.lights;if(!0===O&&(!0===z||t!==w)){const e=t===w&&n.id===C;ct.setState(n,t,e)}let _=!1;n.version===y.__version?y.needsLights&&y.lightsStateVersion!==x.state.version||y.outputEncoding!==o||r.isInstancedMesh&&!1===y.instancing?_=!0:r.isInstancedMesh||!0!==y.instancing?r.isSkinnedMesh&&!1===y.skinning?_=!0:r.isSkinnedMesh||!0!==y.skinning?y.envMap!==l||!0===n.fog&&y.fog!==a?_=!0:void 0===y.numClippingPlanes||y.numClippingPlanes===ct.numPlanes&&y.numIntersection===ct.numIntersection?(y.vertexAlphas!==c||y.vertexTangents!==d||y.morphTargets!==h||y.morphNormals!==u||y.morphColors!==f||y.toneMapping!==g||!0===X.isWebGL2&&y.morphTargetsCount!==v)&&(_=!0):_=!0:_=!0:_=!0:(_=!0,y.__version=n.version);let M=y.currentProgram;!0===_&&(M=Dt(n,e,r));let I=!1,E=!1,S=!1;const T=M.getUniforms(),U=y.uniforms;J.useProgram(M.program)&&(I=!0,E=!0,S=!0);n.id!==C&&(C=n.id,E=!0);if(I||w!==t){if(T.setValue(yt,"projectionMatrix",t.projectionMatrix),X.logarithmicDepthBuffer&&T.setValue(yt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),w!==t&&(w=t,E=!0,S=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){const e=T.map.cameraPosition;void 0!==e&&e.setValue(yt,G.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&T.setValue(yt,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||r.isSkinnedMesh)&&T.setValue(yt,"viewMatrix",t.matrixWorldInverse)}if(r.isSkinnedMesh){T.setOptional(yt,r,"bindMatrix"),T.setOptional(yt,r,"bindMatrixInverse");const t=r.skeleton;t&&(X.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),T.setValue(yt,"boneTexture",t.boneTexture,$),T.setValue(yt,"boneTextureSize",t.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const L=i.morphAttributes;(void 0!==L.position||void 0!==L.normal||void 0!==L.color&&!0===X.isWebGL2)&&ut.update(r,i,n,M);(E||y.receiveShadow!==r.receiveShadow)&&(y.receiveShadow=r.receiveShadow,T.setValue(yt,"receiveShadow",r.receiveShadow));n.isMeshGouraudMaterial&&null!==n.envMap&&(U.envMap.value=l,U.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);E&&(T.setValue(yt,"toneMappingExposure",b.toneMappingExposure),y.needsLights&&(R=S,(D=U).ambientLightColor.needsUpdate=R,D.lightProbe.needsUpdate=R,D.directionalLights.needsUpdate=R,D.directionalLightShadows.needsUpdate=R,D.pointLights.needsUpdate=R,D.pointLightShadows.needsUpdate=R,D.spotLights.needsUpdate=R,D.spotLightShadows.needsUpdate=R,D.rectAreaLights.needsUpdate=R,D.hemisphereLights.needsUpdate=R),a&&!0===n.fog&&st.refreshFogUniforms(U,a),st.refreshMaterialUniforms(U,n,F,B,V),On.upload(yt,y.uniformsList,U,$));var D,R;n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(On.upload(yt,y.uniformsList,U,$),n.uniformsNeedUpdate=!1);n.isSpriteMaterial&&T.setValue(yt,"center",r.center);if(T.setValue(yt,"modelViewMatrix",r.modelViewMatrix),T.setValue(yt,"normalMatrix",r.normalMatrix),T.setValue(yt,"modelMatrix",r.matrixWorld),n.isShaderMaterial||n.isRawShaderMaterial){const t=n.uniformsGroups;for(let e=0,i=t.length;e<i;e++)if(X.isWebGL2){const i=t[e];bt.update(i,M),bt.bind(i,M)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return M}(t,e,i,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 d,h=1;!0===n.wireframe&&(l=nt.getWireframeAttribute(i),h=2),mt.setup(r,n,o,i,l);let u=pt;null!==l&&(d=it.get(l),u=ft,u.setIndex(d));const f=null!==l?l.count:c.count,g=i.drawRange.start*h,m=i.drawRange.count*h,v=null!==a?a.start*h:0,y=null!==a?a.count*h:1/0,x=Math.max(g,v),_=Math.min(f,g+m,v+y)-1,M=Math.max(0,_-x+1);if(0!==M){if(r.isMesh)!0===n.wireframe?(J.setLineWidth(n.wireframeLinewidth*q()),u.setMode(1)):u.setMode(4);else if(r.isLine){let t=n.linewidth;void 0===t&&(t=1),J.setLineWidth(t*q()),r.isLineSegments?u.setMode(1):r.isLineLoop?u.setMode(2):u.setMode(3)}else r.isPoints?u.setMode(0):r.isSprite&&u.setMode(4);if(r.isInstancedMesh)u.renderInstances(x,M,r.count);else if(i.isInstancedBufferGeometry){const t=Math.min(i.instanceCount,i._maxInstanceCount);u.renderInstances(x,M,t)}else u.render(x,M)}},this.compile=function(t,e){function i(t,e,i){!0===t.transparent&&2===t.side?(t.side=1,t.needsUpdate=!0,Dt(t,e,i),t.side=0,t.needsUpdate=!0,Dt(t,e,i),t.side=2):Dt(t,e,i)}p=lt.get(t),p.init(),m.push(p),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(p.pushLight(t),t.castShadow&&p.pushShadow(t))})),p.setupLights(b.physicallyCorrectLights),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++){i(n[r],t,e)}else i(n,t,e)})),m.pop(),p=null};let Et=null;function St(){Ft.stop()}function Bt(){Ft.start()}const Ft=new ti;function Tt(t,e,i,n){const r=t.opaque,s=t.transmissive,o=t.transparent;p.setupLightsView(i),s.length>0&&function(t,e,i){const n=X.isWebGL2;null===V&&(V=new N(1,1,{generateMipmaps:!0,type:Z.has("EXT_color_buffer_half_float")?1016:1009,minFilter:1008,samples:n&&!0===a?4:0}));b.getDrawingBufferSize(j),n?V.setSize(j.x,j.y):V.setSize(u(j.x),u(j.y));const r=b.getRenderTarget();b.setRenderTarget(V),b.clear();const s=b.toneMapping;b.toneMapping=0,Ut(t,e,i),b.toneMapping=s,$.updateMultisampleRenderTarget(V),$.updateRenderTargetMipmap(V),b.setRenderTarget(r)}(r,e,i),n&&J.viewport(M.copy(n)),r.length>0&&Ut(r,e,i),s.length>0&&Ut(s,e,i),o.length>0&&Ut(o,e,i),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1)}function Ut(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)&&Lt(s,e,i,o,l,c)}}function Lt(t,e,i,n,r,a){t.onBeforeRender(b,e,i,n,r,a),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(b,e,i,n,t,a),!0===r.transparent&&2===r.side?(r.side=1,r.needsUpdate=!0,b.renderBufferDirect(i,e,n,r,t,a),r.side=0,r.needsUpdate=!0,b.renderBufferDirect(i,e,n,r,t,a),r.side=2):b.renderBufferDirect(i,e,n,r,t,a),t.onAfterRender(b,e,i,n,r,a)}function Dt(t,e,i){!0!==e.isScene&&(e=W);const n=K.get(t),r=p.state.lights,a=p.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?et:tt).get(t.envMap||n.environment),void 0===c&&(t.addEventListener("dispose",It),c=new Map,n.programs=c);let d=c.get(l);if(void 0!==d){if(n.currentProgram===d&&n.lightsStateVersion===s)return Rt(t,o),d}else o.uniforms=at.getUniforms(t),t.onBuild(i,o,b),t.onBeforeCompile(o,b),d=at.acquireProgram(o,l),c.set(l,d),n.uniforms=o.uniforms;const h=n.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(h.clippingPlanes=ct.uniform),Rt(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&&(h.ambientLightColor.value=r.state.ambient,h.lightProbe.value=r.state.probe,h.directionalLights.value=r.state.directional,h.directionalLightShadows.value=r.state.directionalShadow,h.spotLights.value=r.state.spot,h.spotLightShadows.value=r.state.spotShadow,h.rectAreaLights.value=r.state.rectArea,h.ltc_1.value=r.state.rectAreaLTC1,h.ltc_2.value=r.state.rectAreaLTC2,h.pointLights.value=r.state.point,h.pointLightShadows.value=r.state.pointShadow,h.hemisphereLights.value=r.state.hemi,h.directionalShadowMap.value=r.state.directionalShadowMap,h.directionalShadowMatrix.value=r.state.directionalShadowMatrix,h.spotShadowMap.value=r.state.spotShadowMap,h.spotLightMatrix.value=r.state.spotLightMatrix,h.spotLightMap.value=r.state.spotLightMap,h.pointShadowMap.value=r.state.pointShadowMap,h.pointShadowMatrix.value=r.state.pointShadowMatrix);const u=d.getUniforms(),f=On.seqWithValue(u.seq,h);return n.currentProgram=d,n.uniformsList=f,d}function Rt(t,e){const i=K.get(t);i.outputEncoding=e.outputEncoding,i.instancing=e.instancing,i.skinning=e.skinning,i.morphTargets=e.morphTargets,i.morphNormals=e.morphNormals,i.morphColors=e.morphColors,i.morphTargetsCount=e.morphTargetsCount,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas,i.vertexTangents=e.vertexTangents,i.toneMapping=e.toneMapping}Ft.setAnimationLoop((function(t){Et&&Et(t)})),"undefined"!=typeof self&&Ft.setContext(self),this.setAnimationLoop=function(t){Et=t,At.setAnimationLoop(t),null===t?Ft.stop():Ft.start()},At.addEventListener("sessionstart",St),At.addEventListener("sessionend",Bt),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===y)return;!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===At.enabled&&!0===At.isPresenting&&(!0===At.cameraAutoUpdate&&At.updateCamera(e),e=At.getCamera()),!0===t.isScene&&t.onBeforeRender(b,t,e,A),p=lt.get(t,m.length),p.init(),m.push(p),H.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),P.setFromProjectionMatrix(H),z=this.localClippingEnabled,O=ct.init(this.clippingPlanes,z,e),h=ot.get(t,f.length),h.init(),f.push(h),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)p.pushLight(e),e.castShadow&&p.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||P.intersectsSprite(e)){r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H);const t=rt.update(e),i=e.material;i.visible&&h.push(e,t,i,n,G.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==Y.render.frame&&(e.skeleton.update(),e.skeleton.frame=Y.render.frame),!e.frustumCulled||P.intersectsObject(e))){r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H);const t=rt.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&&h.push(e,t,o,n,G.z,s)}}else i.visible&&h.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,b.sortObjects),h.finish(),!0===b.sortObjects&&h.sort(T,U),!0===O&&ct.beginShadows();const i=p.state.shadowsArray;if(dt.render(i,t,e),!0===O&&ct.endShadows(),!0===this.info.autoReset&&this.info.reset(),ht.render(h,t),p.setupLights(b.physicallyCorrectLights),e.isArrayCamera){const i=e.cameras;for(let e=0,n=i.length;e<n;e++){const n=i[e];Tt(h,t,n,n.viewport)}}else Tt(h,t,e);null!==A&&($.updateMultisampleRenderTarget(A),$.updateRenderTargetMipmap(A)),!0===t.isScene&&t.onAfterRender(b,t,e),mt.resetDefaultState(),C=-1,w=null,m.pop(),p=m.length>0?m[m.length-1]:null,f.pop(),h=f.length>0?f[f.length-1]:null},this.getActiveCubeFace=function(){return x},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(t,e,i){K.get(t.texture).__webglTexture=e,K.get(t.depthTexture).__webglTexture=i;const n=K.get(t);n.__hasExternalTextures=!0,n.__hasExternalTextures&&(n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0===Z.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),n.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const i=K.get(t);i.__webglFramebuffer=e,i.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,i=0){A=t,x=e,_=i;let n=!0;if(t){const e=K.get(t);void 0!==e.__useDefaultFramebuffer?(J.bindFramebuffer(36160,null),n=!1):void 0===e.__webglFramebuffer?$.setupRenderTarget(t):e.__hasExternalTextures&&$.rebindTextures(t,K.get(t.texture).__webglTexture,K.get(t.depthTexture).__webglTexture)}let r=null,a=!1,s=!1;if(t){const i=t.texture;(i.isData3DTexture||i.isDataArrayTexture)&&(s=!0);const n=K.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=n[e],a=!0):r=X.isWebGL2&&t.samples>0&&!1===$.useMultisampledRTT(t)?K.get(t).__webglMultisampledFramebuffer:n,M.copy(t.viewport),I.copy(t.scissor),E=t.scissorTest}else M.copy(L).multiplyScalar(F).floor(),I.copy(D).multiplyScalar(F).floor(),E=R;if(J.bindFramebuffer(36160,r)&&X.drawBuffers&&n&&J.drawBuffers(t,r),J.viewport(M),J.scissor(I),J.setScissorTest(E),a){const n=K.get(t.texture);yt.framebufferTexture2D(36160,36064,34069+e,n.__webglTexture,i)}else if(s){const n=K.get(t.texture),r=e||0;yt.framebufferTextureLayer(36160,36064,n.__webglTexture,i||0,r)}C=-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=K.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)!==yt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=1016===l&&(Z.has("EXT_color_buffer_half_float")||X.isWebGL2&&Z.has("EXT_color_buffer_float"));if(!(1009===l||gt.convert(l)===yt.getParameter(35738)||1015===l&&(X.isWebGL2||Z.has("OES_texture_float")||Z.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&yt.readPixels(e,i,n,r,gt.convert(o),gt.convert(l),a)}finally{const t=null!==A?K.get(A).__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);$.setTexture2D(e,0),yt.copyTexSubImage2D(3553,i,0,0,t.x,t.y,r,a),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);$.setTexture2D(i,0),yt.pixelStorei(37440,i.flipY),yt.pixelStorei(37441,i.premultiplyAlpha),yt.pixelStorei(3317,i.unpackAlignment),e.isDataTexture?yt.texSubImage2D(3553,n,t.x,t.y,r,a,s,o,e.image.data):e.isCompressedTexture?yt.compressedTexSubImage2D(3553,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):yt.texSubImage2D(3553,n,t.x,t.y,s,o,e.image),0===n&&i.generateMipmaps&&yt.generateMipmap(3553),J.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,r=0){if(b.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 d;if(n.isData3DTexture)$.setTexture3D(n,0),d=32879;else{if(!n.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");$.setTexture2DArray(n,0),d=35866}yt.pixelStorei(37440,n.flipY),yt.pixelStorei(37441,n.premultiplyAlpha),yt.pixelStorei(3317,n.unpackAlignment);const h=yt.getParameter(3314),u=yt.getParameter(32878),p=yt.getParameter(3316),f=yt.getParameter(3315),g=yt.getParameter(32877),m=i.isCompressedTexture?i.mipmaps[0]:i.image;yt.pixelStorei(3314,m.width),yt.pixelStorei(32878,m.height),yt.pixelStorei(3316,t.min.x),yt.pixelStorei(3315,t.min.y),yt.pixelStorei(32877,t.min.z),i.isDataTexture||i.isData3DTexture?yt.texSubImage3D(d,r,e.x,e.y,e.z,a,s,o,l,c,m.data):i.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),yt.compressedTexSubImage3D(d,r,e.x,e.y,e.z,a,s,o,l,m.data)):yt.texSubImage3D(d,r,e.x,e.y,e.z,a,s,o,l,c,m),yt.pixelStorei(3314,h),yt.pixelStorei(32878,u),yt.pixelStorei(3316,p),yt.pixelStorei(3315,f),yt.pixelStorei(32877,g),0===r&&n.generateMipmaps&&yt.generateMipmap(d),J.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?$.setTextureCube(t,0):t.isData3DTexture?$.setTexture3D(t,0):t.isDataArrayTexture?$.setTexture2DArray(t,0):$.setTexture2D(t,0),J.unbindTexture()},this.resetState=function(){x=0,_=0,A=null,J.reset(),mt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends Tr{}).prototype.isWebGL1Renderer=!0;class Ur extends ie{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new B(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,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.fog=t.fog,this}}const Lr=new Q,Dr=new Q,Rr=new vt,kr=new bt,Nr=new ct;class Pr extends Ht{constructor(t=new be,e=new Ur){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)Lr.fromBufferAttribute(e,t-1),Dr.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=Lr.distanceTo(Dr);t.setAttribute("lineDistance",new ce(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");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(),Nr.copy(i.boundingSphere),Nr.applyMatrix4(n),Nr.radius+=r,!1===t.ray.intersectsSphere(Nr))return;Rr.copy(n).invert(),kr.copy(t.ray).applyMatrix4(Rr);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=new Q,c=new Q,d=new Q,h=new Q,u=this.isLineSegments?2:1,p=i.index,f=i.attributes.position;if(null!==p){for(let i=Math.max(0,a.start),n=Math.min(p.count,a.start+a.count)-1;i<n;i+=u){const n=p.getX(i),r=p.getX(i+1);l.fromBufferAttribute(f,n),c.fromBufferAttribute(f,r);if(kr.distanceSqToSegment(l,c,h,d)>o)continue;h.applyMatrix4(this.matrixWorld);const a=t.ray.origin.distanceTo(h);a<t.near||a>t.far||e.push({distance:a,point:d.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else{for(let i=Math.max(0,a.start),n=Math.min(f.count,a.start+a.count)-1;i<n;i+=u){l.fromBufferAttribute(f,i),c.fromBufferAttribute(f,i+1);if(kr.distanceSqToSegment(l,c,h,d)>o)continue;h.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(h);n<t.near||n>t.far||e.push({distance:n,point:d.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}class Or{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 g:new Q);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 Q,n=[],r=[],a=[],s=new Q,o=new vt;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new Q)}r[0]=new Q,a[0]=new Q;let c=Number.MAX_VALUE;const d=Math.abs(n[0].x),h=Math.abs(n[0].y),u=Math.abs(n[0].z);d<=c&&(c=d,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),u<=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(l(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(l(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 zr extends Or{constructor(t=0,e=0,i=1,n=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,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 g,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}}function Qr(){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)}}}const Vr=new Q,Hr=new Qr,jr=new Qr,Gr=new Qr;function Wr(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 qr(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 Zr(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)}class Xr extends Or{constructor(t=new g,e=new g,i=new g,n=new g){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new g){const i=e,n=this.v0,r=this.v1,a=this.v2,s=this.v3;return i.set(Zr(t,n.x,r.x,a.x,s.x),Zr(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}}class Jr extends Or{constructor(t=new Q,e=new Q,i=new Q,n=new Q){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new Q){const i=e,n=this.v0,r=this.v1,a=this.v2,s=this.v3;return i.set(Zr(t,n.x,r.x,a.x,s.x),Zr(t,n.y,r.y,a.y,s.y),Zr(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}}class Yr extends Or{constructor(t=new g,e=new g){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new g){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 g;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}}class Kr extends Or{constructor(t=new g,e=new g,i=new g){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new g){const i=e,n=this.v0,r=this.v1,a=this.v2;return i.set(qr(t,n.x,r.x,a.x),qr(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}}class $r extends Or{constructor(t=new Q,e=new Q,i=new Q){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Q){const i=e,n=this.v0,r=this.v1,a=this.v2;return i.set(qr(t,n.x,r.x,a.x),qr(t,n.y,r.y,a.y),qr(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}}class ta extends Or{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new g){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],d=n[a>n.length-3?n.length-1:a+2];return i.set(Wr(s,o.x,l.x,c.x,d.x),Wr(s,o.y,l.y,c.y,d.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 g).fromArray(i))}return this}}var ea=Object.freeze({__proto__:null,ArcCurve:class extends zr{constructor(t,e,i,n,r,a){super(t,e,i,i,n,r,a),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends Or{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new Q){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]:(Vr.subVectors(n[0],n[1]).add(n[0]),s=Vr);const d=n[l%r],h=n[(l+1)%r];if(this.closed||l+2<r?o=n[(l+2)%r]:(Vr.subVectors(n[r-1],n[r-2]).add(n[r-1]),o=Vr),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(s.distanceToSquared(d),t),i=Math.pow(d.distanceToSquared(h),t),n=Math.pow(h.distanceToSquared(o),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),Hr.initNonuniformCatmullRom(s.x,d.x,h.x,o.x,e,i,n),jr.initNonuniformCatmullRom(s.y,d.y,h.y,o.y,e,i,n),Gr.initNonuniformCatmullRom(s.z,d.z,h.z,o.z,e,i,n)}else"catmullrom"===this.curveType&&(Hr.initCatmullRom(s.x,d.x,h.x,o.x,this.tension),jr.initCatmullRom(s.y,d.y,h.y,o.y,this.tension),Gr.initCatmullRom(s.z,d.z,h.z,o.z,this.tension));return i.set(Hr.calc(c),jr.calc(c),Gr.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 Q).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},CubicBezierCurve:Xr,CubicBezierCurve3:Jr,EllipseCurve:zr,LineCurve:Yr,LineCurve3:class extends Or{constructor(t=new Q,e=new Q){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new Q){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:Kr,QuadraticBezierCurve3:$r,SplineCurve:ta});class ia extends be{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=[],d=[],h=[],u=[];let p=0;const f=[],m=i/2;let b=0;function v(i){const r=p,a=new g,f=new Q;let v=0;const y=!0===i?t:e,x=!0===i?1:-1;for(let t=1;t<=n;t++)d.push(0,m*x,0),h.push(0,x,0),u.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);f.x=y*r,f.y=m*x,f.z=y*i,d.push(f.x,f.y,f.z),h.push(0,x,0),a.x=.5*i+.5,a.y=.5*r*x+.5,u.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),v+=3}l.addGroup(b,v,!0===i?1:2),b+=v}!function(){const a=new Q,g=new Q;let v=0;const y=(e-t)/i;for(let l=0;l<=r;l++){const c=[],b=l/r,v=b*(e-t)+t;for(let t=0;t<=n;t++){const e=t/n,r=e*o+s,l=Math.sin(r),f=Math.cos(r);g.x=v*l,g.y=-b*i+m,g.z=v*f,d.push(g.x,g.y,g.z),a.set(l,y,f).normalize(),h.push(a.x,a.y,a.z),u.push(e,1-b),c.push(p++)}f.push(c)}for(let t=0;t<n;t++)for(let e=0;e<r;e++){const i=f[e][t],n=f[e+1][t],r=f[e+1][t+1],a=f[e][t+1];c.push(i,n,a),c.push(n,r,a),v+=6}l.addGroup(b,v,0),b+=v}(),!1===a&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new ce(d,3)),this.setAttribute("normal",new ce(h,3)),this.setAttribute("uv",new ce(u,2))}static fromJSON(t){return new ia(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class na extends ia{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 na(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ra extends be{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=[],d=new Q,h=new Q,u=[],p=[],f=[],g=[];for(let u=0;u<=i;u++){const m=[],b=u/i;let v=0;0==u&&0==a?v=.5/e:u==i&&o==Math.PI&&(v=-.5/e);for(let i=0;i<=e;i++){const o=i/e;d.x=-t*Math.cos(n+o*r)*Math.sin(a+b*s),d.y=t*Math.cos(a+b*s),d.z=t*Math.sin(n+o*r)*Math.sin(a+b*s),p.push(d.x,d.y,d.z),h.copy(d).normalize(),f.push(h.x,h.y,h.z),g.push(o+v,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)&&u.push(e,r,l),(t!==i-1||o<Math.PI)&&u.push(r,s,l)}this.setIndex(u),this.setAttribute("position",new ce(p,3)),this.setAttribute("normal",new ce(f,3)),this.setAttribute("uv",new ce(g,2))}static fromJSON(t){return new ra(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class aa extends be{constructor(t=new $r(new Q(-1,-1,0),new Q(-1,1,0),new Q(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 Q,o=new Q,l=new g;let c=new Q;const d=[],h=[],u=[],p=[];function f(r){c=t.getPointAt(r/e,c);const l=a.normals[r],u=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*u.x,o.y=a*l.y+r*u.y,o.z=a*l.z+r*u.z,o.normalize(),h.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,d.push(s.x,s.y,s.z)}}!function(){for(let t=0;t<e;t++)f(t);f(!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,u.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 ce(d,3)),this.setAttribute("normal",new ce(h,3)),this.setAttribute("uv",new ce(u,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new aa((new ea[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class sa extends ie{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new B(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new B(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new g(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.fog=!0,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.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.fog=t.fog,this}}function oa(t,e,i){return ca(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)}function la(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}function ca(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}class da{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.copySampleValue_(i-1)}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.copySampleValue_(0);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.copySampleValue_(0);if(void 0===n)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}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_(){}}class ha extends da{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,d=this._offsetNext,h=this._weightPrev,u=this._weightNext,p=(i-e)/(n-e),f=p*p,g=f*p,m=-h*g+2*h*f-h*p,b=(1+h)*g+(-1.5-2*h)*f+(-.5+h)*p+1,v=(-1-u)*g+(1.5+u)*f+.5*p,y=u*g-u*f;for(let t=0;t!==s;++t)r[t]=m*a[c+t]+b*a[l+t]+v*a[o+t]+y*a[d+t];return r}}class ua extends da{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),d=1-c;for(let t=0;t!==s;++t)r[t]=a[l+t]*d+a[o+t]*c;return r}}class pa extends da{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}}class fa{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=la(e,this.TimeBufferType),this.values=la(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:la(t.times,Array),values:la(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new pa(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new ua(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new ha(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=oa(i,r,a),this.values=oa(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&&ca(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=oa(this.times),e=oa(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=oa(t,0,a),this.values=oa(e,0,a*i)):(this.times=t,this.values=e),this}clone(){const t=oa(this.times,0),e=oa(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}fa.prototype.TimeBufferType=Float32Array,fa.prototype.ValueBufferType=Float32Array,fa.prototype.DefaultInterpolation=2301;class ga extends fa{}ga.prototype.ValueTypeName="bool",ga.prototype.ValueBufferType=Array,ga.prototype.DefaultInterpolation=2300,ga.prototype.InterpolantFactoryMethodLinear=void 0,ga.prototype.InterpolantFactoryMethodSmooth=void 0;class ma extends fa{}ma.prototype.ValueTypeName="color";class ba extends fa{}ba.prototype.ValueTypeName="number";class va extends da{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)z.slerpFlat(r,0,a,l-s,a,l,o);return r}}class ya extends fa{InterpolantFactoryMethodLinear(t){return new va(this.times,this.values,this.getValueSize(),t)}}ya.prototype.ValueTypeName="quaternion",ya.prototype.DefaultInterpolation=2301,ya.prototype.InterpolantFactoryMethodSmooth=void 0;class xa extends fa{}xa.prototype.ValueTypeName="string",xa.prototype.ValueBufferType=Array,xa.prototype.DefaultInterpolation=2300,xa.prototype.InterpolantFactoryMethodLinear=void 0,xa.prototype.InterpolantFactoryMethodSmooth=void 0;class _a extends fa{}_a.prototype.ValueTypeName="vector";Error;const Aa=new RegExp("[\\[\\]\\.:\\/]","g"),Ca="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",wa=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]")+/(WCOD+)?/.source.replace("WCOD",Ca)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]")+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]")+"$"),Ma=["material","materials","bones","map"];class Ia{constructor(t,e,i){this.path=e,this.parsedPath=i||Ia.parseTrackName(e),this.node=Ia.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 Ia.Composite(t,e,i):new Ia(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Aa,"")}static parseTrackName(t){const e=wa.exec(t);if(null===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!==Ma.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(void 0===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=Ia.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;case"map":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.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;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.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}}Ia.Composite=class{constructor(t,e,i){const n=i||Ia.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()}},Ia.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Ia.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Ia.prototype.GetterByBindingType=[Ia.prototype._getValue_direct,Ia.prototype._getValue_array,Ia.prototype._getValue_arrayElement,Ia.prototype._getValue_toArray],Ia.prototype.SetterByBindingTypeAndVersioning=[[Ia.prototype._setValue_direct,Ia.prototype._setValue_direct_setNeedsUpdate,Ia.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ia.prototype._setValue_array,Ia.prototype._setValue_array_setNeedsUpdate,Ia.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ia.prototype._setValue_arrayElement,Ia.prototype._setValue_arrayElement_setNeedsUpdate,Ia.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ia.prototype._setValue_fromArray,Ia.prototype._setValue_fromArray_setNeedsUpdate,Ia.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];new Float32Array(1);"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"144"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="144");var Ea={value:()=>{}};function Sa(){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 Ba(n)}function Ba(t){this._=t}function Fa(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 Ta(t,e){for(var i,n=0,r=t.length;n<r;++n)if((i=t[n]).name===e)return i.value}function Ua(t,e,i){for(var n=0,r=t.length;n<r;++n)if(t[n].name===e){t[n]=Ea,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=i&&t.push({name:e,value:i}),t}Ba.prototype=Sa.prototype={constructor:Ba,on:function(t,e){var i,n=this._,r=Fa(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]=Ua(n[i],t.name,e);else if(null==e)for(i in n)n[i]=Ua(n[i],t.name,null);return this}for(;++a<s;)if((i=(t=r[a]).type)&&(i=Ta(n[i],t.name)))return i},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new Ba(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 La,Da,Ra=Sa,ka=0,Na=0,Pa=0,Oa=0,za=0,Qa=0,Va="object"==typeof performance&&performance.now?performance:Date,Ha="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ja(){return za||(Ha(Ga),za=Va.now()+Qa)}function Ga(){za=0}function Wa(){this._call=this._time=this._next=null}function qa(t,e,i){var n=new Wa;return n.restart(t,e,i),n}function Za(){za=(Oa=Va.now())+Qa,ka=Na=0;try{!function(){ja(),++ka;for(var t,e=La;e;)(t=za-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ka}()}finally{ka=0,function(){var t,e,i=La,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:La=e);Da=t,Ja(n)}(),za=0}}function Xa(){var t=Va.now(),e=t-Oa;e>1e3&&(Qa-=e,Oa=t)}function Ja(t){ka||(Na&&(Na=clearTimeout(Na)),t-za>24?(t<1/0&&(Na=setTimeout(Za,t-Va.now()-Qa)),Pa&&(Pa=clearInterval(Pa))):(Pa||(Oa=Va.now(),Pa=setInterval(Xa,1e3)),ka=1,Ha(Za)))}Wa.prototype=qa.prototype={constructor:Wa,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?ja():+i)+(null==e?0:+e),this._next||Da===this||(Da?Da._next=this:La=this,Da=this),this._call=t,this._time=i,Ja()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ja())}};const Ya=4294967296;function Ka(t){return t.x}function $a(t){return t.y}function ts(t){return t.z}var es=Math.PI*(3-Math.sqrt(5)),is=20*Math.PI/(9+Math.sqrt(221)),ns=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,d=qa(p),h=Ra("tick","end"),u=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Ya)/Ya}();function p(){f(),h.call("tick",i),r<a&&(d.stop(),h.call("end",i))}function f(e){var a,d,h=t.length;void 0===e&&(e=1);for(var u=0;u<e;++u)for(r+=(o-r)*s,c.forEach((function(t){t(r)})),a=0;a<h;++a)null==(d=t[a]).fx?d.x+=d.vx*=l:(d.x=d.fx,d.vx=0),n>1&&(null==d.fy?d.y+=d.vy*=l:(d.y=d.fy,d.vy=0)),n>2&&(null==d.fz?d.z+=d.vz*=l:(d.z=d.fz,d.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*es,o=i*is;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,u,n),e}return null==t&&(t=[]),g(),i={tick:f,restart:function(){return d.restart(p),i},stop:function(){return d.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?(u=t,c.forEach(m),i):u},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,d=(n>1?l.shift():null)||0,h=(n>2?l.shift():null)||0,u=l.shift()||1/0,p=0,f=t.length;for(u*=u,p=0;p<f;++p)(a=(e=c-(s=t[p]).x)*e+(i=d-(s.y||0))*i+(r=h-(s.z||0))*r)<u&&(o=s,u=a);return o},on:function(t,e){return arguments.length>1?(h.on(t,e),i):h.on(t)}}},rs=function(t){return function(){return t}},as=function(t){return 1e-6*(t()-.5)};function ss(t){return t.index}function os(t,e){var i=t.get(e);if(!i)throw new Error("node not found: "+e);return i}var ls=function(t){var e,i,n,r,a,s,o,l=ss,c=function(t){return 1/Math.min(a[t.source.index],a[t.target.index])},d=rs(30),h=1;function u(n){for(var a=0,l=t.length;a<h;++a)for(var c,d,u,p,f,g=0,m=0,b=0,v=0;g<l;++g)d=(c=t[g]).source,m=(u=c.target).x+u.vx-d.x-d.vx||as(o),r>1&&(b=u.y+u.vy-d.y-d.vy||as(o)),r>2&&(v=u.z+u.vz-d.z-d.vz||as(o)),m*=p=((p=Math.sqrt(m*m+b*b+v*v))-i[g])/p*n*e[g],b*=p,v*=p,u.vx-=m*(f=s[g]),r>1&&(u.vy-=b*f),r>2&&(u.vz-=v*f),d.vx+=m*(f=1-f),r>1&&(d.vy+=b*f),r>2&&(d.vz+=v*f)}function p(){if(n){var r,o,c=n.length,d=t.length,h=new Map(n.map((t,e)=>[l(t,e,n),t]));for(r=0,a=new Array(c);r<d;++r)(o=t[r]).index=r,"object"!=typeof o.source&&(o.source=os(h,o.source)),"object"!=typeof o.target&&(o.target=os(h,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(d);r<d;++r)o=t[r],s[r]=a[o.source.index]/(a[o.source.index]+a[o.target.index]);e=new Array(d),f(),i=new Array(d),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]=+d(t[e],e,t)}return null==t&&(t=[]),u.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()},u.links=function(e){return arguments.length?(t=e,p(),u):t},u.id=function(t){return arguments.length?(l=t,u):l},u.iterations=function(t){return arguments.length?(h=+t,u):h},u.strength=function(t){return arguments.length?(c="function"==typeof t?t:rs(+t),f(),u):c},u.distance=function(t){return arguments.length?(d="function"==typeof t?t:rs(+t),g(),u):d},u};function cs(t,e,i){if(isNaN(e))return t;var n,r,a,s,o,l,c=t._root,d={data:i},h=t._x0,u=t._x1;if(!c)return t._root=d,t;for(;c.length;)if((s=e>=(r=(h+u)/2))?h=r:u=r,n=c,!(c=c[o=+s]))return n[o]=d,t;if(e===(a=+t._x.call(null,c.data)))return d.next=c,n?n[o]=d:t._root=d,t;do{n=n?n[o]=new Array(2):t._root=new Array(2),(s=e>=(r=(h+u)/2))?h=r:u=r}while((o=+s)==(l=+(a>=r)));return n[l]=c,n[o]=d,t}var ds=function(t,e,i){this.node=t,this.x0=e,this.x1=i};function hs(t){return t[0]}function us(t,e){var i=new ps(null==e?hs:e,NaN,NaN);return null==t?i:i.addAll(t)}function ps(t,e,i){this._x=t,this._x0=e,this._x1=i,this._root=void 0}function fs(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var gs=us.prototype=ps.prototype;gs.copy=function(){var t,e,i=new ps(this._x,this._x0,this._x1),n=this._root;if(!n)return i;if(!n.length)return i._root=fs(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]=fs(e));return i},gs.add=function(t){var e=+this._x.call(null,t);return cs(this.cover(e),e,t)},gs.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)cs(this,r[e],t[e]);return this},gs.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},gs.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},gs.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},gs.find=function(t,e){var i,n,r,a,s,o=this._x0,l=this._x1,c=[],d=this._root;for(d&&c.push(new ds(d,o,l)),null==e?e=1/0:(o=t-e,l=t+e);a=c.pop();)if(!(!(d=a.node)||(n=a.x0)>l||(r=a.x1)<o))if(d.length){var h=(n+r)/2;c.push(new ds(d[1],h,r),new ds(d[0],n,h)),(s=+(t>=h))&&(a=c[c.length-1],c[c.length-1]=c[c.length-1-s],c[c.length-1-s]=a)}else{var u=Math.abs(t-+this._x.call(null,d.data));u<e&&(e=u,o=t-u,l=t+u,i=d.data)}return i},gs.remove=function(t){if(isNaN(a=+this._x.call(null,t)))return this;var e,i,n,r,a,s,o,l,c,d=this._root,h=this._x0,u=this._x1;if(!d)return this;if(d.length)for(;;){if((o=a>=(s=(h+u)/2))?h=s:u=s,e=d,!(d=d[l=+o]))return this;if(!d.length)break;e[l+1&1]&&(i=e,c=l)}for(;d.data!==t;)if(n=d,!(d=d.next))return this;return(r=d.next)&&delete d.next,n?(r?n.next=r:delete n.next,this):e?(r?e[l]=r:delete e[l],(d=e[0]||e[1])&&d===(e[1]||e[0])&&!d.length&&(i?i[c]=d:this._root=d),this):(this._root=r,this)},gs.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},gs.root=function(){return this._root},gs.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},gs.visit=function(t){var e,i,n,r,a=[],s=this._root;for(s&&a.push(new ds(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 ds(i,o,r)),(i=s[0])&&a.push(new ds(i,n,o))}return this},gs.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new ds(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 ds(a,s,l)),(a=r[1])&&i.push(new ds(a,l,o))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},gs.x=function(t){return arguments.length?(this._x=t,this):this._x};function ms(t,e,i,n){if(isNaN(e)||isNaN(i))return t;var r,a,s,o,l,c,d,h,u,p=t._root,f={data:n},g=t._x0,m=t._y0,b=t._x1,v=t._y1;if(!p)return t._root=f,t;for(;p.length;)if((c=e>=(a=(g+b)/2))?g=a:b=a,(d=i>=(s=(m+v)/2))?m=s:v=s,r=p,!(p=p[h=d<<1|c]))return r[h]=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[h]=f:t._root=f,t;do{r=r?r[h]=new Array(4):t._root=new Array(4),(c=e>=(a=(g+b)/2))?g=a:b=a,(d=i>=(s=(m+v)/2))?m=s:v=s}while((h=d<<1|c)==(u=(l>=s)<<1|o>=a));return r[u]=p,r[h]=f,t}var bs=function(t,e,i,n,r){this.node=t,this.x0=e,this.y0=i,this.x1=n,this.y1=r};function vs(t){return t[0]}function ys(t){return t[1]}function xs(t,e,i){var n=new _s(null==e?vs:e,null==i?ys:i,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function _s(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 As(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var Cs=xs.prototype=_s.prototype;Cs.copy=function(){var t,e,i=new _s(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=As(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]=As(e));return i},Cs.add=function(t){const e=+this._x.call(null,t),i=+this._y.call(null,t);return ms(this.cover(e,i),e,i,t)},Cs.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,d=-1/0,h=-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>d&&(d=n),r<c&&(c=r),r>h&&(h=r));if(l>d||c>h)return this;for(this.cover(l,c).cover(d,h),i=0;i<a;++i)ms(this,s[i],o[i],t[i]);return this},Cs.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},Cs.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Cs.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]]},Cs.find=function(t,e,i){var n,r,a,s,o,l,c,d=this._x0,h=this._y0,u=this._x1,p=this._y1,f=[],g=this._root;for(g&&f.push(new bs(g,d,h,u,p)),null==i?i=1/0:(d=t-i,h=e-i,u=t+i,p=e+i,i*=i);l=f.pop();)if(!(!(g=l.node)||(r=l.x0)>u||(a=l.y0)>p||(s=l.x1)<d||(o=l.y1)<h))if(g.length){var m=(r+s)/2,b=(a+o)/2;f.push(new bs(g[3],m,b,s,o),new bs(g[2],r,b,m,o),new bs(g[1],m,a,s,b),new bs(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 v=t-+this._x.call(null,g.data),y=e-+this._y.call(null,g.data),x=v*v+y*y;if(x<i){var _=Math.sqrt(i=x);d=t-_,h=e-_,u=t+_,p=e+_,n=g.data}}return n},Cs.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,d,h,u,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,(d=s>=(l=(g+b)/2))?g=l:b=l,e=p,!(p=p[h=d<<1|c]))return this;if(!p.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(i=e,u=h)}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[h]=r:delete e[h],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(i?i[u]=p:this._root=p),this):(this._root=r,this)},Cs.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},Cs.root=function(){return this._root},Cs.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Cs.visit=function(t){var e,i,n,r,a,s,o=[],l=this._root;for(l&&o.push(new bs(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,d=(r+s)/2;(i=l[3])&&o.push(new bs(i,c,d,a,s)),(i=l[2])&&o.push(new bs(i,n,d,c,s)),(i=l[1])&&o.push(new bs(i,c,r,a,d)),(i=l[0])&&o.push(new bs(i,n,r,c,d))}return this},Cs.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new bs(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,d=(s+l)/2,h=(o+c)/2;(a=r[0])&&i.push(new bs(a,s,o,d,h)),(a=r[1])&&i.push(new bs(a,d,o,l,h)),(a=r[2])&&i.push(new bs(a,s,h,d,c)),(a=r[3])&&i.push(new bs(a,d,h,l,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},Cs.x=function(t){return arguments.length?(this._x=t,this):this._x},Cs.y=function(t){return arguments.length?(this._y=t,this):this._y};function ws(t,e,i,n,r){if(isNaN(e)||isNaN(i)||isNaN(n))return t;var a,s,o,l,c,d,h,u,p,f,g,m,b=t._root,v={data:r},y=t._x0,x=t._y0,_=t._z0,A=t._x1,C=t._y1,w=t._z1;if(!b)return t._root=v,t;for(;b.length;)if((u=e>=(s=(y+A)/2))?y=s:A=s,(p=i>=(o=(x+C)/2))?x=o:C=o,(f=n>=(l=(_+w)/2))?_=l:w=l,a=b,!(b=b[g=f<<2|p<<1|u]))return a[g]=v,t;if(c=+t._x.call(null,b.data),d=+t._y.call(null,b.data),h=+t._z.call(null,b.data),e===c&&i===d&&n===h)return v.next=b,a?a[g]=v:t._root=v,t;do{a=a?a[g]=new Array(8):t._root=new Array(8),(u=e>=(s=(y+A)/2))?y=s:A=s,(p=i>=(o=(x+C)/2))?x=o:C=o,(f=n>=(l=(_+w)/2))?_=l:w=l}while((g=f<<2|p<<1|u)==(m=(h>=l)<<2|(d>=o)<<1|c>=s));return a[m]=b,a[g]=v,t}var Ms=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 Is(t){return t[0]}function Es(t){return t[1]}function Ss(t){return t[2]}function Bs(t,e,i,n){var r=new Fs(null==e?Is:e,null==i?Es:i,null==n?Ss:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function Fs(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 Ts(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var Us=Bs.prototype=Fs.prototype;Us.copy=function(){var t,e,i=new Fs(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=Ts(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]=Ts(e));return i},Us.add=function(t){var e=+this._x.call(null,t),i=+this._y.call(null,t),n=+this._z.call(null,t);return ws(this.cover(e,i,n),e,i,n,t)},Us.addAll=function(t){var e,i,n,r,a,s=t.length,o=new Array(s),l=new Array(s),c=new Array(s),d=1/0,h=1/0,u=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<d&&(d=n),n>p&&(p=n),r<h&&(h=r),r>f&&(f=r),a<u&&(u=a),a>g&&(g=a));if(d>p||h>f||u>g)return this;for(this.cover(d,h,u).cover(p,f,g),i=0;i<s;++i)ws(this,o[i],l[i],c[i],t[i]);return this},Us.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,d,h=s-n||1,u=this._root;n>t||t>=s||r>e||e>=o||a>i||i>=l;)switch(d=(i<a)<<2|(e<r)<<1|t<n,(c=new Array(8))[d]=u,u=c,h*=2,d){case 0:s=n+h,o=r+h,l=a+h;break;case 1:n=s-h,o=r+h,l=a+h;break;case 2:s=n+h,r=o-h,l=a+h;break;case 3:n=s-h,r=o-h,l=a+h;break;case 4:s=n+h,o=r+h,a=l-h;break;case 5:n=s-h,o=r+h,a=l-h;break;case 6:s=n+h,r=o-h,a=l-h;break;case 7:n=s-h,r=o-h,a=l-h}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this},Us.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Us.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]]},Us.find=function(t,e,i,n){var r,a,s,o,l,c,d,h,u,p=this._x0,f=this._y0,g=this._z0,m=this._x1,b=this._y1,v=this._z1,y=[],x=this._root;for(x&&y.push(new Ms(x,p,f,g,m,b,v)),null==n?n=1/0:(p=t-n,f=e-n,g=i-n,m=t+n,b=e+n,v=i+n,n*=n);h=y.pop();)if(!(!(x=h.node)||(a=h.x0)>m||(s=h.y0)>b||(o=h.z0)>v||(l=h.x1)<p||(c=h.y1)<f||(d=h.z1)<g))if(x.length){var _=(a+l)/2,A=(s+c)/2,C=(o+d)/2;y.push(new Ms(x[7],_,A,C,l,c,d),new Ms(x[6],a,A,C,_,c,d),new Ms(x[5],_,s,C,l,A,d),new Ms(x[4],a,s,C,_,A,d),new Ms(x[3],_,A,o,l,c,C),new Ms(x[2],a,A,o,_,c,C),new Ms(x[1],_,s,o,l,A,C),new Ms(x[0],a,s,o,_,A,C)),(u=(i>=C)<<2|(e>=A)<<1|t>=_)&&(h=y[y.length-1],y[y.length-1]=y[y.length-1-u],y[y.length-1-u]=h)}else{var w=t-+this._x.call(null,x.data),M=e-+this._y.call(null,x.data),I=i-+this._z.call(null,x.data),E=w*w+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,b=e+S,v=i+S,r=x.data}}return r},Us.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,d,h,u,p,f,g,m=this._root,b=this._x0,v=this._y0,y=this._z0,x=this._x1,_=this._y1,A=this._z1;if(!m)return this;if(m.length)for(;;){if((h=a>=(l=(b+x)/2))?b=l:x=l,(u=s>=(c=(v+_)/2))?v=c:_=c,(p=o>=(d=(y+A)/2))?y=d:A=d,e=m,!(m=m[f=p<<2|u<<1|h]))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)},Us.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},Us.root=function(){return this._root},Us.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Us.visit=function(t){var e,i,n,r,a,s,o,l,c=[],d=this._root;for(d&&c.push(new Ms(d,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=c.pop();)if(!t(d=e.node,n=e.x0,r=e.y0,a=e.z0,s=e.x1,o=e.y1,l=e.z1)&&d.length){var h=(n+s)/2,u=(r+o)/2,p=(a+l)/2;(i=d[7])&&c.push(new Ms(i,h,u,p,s,o,l)),(i=d[6])&&c.push(new Ms(i,n,u,p,h,o,l)),(i=d[5])&&c.push(new Ms(i,h,r,p,s,u,l)),(i=d[4])&&c.push(new Ms(i,n,r,p,h,u,l)),(i=d[3])&&c.push(new Ms(i,h,u,a,s,o,p)),(i=d[2])&&c.push(new Ms(i,n,u,a,h,o,p)),(i=d[1])&&c.push(new Ms(i,h,r,a,s,u,p)),(i=d[0])&&c.push(new Ms(i,n,r,a,h,u,p))}return this},Us.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new Ms(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,d=e.y1,h=e.z1,u=(s+c)/2,p=(o+d)/2,f=(l+h)/2;(a=r[0])&&i.push(new Ms(a,s,o,l,u,p,f)),(a=r[1])&&i.push(new Ms(a,u,o,l,c,p,f)),(a=r[2])&&i.push(new Ms(a,s,p,l,u,d,f)),(a=r[3])&&i.push(new Ms(a,u,p,l,c,d,f)),(a=r[4])&&i.push(new Ms(a,s,o,f,u,p,h)),(a=r[5])&&i.push(new Ms(a,u,o,f,c,p,h)),(a=r[6])&&i.push(new Ms(a,s,p,f,u,d,h)),(a=r[7])&&i.push(new Ms(a,u,p,f,c,d,h))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},Us.x=function(t){return arguments.length?(this._x=t,this):this._x},Us.y=function(t){return arguments.length?(this._y=t,this):this._y},Us.z=function(t){return arguments.length?(this._z=t,this):this._z};var Ls=function(){var t,e,i,n,r,a,s=rs(-30),o=1,l=1/0,c=.81;function d(n){var a,s=t.length,o=(1===e?us(t,Ka):2===e?xs(t,Ka,$a):3===e?Bs(t,Ka,$a,ts):null).visitAfter(u);for(r=n,a=0;a<s;++a)i=t[a],o.visit(p)}function h(){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 u(t){var i,n,r,s,o,l,c=0,d=0,h=t.length;if(h){for(r=s=o=l=0;l<h;++l)(i=t[l])&&(n=Math.abs(i.value))&&(c+=i.value,d+=n,r+=n*(i.x||0),s+=n*(i.y||0),o+=n*(i.z||0));c*=Math.sqrt(4/h),t.x=r/d,e>1&&(t.y=s/d),e>2&&(t.z=o/d)}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,d,h,u){if(!t.value)return!0;var p=[d,h,u][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,v=f*f+g*g+m*m;if(b*b/c<v)return v<l&&(0===f&&(v+=(f=as(n))*f),e>1&&0===g&&(v+=(g=as(n))*g),e>2&&0===m&&(v+=(m=as(n))*m),v<o&&(v=Math.sqrt(o*v)),i.vx+=f*t.value*r/v,e>1&&(i.vy+=g*t.value*r/v),e>2&&(i.vz+=m*t.value*r/v)),!0;if(!(t.length||v>=l)){(t.data!==i||t.next)&&(0===f&&(v+=(f=as(n))*f),e>1&&0===g&&(v+=(g=as(n))*g),e>2&&0===m&&(v+=(m=as(n))*m),v<o&&(v=Math.sqrt(o*v)));do{t.data!==i&&(b=a[t.data.index]*r/v,i.vx+=f*b,e>1&&(i.vy+=g*b),e>2&&(i.vz+=m*b))}while(t=t.next)}}return d.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,h()},d.strength=function(t){return arguments.length?(s="function"==typeof t?t:rs(+t),h(),d):s},d.distanceMin=function(t){return arguments.length?(o=t*t,d):Math.sqrt(o)},d.distanceMax=function(t){return arguments.length?(l=t*t,d):Math.sqrt(l)},d.theta=function(t){return arguments.length?(c=t*t,d):Math.sqrt(c)},d},Ds=function(t,e,i){var n,r=1;function a(){var a,s,o=n.length,l=0,c=0,d=0;for(a=0;a<o;++a)l+=(s=n[a]).x||0,c+=s.y||0,d+=s.z||0;for(l=(l/o-t)*r,c=(c/o-e)*r,d=(d/o-i)*r,a=0;a<o;++a)s=n[a],l&&(s.x-=l),c&&(s.y-=c),d&&(s.z-=d)}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},Rs=i(9),ks=i.n(Rs),Ns=i(10),Ps=i.n(Ns),Os=i(11),zs=i.n(Os);function Qs(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Vs(t,e,i){return e&&Qs(t.prototype,e),i&&Qs(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function Hs(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)||function(t,e){if(!t)return;if("string"==typeof t)return js(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 js(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 js(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 Gs=Vs((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 Ws=i(1);function qs(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 Zs(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 Xs(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 Js(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)||Ks(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 Ys(t){return function(t){if(Array.isArray(t))return $s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ks(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 Ks(t,e){if(t){if("string"==typeof t)return $s(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)?$s(t,e):void 0}}function $s(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 to(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 eo=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],d=Xs(l,[o].map(to));s=c,a=d}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=Js(e,2),r=n[0],a=n[1];return t(a,[].concat(Ys(i),[r]))}))}(a),e instanceof Array&&0===e.length&&1===s.length&&(s[0].keys=[])),s};function io(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 no(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ro(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 ao(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)||oo(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 so(t){return function(t){if(Array.isArray(t))return lo(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||oo(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 oo(t,e){if(t){if("string"==typeof t)return lo(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)?lo(t,e):void 0}}function lo(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 co=["createObj","updateObj","exitObj","objBindAttr","dataBindAttr"];function ho(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,d=function(t){return t.hasOwnProperty(s)},h=e.filter((function(t){return!d(t)})),u=e.filter(d).map((function(t){return t[s]})),p=c?{enter:t,exit:u,update:[]}:function(t,e,i){var n={enter:[],update:[],exit:[]};if(i){var r=eo(t,i,!1),a=eo(e,i,!1),s=Object.assign({},r,a);Object.entries(s).forEach((function(t){var e=ao(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(so(o),so(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}(u,t,o);return p.update=p.update.map((function(t){var e=ao(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(h.map((function(t){return no({},r,t)}))),p}function uo(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,d=void 0===c?function(t){}:c,h=r.objBindAttr,u=void 0===h?"__obj":h,p=r.dataBindAttr,f=void 0===p?"__data":p,g=ro(r,co),m=ho(t,e,function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?io(Object(i),!0).forEach((function(e){no(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):io(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({objBindAttr:u,dataBindAttr:f},g)),b=m.enter,v=m.update;m.exit.forEach((function(t){var e=t[u];delete t[u],d(e),n(e)}));var y=function(t){var e=[];return t.forEach((function(t){var i=s(t);i&&(i[f]=t,t[u]=i,e.push(i))})),e}(b);!function(t){t.forEach((function(t){var e=t[u];e&&(e[f]=t,l(e,t))}))}([].concat(so(b),so(v))),y.forEach(i)}class po extends Map{constructor(t,e=bo){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(fo(this,t))}has(t){return super.has(fo(this,t))}set(t,e){return super.set(go(this,t),e)}delete(t){return super.delete(mo(this,t))}}Set;function fo({_intern:t,_key:e},i){const n=e(i);return t.has(n)?t.get(n):i}function go({_intern:t,_key:e},i){const n=e(i);return t.has(n)?t.get(n):(t.set(n,i),i)}function mo({_intern:t,_key:e},i){const n=e(i);return t.has(n)&&(i=t.get(n),t.delete(n)),i}function bo(t){return null!==t&&"object"==typeof t?t.valueOf():t}function vo(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}const yo=Symbol("implicit");var xo=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"),_o=i(5),Ao=i.n(_o);function Co(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 wo(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Co(Object(i),!0).forEach((function(e){Bo(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Co(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Mo(t){return(Mo="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 Io(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Eo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function So(t,e,i){return e&&Eo(t.prototype,e),i&&Eo(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function Bo(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Fo(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}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Uo(t,e)}function To(t){return(To=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Uo(t,e){return(Uo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Lo(){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 Do(t,e,i){return(Do=Lo()?Reflect.construct.bind():function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&Uo(r,i.prototype),r}).apply(null,arguments)}function Ro(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 ko(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function No(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return ko(t)}function Po(t){var e=Lo();return function(){var i,n=To(t);if(e){var r=To(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return No(this,i)}}function Oo(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)||Qo(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 zo(t){return function(t){if(Array.isArray(t))return Vo(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Qo(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 Qo(t,e){if(t){if("string"==typeof t)return Vo(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)?Vo(t,e):void 0}}function Vo(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 Ho=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)},jo=function(t){for(;t.children.length;){var e=t.children[0];t.remove(e),Ho(e)}},Go=["objFilter"];function Wo(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=Ro(i,Go);return uo(t,e.children.filter(r),(function(t){return e.add(t)}),(function(t){e.remove(t),jo(t)}),wo({objBindAttr:"__threeObj"},a))}var qo=function(t){return isNaN(t)?parseInt(Ao()(t).toHex(),16):t},Zo=function(t){return isNaN(t)?Ao()(t).getAlpha():1},Xo=function t(){var e=new po,i=[],n=[],r=yo;function a(t){let a=e.get(t);if(void 0===a){if(r!==yo)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 po;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)},vo.apply(a,arguments),a}(xo);function Jo(t,e,i){e&&"string"==typeof i&&t.filter((function(t){return!t[i]})).forEach((function(t){t[i]=Xo(e(t))}))}var Yo,Ko,$o,tl,el,il,nl,rl,al,sl,ol,ll,cl,dl,hl=window.THREE?window.THREE:{Group:wr,Mesh:Re,MeshLambertMaterial:sa,Color:B,BufferGeometry:be,BufferAttribute:se,Matrix4:vt,Vector3:Q,SphereBufferGeometry:class extends ra{constructor(t,e,i,n,r,a,s){console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),super(t,e,i,n,r,a,s)}},CylinderBufferGeometry:class extends ia{constructor(t,e,i,n,r,a,s,o){console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),super(t,e,i,n,r,a,s,o)}},TubeBufferGeometry:class extends aa{constructor(t,e,i,n,r){console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),super(t,e,i,n,r)}},ConeBufferGeometry:class extends na{constructor(t,e,i,n,r,a,s){console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),super(t,e,i,n,r,a,s)}},Line:Pr,LineBasicMaterial:Ur,QuadraticBezierCurve3:$r,CubicBezierCurve3:Jr,Box3:j},ul={graph:ks.a,forcelayout:Ps.a},pl=(new hl.BufferGeometry).setAttribute?"setAttribute":"addAttribute",fl=(new hl.BufferGeometry).applyMatrix4?"applyMatrix4":"applyMatrix";var gl=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){Fo(r,e);var n=Po(r);function r(){var e;Io(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(zo(i?[ko(e)]:[]),s)),e}return So(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}((Ko=(Yo={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(Ws.default)(t.linkWidth),i=Object(Ws.default)(t.linkCurvature),n=Object(Ws.default)(t.linkCurveRotation),r=Object(Ws.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"],d=l[a?"target":"to"];if(c&&d&&c.hasOwnProperty("x")&&d.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,d=new hl.Vector3(s.x,s.y||0,s.z||0),h=new hl.Vector3(o.x,o.y||0,o.z||0),u=d.distanceTo(h),p=n(e);if(u>0){var f=o.x-s.x,g=o.y-s.y||0,m=(new hl.Vector3).subVectors(h,d),b=m.clone().multiplyScalar(l).cross(0!==f||0!==g?new hl.Vector3(0,0,1):new hl.Vector3(0,1,0)).applyAxisAngle(m.normalize(),p).add((new hl.Vector3).addVectors(d,h).divideScalar(2));c=new hl.QuadraticBezierCurve3(d,b,h)}else{var v=70*l,y=-p,x=y+Math.PI/2;c=new hl.CubicBezierCurve3(d,new hl.Vector3(v*Math.cos(x),v*Math.sin(x),0).add(d),new hl.Vector3(v*Math.cos(y),v*Math.sin(y),0).add(d),h)}e.__curve=c}else e.__curve=null}}(s);var h=r(s);if(!t.linkPositionUpdate||!t.linkPositionUpdate(h?o.children[1]:o,{start:{x:c.x,y:c.y,z:c.z},end:{x:d.x,y:d.y,z:d.z}},s)||h){var u=s.__curve,p=o.children.length?o.children[0]:o;if("Line"===p.type){if(u)p.geometry.setFromPoints(u.getPoints(30));else{var f=p.geometry.getAttribute("position");f&&f.array&&6===f.array.length||p.geometry[pl]("position",f=new hl.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]=d.x,f.array[4]=d.y||0,f.array[5]=d.z||0,f.needsUpdate=!0}p.geometry.computeBoundingSphere()}else if("Mesh"===p.type)if(u){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 hl.TubeBufferGeometry(u,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,v=new hl.CylinderBufferGeometry(b,b,1,t.linkResolution,1,!1);v[fl]((new hl.Matrix4).makeTranslation(0,.5,0)),v[fl]((new hl.Matrix4).makeRotationX(Math.PI/2)),p.geometry.dispose(),p.geometry=v}var y=new hl.Vector3(c.x,c.y||0,c.z||0),x=new hl.Vector3(d.x,d.y||0,d.z||0),_=y.distanceTo(x);p.position.x=y.x,p.position.y=y.y,p.position.z=y.z,p.scale.z=_,p.parent.localToWorld(x),p.lookAt(x)}}}}}))}(),e=Object(Ws.default)(t.linkDirectionalArrowRelPos),i=Object(Ws.default)(t.linkDirectionalArrowLength),n=Object(Ws.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 d=Math.sqrt(Math.max(0,n(l)||1))*t.nodeRelSize,h=Math.sqrt(Math.max(0,n(c)||1))*t.nodeRelSize,u=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=d+u+(g-d-h-u)*p,b=f(m/g),v=f((m-u)/g);["x","y","z"].forEach((function(t){return s.position[t]=v[t]}));var y=Do(hl.Vector3,zo(["x","y","z"].map((function(t){return b[t]}))));s.parent.localToWorld(y),s.lookAt(y)}}})),r=Object(Ws.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),d=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(zo(i||[]),zo(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 jo(t);t.__progressRatio=t.__progressRatio%1}var r=t.__progressRatio,a=d(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 hl.Group;i.__linkThreeObjType="singleHopPhotons",e.__singleHopPhotonsObj=i,t.graphScene.add(i)}var n=Object(Ws.default)(t.linkDirectionalParticleWidth),r=Math.ceil(10*n(e))/10/2,a=t.linkDirectionalParticleResolution,s=new hl.SphereBufferGeometry(r,a,a),o=Object(Ws.default)(t.linkColor),l=Object(Ws.default)(t.linkDirectionalParticleColor)(e)||o(e)||"#f0f0f0",c=new hl.Color(qo(l)),d=3*t.linkOpacity,h=new hl.MeshLambertMaterial({color:c,transparent:!0,opacity:d});e.__singleHopPhotonsObj.add(new hl.Mesh(s,h))}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 hl.Box3;r.copy(i.geometry.boundingBox).applyMatrix4(i.matrixWorld),n.push(r)}return n.concat.apply(n,zo((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,zo(["x","y","z"].map((function(t){return Bo({},t,[qs(i,(function(e){return e.min[t]})),Zs(i,(function(e){return e.max[t]}))])})))):null}},stateInit:function(){return{d3ForceLayout:ns().force("link",ls()).force("charge",Ls()).force("center",Ds()).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"])&&Jo(t.graphData.nodes,Object(Ws.default)(t.nodeAutoColorBy),t.nodeColor),null!==t.linkAutoColorBy&&i(["linkAutoColorBy","graphData","linkColor"])&&Jo(t.graphData.links,Object(Ws.default)(t.linkAutoColorBy),t.linkColor),t._flushObjects||i(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var n=Object(Ws.default)(t.nodeThreeObject),r=Object(Ws.default)(t.nodeThreeObjectExtend),a=Object(Ws.default)(t.nodeVal),s=Object(Ws.default)(t.nodeColor),o=Object(Ws.default)(t.nodeVisibility),l={},c={};Wo(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 hl.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 hl.SphereBufferGeometry(r,o,o)),e.geometry.dispose(),e.geometry=l[n]);var d=s(i),h=new hl.Color(qo(d||"#ffffaa")),u=t.nodeOpacity*Zo(d);"MeshLambertMaterial"===e.material.type&&e.material.color.equals(h)&&e.material.opacity===u||(c.hasOwnProperty(d)||(c[d]=new hl.MeshLambertMaterial({color:h,transparent:!0,opacity:u})),e.material.dispose(),e.material=c[d])}}})}if(t._flushObjects||i(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution"])){var d=Object(Ws.default)(t.linkThreeObject),h=Object(Ws.default)(t.linkThreeObjectExtend),u=Object(Ws.default)(t.linkMaterial),p=Object(Ws.default)(t.linkVisibility),f=Object(Ws.default)(t.linkColor),g=Object(Ws.default)(t.linkWidth),m={},b={},v={},y=t.graphData.links.filter(p);if(Wo(y,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=d(e),a=h(e);if(r&&t.linkThreeObject===r&&(r=r.clone()),!r||a)if(g(e))i=new hl.Mesh;else{var s=new hl.BufferGeometry;s[pl]("position",new hl.BufferAttribute(new Float32Array(6),3)),i=new hl.Line(s)}return r?a?((n=new hl.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 hl.CylinderBufferGeometry(s,s,1,o,1,!1);l[fl]((new hl.Matrix4).makeTranslation(0,.5,0)),l[fl]((new hl.Matrix4).makeRotationX(Math.PI/2)),m[r]=l}n.geometry.dispose(),n.geometry=m[r]}}var c=u(i);if(c)n.material=c;else{var d=f(i),h=new hl.Color(qo(d||"#f0f0f0")),p=t.linkOpacity*Zo(d),y=a?"MeshLambertMaterial":"LineBasicMaterial";if(n.material.type!==y||!n.material.color.equals(h)||n.material.opacity!==p){var x=a?b:v;x.hasOwnProperty(d)||(x[d]=new hl[y]({color:h,transparent:p<1,opacity:p,depthWrite:p>=1})),n.material.dispose(),n.material=x[d]}}}}}),t.linkDirectionalArrowLength||e.hasOwnProperty("linkDirectionalArrowLength")){var x=Object(Ws.default)(t.linkDirectionalArrowLength),_=Object(Ws.default)(t.linkDirectionalArrowColor);Wo(y.filter(x),t.graphScene,{objBindAttr:"__arrowObj",objFilter:function(t){return"arrow"===t.__linkThreeObjType},createObj:function(){var t=new hl.Mesh(void 0,new hl.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 hl.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 hl.Color(_(i)||f(i)||"#f0f0f0"),e.material.opacity=3*t.linkOpacity}})}if(t.linkDirectionalParticles||e.hasOwnProperty("linkDirectionalParticles")){var A=Object(Ws.default)(t.linkDirectionalParticles),C=Object(Ws.default)(t.linkDirectionalParticleWidth),w=Object(Ws.default)(t.linkDirectionalParticleColor),M={},I={};Wo(y.filter(A),t.graphScene,{objBindAttr:"__photonsObj",objFilter:function(t){return"photons"===t.__linkThreeObjType},createObj:function(){var t=new hl.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*C(i))/10/2,o=t.linkDirectionalParticleResolution;a&&a.geometry.parameters.radius===s&&a.geometry.parameters.widthSegments===o?n=a.geometry:(I.hasOwnProperty(s)||(I[s]=new hl.SphereBufferGeometry(s,o,o)),n=I[s],a&&a.geometry.dispose());var l,c=w(i)||f(i)||"#f0f0f0",d=new hl.Color(qo(c)),h=3*t.linkOpacity;a&&a.material.color.equals(d)&&a.material.opacity===h?l=a.material:(M.hasOwnProperty(c)||(M[c]=new hl.MeshLambertMaterial({color:d,transparent:!0,opacity:h})),l=M[c],a&&a.material.dispose()),Wo(zo(new Array(r)).map((function(t,e){return{idx:e}})),e,{idAccessor:function(t){return t.idx},createObj:function(){return new hl.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 B=t.d3ForceLayout.force("link");B&&B.id((function(e){return e[t.nodeId]})).links(t.graphData.links);var F=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"===Mo(t)?e(t):t}s.out.push(o)}));var d=[];u(Object.values(c));var h=Object.assign.apply(Object,[{}].concat(zo(Object.entries(c).filter((function(t){return!Oo(t,2)[1].skip})).map((function(t){var e=Oo(t,2);return Bo({},e[0],e[1].depth)})))));return h;function u(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(zo(i.slice(i.indexOf(s))),[s]).map((function(t){return e(t.data)}));return d.some((function(e){return e.length===t.length&&e.every((function(e,i){return e===t[i]}))}))||(d.push(t),l(t)),"continue"}();if("continue"===o)continue}n>s.depth&&(s.depth=n,u(s.out,[].concat(zo(i),[s]),n+(s.skip?0:1)))}}}(t.graphData,(function(e){return e[t.nodeId]}),{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),T=Math.max.apply(Math,zo(Object.values(F||[]))),U=t.dagLevelDistance||t.graphData.nodes.length/(T||1)*2*(-1!==["radialin","radialout"].indexOf(t.dagMode)?.7:1);if(t.dagMode){var L=function(e,i){return function(n){return e?(F[n[t.nodeId]]-T/2)*U*(i?-1:1):void 0}},D=L(-1!==["lr","rl"].indexOf(t.dagMode),"rl"===t.dagMode),R=L(-1!==["td","bu"].indexOf(t.dagMode),"td"===t.dagMode),k=L(-1!==["zin","zout"].indexOf(t.dagMode),"zout"===t.dagMode);t.graphData.nodes.filter(t.dagNodeFilter).forEach((function(t){t.fx=D(t),t.fy=R(t),t.fz=k(t)}))}t.d3ForceLayout.force("dagRadial",-1!==["radialin","radialout"].indexOf(t.dagMode)?function(t,e,i,n){var r,a,s,o,l=rs(.1);function c(t){for(var l=0,c=r.length;l<c;++l){var d=r[l],h=d.x-e||1e-6,u=(d.y||0)-i||1e-6,p=(d.z||0)-n||1e-6,f=Math.sqrt(h*h+u*u+p*p),g=(o[l]-f)*s[l]*t/f;d.vx+=h*g,a>1&&(d.vy+=u*g),a>2&&(d.vz+=p*g)}}function d(){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=rs(+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,d()},c.strength=function(t){return arguments.length?(l="function"==typeof t?t:rs(+t),d(),c):l},c.radius=function(e){return arguments.length?(t="function"==typeof e?e:rs(+e),d(),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=F[e[t.nodeId]]||-1;return("radialin"===t.dagMode?T-i:i)*U})).strength((function(e){return t.dagNodeFilter(e)?1:0})):null)}else{var N=ul.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=ul.forcelayout(N,wo({dimensions:t.numDimensions},t.ngraphPhysics))).graph=N}for(var P=0;P<t.warmupTicks&&!(S&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);P++)E[S?"tick":"step"]();t.layout=E,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}}).stateInit,$o=void 0===Ko?function(){return{}}:Ko,tl=Yo.props,el=void 0===tl?{}:tl,il=Yo.methods,nl=void 0===il?{}:il,rl=Yo.aliases,al=void 0===rl?{}:rl,sl=Yo.init,ol=void 0===sl?function(){}:sl,ll=Yo.update,cl=void 0===ll?function(){}:ll,dl=Object.keys(el).map((function(t){return new Gs(t,el[t])})),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign({},$o instanceof Function?$o(t):$o,{initialised:!1}),i={};function n(e){return r(e,t),a(),n}var r=function(t,i){ol.call(n,t,e,i),e.initialised=!0},a=zs()((function(){e.initialised&&(cl.call(n,e,i),i={})}),1);return dl.forEach((function(t){n[t.name]=function(t){var r=t.name,s=t.triggerUpdate,o=void 0!==s&&s,l=t.onChange,c=void 0===l?function(t,e){}:l,d=t.defaultVal,h=void 0===d?null:d;return function(t){var s=e[r];if(!arguments.length)return s;var l=void 0===t?h:t;return e[r]=l,c.call(n,l,e,s),!i.hasOwnProperty(r)&&(i[r]=s),o&&a(),n}}(t)})),Object.keys(nl).forEach((function(t){n[t]=function(){for(var i,r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return(i=nl[t]).call.apply(i,[n,e].concat(a))}})),Object.entries(al).forEach((function(t){var e=Hs(t,2),i=e[0],r=e[1];return n[i]=n[r]})),n.resetProps=function(){return dl.forEach((function(t){n[t.name](t.defaultVal)})),n},n.resetProps(),e._rerender=a,n}),(window.THREE?window.THREE:{Group:wr}).Group,!0)}]);
|
|
8
8
|
//# sourceMappingURL=aframe-babia-components.min.js.map
|