ss-component-new 1.1.255 → 1.1.256

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/array-NRuqpA_a.js +4978 -0
  2. package/dist/array-uS_jzZMI.cjs +7 -0
  3. package/dist/{cloneDeep-Dyt41_L-.js → cloneDeep-D65qCr1M.js} +1 -1
  4. package/dist/{cloneDeep-C-pGUQKf.cjs → cloneDeep-DpFtWtui.cjs} +1 -1
  5. package/dist/{index-D2mqkg4c.cjs → index-5143SE2R.cjs} +1 -1
  6. package/dist/index-7eRz67Nr.js +908 -0
  7. package/dist/{index-CXnqXm6c.cjs → index-7hpm5RMu.cjs} +1 -1
  8. package/dist/index-9qLLF6Sz.cjs +1 -0
  9. package/dist/{index-DV6L8VsR.js → index-B1hAxVvT.js} +5 -5
  10. package/dist/index-B6QzxKzK.js +2115 -0
  11. package/dist/{index-BJGqjruN.js → index-BFWs_38B.js} +1 -1
  12. package/dist/{index-DY1Iv1Nz.js → index-BLY3jSMo.js} +8 -8
  13. package/dist/index-BLZ2LAOD.cjs +1 -0
  14. package/dist/{index-ZO1MQu0A.js → index-BOHz7nwR.js} +4 -4
  15. package/dist/index-BTruFGQP.cjs +1 -0
  16. package/dist/{index-ChBbyPw-.cjs → index-BZFuXIEF.cjs} +1 -1
  17. package/dist/index-BZRyqDKA.cjs +1 -0
  18. package/dist/index-Bb3Boi4X.js +373 -0
  19. package/dist/index-BgvNGJEj.cjs +1 -0
  20. package/dist/{index-VEIBSb0L.cjs → index-BjXTv-yp.cjs} +1 -1
  21. package/dist/{index-ChLhaUgK.cjs → index-BjoY1ow9.cjs} +175 -175
  22. package/dist/{index-Bvff3Rjc.js → index-BrNejk6v.js} +5 -5
  23. package/dist/{index-4QOp-GFW.js → index-BsDpqg06.js} +7 -7
  24. package/dist/{index-BPhMb7pK.js → index-BsqfcSII.js} +4 -4
  25. package/dist/{index-ByA8EBvo.cjs → index-CH5mx9VZ.cjs} +1 -1
  26. package/dist/index-CInyuIT4.cjs +1 -0
  27. package/dist/index-CRmbzY0-.cjs +1 -0
  28. package/dist/index-CSFgUZmi.cjs +9 -0
  29. package/dist/{index-BCY2xvgA.js → index-CVisVgQj.js} +1 -1
  30. package/dist/{index-Bb_UeGKJ.cjs → index-C_lPyJRy.cjs} +1 -1
  31. package/dist/{index-BqgOQWUB.js → index-Cs2XSpjM.js} +6 -6
  32. package/dist/{index-D_zly77U.js → index-Cs6aYNpY.js} +1985 -1932
  33. package/dist/index-CudxvfIs.js +33 -0
  34. package/dist/{index-D5Bz4nyQ.js → index-CwGC8R8R.js} +1 -1
  35. package/dist/{index-DsP7FB21.cjs → index-D4b6fLCT.cjs} +1 -1
  36. package/dist/index-DAwFQtgR.cjs +6 -0
  37. package/dist/{index-D2pc-BzQ.cjs → index-DG-rX-h9.cjs} +1 -1
  38. package/dist/{index-AmZEXNoQ.cjs → index-DKlDs6rr.cjs} +1 -1
  39. package/dist/{index-ChC7cQXw.cjs → index-DRO-doj3.cjs} +1 -1
  40. package/dist/{index-XqdyrkBW.js → index-DSSzfbXz.js} +8 -7
  41. package/dist/{index-exmBUjmZ.js → index-Ddt-py_9.js} +5 -5
  42. package/dist/index-DfM5skGF.cjs +1 -0
  43. package/dist/{index-CJz4osvs.js → index-DjljbsvQ.js} +6 -6
  44. package/dist/{index-Hiw-v6tJ.cjs → index-DmhJL6si.cjs} +1 -1
  45. package/dist/{index-CgreBJdF.js → index-DoVdmhVZ.js} +21 -20
  46. package/dist/{index-4zv-tITd.cjs → index-DordXHzi.cjs} +1 -1
  47. package/dist/{index-DmOEedex.js → index-GcvQB1OB.js} +13 -12
  48. package/dist/{index-DVpKjSNf.cjs → index-OGxpX9cx.cjs} +1 -1
  49. package/dist/index-S5bHuqsW.cjs +1 -0
  50. package/dist/{index-Bs2mNVJb.js → index-X2R-1WGH.js} +3 -3
  51. package/dist/{index-C9zbvQ_u.js → index-XU2dA5Uv.js} +24 -23
  52. package/dist/{index-DokJCYVc.cjs → index-jXB4NUd1.cjs} +1 -1
  53. package/dist/{index-BZCF6V6l.js → index-nfabzKkp.js} +4 -4
  54. package/dist/{index-DFaF-8_G.js → index-w1UtzHv-.js} +14 -17
  55. package/dist/index-yxASh3FK.js +3761 -0
  56. package/dist/{index-DVg2yzki.js → index-zRUxy31r.js} +1 -1
  57. package/dist/{index.vue_vue_type_script_setup_true_lang-BJKLFe1B.cjs → index.vue_vue_type_script_setup_true_lang-CIP77JiD.cjs} +1 -1
  58. package/dist/{index.vue_vue_type_script_setup_true_lang-DKt1jWSZ.js → index.vue_vue_type_script_setup_true_lang-Tw6PfjMa.js} +1 -1
  59. package/dist/index.vue_vue_type_style_index_0_scoped_0cbc0899_lang-CO9vJuxe.js +607 -0
  60. package/dist/index.vue_vue_type_style_index_0_scoped_0cbc0899_lang-DwrbQWhT.cjs +1 -0
  61. package/dist/index.vue_vue_type_style_index_0_scoped_11a5120d_lang-Br85-Gf0.js +304 -0
  62. package/dist/index.vue_vue_type_style_index_0_scoped_11a5120d_lang-CaalWbFo.cjs +1 -0
  63. package/dist/{login-l8Wv_G2i.js → login-Cvjr869W.js} +6 -6
  64. package/dist/login-hlCYwdtY.cjs +1 -0
  65. package/dist/{main-WNNH9wBa.cjs → main-Cc3OSRwO.cjs} +1 -1
  66. package/dist/{main-AjMVz5uU.js → main-DNxdz1id.js} +6 -6
  67. package/dist/menu-BChIacAp.cjs +11 -0
  68. package/dist/menu-BjsF_u0O.js +4867 -0
  69. package/dist/{modelComp-CxFffZnZ.js → modelComp-BTVOfrd2.js} +1 -1
  70. package/dist/{modelComp-CyktectM.cjs → modelComp-BxHtQcEE.cjs} +1 -1
  71. package/dist/ss-component.cjs +1 -1
  72. package/dist/ss-component.css +1 -1
  73. package/dist/ss-component.js +16 -16
  74. package/dist/ss-component3.cjs +1 -1
  75. package/dist/ss-component3.js +1 -1
  76. package/package.json +1 -1
  77. package/dist/array-D0ksMxBm.js +0 -4732
  78. package/dist/array-FnDBAqr_.cjs +0 -7
  79. package/dist/index-1L58FxXE.cjs +0 -1
  80. package/dist/index-BHBz_g9I.cjs +0 -1
  81. package/dist/index-BKvrNIq2.js +0 -4199
  82. package/dist/index-BLMAsu2L.cjs +0 -1
  83. package/dist/index-BT1bqIxy.js +0 -29
  84. package/dist/index-Bb-62WPF.cjs +0 -1
  85. package/dist/index-BeYOMEs2.js +0 -674
  86. package/dist/index-BipikeGR.js +0 -199
  87. package/dist/index-BjjXJSlm.cjs +0 -1
  88. package/dist/index-CNw33JR-.js +0 -371
  89. package/dist/index-DALSlEkV.cjs +0 -1
  90. package/dist/index-DRIDbmGM.cjs +0 -1
  91. package/dist/index-DeUj3yRd.cjs +0 -9
  92. package/dist/index-Dxbc5WoF.cjs +0 -1
  93. package/dist/index-HW8r5PRa.cjs +0 -1
  94. package/dist/index-JN1a_LH1.cjs +0 -1
  95. package/dist/index.vue_vue_type_style_index_0_scoped_11a5120d_lang-B7wukF06.cjs +0 -1
  96. package/dist/index.vue_vue_type_style_index_0_scoped_11a5120d_lang-BJ_xZq3T.js +0 -304
  97. package/dist/index.vue_vue_type_style_index_0_scoped_4b7a2e5d_lang-ByetdKK8.cjs +0 -1
  98. package/dist/index.vue_vue_type_style_index_0_scoped_4b7a2e5d_lang-CUy9QkFH.js +0 -908
  99. package/dist/login-Bps4AQ46.cjs +0 -1
  100. package/dist/menu-BEvMDEbJ.js +0 -6783
  101. package/dist/menu-Cj-UKXED.cjs +0 -16
  102. package/dist/obj/model.mtl +0 -42
  103. package/dist/obj/model.obj +0 -26110
  104. package/public/obj/model.mtl +0 -42
  105. package/public/obj/model.obj +0 -26110
@@ -1,12 +1,12 @@
1
- "use strict";const $=require("vue"),Wi=require("./index-HW8r5PRa.cjs"),Jo=require("./modelComp-CyktectM.cjs"),Mn=require("./index-ChC7cQXw.cjs"),Wt=require("./index-DeUj3yRd.cjs"),Ma=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),Ae=require("./cloneDeep-C-pGUQKf.cjs"),it=require("./menu-Cj-UKXED.cjs"),Ua=require("./index-Dxbc5WoF.cjs");var Yl="__lodash_hash_undefined__";function jl(i){return this.__data__.set(i,Yl),this}function Kl(i){return this.__data__.has(i)}function Fr(i){var e=-1,t=i==null?0:i.length;for(this.__data__=new Mn.MapCache;++e<t;)this.add(i[e])}Fr.prototype.add=Fr.prototype.push=jl;Fr.prototype.has=Kl;function Zl(i,e){for(var t=-1,n=i==null?0:i.length;++t<n;)if(e(i[t],t,i))return!0;return!1}function $l(i,e){return i.has(e)}var Jl=1,Ql=2;function Qo(i,e,t,n,r,s){var a=t&Jl,o=i.length,l=e.length;if(o!=l&&!(a&&l>o))return!1;var c=s.get(i),h=s.get(e);if(c&&h)return c==e&&h==i;var u=-1,d=!0,p=t&Ql?new Fr:void 0;for(s.set(i,e),s.set(e,i);++u<o;){var _=i[u],v=e[u];if(n)var m=a?n(v,_,u,e,i,s):n(_,v,u,i,e,s);if(m!==void 0){if(m)continue;d=!1;break}if(p){if(!Zl(e,function(f,b){if(!$l(p,b)&&(_===f||r(_,f,t,n,s)))return p.push(b)})){d=!1;break}}else if(!(_===v||r(_,v,t,n,s))){d=!1;break}}return s.delete(i),s.delete(e),d}function ec(i){var e=-1,t=Array(i.size);return i.forEach(function(n,r){t[++e]=[r,n]}),t}function tc(i){var e=-1,t=Array(i.size);return i.forEach(function(n){t[++e]=n}),t}var nc=1,ic=2,rc="[object Boolean]",sc="[object Date]",ac="[object Error]",oc="[object Map]",lc="[object Number]",cc="[object RegExp]",hc="[object Set]",uc="[object String]",fc="[object Symbol]",dc="[object ArrayBuffer]",pc="[object DataView]",Ia=Mn.Symbol?Mn.Symbol.prototype:void 0,Kr=Ia?Ia.valueOf:void 0;function mc(i,e,t,n,r,s,a){switch(t){case pc:if(i.byteLength!=e.byteLength||i.byteOffset!=e.byteOffset)return!1;i=i.buffer,e=e.buffer;case dc:return!(i.byteLength!=e.byteLength||!s(new Ae.Uint8Array(i),new Ae.Uint8Array(e)));case rc:case sc:case lc:return Mn.eq(+i,+e);case ac:return i.name==e.name&&i.message==e.message;case cc:case uc:return i==e+"";case oc:var o=ec;case hc:var l=n&nc;if(o||(o=tc),i.size!=e.size&&!l)return!1;var c=a.get(i);if(c)return c==e;n|=ic,a.set(i,e);var h=Qo(o(i),o(e),n,r,s,a);return a.delete(i),h;case fc:if(Kr)return Kr.call(i)==Kr.call(e)}return!1}var _c=1,gc=Object.prototype,vc=gc.hasOwnProperty;function xc(i,e,t,n,r,s){var a=t&_c,o=Ae.getAllKeys(i),l=o.length,c=Ae.getAllKeys(e),h=c.length;if(l!=h&&!a)return!1;for(var u=l;u--;){var d=o[u];if(!(a?d in e:vc.call(e,d)))return!1}var p=s.get(i),_=s.get(e);if(p&&_)return p==e&&_==i;var v=!0;s.set(i,e),s.set(e,i);for(var m=a;++u<l;){d=o[u];var f=i[d],b=e[d];if(n)var E=a?n(b,f,d,e,i,s):n(f,b,d,i,e,s);if(!(E===void 0?f===b||r(f,b,t,n,s):E)){v=!1;break}m||(m=d=="constructor")}if(v&&!m){var S=i.constructor,L=e.constructor;S!=L&&"constructor"in i&&"constructor"in e&&!(typeof S=="function"&&S instanceof S&&typeof L=="function"&&L instanceof L)&&(v=!1)}return s.delete(i),s.delete(e),v}var Mc=1,Na="[object Arguments]",Fa="[object Array]",er="[object Object]",Sc=Object.prototype,Oa=Sc.hasOwnProperty;function yc(i,e,t,n,r,s){var a=Mn.isArray(i),o=Mn.isArray(e),l=a?Fa:Ae.getTag(i),c=o?Fa:Ae.getTag(e);l=l==Na?er:l,c=c==Na?er:c;var h=l==er,u=c==er,d=l==c;if(d&&Ae.isBuffer(i)){if(!Ae.isBuffer(e))return!1;a=!0,h=!1}if(d&&!h)return s||(s=new Ae.Stack),a||Ae.isTypedArray(i)?Qo(i,e,t,n,r,s):mc(i,e,l,t,n,r,s);if(!(t&Mc)){var p=h&&Oa.call(i,"__wrapped__"),_=u&&Oa.call(e,"__wrapped__");if(p||_){var v=p?i.value():i,m=_?e.value():e;return s||(s=new Ae.Stack),r(v,m,t,n,s)}}return d?(s||(s=new Ae.Stack),xc(i,e,t,n,r,s)):!1}function el(i,e,t,n,r){return i===e?!0:i==null||e==null||!Mn.isObjectLike(i)&&!Mn.isObjectLike(e)?i!==i&&e!==e:yc(i,e,t,n,el,r)}function Ec(i,e){return el(i,e)}const Tc={__name:"index",props:{isVisible:{type:Boolean,default:!1},title:{type:String,default:""},width:{type:Number,default:200}},setup(i){const e=i,t=$.ref(null),n=$.ref(!1),r=$.ref(null);return $.watch(()=>e==null?void 0:e.isVisible,()=>{n.value=e==null?void 0:e.isVisible},{deep:!0,immediate:!0}),$.watch(()=>r.value,()=>{$.nextTick(()=>{var s,a;(a=(s=t.value)==null?void 0:s.updatePopper)==null||a.call(s)})},{deep:!0,immediate:!0}),(s,a)=>{const o=$.resolveComponent("el-popover");return $.openBlock(),$.createBlock(o,{visible:n.value,placement:"bottom",title:e==null?void 0:e.title,width:e==null?void 0:e.width,ref_key:"popOverRef",ref:t},{reference:$.withCtx(()=>[$.createElementVNode("div",null,[$.renderSlot(s.$slots,"reference",{ref_key:"referenceRef",ref:r})])]),default:$.withCtx(()=>[$.createElementVNode("div",null,[$.renderSlot(s.$slots,"content")])]),_:3},8,["visible","title","width"])}}},bc={class:"extra-button-content"},Ac={key:0,class:"extra-header"},wc=["onClick"],Rc={class:"extra-button-filter"},Cc={class:"form-content-value"},Pc={__name:"header",props:{buttons:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]}},emits:["buttonClick","filter"],setup(i,{emit:e}){const t=e,n=i,r=$.ref(!1),s=$.ref([]),a=$.ref([{label:"取消"},{label:"确认"}]),o=h=>{t("buttonClick",h)},l=h=>{var u,d;s.value=(d=(u=Wt.getColumnChild(Ae.cloneDeep(h)))==null?void 0:u.filter(p=>(p==null?void 0:p.label)!==""&&(p==null?void 0:p.label)!=="操作"))==null?void 0:d.map(p=>({label:(p==null?void 0:p.label)??"",value:"",name:(p==null?void 0:p.label)??"",isFormColHidden:p==null?void 0:p.isTableColHidden}))},c=h=>{(h==null?void 0:h.buttonName)==="确认"&&t("filter",h==null?void 0:h.content),r.value=!1};return $.onMounted(()=>{l(n.columns)}),$.watch(()=>n.columns,()=>{l(n.columns)},{deep:!0,immediate:!0}),(h,u)=>{var p;const d=$.resolveComponent("el-tooltip");return $.openBlock(),$.createElementBlock("div",bc,[n!=null&&n.buttons&&((p=n==null?void 0:n.buttons)==null?void 0:p.length)>0?($.openBlock(),$.createElementBlock("div",Ac,[($.openBlock(!0),$.createElementBlock($.Fragment,null,$.renderList(n==null?void 0:n.buttons,(_,v)=>($.openBlock(),$.createElementBlock("div",{class:"extra-contents",key:v},[$.createElementVNode("div",{class:"extra-content",style:$.normalizeStyle({background:(_==null?void 0:_.background)??"var(--ssComponent-primary-color)",color:"var(--system-bg)"}),onClick:m=>o(_==null?void 0:_.label)},$.toDisplayString(_==null?void 0:_.label),13,wc)]))),128))])):$.createCommentVNode("",!0),$.createElementVNode("div",Rc,[$.createVNode(Tc,{title:"筛选数据",width:500,isVisible:r.value},{reference:$.withCtx(()=>[$.createVNode(d,{content:"筛选",placement:"top-start"},{default:$.withCtx(()=>[$.createElementVNode("div",{class:"button-style",onClick:u[0]||(u[0]=_=>r.value=!r.value)},[$.createVNode($.unref(Mn.filter_default),{color:"var(--ssComponent-black)"})])]),_:1})]),content:$.withCtx(()=>[$.createElementVNode("div",Cc,[($.openBlock(),$.createBlock(Wt.ssForm,{rowContents:s.value,buttonValue:a.value,isRowFlex:!0,isEnableWrap:!1,isButtonRow:!1,key:a.value,isStartJustify:!1,onOnButtonClick:c},null,8,["rowContents","buttonValue"]))])]),_:1},8,["isVisible"])])])}}},Dc=Ma._export_sfc(Pc,[["__scopeId","data-v-e7197dc5"]]);/**
1
+ "use strict";const $=require("vue"),ot=require("./index-DAwFQtgR.cjs"),nl=require("./modelComp-BxHtQcEE.cjs"),Mn=require("./index-DRO-doj3.cjs"),Vi=require("./index-CSFgUZmi.cjs"),be=require("./cloneDeep-DpFtWtui.cjs"),Ea=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),mn=require("./menu-BChIacAp.cjs"),Fa=require("./index-DfM5skGF.cjs");var $l="__lodash_hash_undefined__";function Jl(i){return this.__data__.set(i,$l),this}function Ql(i){return this.__data__.has(i)}function Br(i){var e=-1,t=i==null?0:i.length;for(this.__data__=new Mn.MapCache;++e<t;)this.add(i[e])}Br.prototype.add=Br.prototype.push=Jl;Br.prototype.has=Ql;function ec(i,e){for(var t=-1,n=i==null?0:i.length;++t<n;)if(e(i[t],t,i))return!0;return!1}function tc(i,e){return i.has(e)}var nc=1,ic=2;function il(i,e,t,n,r,s){var a=t&nc,o=i.length,l=e.length;if(o!=l&&!(a&&l>o))return!1;var c=s.get(i),h=s.get(e);if(c&&h)return c==e&&h==i;var u=-1,d=!0,p=t&ic?new Br:void 0;for(s.set(i,e),s.set(e,i);++u<o;){var _=i[u],v=e[u];if(n)var m=a?n(v,_,u,e,i,s):n(_,v,u,i,e,s);if(m!==void 0){if(m)continue;d=!1;break}if(p){if(!ec(e,function(f,b){if(!tc(p,b)&&(_===f||r(_,f,t,n,s)))return p.push(b)})){d=!1;break}}else if(!(_===v||r(_,v,t,n,s))){d=!1;break}}return s.delete(i),s.delete(e),d}function rc(i){var e=-1,t=Array(i.size);return i.forEach(function(n,r){t[++e]=[r,n]}),t}function sc(i){var e=-1,t=Array(i.size);return i.forEach(function(n){t[++e]=n}),t}var ac=1,oc=2,lc="[object Boolean]",cc="[object Date]",hc="[object Error]",uc="[object Map]",fc="[object Number]",dc="[object RegExp]",pc="[object Set]",mc="[object String]",_c="[object Symbol]",gc="[object ArrayBuffer]",vc="[object DataView]",Oa=Mn.Symbol?Mn.Symbol.prototype:void 0,Jr=Oa?Oa.valueOf:void 0;function xc(i,e,t,n,r,s,a){switch(t){case vc:if(i.byteLength!=e.byteLength||i.byteOffset!=e.byteOffset)return!1;i=i.buffer,e=e.buffer;case gc:return!(i.byteLength!=e.byteLength||!s(new be.Uint8Array(i),new be.Uint8Array(e)));case lc:case cc:case fc:return Mn.eq(+i,+e);case hc:return i.name==e.name&&i.message==e.message;case dc:case mc:return i==e+"";case uc:var o=rc;case pc:var l=n&ac;if(o||(o=sc),i.size!=e.size&&!l)return!1;var c=a.get(i);if(c)return c==e;n|=oc,a.set(i,e);var h=il(o(i),o(e),n,r,s,a);return a.delete(i),h;case _c:if(Jr)return Jr.call(i)==Jr.call(e)}return!1}var Mc=1,Sc=Object.prototype,yc=Sc.hasOwnProperty;function Ec(i,e,t,n,r,s){var a=t&Mc,o=be.getAllKeys(i),l=o.length,c=be.getAllKeys(e),h=c.length;if(l!=h&&!a)return!1;for(var u=l;u--;){var d=o[u];if(!(a?d in e:yc.call(e,d)))return!1}var p=s.get(i),_=s.get(e);if(p&&_)return p==e&&_==i;var v=!0;s.set(i,e),s.set(e,i);for(var m=a;++u<l;){d=o[u];var f=i[d],b=e[d];if(n)var E=a?n(b,f,d,e,i,s):n(f,b,d,i,e,s);if(!(E===void 0?f===b||r(f,b,t,n,s):E)){v=!1;break}m||(m=d=="constructor")}if(v&&!m){var S=i.constructor,D=e.constructor;S!=D&&"constructor"in i&&"constructor"in e&&!(typeof S=="function"&&S instanceof S&&typeof D=="function"&&D instanceof D)&&(v=!1)}return s.delete(i),s.delete(e),v}var Tc=1,Ba="[object Arguments]",za="[object Array]",nr="[object Object]",bc=Object.prototype,ka=bc.hasOwnProperty;function Ac(i,e,t,n,r,s){var a=Mn.isArray(i),o=Mn.isArray(e),l=a?za:be.getTag(i),c=o?za:be.getTag(e);l=l==Ba?nr:l,c=c==Ba?nr:c;var h=l==nr,u=c==nr,d=l==c;if(d&&be.isBuffer(i)){if(!be.isBuffer(e))return!1;a=!0,h=!1}if(d&&!h)return s||(s=new be.Stack),a||be.isTypedArray(i)?il(i,e,t,n,r,s):xc(i,e,l,t,n,r,s);if(!(t&Tc)){var p=h&&ka.call(i,"__wrapped__"),_=u&&ka.call(e,"__wrapped__");if(p||_){var v=p?i.value():i,m=_?e.value():e;return s||(s=new be.Stack),r(v,m,t,n,s)}}return d?(s||(s=new be.Stack),Ec(i,e,t,n,r,s)):!1}function rl(i,e,t,n,r){return i===e?!0:i==null||e==null||!Mn.isObjectLike(i)&&!Mn.isObjectLike(e)?i!==i&&e!==e:Ac(i,e,t,n,rl,r)}function wc(i,e){return rl(i,e)}const Rc={__name:"index",props:{isVisible:{type:Boolean,default:!1},title:{type:String,default:""},width:{type:Number,default:200}},setup(i){const e=i,t=$.ref(null),n=$.ref(!1),r=$.ref(null);return $.watch(()=>e==null?void 0:e.isVisible,()=>{n.value=e==null?void 0:e.isVisible},{deep:!0,immediate:!0}),$.watch(()=>r.value,()=>{$.nextTick(()=>{var s,a;(a=(s=t.value)==null?void 0:s.updatePopper)==null||a.call(s)})},{deep:!0,immediate:!0}),(s,a)=>{const o=$.resolveComponent("el-popover");return $.openBlock(),$.createBlock(o,{visible:n.value,placement:"bottom",title:e==null?void 0:e.title,width:e==null?void 0:e.width,ref_key:"popOverRef",ref:t},{reference:$.withCtx(()=>[$.createElementVNode("div",null,[$.renderSlot(s.$slots,"reference",{ref_key:"referenceRef",ref:r})])]),default:$.withCtx(()=>[$.createElementVNode("div",null,[$.renderSlot(s.$slots,"content")])]),_:3},8,["visible","title","width"])}}},_i=$.ref(0),zr=i=>i==null?void 0:i.map(t=>(_i.value++,Array.isArray(t)?zr(t):{label:(t==null?void 0:t.label)??"",prop:(t==null?void 0:t.label)==="操作"?"operate":(t==null?void 0:t.prop)??"a"+_i.value,width:(t==null?void 0:t.label)==="操作"?"200":t!=null&&t.width?parseInt(t.width):"",fixed:(t==null?void 0:t.fixed)??void 0,sortable:(t==null?void 0:t.sortable)??!1,align:(t==null?void 0:t.align)??"center",showOverflowTooltip:(t==null?void 0:t.showOverflowTooltip)??!0,isNotDrag:(t==null?void 0:t.isNotDrag)??!1,isEditCol:(t==null?void 0:t.isEditCol)??!1,isOperate:(t==null?void 0:t.isOperate)??!1,id:(t==null?void 0:t.id)??_i.value,type:(t==null?void 0:t.label)==="操作"?"operate":void 0,formType:(t==null?void 0:t.formType)??"",isHidden:t==null?void 0:t.isHidden,options:(t==null?void 0:t.options)??[],children:zr(t.children)??void 0})),Cc=i=>{const e=[];function t(n){if(Array.isArray(n))for(const r of n)!r.children||r.children.length===0?e.push(r):t(r.children)}return t(i),e},Ha=i=>be.cloneDeep(i).map(t=>(Array.isArray(t)&&(t=t.map(n=>(Array.isArray(n)?n=zr(n):(n={label:(n==null?void 0:n.label)??"",prop:(n==null?void 0:n.label)==="操作"?"operate":(n==null?void 0:n.prop)??"a"+_i.value,width:(n==null?void 0:n.label)==="操作"?"200":n!=null&&n.width?parseInt(n.width):"",fixed:(n==null?void 0:n.fixed)??void 0,sortable:(n==null?void 0:n.sortable)??!1,align:(n==null?void 0:n.align)??"center",showOverflowTooltip:(n==null?void 0:n.showOverflowTooltip)??!0,isNotDrag:(n==null?void 0:n.isNotDrag)??!1,isEditCol:(n==null?void 0:n.isEditCol)??!1,isOperate:(n==null?void 0:n.isOperate)??!1,id:(n==null?void 0:n.id)??_i.value,type:(n==null?void 0:n.label)==="操作"?"operate":void 0,formType:(n==null?void 0:n.formType)??"",isHidden:n==null?void 0:n.isHidden,options:(n==null?void 0:n.options)??[],children:zr(n.children)},_i.value++),n))),t)),qi=i=>{function e(t,n=[]){if(!t||t.length===0)return[];let r=n;return Array.isArray(t)&&(t==null||t.forEach(s=>{var a;s!=null&&s.children&&((a=s.children)==null?void 0:a.length)>0?r=e(s==null?void 0:s.children,r):r.push(s)})),r}return e(i)},Pc={class:"extra-button-content"},Dc={key:0,class:"extra-header"},Lc=["onClick"],Uc={class:"extra-button-filter"},Ic={class:"form-content-value"},Nc={__name:"header",props:{buttons:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]}},emits:["buttonClick","filter"],setup(i,{emit:e}){const t=e,n=i,r=$.ref(!1),s=$.ref([]),a=$.ref([{label:"取消"},{label:"确认"}]),o=h=>{t("buttonClick",h)},l=h=>{var u,d;s.value=(d=(u=qi(be.cloneDeep(h)))==null?void 0:u.filter(p=>(p==null?void 0:p.label)!==""&&(p==null?void 0:p.label)!=="操作"))==null?void 0:d.map(p=>({label:(p==null?void 0:p.label)??"",value:"",name:(p==null?void 0:p.label)??"",isFormColHidden:p==null?void 0:p.isTableColHidden}))},c=h=>{(h==null?void 0:h.buttonName)==="确认"&&t("filter",h==null?void 0:h.content),r.value=!1};return $.onMounted(()=>{l(n.columns)}),$.watch(()=>n.columns,()=>{l(n.columns)},{deep:!0,immediate:!0}),(h,u)=>{var p;const d=$.resolveComponent("el-tooltip");return $.openBlock(),$.createElementBlock("div",Pc,[n!=null&&n.buttons&&((p=n==null?void 0:n.buttons)==null?void 0:p.length)>0?($.openBlock(),$.createElementBlock("div",Dc,[($.openBlock(!0),$.createElementBlock($.Fragment,null,$.renderList(n==null?void 0:n.buttons,(_,v)=>($.openBlock(),$.createElementBlock("div",{class:"extra-contents",key:v},[$.createElementVNode("div",{class:"extra-content",style:$.normalizeStyle({background:(_==null?void 0:_.background)??"var(--ssComponent-primary-color)",color:"var(--system-bg)"}),onClick:m=>o(_==null?void 0:_.label)},$.toDisplayString(_==null?void 0:_.label),13,Lc)]))),128))])):$.createCommentVNode("",!0),$.createElementVNode("div",Uc,[$.createVNode(Rc,{title:"筛选数据",width:500,isVisible:r.value},{reference:$.withCtx(()=>[$.createVNode(d,{content:"筛选",placement:"top-start"},{default:$.withCtx(()=>[$.createElementVNode("div",{class:"button-style",onClick:u[0]||(u[0]=_=>r.value=!r.value)},[$.createVNode($.unref(Mn.filter_default),{color:"var(--ssComponent-black)"})])]),_:1})]),content:$.withCtx(()=>[$.createElementVNode("div",Ic,[($.openBlock(),$.createBlock(Vi.ssForm,{rowContents:s.value,buttonValue:a.value,isRowFlex:!0,isEnableWrap:!1,isButtonRow:!1,key:a.value,isStartJustify:!1,onOnButtonClick:c},null,8,["rowContents","buttonValue"]))])]),_:1},8,["isVisible"])])])}}},Fc=Ea._export_sfc(Nc,[["__scopeId","data-v-e7197dc5"]]);/**
2
2
  * @license
3
3
  * Copyright 2010-2025 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT
5
- */const Sa="177",_i={ROTATE:0,DOLLY:1,PAN:2},pi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Lc=0,Ba=1,Uc=2,tl=1,Ic=2,pn=3,Sn=0,It=1,_n=2,Dn=0,gi=1,za=2,ka=3,Ha=4,Nc=5,Xn=100,Fc=101,Oc=102,Bc=103,zc=104,kc=200,Hc=201,Vc=202,Gc=203,Ds=204,Ls=205,Wc=206,Xc=207,qc=208,Yc=209,jc=210,Kc=211,Zc=212,$c=213,Jc=214,Us=0,Is=1,Ns=2,Mi=3,Fs=4,Os=5,Bs=6,zs=7,ya=0,Qc=1,eh=2,Ln=0,th=1,nh=2,ih=3,rh=4,sh=5,ah=6,oh=7,nl=300,Si=301,yi=302,ks=303,Hs=304,Wr=306,Or=1e3,Yn=1001,Vs=1002,Qt=1003,lh=1004,tr=1005,rn=1006,Zr=1007,jn=1008,an=1009,il=1010,rl=1011,Xi=1012,Ea=1013,Kn=1014,gn=1015,Zi=1016,Ta=1017,ba=1018,qi=1020,sl=35902,al=1021,ol=1022,$t=1023,Yi=1026,ji=1027,ll=1028,Aa=1029,cl=1030,wa=1031,Ra=1033,Rr=33776,Cr=33777,Pr=33778,Dr=33779,Gs=35840,Ws=35841,Xs=35842,qs=35843,Ys=36196,js=37492,Ks=37496,Zs=37808,$s=37809,Js=37810,Qs=37811,ea=37812,ta=37813,na=37814,ia=37815,ra=37816,sa=37817,aa=37818,oa=37819,la=37820,ca=37821,Lr=36492,ha=36494,ua=36495,hl=36283,fa=36284,da=36285,pa=36286,ch=3200,hh=3201,ul=0,uh=1,Pn="",Et="srgb",Ei="srgb-linear",Br="linear",st="srgb",ei=7680,Va=519,fh=512,dh=513,ph=514,fl=515,mh=516,_h=517,gh=518,vh=519,Ga=35044,Wa="300 es",vn=2e3,zr=2001;class Jn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const Tt=["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"],Ur=Math.PI/180,ma=180/Math.PI;function $i(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Tt[i&255]+Tt[i>>8&255]+Tt[i>>16&255]+Tt[i>>24&255]+"-"+Tt[e&255]+Tt[e>>8&255]+"-"+Tt[e>>16&15|64]+Tt[e>>24&255]+"-"+Tt[t&63|128]+Tt[t>>8&255]+"-"+Tt[t>>16&255]+Tt[t>>24&255]+Tt[n&255]+Tt[n>>8&255]+Tt[n>>16&255]+Tt[n>>24&255]).toLowerCase()}function $e(i,e,t){return Math.max(e,Math.min(t,i))}function xh(i,e){return(i%e+e)%e}function $r(i,e,t){return(1-t)*i+t*e}function Ni(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Lt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const Mh={DEG2RAD:Ur};class Xe{constructor(e=0,t=0){Xe.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=$e(this.x,e.x,t.x),this.y=$e(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=$e(this.x,e,t),this.y=$e(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar($e(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos($e(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Zn{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],h=n[r+2],u=n[r+3];const d=s[a+0],p=s[a+1],_=s[a+2],v=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=p,e[t+2]=_,e[t+3]=v;return}if(u!==v||l!==d||c!==p||h!==_){let m=1-o;const f=l*d+c*p+h*_+u*v,b=f>=0?1:-1,E=1-f*f;if(E>Number.EPSILON){const L=Math.sqrt(E),w=Math.atan2(L,f*b);m=Math.sin(m*w)/L,o=Math.sin(o*w)/L}const S=o*b;if(l=l*m+d*S,c=c*m+p*S,h=h*m+_*S,u=u*m+v*S,m===1-o){const L=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=L,c*=L,h*=L,u*=L}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],u=s[a],d=s[a+1],p=s[a+2],_=s[a+3];return e[t]=o*_+h*u+l*p-c*d,e[t+1]=l*_+h*d+c*u-o*p,e[t+2]=c*_+h*p+o*d-l*u,e[t+3]=h*_-o*u-l*d-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(r/2),u=o(s/2),d=l(n/2),p=l(r/2),_=l(s/2);switch(a){case"XYZ":this._x=d*h*u+c*p*_,this._y=c*p*u-d*h*_,this._z=c*h*_+d*p*u,this._w=c*h*u-d*p*_;break;case"YXZ":this._x=d*h*u+c*p*_,this._y=c*p*u-d*h*_,this._z=c*h*_-d*p*u,this._w=c*h*u+d*p*_;break;case"ZXY":this._x=d*h*u-c*p*_,this._y=c*p*u+d*h*_,this._z=c*h*_+d*p*u,this._w=c*h*u-d*p*_;break;case"ZYX":this._x=d*h*u-c*p*_,this._y=c*p*u+d*h*_,this._z=c*h*_-d*p*u,this._w=c*h*u+d*p*_;break;case"YZX":this._x=d*h*u+c*p*_,this._y=c*p*u+d*h*_,this._z=c*h*_-d*p*u,this._w=c*h*u-d*p*_;break;case"XZY":this._x=d*h*u-c*p*_,this._y=c*p*u-d*h*_,this._z=c*h*_+d*p*u,this._w=c*h*u+d*p*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],u=t[10],d=n+o+u;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(h-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(n>o&&n>u){const p=2*Math.sqrt(1+n-o-u);this._w=(h-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>u){const p=2*Math.sqrt(1+o-n-u);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+h)/p}else{const p=2*Math.sqrt(1+u-n-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+h)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs($e(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const p=1-t;return this._w=p*a+t*this._w,this._x=p*n+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-t)*h)/c,d=Math.sin(t*h)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=r*u+this._y*d,this._z=s*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class N{constructor(e=0,t=0,n=0){N.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Xa.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Xa.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),h=2*(o*t-s*r),u=2*(s*n-a*t);return this.x=t+l*c+a*u-o*h,this.y=n+l*h+o*c-s*u,this.z=r+l*u+s*h-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=$e(this.x,e.x,t.x),this.y=$e(this.y,e.y,t.y),this.z=$e(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=$e(this.x,e,t),this.y=$e(this.y,e,t),this.z=$e(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar($e(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Jr.copy(this).projectOnVector(e),this.sub(Jr)}reflect(e){return this.sub(Jr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos($e(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Jr=new N,Xa=new Zn;class qe{constructor(e,t,n,r,s,a,o,l,c){qe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],d=n[2],p=n[5],_=n[8],v=r[0],m=r[3],f=r[6],b=r[1],E=r[4],S=r[7],L=r[2],w=r[5],C=r[8];return s[0]=a*v+o*b+l*L,s[3]=a*m+o*E+l*w,s[6]=a*f+o*S+l*C,s[1]=c*v+h*b+u*L,s[4]=c*m+h*E+u*w,s[7]=c*f+h*S+u*C,s[2]=d*v+p*b+_*L,s[5]=d*m+p*E+_*w,s[8]=d*f+p*S+_*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*s*h+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=h*a-o*c,d=o*l-h*s,p=c*s-a*l,_=t*u+n*d+r*p;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/_;return e[0]=u*v,e[1]=(r*c-h*n)*v,e[2]=(o*n-r*a)*v,e[3]=d*v,e[4]=(h*t-r*l)*v,e[5]=(r*s-o*t)*v,e[6]=p*v,e[7]=(n*l-c*t)*v,e[8]=(a*t-n*s)*v,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Qr.makeScale(e,t)),this}rotate(e){return this.premultiply(Qr.makeRotation(-e)),this}translate(e,t){return this.premultiply(Qr.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Qr=new qe;function dl(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Ki(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Sh(){const i=Ki("canvas");return i.style.display="block",i}const qa={};function vi(i){i in qa||(qa[i]=!0,console.warn(i))}function yh(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Eh(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Th(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Ya=new qe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ja=new qe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function bh(){const i={enabled:!0,workingColorSpace:Ei,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===st&&(r.r=xn(r.r),r.g=xn(r.g),r.b=xn(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===st&&(r.r=xi(r.r),r.g=xi(r.g),r.b=xi(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Pn?Br:this.spaces[r].transfer},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return vi("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return vi("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Ei]:{primaries:e,whitePoint:n,transfer:Br,toXYZ:Ya,fromXYZ:ja,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Et},outputColorSpaceConfig:{drawingBufferColorSpace:Et}},[Et]:{primaries:e,whitePoint:n,transfer:st,toXYZ:Ya,fromXYZ:ja,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Et}}}),i}const Qe=bh();function xn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function xi(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let ti;class Ah{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ti===void 0&&(ti=Ki("canvas")),ti.width=e.width,ti.height=e.height;const r=ti.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=ti}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Ki("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=xn(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(xn(t[n]/255)*255):t[n]=xn(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let wh=0;class Ca{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:wh++}),this.uuid=$i(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(es(r[a].image)):s.push(es(r[a]))}else s=es(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function es(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Ah.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Rh=0;const ts=new N;class Pt extends Jn{constructor(e=Pt.DEFAULT_IMAGE,t=Pt.DEFAULT_MAPPING,n=Yn,r=Yn,s=rn,a=jn,o=$t,l=an,c=Pt.DEFAULT_ANISOTROPY,h=Pn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Rh++}),this.uuid=$i(),this.name="",this.source=new Ca(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Xe(0,0),this.repeat=new Xe(1,1),this.center=new Xe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new qe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(ts).x}get height(){return this.source.getSize(ts).y}get depth(){return this.source.getSize(ts).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==nl)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Or:e.x=e.x-Math.floor(e.x);break;case Yn:e.x=e.x<0?0:1;break;case Vs:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Or:e.y=e.y-Math.floor(e.y);break;case Yn:e.y=e.y<0?0:1;break;case Vs:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Pt.DEFAULT_IMAGE=null;Pt.DEFAULT_MAPPING=nl;Pt.DEFAULT_ANISOTROPY=1;class pt{constructor(e=0,t=0,n=0,r=1){pt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){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: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],h=l[4],u=l[8],d=l[1],p=l[5],_=l[9],v=l[2],m=l[6],f=l[10];if(Math.abs(h-d)<.01&&Math.abs(u-v)<.01&&Math.abs(_-m)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+v)<.1&&Math.abs(_+m)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(c+1)/2,S=(p+1)/2,L=(f+1)/2,w=(h+d)/4,C=(u+v)/4,P=(_+m)/4;return E>S&&E>L?E<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(E),r=w/n,s=C/n):S>L?S<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(S),n=w/r,s=P/r):L<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(L),n=C/s,r=P/s),this.set(n,r,s,t),this}let b=Math.sqrt((m-_)*(m-_)+(u-v)*(u-v)+(d-h)*(d-h));return Math.abs(b)<.001&&(b=1),this.x=(m-_)/b,this.y=(u-v)/b,this.z=(d-h)/b,this.w=Math.acos((c+p+f-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=$e(this.x,e.x,t.x),this.y=$e(this.y,e.y,t.y),this.z=$e(this.z,e.z,t.z),this.w=$e(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=$e(this.x,e,t),this.y=$e(this.y,e,t),this.z=$e(this.z,e,t),this.w=$e(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar($e(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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 Ch extends Jn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:rn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new pt(0,0,e,t),this.scissorTest=!1,this.viewport=new pt(0,0,e,t);const r={width:e,height:t,depth:n.depth},s=new Pt(r);this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:rn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isArrayTexture=this.textures[r].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new Ca(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class $n extends Ch{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class pl extends Pt{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Qt,this.minFilter=Qt,this.wrapR=Yn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ph extends Pt{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Qt,this.minFilter=Qt,this.wrapR=Yn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ai{constructor(e=new N(1/0,1/0,1/0),t=new N(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Yt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Yt.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Yt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Yt):Yt.fromBufferAttribute(s,a),Yt.applyMatrix4(e.matrixWorld),this.expandByPoint(Yt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),nr.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),nr.copy(n.boundingBox)),nr.applyMatrix4(e.matrixWorld),this.union(nr)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Yt),Yt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Fi),ir.subVectors(this.max,Fi),ni.subVectors(e.a,Fi),ii.subVectors(e.b,Fi),ri.subVectors(e.c,Fi),En.subVectors(ii,ni),Tn.subVectors(ri,ii),Bn.subVectors(ni,ri);let t=[0,-En.z,En.y,0,-Tn.z,Tn.y,0,-Bn.z,Bn.y,En.z,0,-En.x,Tn.z,0,-Tn.x,Bn.z,0,-Bn.x,-En.y,En.x,0,-Tn.y,Tn.x,0,-Bn.y,Bn.x,0];return!ns(t,ni,ii,ri,ir)||(t=[1,0,0,0,1,0,0,0,1],!ns(t,ni,ii,ri,ir))?!1:(rr.crossVectors(En,Tn),t=[rr.x,rr.y,rr.z],ns(t,ni,ii,ri,ir))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Yt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Yt).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(ln[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ln[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ln[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ln[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ln[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ln[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ln[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ln[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ln),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const ln=[new N,new N,new N,new N,new N,new N,new N,new N],Yt=new N,nr=new Ai,ni=new N,ii=new N,ri=new N,En=new N,Tn=new N,Bn=new N,Fi=new N,ir=new N,rr=new N,zn=new N;function ns(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){zn.fromArray(i,s);const o=r.x*Math.abs(zn.x)+r.y*Math.abs(zn.y)+r.z*Math.abs(zn.z),l=e.dot(zn),c=t.dot(zn),h=n.dot(zn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Dh=new Ai,Oi=new N,is=new N;class Ji{constructor(e=new N,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Dh.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Oi.subVectors(e,this.center);const t=Oi.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Oi,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(is.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Oi.copy(e.center).add(is)),this.expandByPoint(Oi.copy(e.center).sub(is))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const cn=new N,rs=new N,sr=new N,bn=new N,ss=new N,ar=new N,as=new N;class Xr{constructor(e=new N,t=new N(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,cn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=cn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(cn.copy(this.origin).addScaledVector(this.direction,t),cn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){rs.copy(e).add(t).multiplyScalar(.5),sr.copy(t).sub(e).normalize(),bn.copy(this.origin).sub(rs);const s=e.distanceTo(t)*.5,a=-this.direction.dot(sr),o=bn.dot(this.direction),l=-bn.dot(sr),c=bn.lengthSq(),h=Math.abs(1-a*a);let u,d,p,_;if(h>0)if(u=a*l-o,d=a*o-l,_=s*h,u>=0)if(d>=-_)if(d<=_){const v=1/h;u*=v,d*=v,p=u*(u+a*d+2*o)+d*(a*u+d+2*l)+c}else d=s,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*l)+c;else d=-s,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*l)+c;else d<=-_?(u=Math.max(0,-(-a*s+o)),d=u>0?-s:Math.min(Math.max(-s,-l),s),p=-u*u+d*(d+2*l)+c):d<=_?(u=0,d=Math.min(Math.max(-s,-l),s),p=d*(d+2*l)+c):(u=Math.max(0,-(a*s+o)),d=u>0?s:Math.min(Math.max(-s,-l),s),p=-u*u+d*(d+2*l)+c);else d=a>0?-s:s,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(rs).addScaledVector(sr,d),p}intersectSphere(e,t){cn.subVectors(e.center,this.origin);const n=cn.dot(this.direction),r=cn.dot(cn)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),h>=0?(s=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(s=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,l=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,l=(e.min.z-d.z)*u),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,cn)!==null}intersectTriangle(e,t,n,r,s){ss.subVectors(t,e),ar.subVectors(n,e),as.crossVectors(ss,ar);let a=this.direction.dot(as),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;bn.subVectors(this.origin,e);const l=o*this.direction.dot(ar.crossVectors(bn,ar));if(l<0)return null;const c=o*this.direction.dot(ss.cross(bn));if(c<0||l+c>a)return null;const h=-o*bn.dot(as);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ht{constructor(e,t,n,r,s,a,o,l,c,h,u,d,p,_,v,m){ht.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,h,u,d,p,_,v,m)}set(e,t,n,r,s,a,o,l,c,h,u,d,p,_,v,m){const f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=h,f[10]=u,f[14]=d,f[3]=p,f[7]=_,f[11]=v,f[15]=m,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 ht().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/si.setFromMatrixColumn(e,0).length(),s=1/si.setFromMatrixColumn(e,1).length(),a=1/si.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const d=a*h,p=a*u,_=o*h,v=o*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=p+_*c,t[5]=d-v*c,t[9]=-o*l,t[2]=v-d*c,t[6]=_+p*c,t[10]=a*l}else if(e.order==="YXZ"){const d=l*h,p=l*u,_=c*h,v=c*u;t[0]=d+v*o,t[4]=_*o-p,t[8]=a*c,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=p*o-_,t[6]=v+d*o,t[10]=a*l}else if(e.order==="ZXY"){const d=l*h,p=l*u,_=c*h,v=c*u;t[0]=d-v*o,t[4]=-a*u,t[8]=_+p*o,t[1]=p+_*o,t[5]=a*h,t[9]=v-d*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const d=a*h,p=a*u,_=o*h,v=o*u;t[0]=l*h,t[4]=_*c-p,t[8]=d*c+v,t[1]=l*u,t[5]=v*c+d,t[9]=p*c-_,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const d=a*l,p=a*c,_=o*l,v=o*c;t[0]=l*h,t[4]=v-d*u,t[8]=_*u+p,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=p*u+_,t[10]=d-v*u}else if(e.order==="XZY"){const d=a*l,p=a*c,_=o*l,v=o*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=d*u+v,t[5]=a*h,t[9]=p*u-_,t[2]=_*u-p,t[6]=o*h,t[10]=v*u+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Lh,e,Uh)}lookAt(e,t,n){const r=this.elements;return Ot.subVectors(e,t),Ot.lengthSq()===0&&(Ot.z=1),Ot.normalize(),An.crossVectors(n,Ot),An.lengthSq()===0&&(Math.abs(n.z)===1?Ot.x+=1e-4:Ot.z+=1e-4,Ot.normalize(),An.crossVectors(n,Ot)),An.normalize(),or.crossVectors(Ot,An),r[0]=An.x,r[4]=or.x,r[8]=Ot.x,r[1]=An.y,r[5]=or.y,r[9]=Ot.y,r[2]=An.z,r[6]=or.z,r[10]=Ot.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],d=n[9],p=n[13],_=n[2],v=n[6],m=n[10],f=n[14],b=n[3],E=n[7],S=n[11],L=n[15],w=r[0],C=r[4],P=r[8],y=r[12],x=r[1],R=r[5],H=r[9],B=r[13],j=r[2],J=r[6],W=r[10],ne=r[14],G=r[3],fe=r[7],xe=r[11],se=r[15];return s[0]=a*w+o*x+l*j+c*G,s[4]=a*C+o*R+l*J+c*fe,s[8]=a*P+o*H+l*W+c*xe,s[12]=a*y+o*B+l*ne+c*se,s[1]=h*w+u*x+d*j+p*G,s[5]=h*C+u*R+d*J+p*fe,s[9]=h*P+u*H+d*W+p*xe,s[13]=h*y+u*B+d*ne+p*se,s[2]=_*w+v*x+m*j+f*G,s[6]=_*C+v*R+m*J+f*fe,s[10]=_*P+v*H+m*W+f*xe,s[14]=_*y+v*B+m*ne+f*se,s[3]=b*w+E*x+S*j+L*G,s[7]=b*C+E*R+S*J+L*fe,s[11]=b*P+E*H+S*W+L*xe,s[15]=b*y+E*B+S*ne+L*se,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],u=e[6],d=e[10],p=e[14],_=e[3],v=e[7],m=e[11],f=e[15];return _*(+s*l*u-r*c*u-s*o*d+n*c*d+r*o*p-n*l*p)+v*(+t*l*p-t*c*d+s*a*d-r*a*p+r*c*h-s*l*h)+m*(+t*c*u-t*o*p-s*a*u+n*a*p+s*o*h-n*c*h)+f*(-r*o*h-t*l*u+t*o*d+r*a*u-n*a*d+n*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=e[9],d=e[10],p=e[11],_=e[12],v=e[13],m=e[14],f=e[15],b=u*m*c-v*d*c+v*l*p-o*m*p-u*l*f+o*d*f,E=_*d*c-h*m*c-_*l*p+a*m*p+h*l*f-a*d*f,S=h*v*c-_*u*c+_*o*p-a*v*p-h*o*f+a*u*f,L=_*u*l-h*v*l-_*o*d+a*v*d+h*o*m-a*u*m,w=t*b+n*E+r*S+s*L;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/w;return e[0]=b*C,e[1]=(v*d*s-u*m*s-v*r*p+n*m*p+u*r*f-n*d*f)*C,e[2]=(o*m*s-v*l*s+v*r*c-n*m*c-o*r*f+n*l*f)*C,e[3]=(u*l*s-o*d*s-u*r*c+n*d*c+o*r*p-n*l*p)*C,e[4]=E*C,e[5]=(h*m*s-_*d*s+_*r*p-t*m*p-h*r*f+t*d*f)*C,e[6]=(_*l*s-a*m*s-_*r*c+t*m*c+a*r*f-t*l*f)*C,e[7]=(a*d*s-h*l*s+h*r*c-t*d*c-a*r*p+t*l*p)*C,e[8]=S*C,e[9]=(_*u*s-h*v*s-_*n*p+t*v*p+h*n*f-t*u*f)*C,e[10]=(a*v*s-_*o*s+_*n*c-t*v*c-a*n*f+t*o*f)*C,e[11]=(h*o*s-a*u*s-h*n*c+t*u*c+a*n*p-t*o*p)*C,e[12]=L*C,e[13]=(h*v*r-_*u*r+_*n*d-t*v*d-h*n*m+t*u*m)*C,e[14]=(_*o*r-a*v*r-_*n*l+t*v*l+a*n*m-t*o*m)*C,e[15]=(a*u*r-h*o*r+h*n*l-t*u*l-a*n*d+t*o*d)*C,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,u=o+o,d=s*c,p=s*h,_=s*u,v=a*h,m=a*u,f=o*u,b=l*c,E=l*h,S=l*u,L=n.x,w=n.y,C=n.z;return r[0]=(1-(v+f))*L,r[1]=(p+S)*L,r[2]=(_-E)*L,r[3]=0,r[4]=(p-S)*w,r[5]=(1-(d+f))*w,r[6]=(m+b)*w,r[7]=0,r[8]=(_+E)*C,r[9]=(m-b)*C,r[10]=(1-(d+v))*C,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=si.set(r[0],r[1],r[2]).length();const a=si.set(r[4],r[5],r[6]).length(),o=si.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],jt.copy(this);const c=1/s,h=1/a,u=1/o;return jt.elements[0]*=c,jt.elements[1]*=c,jt.elements[2]*=c,jt.elements[4]*=h,jt.elements[5]*=h,jt.elements[6]*=h,jt.elements[8]*=u,jt.elements[9]*=u,jt.elements[10]*=u,t.setFromRotationMatrix(jt),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=vn){const l=this.elements,c=2*s/(t-e),h=2*s/(n-r),u=(t+e)/(t-e),d=(n+r)/(n-r);let p,_;if(o===vn)p=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===zr)p=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=vn){const l=this.elements,c=1/(t-e),h=1/(n-r),u=1/(a-s),d=(t+e)*c,p=(n+r)*h;let _,v;if(o===vn)_=(a+s)*u,v=-2*u;else if(o===zr)_=s*u,v=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=v,l[14]=-_,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const si=new N,jt=new ht,Lh=new N(0,0,0),Uh=new N(1,1,1),An=new N,or=new N,Ot=new N,Ka=new ht,Za=new Zn;class on{constructor(e=0,t=0,n=0,r=on.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],u=r[2],d=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin($e(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-$e(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin($e(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-$e(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin($e(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-$e(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ka.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ka,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Za.setFromEuler(this),this.setFromQuaternion(Za,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}on.DEFAULT_ORDER="XYZ";class ml{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Ih=0;const $a=new N,ai=new Zn,hn=new ht,lr=new N,Bi=new N,Nh=new N,Fh=new Zn,Ja=new N(1,0,0),Qa=new N(0,1,0),eo=new N(0,0,1),to={type:"added"},Oh={type:"removed"},oi={type:"childadded",child:null},os={type:"childremoved",child:null};class St extends Jn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ih++}),this.uuid=$i(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=St.DEFAULT_UP.clone();const e=new N,t=new on,n=new Zn,r=new N(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ht},normalMatrix:{value:new qe}}),this.matrix=new ht,this.matrixWorld=new ht,this.matrixAutoUpdate=St.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=St.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ml,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ai.setFromAxisAngle(e,t),this.quaternion.multiply(ai),this}rotateOnWorldAxis(e,t){return ai.setFromAxisAngle(e,t),this.quaternion.premultiply(ai),this}rotateX(e){return this.rotateOnAxis(Ja,e)}rotateY(e){return this.rotateOnAxis(Qa,e)}rotateZ(e){return this.rotateOnAxis(eo,e)}translateOnAxis(e,t){return $a.copy(e).applyQuaternion(this.quaternion),this.position.add($a.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ja,e)}translateY(e){return this.translateOnAxis(Qa,e)}translateZ(e){return this.translateOnAxis(eo,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(hn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?lr.copy(e):lr.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Bi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?hn.lookAt(Bi,lr,this.up):hn.lookAt(lr,Bi,this.up),this.quaternion.setFromRotationMatrix(hn),r&&(hn.extractRotation(r.matrixWorld),ai.setFromRotationMatrix(hn),this.quaternion.premultiply(ai.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(to),oi.child=e,this.dispatchEvent(oi),oi.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Oh),os.child=e,this.dispatchEvent(os),os.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),hn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),hn.multiply(e.parent.matrixWorld)),e.applyMatrix4(hn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(to),oi.child=e,this.dispatchEvent(oi),oi.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Bi,e,Nh),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Bi,Fh,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const u=l[c];s(e.shapes,u)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),u=a(e.shapes),d=a(e.skeletons),p=a(e.animations),_=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),p.length>0&&(n.animations=p),_.length>0&&(n.nodes=_)}return n.object=r,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}St.DEFAULT_UP=new N(0,1,0);St.DEFAULT_MATRIX_AUTO_UPDATE=!0;St.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Kt=new N,un=new N,ls=new N,fn=new N,li=new N,ci=new N,no=new N,cs=new N,hs=new N,us=new N,fs=new pt,ds=new pt,ps=new pt;class Zt{constructor(e=new N,t=new N,n=new N){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Kt.subVectors(e,t),r.cross(Kt);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Kt.subVectors(r,t),un.subVectors(n,t),ls.subVectors(e,t);const a=Kt.dot(Kt),o=Kt.dot(un),l=Kt.dot(ls),c=un.dot(un),h=un.dot(ls),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;const d=1/u,p=(c*l-o*h)*d,_=(a*h-o*l)*d;return s.set(1-p-_,_,p)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,fn)===null?!1:fn.x>=0&&fn.y>=0&&fn.x+fn.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,fn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,fn.x),l.addScaledVector(a,fn.y),l.addScaledVector(o,fn.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return fs.setScalar(0),ds.setScalar(0),ps.setScalar(0),fs.fromBufferAttribute(e,t),ds.fromBufferAttribute(e,n),ps.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(fs,s.x),a.addScaledVector(ds,s.y),a.addScaledVector(ps,s.z),a}static isFrontFacing(e,t,n,r){return Kt.subVectors(n,t),un.subVectors(e,t),Kt.cross(un).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Kt.subVectors(this.c,this.b),un.subVectors(this.a,this.b),Kt.cross(un).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Zt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Zt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Zt.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Zt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Zt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;li.subVectors(r,n),ci.subVectors(s,n),cs.subVectors(e,n);const l=li.dot(cs),c=ci.dot(cs);if(l<=0&&c<=0)return t.copy(n);hs.subVectors(e,r);const h=li.dot(hs),u=ci.dot(hs);if(h>=0&&u<=h)return t.copy(r);const d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(li,a);us.subVectors(e,s);const p=li.dot(us),_=ci.dot(us);if(_>=0&&p<=_)return t.copy(s);const v=p*c-l*_;if(v<=0&&c>=0&&_<=0)return o=c/(c-_),t.copy(n).addScaledVector(ci,o);const m=h*_-p*u;if(m<=0&&u-h>=0&&p-_>=0)return no.subVectors(s,r),o=(u-h)/(u-h+(p-_)),t.copy(r).addScaledVector(no,o);const f=1/(m+v+d);return a=v*f,o=d*f,t.copy(n).addScaledVector(li,a).addScaledVector(ci,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const _l={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},wn={h:0,s:0,l:0},cr={h:0,s:0,l:0};function ms(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class Ke{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Et){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Qe.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Qe.workingColorSpace){return this.r=e,this.g=t,this.b=n,Qe.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Qe.workingColorSpace){if(e=xh(e,1),t=$e(t,0,1),n=$e(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=ms(a,s,e+1/3),this.g=ms(a,s,e),this.b=ms(a,s,e-1/3)}return Qe.colorSpaceToWorking(this,r),this}setStyle(e,t=Et){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Et){const n=_l[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=xn(e.r),this.g=xn(e.g),this.b=xn(e.b),this}copyLinearToSRGB(e){return this.r=xi(e.r),this.g=xi(e.g),this.b=xi(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Et){return Qe.workingToColorSpace(bt.copy(this),e),Math.round($e(bt.r*255,0,255))*65536+Math.round($e(bt.g*255,0,255))*256+Math.round($e(bt.b*255,0,255))}getHexString(e=Et){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Qe.workingColorSpace){Qe.workingToColorSpace(bt.copy(this),t);const n=bt.r,r=bt.g,s=bt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(r-s)/u+(r<s?6:0);break;case r:l=(s-n)/u+2;break;case s:l=(n-r)/u+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=Qe.workingColorSpace){return Qe.workingToColorSpace(bt.copy(this),t),e.r=bt.r,e.g=bt.g,e.b=bt.b,e}getStyle(e=Et){Qe.workingToColorSpace(bt.copy(this),e);const t=bt.r,n=bt.g,r=bt.b;return e!==Et?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(wn),this.setHSL(wn.h+e,wn.s+t,wn.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(wn),e.getHSL(cr);const n=$r(wn.h,cr.h,t),r=$r(wn.s,cr.s,t),s=$r(wn.l,cr.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const bt=new Ke;Ke.NAMES=_l;let Bh=0;class yn extends Jn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Bh++}),this.uuid=$i(),this.name="",this.type="Material",this.blending=gi,this.side=Sn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ds,this.blendDst=Ls,this.blendEquation=Xn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ke(0,0,0),this.blendAlpha=0,this.depthFunc=Mi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Va,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ei,this.stencilZFail=ei,this.stencilZPass=ei,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.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==gi&&(n.blending=this.blending),this.side!==Sn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Ds&&(n.blendSrc=this.blendSrc),this.blendDst!==Ls&&(n.blendDst=this.blendDst),this.blendEquation!==Xn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Mi&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Va&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ei&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ei&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ei&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class gl extends yn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ke(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.envMapRotation=new on,this.combine=ya,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const mt=new N,hr=new Xe;let zh=0;class sn{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:zh++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Ga,this.updateRanges=[],this.gpuType=gn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)hr.fromBufferAttribute(this,t),hr.applyMatrix3(e),this.setXY(t,hr.x,hr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)mt.fromBufferAttribute(this,t),mt.applyMatrix3(e),this.setXYZ(t,mt.x,mt.y,mt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)mt.fromBufferAttribute(this,t),mt.applyMatrix4(e),this.setXYZ(t,mt.x,mt.y,mt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)mt.fromBufferAttribute(this,t),mt.applyNormalMatrix(e),this.setXYZ(t,mt.x,mt.y,mt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)mt.fromBufferAttribute(this,t),mt.transformDirection(e),this.setXYZ(t,mt.x,mt.y,mt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Ni(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Lt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Ni(t,this.array)),t}setX(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Ni(t,this.array)),t}setY(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Ni(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Ni(t,this.array)),t}setW(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),r=Lt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),r=Lt(r,this.array),s=Lt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Ga&&(e.usage=this.usage),e}}class vl extends sn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class xl extends sn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Ct extends sn{constructor(e,t,n){super(new Float32Array(e),t,n)}}let kh=0;const Vt=new ht,_s=new St,hi=new N,Bt=new Ai,zi=new Ai,Mt=new N;class en extends Jn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:kh++}),this.uuid=$i(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=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(e){return Array.isArray(e)?this.index=new(dl(e)?xl:vl)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new qe().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Vt.makeRotationFromQuaternion(e),this.applyMatrix4(Vt),this}rotateX(e){return Vt.makeRotationX(e),this.applyMatrix4(Vt),this}rotateY(e){return Vt.makeRotationY(e),this.applyMatrix4(Vt),this}rotateZ(e){return Vt.makeRotationZ(e),this.applyMatrix4(Vt),this}translate(e,t,n){return Vt.makeTranslation(e,t,n),this.applyMatrix4(Vt),this}scale(e,t,n){return Vt.makeScale(e,t,n),this.applyMatrix4(Vt),this}lookAt(e){return _s.lookAt(e),_s.updateMatrix(),this.applyMatrix4(_s.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(hi).negate(),this.translate(hi.x,hi.y,hi.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Ct(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ai);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new N(-1/0,-1/0,-1/0),new N(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Bt.setFromBufferAttribute(s),this.morphTargetsRelative?(Mt.addVectors(this.boundingBox.min,Bt.min),this.boundingBox.expandByPoint(Mt),Mt.addVectors(this.boundingBox.max,Bt.max),this.boundingBox.expandByPoint(Mt)):(this.boundingBox.expandByPoint(Bt.min),this.boundingBox.expandByPoint(Bt.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(){this.boundingSphere===null&&(this.boundingSphere=new Ji);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new N,1/0);return}if(e){const n=this.boundingSphere.center;if(Bt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];zi.setFromBufferAttribute(o),this.morphTargetsRelative?(Mt.addVectors(Bt.min,zi.min),Bt.expandByPoint(Mt),Mt.addVectors(Bt.max,zi.max),Bt.expandByPoint(Mt)):(Bt.expandByPoint(zi.min),Bt.expandByPoint(zi.max))}Bt.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)Mt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Mt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)Mt.fromBufferAttribute(o,c),l&&(hi.fromBufferAttribute(e,c),Mt.add(hi)),r=Math.max(r,n.distanceToSquared(Mt))}this.boundingSphere.radius=Math.sqrt(r),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 e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new sn(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let P=0;P<n.count;P++)o[P]=new N,l[P]=new N;const c=new N,h=new N,u=new N,d=new Xe,p=new Xe,_=new Xe,v=new N,m=new N;function f(P,y,x){c.fromBufferAttribute(n,P),h.fromBufferAttribute(n,y),u.fromBufferAttribute(n,x),d.fromBufferAttribute(s,P),p.fromBufferAttribute(s,y),_.fromBufferAttribute(s,x),h.sub(c),u.sub(c),p.sub(d),_.sub(d);const R=1/(p.x*_.y-_.x*p.y);isFinite(R)&&(v.copy(h).multiplyScalar(_.y).addScaledVector(u,-p.y).multiplyScalar(R),m.copy(u).multiplyScalar(p.x).addScaledVector(h,-_.x).multiplyScalar(R),o[P].add(v),o[y].add(v),o[x].add(v),l[P].add(m),l[y].add(m),l[x].add(m))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let P=0,y=b.length;P<y;++P){const x=b[P],R=x.start,H=x.count;for(let B=R,j=R+H;B<j;B+=3)f(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const E=new N,S=new N,L=new N,w=new N;function C(P){L.fromBufferAttribute(r,P),w.copy(L);const y=o[P];E.copy(y),E.sub(L.multiplyScalar(L.dot(y))).normalize(),S.crossVectors(w,y);const R=S.dot(l[P])<0?-1:1;a.setXYZW(P,E.x,E.y,E.z,R)}for(let P=0,y=b.length;P<y;++P){const x=b[P],R=x.start,H=x.count;for(let B=R,j=R+H;B<j;B+=3)C(e.getX(B+0)),C(e.getX(B+1)),C(e.getX(B+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new sn(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,p=n.count;d<p;d++)n.setXYZ(d,0,0,0);const r=new N,s=new N,a=new N,o=new N,l=new N,c=new N,h=new N,u=new N;if(e)for(let d=0,p=e.count;d<p;d+=3){const _=e.getX(d+0),v=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,_),s.fromBufferAttribute(t,v),a.fromBufferAttribute(t,m),h.subVectors(a,s),u.subVectors(r,s),h.cross(u),o.fromBufferAttribute(n,_),l.fromBufferAttribute(n,v),c.fromBufferAttribute(n,m),o.add(h),l.add(h),c.add(h),n.setXYZ(_,o.x,o.y,o.z),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let d=0,p=t.count;d<p;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,s),u.subVectors(r,s),h.cross(u),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Mt.fromBufferAttribute(e,t),Mt.normalize(),e.setXYZ(t,Mt.x,Mt.y,Mt.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,u=o.normalized,d=new c.constructor(l.length*h);let p=0,_=0;for(let v=0,m=l.length;v<m;v++){o.isInterleavedBufferAttribute?p=l[v]*o.data.stride+o.offset:p=l[v]*h;for(let f=0;f<h;f++)d[_++]=c[p++]}return new sn(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new en,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,u=c.length;h<u;h++){const d=c[h],p=e(d,n);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,d=c.length;u<d;u++){const p=c[u];h.push(p.toJSON(e.data))}h.length>0&&(r[l]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],u=s[c];for(let d=0,p=u.length;d<p;d++)h.push(u[d].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;c++){const u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const io=new ht,kn=new Xr,ur=new Ji,ro=new N,fr=new N,dr=new N,pr=new N,gs=new N,mr=new N,so=new N,_r=new N;class Jt extends St{constructor(e=new en,t=new gl){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){mr.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],u=s[l];h!==0&&(gs.fromBufferAttribute(u,e),a?mr.addScaledVector(gs,h):mr.addScaledVector(gs.sub(t),h))}t.add(mr)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),ur.copy(n.boundingSphere),ur.applyMatrix4(s),kn.copy(e.ray).recast(e.near),!(ur.containsPoint(kn.origin)===!1&&(kn.intersectSphere(ur,ro)===null||kn.origin.distanceToSquared(ro)>(e.far-e.near)**2))&&(io.copy(s).invert(),kn.copy(e.ray).applyMatrix4(io),!(n.boundingBox!==null&&kn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,kn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,d=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let _=0,v=d.length;_<v;_++){const m=d[_],f=a[m.materialIndex],b=Math.max(m.start,p.start),E=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));for(let S=b,L=E;S<L;S+=3){const w=o.getX(S),C=o.getX(S+1),P=o.getX(S+2);r=gr(this,f,e,n,c,h,u,w,C,P),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const _=Math.max(0,p.start),v=Math.min(o.count,p.start+p.count);for(let m=_,f=v;m<f;m+=3){const b=o.getX(m),E=o.getX(m+1),S=o.getX(m+2);r=gr(this,a,e,n,c,h,u,b,E,S),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let _=0,v=d.length;_<v;_++){const m=d[_],f=a[m.materialIndex],b=Math.max(m.start,p.start),E=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let S=b,L=E;S<L;S+=3){const w=S,C=S+1,P=S+2;r=gr(this,f,e,n,c,h,u,w,C,P),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const _=Math.max(0,p.start),v=Math.min(l.count,p.start+p.count);for(let m=_,f=v;m<f;m+=3){const b=m,E=m+1,S=m+2;r=gr(this,a,e,n,c,h,u,b,E,S),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function Hh(i,e,t,n,r,s,a,o){let l;if(e.side===It?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===Sn,o),l===null)return null;_r.copy(o),_r.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(_r);return c<t.near||c>t.far?null:{distance:c,point:_r.clone(),object:i}}function gr(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,fr),i.getVertexPosition(l,dr),i.getVertexPosition(c,pr);const h=Hh(i,e,t,n,fr,dr,pr,so);if(h){const u=new N;Zt.getBarycoord(so,fr,dr,pr,u),r&&(h.uv=Zt.getInterpolatedAttribute(r,o,l,c,u,new Xe)),s&&(h.uv1=Zt.getInterpolatedAttribute(s,o,l,c,u,new Xe)),a&&(h.normal=Zt.getInterpolatedAttribute(a,o,l,c,u,new N),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new N,materialIndex:0};Zt.getNormal(fr,dr,pr,d.normal),h.face=d,h.barycoord=u}return h}class Qi extends en{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],u=[];let d=0,p=0;_("z","y","x",-1,-1,n,t,e,a,s,0),_("z","y","x",1,-1,n,t,-e,a,s,1),_("x","z","y",1,1,e,n,t,r,a,2),_("x","z","y",1,-1,e,n,-t,r,a,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Ct(c,3)),this.setAttribute("normal",new Ct(h,3)),this.setAttribute("uv",new Ct(u,2));function _(v,m,f,b,E,S,L,w,C,P,y){const x=S/C,R=L/P,H=S/2,B=L/2,j=w/2,J=C+1,W=P+1;let ne=0,G=0;const fe=new N;for(let xe=0;xe<W;xe++){const se=xe*R-B;for(let We=0;We<J;We++){const Ze=We*x-H;fe[v]=Ze*b,fe[m]=se*E,fe[f]=j,c.push(fe.x,fe.y,fe.z),fe[v]=0,fe[m]=0,fe[f]=w>0?1:-1,h.push(fe.x,fe.y,fe.z),u.push(We/C),u.push(1-xe/P),ne+=1}}for(let xe=0;xe<P;xe++)for(let se=0;se<C;se++){const We=d+se+J*xe,Ze=d+se+J*(xe+1),Y=d+(se+1)+J*(xe+1),le=d+(se+1)+J*xe;l.push(We,Ze,le),l.push(Ze,Y,le),G+=6}o.addGroup(p,G,y),p+=G,d+=ne}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ti(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function Rt(i){const e={};for(let t=0;t<i.length;t++){const n=Ti(i[t]);for(const r in n)e[r]=n[r]}return e}function Vh(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Ml(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Qe.workingColorSpace}const Gh={clone:Ti,merge:Rt};var Wh=`void main() {
5
+ */const Ta="177",gi={ROTATE:0,DOLLY:1,PAN:2},pi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Oc=0,Va=1,Bc=2,sl=1,zc=2,dn=3,Sn=0,It=1,_n=2,Dn=0,vi=1,Ga=2,Wa=3,Xa=4,kc=5,Xn=100,Hc=101,Vc=102,Gc=103,Wc=104,Xc=200,qc=201,Yc=202,jc=203,Is=204,Ns=205,Kc=206,Zc=207,$c=208,Jc=209,Qc=210,eh=211,th=212,nh=213,ih=214,Fs=0,Os=1,Bs=2,Si=3,zs=4,ks=5,Hs=6,Vs=7,ba=0,rh=1,sh=2,Ln=0,ah=1,oh=2,lh=3,ch=4,hh=5,uh=6,fh=7,al=300,yi=301,Ei=302,Gs=303,Ws=304,Yr=306,kr=1e3,Yn=1001,Xs=1002,Jt=1003,dh=1004,ir=1005,nn=1006,Qr=1007,jn=1008,sn=1009,ol=1010,ll=1011,Yi=1012,Aa=1013,Kn=1014,gn=1015,Ji=1016,wa=1017,Ra=1018,ji=1020,cl=35902,hl=1021,ul=1022,Zt=1023,Ki=1026,Zi=1027,fl=1028,Ca=1029,dl=1030,Pa=1031,Da=1033,Pr=33776,Dr=33777,Lr=33778,Ur=33779,qs=35840,Ys=35841,js=35842,Ks=35843,Zs=36196,$s=37492,Js=37496,Qs=37808,ea=37809,ta=37810,na=37811,ia=37812,ra=37813,sa=37814,aa=37815,oa=37816,la=37817,ca=37818,ha=37819,ua=37820,fa=37821,Ir=36492,da=36494,pa=36495,pl=36283,ma=36284,_a=36285,ga=36286,ph=3200,mh=3201,ml=0,_h=1,Pn="",Et="srgb",Ti="srgb-linear",Hr="linear",rt="srgb",ei=7680,qa=519,gh=512,vh=513,xh=514,_l=515,Mh=516,Sh=517,yh=518,Eh=519,Ya=35044,ja="300 es",vn=2e3,Vr=2001;class Jn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const Tt=["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"],Nr=Math.PI/180,va=180/Math.PI;function Qi(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Tt[i&255]+Tt[i>>8&255]+Tt[i>>16&255]+Tt[i>>24&255]+"-"+Tt[e&255]+Tt[e>>8&255]+"-"+Tt[e>>16&15|64]+Tt[e>>24&255]+"-"+Tt[t&63|128]+Tt[t>>8&255]+"-"+Tt[t>>16&255]+Tt[t>>24&255]+Tt[n&255]+Tt[n>>8&255]+Tt[n>>16&255]+Tt[n>>24&255]).toLowerCase()}function $e(i,e,t){return Math.max(e,Math.min(t,i))}function Th(i,e){return(i%e+e)%e}function es(i,e,t){return(1-t)*i+t*e}function Fi(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Lt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const bh={DEG2RAD:Nr};class Xe{constructor(e=0,t=0){Xe.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=$e(this.x,e.x,t.x),this.y=$e(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=$e(this.x,e,t),this.y=$e(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar($e(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos($e(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Zn{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],h=n[r+2],u=n[r+3];const d=s[a+0],p=s[a+1],_=s[a+2],v=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=p,e[t+2]=_,e[t+3]=v;return}if(u!==v||l!==d||c!==p||h!==_){let m=1-o;const f=l*d+c*p+h*_+u*v,b=f>=0?1:-1,E=1-f*f;if(E>Number.EPSILON){const D=Math.sqrt(E),w=Math.atan2(D,f*b);m=Math.sin(m*w)/D,o=Math.sin(o*w)/D}const S=o*b;if(l=l*m+d*S,c=c*m+p*S,h=h*m+_*S,u=u*m+v*S,m===1-o){const D=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=D,c*=D,h*=D,u*=D}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],u=s[a],d=s[a+1],p=s[a+2],_=s[a+3];return e[t]=o*_+h*u+l*p-c*d,e[t+1]=l*_+h*d+c*u-o*p,e[t+2]=c*_+h*p+o*d-l*u,e[t+3]=h*_-o*u-l*d-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(r/2),u=o(s/2),d=l(n/2),p=l(r/2),_=l(s/2);switch(a){case"XYZ":this._x=d*h*u+c*p*_,this._y=c*p*u-d*h*_,this._z=c*h*_+d*p*u,this._w=c*h*u-d*p*_;break;case"YXZ":this._x=d*h*u+c*p*_,this._y=c*p*u-d*h*_,this._z=c*h*_-d*p*u,this._w=c*h*u+d*p*_;break;case"ZXY":this._x=d*h*u-c*p*_,this._y=c*p*u+d*h*_,this._z=c*h*_+d*p*u,this._w=c*h*u-d*p*_;break;case"ZYX":this._x=d*h*u-c*p*_,this._y=c*p*u+d*h*_,this._z=c*h*_-d*p*u,this._w=c*h*u+d*p*_;break;case"YZX":this._x=d*h*u+c*p*_,this._y=c*p*u+d*h*_,this._z=c*h*_-d*p*u,this._w=c*h*u-d*p*_;break;case"XZY":this._x=d*h*u-c*p*_,this._y=c*p*u-d*h*_,this._z=c*h*_+d*p*u,this._w=c*h*u+d*p*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],u=t[10],d=n+o+u;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(h-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(n>o&&n>u){const p=2*Math.sqrt(1+n-o-u);this._w=(h-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>u){const p=2*Math.sqrt(1+o-n-u);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+h)/p}else{const p=2*Math.sqrt(1+u-n-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+h)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs($e(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const p=1-t;return this._w=p*a+t*this._w,this._x=p*n+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-t)*h)/c,d=Math.sin(t*h)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=r*u+this._y*d,this._z=s*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class N{constructor(e=0,t=0,n=0){N.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Ka.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ka.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),h=2*(o*t-s*r),u=2*(s*n-a*t);return this.x=t+l*c+a*u-o*h,this.y=n+l*h+o*c-s*u,this.z=r+l*u+s*h-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=$e(this.x,e.x,t.x),this.y=$e(this.y,e.y,t.y),this.z=$e(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=$e(this.x,e,t),this.y=$e(this.y,e,t),this.z=$e(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar($e(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ts.copy(this).projectOnVector(e),this.sub(ts)}reflect(e){return this.sub(ts.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos($e(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const ts=new N,Ka=new Zn;class qe{constructor(e,t,n,r,s,a,o,l,c){qe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],d=n[2],p=n[5],_=n[8],v=r[0],m=r[3],f=r[6],b=r[1],E=r[4],S=r[7],D=r[2],w=r[5],R=r[8];return s[0]=a*v+o*b+l*D,s[3]=a*m+o*E+l*w,s[6]=a*f+o*S+l*R,s[1]=c*v+h*b+u*D,s[4]=c*m+h*E+u*w,s[7]=c*f+h*S+u*R,s[2]=d*v+p*b+_*D,s[5]=d*m+p*E+_*w,s[8]=d*f+p*S+_*R,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*s*h+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=h*a-o*c,d=o*l-h*s,p=c*s-a*l,_=t*u+n*d+r*p;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/_;return e[0]=u*v,e[1]=(r*c-h*n)*v,e[2]=(o*n-r*a)*v,e[3]=d*v,e[4]=(h*t-r*l)*v,e[5]=(r*s-o*t)*v,e[6]=p*v,e[7]=(n*l-c*t)*v,e[8]=(a*t-n*s)*v,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(ns.makeScale(e,t)),this}rotate(e){return this.premultiply(ns.makeRotation(-e)),this}translate(e,t){return this.premultiply(ns.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const ns=new qe;function gl(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function $i(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Ah(){const i=$i("canvas");return i.style.display="block",i}const Za={};function xi(i){i in Za||(Za[i]=!0,console.warn(i))}function wh(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Rh(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Ch(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const $a=new qe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ja=new qe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ph(){const i={enabled:!0,workingColorSpace:Ti,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===rt&&(r.r=xn(r.r),r.g=xn(r.g),r.b=xn(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===rt&&(r.r=Mi(r.r),r.g=Mi(r.g),r.b=Mi(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Pn?Hr:this.spaces[r].transfer},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return xi("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return xi("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Ti]:{primaries:e,whitePoint:n,transfer:Hr,toXYZ:$a,fromXYZ:Ja,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Et},outputColorSpaceConfig:{drawingBufferColorSpace:Et}},[Et]:{primaries:e,whitePoint:n,transfer:rt,toXYZ:$a,fromXYZ:Ja,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Et}}}),i}const Qe=Ph();function xn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Mi(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let ti;class Dh{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ti===void 0&&(ti=$i("canvas")),ti.width=e.width,ti.height=e.height;const r=ti.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=ti}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=$i("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=xn(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(xn(t[n]/255)*255):t[n]=xn(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Lh=0;class La{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Lh++}),this.uuid=Qi(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(is(r[a].image)):s.push(is(r[a]))}else s=is(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function is(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Dh.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Uh=0;const rs=new N;class Pt extends Jn{constructor(e=Pt.DEFAULT_IMAGE,t=Pt.DEFAULT_MAPPING,n=Yn,r=Yn,s=nn,a=jn,o=Zt,l=sn,c=Pt.DEFAULT_ANISOTROPY,h=Pn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Uh++}),this.uuid=Qi(),this.name="",this.source=new La(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Xe(0,0),this.repeat=new Xe(1,1),this.center=new Xe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new qe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(rs).x}get height(){return this.source.getSize(rs).y}get depth(){return this.source.getSize(rs).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==al)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case kr:e.x=e.x-Math.floor(e.x);break;case Yn:e.x=e.x<0?0:1;break;case Xs:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case kr:e.y=e.y-Math.floor(e.y);break;case Yn:e.y=e.y<0?0:1;break;case Xs:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Pt.DEFAULT_IMAGE=null;Pt.DEFAULT_MAPPING=al;Pt.DEFAULT_ANISOTROPY=1;class pt{constructor(e=0,t=0,n=0,r=1){pt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){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: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],h=l[4],u=l[8],d=l[1],p=l[5],_=l[9],v=l[2],m=l[6],f=l[10];if(Math.abs(h-d)<.01&&Math.abs(u-v)<.01&&Math.abs(_-m)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+v)<.1&&Math.abs(_+m)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(c+1)/2,S=(p+1)/2,D=(f+1)/2,w=(h+d)/4,R=(u+v)/4,L=(_+m)/4;return E>S&&E>D?E<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(E),r=w/n,s=R/n):S>D?S<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(S),n=w/r,s=L/r):D<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(D),n=R/s,r=L/s),this.set(n,r,s,t),this}let b=Math.sqrt((m-_)*(m-_)+(u-v)*(u-v)+(d-h)*(d-h));return Math.abs(b)<.001&&(b=1),this.x=(m-_)/b,this.y=(u-v)/b,this.z=(d-h)/b,this.w=Math.acos((c+p+f-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=$e(this.x,e.x,t.x),this.y=$e(this.y,e.y,t.y),this.z=$e(this.z,e.z,t.z),this.w=$e(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=$e(this.x,e,t),this.y=$e(this.y,e,t),this.z=$e(this.z,e,t),this.w=$e(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar($e(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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 Ih extends Jn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:nn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new pt(0,0,e,t),this.scissorTest=!1,this.viewport=new pt(0,0,e,t);const r={width:e,height:t,depth:n.depth},s=new Pt(r);this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:nn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isArrayTexture=this.textures[r].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new La(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class $n extends Ih{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class vl extends Pt{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Jt,this.minFilter=Jt,this.wrapR=Yn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Nh extends Pt{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Jt,this.minFilter=Jt,this.wrapR=Yn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class wi{constructor(e=new N(1/0,1/0,1/0),t=new N(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(qt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(qt.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=qt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,qt):qt.fromBufferAttribute(s,a),qt.applyMatrix4(e.matrixWorld),this.expandByPoint(qt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),rr.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),rr.copy(n.boundingBox)),rr.applyMatrix4(e.matrixWorld),this.union(rr)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,qt),qt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Oi),sr.subVectors(this.max,Oi),ni.subVectors(e.a,Oi),ii.subVectors(e.b,Oi),ri.subVectors(e.c,Oi),En.subVectors(ii,ni),Tn.subVectors(ri,ii),Bn.subVectors(ni,ri);let t=[0,-En.z,En.y,0,-Tn.z,Tn.y,0,-Bn.z,Bn.y,En.z,0,-En.x,Tn.z,0,-Tn.x,Bn.z,0,-Bn.x,-En.y,En.x,0,-Tn.y,Tn.x,0,-Bn.y,Bn.x,0];return!ss(t,ni,ii,ri,sr)||(t=[1,0,0,0,1,0,0,0,1],!ss(t,ni,ii,ri,sr))?!1:(ar.crossVectors(En,Tn),t=[ar.x,ar.y,ar.z],ss(t,ni,ii,ri,sr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qt).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(on[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),on[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),on[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),on[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),on[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),on[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),on[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),on[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(on),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const on=[new N,new N,new N,new N,new N,new N,new N,new N],qt=new N,rr=new wi,ni=new N,ii=new N,ri=new N,En=new N,Tn=new N,Bn=new N,Oi=new N,sr=new N,ar=new N,zn=new N;function ss(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){zn.fromArray(i,s);const o=r.x*Math.abs(zn.x)+r.y*Math.abs(zn.y)+r.z*Math.abs(zn.z),l=e.dot(zn),c=t.dot(zn),h=n.dot(zn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Fh=new wi,Bi=new N,as=new N;class er{constructor(e=new N,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Fh.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Bi.subVectors(e,this.center);const t=Bi.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Bi,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(as.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Bi.copy(e.center).add(as)),this.expandByPoint(Bi.copy(e.center).sub(as))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const ln=new N,os=new N,or=new N,bn=new N,ls=new N,lr=new N,cs=new N;class jr{constructor(e=new N,t=new N(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ln)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ln.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ln.copy(this.origin).addScaledVector(this.direction,t),ln.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){os.copy(e).add(t).multiplyScalar(.5),or.copy(t).sub(e).normalize(),bn.copy(this.origin).sub(os);const s=e.distanceTo(t)*.5,a=-this.direction.dot(or),o=bn.dot(this.direction),l=-bn.dot(or),c=bn.lengthSq(),h=Math.abs(1-a*a);let u,d,p,_;if(h>0)if(u=a*l-o,d=a*o-l,_=s*h,u>=0)if(d>=-_)if(d<=_){const v=1/h;u*=v,d*=v,p=u*(u+a*d+2*o)+d*(a*u+d+2*l)+c}else d=s,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*l)+c;else d=-s,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*l)+c;else d<=-_?(u=Math.max(0,-(-a*s+o)),d=u>0?-s:Math.min(Math.max(-s,-l),s),p=-u*u+d*(d+2*l)+c):d<=_?(u=0,d=Math.min(Math.max(-s,-l),s),p=d*(d+2*l)+c):(u=Math.max(0,-(a*s+o)),d=u>0?s:Math.min(Math.max(-s,-l),s),p=-u*u+d*(d+2*l)+c);else d=a>0?-s:s,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(os).addScaledVector(or,d),p}intersectSphere(e,t){ln.subVectors(e.center,this.origin);const n=ln.dot(this.direction),r=ln.dot(ln)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),h>=0?(s=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(s=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,l=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,l=(e.min.z-d.z)*u),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,ln)!==null}intersectTriangle(e,t,n,r,s){ls.subVectors(t,e),lr.subVectors(n,e),cs.crossVectors(ls,lr);let a=this.direction.dot(cs),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;bn.subVectors(this.origin,e);const l=o*this.direction.dot(lr.crossVectors(bn,lr));if(l<0)return null;const c=o*this.direction.dot(ls.cross(bn));if(c<0||l+c>a)return null;const h=-o*bn.dot(cs);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ht{constructor(e,t,n,r,s,a,o,l,c,h,u,d,p,_,v,m){ht.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,h,u,d,p,_,v,m)}set(e,t,n,r,s,a,o,l,c,h,u,d,p,_,v,m){const f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=h,f[10]=u,f[14]=d,f[3]=p,f[7]=_,f[11]=v,f[15]=m,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 ht().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/si.setFromMatrixColumn(e,0).length(),s=1/si.setFromMatrixColumn(e,1).length(),a=1/si.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const d=a*h,p=a*u,_=o*h,v=o*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=p+_*c,t[5]=d-v*c,t[9]=-o*l,t[2]=v-d*c,t[6]=_+p*c,t[10]=a*l}else if(e.order==="YXZ"){const d=l*h,p=l*u,_=c*h,v=c*u;t[0]=d+v*o,t[4]=_*o-p,t[8]=a*c,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=p*o-_,t[6]=v+d*o,t[10]=a*l}else if(e.order==="ZXY"){const d=l*h,p=l*u,_=c*h,v=c*u;t[0]=d-v*o,t[4]=-a*u,t[8]=_+p*o,t[1]=p+_*o,t[5]=a*h,t[9]=v-d*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const d=a*h,p=a*u,_=o*h,v=o*u;t[0]=l*h,t[4]=_*c-p,t[8]=d*c+v,t[1]=l*u,t[5]=v*c+d,t[9]=p*c-_,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const d=a*l,p=a*c,_=o*l,v=o*c;t[0]=l*h,t[4]=v-d*u,t[8]=_*u+p,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=p*u+_,t[10]=d-v*u}else if(e.order==="XZY"){const d=a*l,p=a*c,_=o*l,v=o*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=d*u+v,t[5]=a*h,t[9]=p*u-_,t[2]=_*u-p,t[6]=o*h,t[10]=v*u+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Oh,e,Bh)}lookAt(e,t,n){const r=this.elements;return Ot.subVectors(e,t),Ot.lengthSq()===0&&(Ot.z=1),Ot.normalize(),An.crossVectors(n,Ot),An.lengthSq()===0&&(Math.abs(n.z)===1?Ot.x+=1e-4:Ot.z+=1e-4,Ot.normalize(),An.crossVectors(n,Ot)),An.normalize(),cr.crossVectors(Ot,An),r[0]=An.x,r[4]=cr.x,r[8]=Ot.x,r[1]=An.y,r[5]=cr.y,r[9]=Ot.y,r[2]=An.z,r[6]=cr.z,r[10]=Ot.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],d=n[9],p=n[13],_=n[2],v=n[6],m=n[10],f=n[14],b=n[3],E=n[7],S=n[11],D=n[15],w=r[0],R=r[4],L=r[8],y=r[12],x=r[1],C=r[5],H=r[9],B=r[13],j=r[2],J=r[6],W=r[10],ne=r[14],G=r[3],fe=r[7],xe=r[11],se=r[15];return s[0]=a*w+o*x+l*j+c*G,s[4]=a*R+o*C+l*J+c*fe,s[8]=a*L+o*H+l*W+c*xe,s[12]=a*y+o*B+l*ne+c*se,s[1]=h*w+u*x+d*j+p*G,s[5]=h*R+u*C+d*J+p*fe,s[9]=h*L+u*H+d*W+p*xe,s[13]=h*y+u*B+d*ne+p*se,s[2]=_*w+v*x+m*j+f*G,s[6]=_*R+v*C+m*J+f*fe,s[10]=_*L+v*H+m*W+f*xe,s[14]=_*y+v*B+m*ne+f*se,s[3]=b*w+E*x+S*j+D*G,s[7]=b*R+E*C+S*J+D*fe,s[11]=b*L+E*H+S*W+D*xe,s[15]=b*y+E*B+S*ne+D*se,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],u=e[6],d=e[10],p=e[14],_=e[3],v=e[7],m=e[11],f=e[15];return _*(+s*l*u-r*c*u-s*o*d+n*c*d+r*o*p-n*l*p)+v*(+t*l*p-t*c*d+s*a*d-r*a*p+r*c*h-s*l*h)+m*(+t*c*u-t*o*p-s*a*u+n*a*p+s*o*h-n*c*h)+f*(-r*o*h-t*l*u+t*o*d+r*a*u-n*a*d+n*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=e[9],d=e[10],p=e[11],_=e[12],v=e[13],m=e[14],f=e[15],b=u*m*c-v*d*c+v*l*p-o*m*p-u*l*f+o*d*f,E=_*d*c-h*m*c-_*l*p+a*m*p+h*l*f-a*d*f,S=h*v*c-_*u*c+_*o*p-a*v*p-h*o*f+a*u*f,D=_*u*l-h*v*l-_*o*d+a*v*d+h*o*m-a*u*m,w=t*b+n*E+r*S+s*D;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/w;return e[0]=b*R,e[1]=(v*d*s-u*m*s-v*r*p+n*m*p+u*r*f-n*d*f)*R,e[2]=(o*m*s-v*l*s+v*r*c-n*m*c-o*r*f+n*l*f)*R,e[3]=(u*l*s-o*d*s-u*r*c+n*d*c+o*r*p-n*l*p)*R,e[4]=E*R,e[5]=(h*m*s-_*d*s+_*r*p-t*m*p-h*r*f+t*d*f)*R,e[6]=(_*l*s-a*m*s-_*r*c+t*m*c+a*r*f-t*l*f)*R,e[7]=(a*d*s-h*l*s+h*r*c-t*d*c-a*r*p+t*l*p)*R,e[8]=S*R,e[9]=(_*u*s-h*v*s-_*n*p+t*v*p+h*n*f-t*u*f)*R,e[10]=(a*v*s-_*o*s+_*n*c-t*v*c-a*n*f+t*o*f)*R,e[11]=(h*o*s-a*u*s-h*n*c+t*u*c+a*n*p-t*o*p)*R,e[12]=D*R,e[13]=(h*v*r-_*u*r+_*n*d-t*v*d-h*n*m+t*u*m)*R,e[14]=(_*o*r-a*v*r-_*n*l+t*v*l+a*n*m-t*o*m)*R,e[15]=(a*u*r-h*o*r+h*n*l-t*u*l-a*n*d+t*o*d)*R,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,u=o+o,d=s*c,p=s*h,_=s*u,v=a*h,m=a*u,f=o*u,b=l*c,E=l*h,S=l*u,D=n.x,w=n.y,R=n.z;return r[0]=(1-(v+f))*D,r[1]=(p+S)*D,r[2]=(_-E)*D,r[3]=0,r[4]=(p-S)*w,r[5]=(1-(d+f))*w,r[6]=(m+b)*w,r[7]=0,r[8]=(_+E)*R,r[9]=(m-b)*R,r[10]=(1-(d+v))*R,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=si.set(r[0],r[1],r[2]).length();const a=si.set(r[4],r[5],r[6]).length(),o=si.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Yt.copy(this);const c=1/s,h=1/a,u=1/o;return Yt.elements[0]*=c,Yt.elements[1]*=c,Yt.elements[2]*=c,Yt.elements[4]*=h,Yt.elements[5]*=h,Yt.elements[6]*=h,Yt.elements[8]*=u,Yt.elements[9]*=u,Yt.elements[10]*=u,t.setFromRotationMatrix(Yt),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=vn){const l=this.elements,c=2*s/(t-e),h=2*s/(n-r),u=(t+e)/(t-e),d=(n+r)/(n-r);let p,_;if(o===vn)p=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===Vr)p=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=vn){const l=this.elements,c=1/(t-e),h=1/(n-r),u=1/(a-s),d=(t+e)*c,p=(n+r)*h;let _,v;if(o===vn)_=(a+s)*u,v=-2*u;else if(o===Vr)_=s*u,v=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=v,l[14]=-_,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const si=new N,Yt=new ht,Oh=new N(0,0,0),Bh=new N(1,1,1),An=new N,cr=new N,Ot=new N,Qa=new ht,eo=new Zn;class an{constructor(e=0,t=0,n=0,r=an.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],u=r[2],d=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin($e(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-$e(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin($e(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-$e(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin($e(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-$e(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Qa.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Qa,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return eo.setFromEuler(this),this.setFromQuaternion(eo,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}an.DEFAULT_ORDER="XYZ";class xl{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let zh=0;const to=new N,ai=new Zn,cn=new ht,hr=new N,zi=new N,kh=new N,Hh=new Zn,no=new N(1,0,0),io=new N(0,1,0),ro=new N(0,0,1),so={type:"added"},Vh={type:"removed"},oi={type:"childadded",child:null},hs={type:"childremoved",child:null};class St extends Jn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:zh++}),this.uuid=Qi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=St.DEFAULT_UP.clone();const e=new N,t=new an,n=new Zn,r=new N(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ht},normalMatrix:{value:new qe}}),this.matrix=new ht,this.matrixWorld=new ht,this.matrixAutoUpdate=St.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=St.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new xl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ai.setFromAxisAngle(e,t),this.quaternion.multiply(ai),this}rotateOnWorldAxis(e,t){return ai.setFromAxisAngle(e,t),this.quaternion.premultiply(ai),this}rotateX(e){return this.rotateOnAxis(no,e)}rotateY(e){return this.rotateOnAxis(io,e)}rotateZ(e){return this.rotateOnAxis(ro,e)}translateOnAxis(e,t){return to.copy(e).applyQuaternion(this.quaternion),this.position.add(to.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(no,e)}translateY(e){return this.translateOnAxis(io,e)}translateZ(e){return this.translateOnAxis(ro,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(cn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?hr.copy(e):hr.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),zi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?cn.lookAt(zi,hr,this.up):cn.lookAt(hr,zi,this.up),this.quaternion.setFromRotationMatrix(cn),r&&(cn.extractRotation(r.matrixWorld),ai.setFromRotationMatrix(cn),this.quaternion.premultiply(ai.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(so),oi.child=e,this.dispatchEvent(oi),oi.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Vh),hs.child=e,this.dispatchEvent(hs),hs.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),cn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),cn.multiply(e.parent.matrixWorld)),e.applyMatrix4(cn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(so),oi.child=e,this.dispatchEvent(oi),oi.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(zi,e,kh),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(zi,Hh,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const u=l[c];s(e.shapes,u)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),u=a(e.shapes),d=a(e.skeletons),p=a(e.animations),_=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),p.length>0&&(n.animations=p),_.length>0&&(n.nodes=_)}return n.object=r,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}St.DEFAULT_UP=new N(0,1,0);St.DEFAULT_MATRIX_AUTO_UPDATE=!0;St.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const jt=new N,hn=new N,us=new N,un=new N,li=new N,ci=new N,ao=new N,fs=new N,ds=new N,ps=new N,ms=new pt,_s=new pt,gs=new pt;class Kt{constructor(e=new N,t=new N,n=new N){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),jt.subVectors(e,t),r.cross(jt);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){jt.subVectors(r,t),hn.subVectors(n,t),us.subVectors(e,t);const a=jt.dot(jt),o=jt.dot(hn),l=jt.dot(us),c=hn.dot(hn),h=hn.dot(us),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;const d=1/u,p=(c*l-o*h)*d,_=(a*h-o*l)*d;return s.set(1-p-_,_,p)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,un)===null?!1:un.x>=0&&un.y>=0&&un.x+un.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,un)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,un.x),l.addScaledVector(a,un.y),l.addScaledVector(o,un.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return ms.setScalar(0),_s.setScalar(0),gs.setScalar(0),ms.fromBufferAttribute(e,t),_s.fromBufferAttribute(e,n),gs.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(ms,s.x),a.addScaledVector(_s,s.y),a.addScaledVector(gs,s.z),a}static isFrontFacing(e,t,n,r){return jt.subVectors(n,t),hn.subVectors(e,t),jt.cross(hn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return jt.subVectors(this.c,this.b),hn.subVectors(this.a,this.b),jt.cross(hn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Kt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Kt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Kt.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Kt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Kt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;li.subVectors(r,n),ci.subVectors(s,n),fs.subVectors(e,n);const l=li.dot(fs),c=ci.dot(fs);if(l<=0&&c<=0)return t.copy(n);ds.subVectors(e,r);const h=li.dot(ds),u=ci.dot(ds);if(h>=0&&u<=h)return t.copy(r);const d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(li,a);ps.subVectors(e,s);const p=li.dot(ps),_=ci.dot(ps);if(_>=0&&p<=_)return t.copy(s);const v=p*c-l*_;if(v<=0&&c>=0&&_<=0)return o=c/(c-_),t.copy(n).addScaledVector(ci,o);const m=h*_-p*u;if(m<=0&&u-h>=0&&p-_>=0)return ao.subVectors(s,r),o=(u-h)/(u-h+(p-_)),t.copy(r).addScaledVector(ao,o);const f=1/(m+v+d);return a=v*f,o=d*f,t.copy(n).addScaledVector(li,a).addScaledVector(ci,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Ml={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},wn={h:0,s:0,l:0},ur={h:0,s:0,l:0};function vs(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class Ke{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Et){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Qe.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Qe.workingColorSpace){return this.r=e,this.g=t,this.b=n,Qe.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Qe.workingColorSpace){if(e=Th(e,1),t=$e(t,0,1),n=$e(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=vs(a,s,e+1/3),this.g=vs(a,s,e),this.b=vs(a,s,e-1/3)}return Qe.colorSpaceToWorking(this,r),this}setStyle(e,t=Et){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Et){const n=Ml[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=xn(e.r),this.g=xn(e.g),this.b=xn(e.b),this}copyLinearToSRGB(e){return this.r=Mi(e.r),this.g=Mi(e.g),this.b=Mi(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Et){return Qe.workingToColorSpace(bt.copy(this),e),Math.round($e(bt.r*255,0,255))*65536+Math.round($e(bt.g*255,0,255))*256+Math.round($e(bt.b*255,0,255))}getHexString(e=Et){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Qe.workingColorSpace){Qe.workingToColorSpace(bt.copy(this),t);const n=bt.r,r=bt.g,s=bt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(r-s)/u+(r<s?6:0);break;case r:l=(s-n)/u+2;break;case s:l=(n-r)/u+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=Qe.workingColorSpace){return Qe.workingToColorSpace(bt.copy(this),t),e.r=bt.r,e.g=bt.g,e.b=bt.b,e}getStyle(e=Et){Qe.workingToColorSpace(bt.copy(this),e);const t=bt.r,n=bt.g,r=bt.b;return e!==Et?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(wn),this.setHSL(wn.h+e,wn.s+t,wn.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(wn),e.getHSL(ur);const n=es(wn.h,ur.h,t),r=es(wn.s,ur.s,t),s=es(wn.l,ur.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const bt=new Ke;Ke.NAMES=Ml;let Gh=0;class yn extends Jn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Gh++}),this.uuid=Qi(),this.name="",this.type="Material",this.blending=vi,this.side=Sn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Is,this.blendDst=Ns,this.blendEquation=Xn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ke(0,0,0),this.blendAlpha=0,this.depthFunc=Si,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=qa,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ei,this.stencilZFail=ei,this.stencilZPass=ei,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.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==vi&&(n.blending=this.blending),this.side!==Sn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Is&&(n.blendSrc=this.blendSrc),this.blendDst!==Ns&&(n.blendDst=this.blendDst),this.blendEquation!==Xn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Si&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==qa&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ei&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ei&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ei&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Sl extends yn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ke(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.envMapRotation=new an,this.combine=ba,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const mt=new N,fr=new Xe;let Wh=0;class rn{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Wh++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Ya,this.updateRanges=[],this.gpuType=gn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)fr.fromBufferAttribute(this,t),fr.applyMatrix3(e),this.setXY(t,fr.x,fr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)mt.fromBufferAttribute(this,t),mt.applyMatrix3(e),this.setXYZ(t,mt.x,mt.y,mt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)mt.fromBufferAttribute(this,t),mt.applyMatrix4(e),this.setXYZ(t,mt.x,mt.y,mt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)mt.fromBufferAttribute(this,t),mt.applyNormalMatrix(e),this.setXYZ(t,mt.x,mt.y,mt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)mt.fromBufferAttribute(this,t),mt.transformDirection(e),this.setXYZ(t,mt.x,mt.y,mt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Fi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Lt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Fi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Fi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Fi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Fi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),r=Lt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),r=Lt(r,this.array),s=Lt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Ya&&(e.usage=this.usage),e}}class yl extends rn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class El extends rn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Ct extends rn{constructor(e,t,n){super(new Float32Array(e),t,n)}}let Xh=0;const Vt=new ht,xs=new St,hi=new N,Bt=new wi,ki=new wi,Mt=new N;class Qt extends Jn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Xh++}),this.uuid=Qi(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=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(e){return Array.isArray(e)?this.index=new(gl(e)?El:yl)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new qe().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Vt.makeRotationFromQuaternion(e),this.applyMatrix4(Vt),this}rotateX(e){return Vt.makeRotationX(e),this.applyMatrix4(Vt),this}rotateY(e){return Vt.makeRotationY(e),this.applyMatrix4(Vt),this}rotateZ(e){return Vt.makeRotationZ(e),this.applyMatrix4(Vt),this}translate(e,t,n){return Vt.makeTranslation(e,t,n),this.applyMatrix4(Vt),this}scale(e,t,n){return Vt.makeScale(e,t,n),this.applyMatrix4(Vt),this}lookAt(e){return xs.lookAt(e),xs.updateMatrix(),this.applyMatrix4(xs.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(hi).negate(),this.translate(hi.x,hi.y,hi.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Ct(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new wi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new N(-1/0,-1/0,-1/0),new N(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Bt.setFromBufferAttribute(s),this.morphTargetsRelative?(Mt.addVectors(this.boundingBox.min,Bt.min),this.boundingBox.expandByPoint(Mt),Mt.addVectors(this.boundingBox.max,Bt.max),this.boundingBox.expandByPoint(Mt)):(this.boundingBox.expandByPoint(Bt.min),this.boundingBox.expandByPoint(Bt.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(){this.boundingSphere===null&&(this.boundingSphere=new er);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new N,1/0);return}if(e){const n=this.boundingSphere.center;if(Bt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];ki.setFromBufferAttribute(o),this.morphTargetsRelative?(Mt.addVectors(Bt.min,ki.min),Bt.expandByPoint(Mt),Mt.addVectors(Bt.max,ki.max),Bt.expandByPoint(Mt)):(Bt.expandByPoint(ki.min),Bt.expandByPoint(ki.max))}Bt.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)Mt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Mt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)Mt.fromBufferAttribute(o,c),l&&(hi.fromBufferAttribute(e,c),Mt.add(hi)),r=Math.max(r,n.distanceToSquared(Mt))}this.boundingSphere.radius=Math.sqrt(r),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 e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new rn(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let L=0;L<n.count;L++)o[L]=new N,l[L]=new N;const c=new N,h=new N,u=new N,d=new Xe,p=new Xe,_=new Xe,v=new N,m=new N;function f(L,y,x){c.fromBufferAttribute(n,L),h.fromBufferAttribute(n,y),u.fromBufferAttribute(n,x),d.fromBufferAttribute(s,L),p.fromBufferAttribute(s,y),_.fromBufferAttribute(s,x),h.sub(c),u.sub(c),p.sub(d),_.sub(d);const C=1/(p.x*_.y-_.x*p.y);isFinite(C)&&(v.copy(h).multiplyScalar(_.y).addScaledVector(u,-p.y).multiplyScalar(C),m.copy(u).multiplyScalar(p.x).addScaledVector(h,-_.x).multiplyScalar(C),o[L].add(v),o[y].add(v),o[x].add(v),l[L].add(m),l[y].add(m),l[x].add(m))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let L=0,y=b.length;L<y;++L){const x=b[L],C=x.start,H=x.count;for(let B=C,j=C+H;B<j;B+=3)f(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const E=new N,S=new N,D=new N,w=new N;function R(L){D.fromBufferAttribute(r,L),w.copy(D);const y=o[L];E.copy(y),E.sub(D.multiplyScalar(D.dot(y))).normalize(),S.crossVectors(w,y);const C=S.dot(l[L])<0?-1:1;a.setXYZW(L,E.x,E.y,E.z,C)}for(let L=0,y=b.length;L<y;++L){const x=b[L],C=x.start,H=x.count;for(let B=C,j=C+H;B<j;B+=3)R(e.getX(B+0)),R(e.getX(B+1)),R(e.getX(B+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new rn(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,p=n.count;d<p;d++)n.setXYZ(d,0,0,0);const r=new N,s=new N,a=new N,o=new N,l=new N,c=new N,h=new N,u=new N;if(e)for(let d=0,p=e.count;d<p;d+=3){const _=e.getX(d+0),v=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,_),s.fromBufferAttribute(t,v),a.fromBufferAttribute(t,m),h.subVectors(a,s),u.subVectors(r,s),h.cross(u),o.fromBufferAttribute(n,_),l.fromBufferAttribute(n,v),c.fromBufferAttribute(n,m),o.add(h),l.add(h),c.add(h),n.setXYZ(_,o.x,o.y,o.z),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let d=0,p=t.count;d<p;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,s),u.subVectors(r,s),h.cross(u),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Mt.fromBufferAttribute(e,t),Mt.normalize(),e.setXYZ(t,Mt.x,Mt.y,Mt.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,u=o.normalized,d=new c.constructor(l.length*h);let p=0,_=0;for(let v=0,m=l.length;v<m;v++){o.isInterleavedBufferAttribute?p=l[v]*o.data.stride+o.offset:p=l[v]*h;for(let f=0;f<h;f++)d[_++]=c[p++]}return new rn(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Qt,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,u=c.length;h<u;h++){const d=c[h],p=e(d,n);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,d=c.length;u<d;u++){const p=c[u];h.push(p.toJSON(e.data))}h.length>0&&(r[l]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],u=s[c];for(let d=0,p=u.length;d<p;d++)h.push(u[d].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;c++){const u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const oo=new ht,kn=new jr,dr=new er,lo=new N,pr=new N,mr=new N,_r=new N,Ms=new N,gr=new N,co=new N,vr=new N;class $t extends St{constructor(e=new Qt,t=new Sl){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){gr.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],u=s[l];h!==0&&(Ms.fromBufferAttribute(u,e),a?gr.addScaledVector(Ms,h):gr.addScaledVector(Ms.sub(t),h))}t.add(gr)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),dr.copy(n.boundingSphere),dr.applyMatrix4(s),kn.copy(e.ray).recast(e.near),!(dr.containsPoint(kn.origin)===!1&&(kn.intersectSphere(dr,lo)===null||kn.origin.distanceToSquared(lo)>(e.far-e.near)**2))&&(oo.copy(s).invert(),kn.copy(e.ray).applyMatrix4(oo),!(n.boundingBox!==null&&kn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,kn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,d=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let _=0,v=d.length;_<v;_++){const m=d[_],f=a[m.materialIndex],b=Math.max(m.start,p.start),E=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));for(let S=b,D=E;S<D;S+=3){const w=o.getX(S),R=o.getX(S+1),L=o.getX(S+2);r=xr(this,f,e,n,c,h,u,w,R,L),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const _=Math.max(0,p.start),v=Math.min(o.count,p.start+p.count);for(let m=_,f=v;m<f;m+=3){const b=o.getX(m),E=o.getX(m+1),S=o.getX(m+2);r=xr(this,a,e,n,c,h,u,b,E,S),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let _=0,v=d.length;_<v;_++){const m=d[_],f=a[m.materialIndex],b=Math.max(m.start,p.start),E=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let S=b,D=E;S<D;S+=3){const w=S,R=S+1,L=S+2;r=xr(this,f,e,n,c,h,u,w,R,L),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const _=Math.max(0,p.start),v=Math.min(l.count,p.start+p.count);for(let m=_,f=v;m<f;m+=3){const b=m,E=m+1,S=m+2;r=xr(this,a,e,n,c,h,u,b,E,S),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function qh(i,e,t,n,r,s,a,o){let l;if(e.side===It?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===Sn,o),l===null)return null;vr.copy(o),vr.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(vr);return c<t.near||c>t.far?null:{distance:c,point:vr.clone(),object:i}}function xr(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,pr),i.getVertexPosition(l,mr),i.getVertexPosition(c,_r);const h=qh(i,e,t,n,pr,mr,_r,co);if(h){const u=new N;Kt.getBarycoord(co,pr,mr,_r,u),r&&(h.uv=Kt.getInterpolatedAttribute(r,o,l,c,u,new Xe)),s&&(h.uv1=Kt.getInterpolatedAttribute(s,o,l,c,u,new Xe)),a&&(h.normal=Kt.getInterpolatedAttribute(a,o,l,c,u,new N),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new N,materialIndex:0};Kt.getNormal(pr,mr,_r,d.normal),h.face=d,h.barycoord=u}return h}class tr extends Qt{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],u=[];let d=0,p=0;_("z","y","x",-1,-1,n,t,e,a,s,0),_("z","y","x",1,-1,n,t,-e,a,s,1),_("x","z","y",1,1,e,n,t,r,a,2),_("x","z","y",1,-1,e,n,-t,r,a,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Ct(c,3)),this.setAttribute("normal",new Ct(h,3)),this.setAttribute("uv",new Ct(u,2));function _(v,m,f,b,E,S,D,w,R,L,y){const x=S/R,C=D/L,H=S/2,B=D/2,j=w/2,J=R+1,W=L+1;let ne=0,G=0;const fe=new N;for(let xe=0;xe<W;xe++){const se=xe*C-B;for(let We=0;We<J;We++){const Ze=We*x-H;fe[v]=Ze*b,fe[m]=se*E,fe[f]=j,c.push(fe.x,fe.y,fe.z),fe[v]=0,fe[m]=0,fe[f]=w>0?1:-1,h.push(fe.x,fe.y,fe.z),u.push(We/R),u.push(1-xe/L),ne+=1}}for(let xe=0;xe<L;xe++)for(let se=0;se<R;se++){const We=d+se+J*xe,Ze=d+se+J*(xe+1),Y=d+(se+1)+J*(xe+1),le=d+(se+1)+J*xe;l.push(We,Ze,le),l.push(Ze,Y,le),G+=6}o.addGroup(p,G,y),p+=G,d+=ne}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tr(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function bi(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function Rt(i){const e={};for(let t=0;t<i.length;t++){const n=bi(i[t]);for(const r in n)e[r]=n[r]}return e}function Yh(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Tl(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Qe.workingColorSpace}const jh={clone:bi,merge:Rt};var Kh=`void main() {
6
6
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
7
- }`,Xh=`void main() {
7
+ }`,Zh=`void main() {
8
8
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
9
- }`;class Un extends yn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Wh,this.fragmentShader=Xh,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ti(e.uniforms),this.uniformsGroups=Vh(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Sl extends St{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ht,this.projectionMatrix=new ht,this.projectionMatrixInverse=new ht,this.coordinateSystem=vn}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Rn=new N,ao=new Xe,oo=new Xe;class Xt extends Sl{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=ma*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ur*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ma*2*Math.atan(Math.tan(Ur*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Rn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Rn.x,Rn.y).multiplyScalar(-e/Rn.z),Rn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Rn.x,Rn.y).multiplyScalar(-e/Rn.z)}getViewSize(e,t){return this.getViewBounds(e,ao,oo),t.subVectors(oo,ao)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Ur*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ui=-90,fi=1;class qh extends St{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Xt(ui,fi,e,t);r.layers=this.layers,this.add(r);const s=new Xt(ui,fi,e,t);s.layers=this.layers,this.add(s);const a=new Xt(ui,fi,e,t);a.layers=this.layers,this.add(a);const o=new Xt(ui,fi,e,t);o.layers=this.layers,this.add(o);const l=new Xt(ui,fi,e,t);l.layers=this.layers,this.add(l);const c=new Xt(ui,fi,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===vn)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===zr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const v=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=v,e.setRenderTarget(n,5,r),e.render(t,h),e.setRenderTarget(u,d,p),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class yl extends Pt{constructor(e=[],t=Si,n,r,s,a,o,l,c,h){super(e,t,n,r,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Yh extends $n{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new yl(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
9
+ }`;class Un extends yn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Kh,this.fragmentShader=Zh,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=bi(e.uniforms),this.uniformsGroups=Yh(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class bl extends St{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ht,this.projectionMatrix=new ht,this.projectionMatrixInverse=new ht,this.coordinateSystem=vn}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Rn=new N,ho=new Xe,uo=new Xe;class Wt extends bl{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=va*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Nr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return va*2*Math.atan(Math.tan(Nr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Rn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Rn.x,Rn.y).multiplyScalar(-e/Rn.z),Rn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Rn.x,Rn.y).multiplyScalar(-e/Rn.z)}getViewSize(e,t){return this.getViewBounds(e,ho,uo),t.subVectors(uo,ho)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Nr*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ui=-90,fi=1;class $h extends St{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Wt(ui,fi,e,t);r.layers=this.layers,this.add(r);const s=new Wt(ui,fi,e,t);s.layers=this.layers,this.add(s);const a=new Wt(ui,fi,e,t);a.layers=this.layers,this.add(a);const o=new Wt(ui,fi,e,t);o.layers=this.layers,this.add(o);const l=new Wt(ui,fi,e,t);l.layers=this.layers,this.add(l);const c=new Wt(ui,fi,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===vn)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Vr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const v=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=v,e.setRenderTarget(n,5,r),e.render(t,h),e.setRenderTarget(u,d,p),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Al extends Pt{constructor(e=[],t=yi,n,r,s,a,o,l,c,h){super(e,t,n,r,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Jh extends $n{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Al(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
10
10
 
11
11
  varying vec3 vWorldDirection;
12
12
 
@@ -41,13 +41,13 @@
41
41
  gl_FragColor = texture2D( tEquirect, sampleUV );
42
42
 
43
43
  }
44
- `},r=new Qi(5,5,5),s=new Un({name:"CubemapFromEquirect",uniforms:Ti(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:It,blending:Dn});s.uniforms.tEquirect.value=t;const a=new Jt(r,s),o=t.minFilter;return t.minFilter===jn&&(t.minFilter=rn),new qh(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}class Hi extends St{constructor(){super(),this.isGroup=!0,this.type="Group"}}const jh={type:"move"};class vs{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Hi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Hi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Hi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const v of e.hand.values()){const m=t.getJointPose(v,n),f=this._getHandJoint(c,v);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],d=h.position.distanceTo(u.position),p=.02,_=.005;c.inputState.pinching&&d>p+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=p-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,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,this.dispatchEvent(jh)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Hi;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Kh extends St{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new on,this.environmentIntensity=1,this.environmentRotation=new on,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const xs=new N,Zh=new N,$h=new qe;class Cn{constructor(e=new N(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=xs.subVectors(n,t).cross(Zh.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(xs),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||$h.getNormalMatrix(e),r=this.coplanarPoint(xs).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Hn=new Ji,vr=new N;class Pa{constructor(e=new Cn,t=new Cn,n=new Cn,r=new Cn,s=new Cn,a=new Cn){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=vn){const n=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],h=r[5],u=r[6],d=r[7],p=r[8],_=r[9],v=r[10],m=r[11],f=r[12],b=r[13],E=r[14],S=r[15];if(n[0].setComponents(l-s,d-c,m-p,S-f).normalize(),n[1].setComponents(l+s,d+c,m+p,S+f).normalize(),n[2].setComponents(l+a,d+h,m+_,S+b).normalize(),n[3].setComponents(l-a,d-h,m-_,S-b).normalize(),n[4].setComponents(l-o,d-u,m-v,S-E).normalize(),t===vn)n[5].setComponents(l+o,d+u,m+v,S+E).normalize();else if(t===zr)n[5].setComponents(o,u,v,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Hn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Hn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Hn)}intersectsSprite(e){return Hn.center.set(0,0,0),Hn.radius=.7071067811865476,Hn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Hn)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(vr.x=r.normal.x>0?e.max.x:e.min.x,vr.y=r.normal.y>0?e.max.y:e.min.y,vr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(vr)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Ir extends yn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ke(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const kr=new N,Hr=new N,lo=new ht,ki=new Xr,xr=new Ji,Ms=new N,co=new N;class Jh extends St{constructor(e=new en,t=new Ir){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)kr.fromBufferAttribute(t,r-1),Hr.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=kr.distanceTo(Hr);e.setAttribute("lineDistance",new Ct(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),xr.copy(n.boundingSphere),xr.applyMatrix4(r),xr.radius+=s,e.ray.intersectsSphere(xr)===!1)return;lo.copy(r).invert(),ki.copy(e.ray).applyMatrix4(lo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=n.index,d=n.attributes.position;if(h!==null){const p=Math.max(0,a.start),_=Math.min(h.count,a.start+a.count);for(let v=p,m=_-1;v<m;v+=c){const f=h.getX(v),b=h.getX(v+1),E=Mr(this,e,ki,l,f,b,v);E&&t.push(E)}if(this.isLineLoop){const v=h.getX(_-1),m=h.getX(p),f=Mr(this,e,ki,l,v,m,_-1);f&&t.push(f)}}else{const p=Math.max(0,a.start),_=Math.min(d.count,a.start+a.count);for(let v=p,m=_-1;v<m;v+=c){const f=Mr(this,e,ki,l,v,v+1,v);f&&t.push(f)}if(this.isLineLoop){const v=Mr(this,e,ki,l,_-1,p,_-1);v&&t.push(v)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Mr(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(kr.fromBufferAttribute(o,r),Hr.fromBufferAttribute(o,s),t.distanceSqToSegment(kr,Hr,Ms,co)>n)return;Ms.applyMatrix4(i.matrixWorld);const c=e.ray.origin.distanceTo(Ms);if(!(c<e.near||c>e.far))return{distance:c,point:co.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const ho=new N,uo=new N;class fo extends Jh{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)ho.fromBufferAttribute(t,r),uo.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+ho.distanceTo(uo);e.setAttribute("lineDistance",new Ct(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Vi extends yn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ke(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const po=new ht,_a=new Xr,Sr=new Ji,yr=new N;class Ss extends St{constructor(e=new en,t=new Vi){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Sr.copy(n.boundingSphere),Sr.applyMatrix4(r),Sr.radius+=s,e.ray.intersectsSphere(Sr)===!1)return;po.copy(r).invert(),_a.copy(e.ray).applyMatrix4(po);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,u=n.attributes.position;if(c!==null){const d=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let _=d,v=p;_<v;_++){const m=c.getX(_);yr.fromBufferAttribute(u,m),mo(yr,m,l,r,e,t,this)}}else{const d=Math.max(0,a.start),p=Math.min(u.count,a.start+a.count);for(let _=d,v=p;_<v;_++)yr.fromBufferAttribute(u,_),mo(yr,_,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function mo(i,e,t,n,r,s,a){const o=_a.distanceSqToPoint(i);if(o<t){const l=new N;_a.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class El extends Pt{constructor(e,t,n=Kn,r,s,a,o=Qt,l=Qt,c,h=Yi,u=1){if(h!==Yi&&h!==ji)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const d={width:e,height:t,depth:u};super(d,r,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Ca(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class qr extends en{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,h=l+1,u=e/o,d=t/l,p=[],_=[],v=[],m=[];for(let f=0;f<h;f++){const b=f*d-a;for(let E=0;E<c;E++){const S=E*u-s;_.push(S,-b,0),v.push(0,0,1),m.push(E/o),m.push(1-f/l)}}for(let f=0;f<l;f++)for(let b=0;b<o;b++){const E=b+c*f,S=b+c*(f+1),L=b+1+c*(f+1),w=b+1+c*f;p.push(E,S,w),p.push(S,L,w)}this.setIndex(p),this.setAttribute("position",new Ct(_,3)),this.setAttribute("normal",new Ct(v,3)),this.setAttribute("uv",new Ct(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qr(e.width,e.height,e.widthSegments,e.heightSegments)}}class Tl extends yn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ke(16777215),this.specular=new Ke(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ul,this.normalScale=new Xe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new on,this.combine=ya,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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Qh extends yn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ch,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class eu extends yn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Vr={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class tu{constructor(e,t,n){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(h){o++,s===!1&&r.onStart!==void 0&&r.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,r.onProgress!==void 0&&r.onProgress(h,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){const u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=c.length;u<d;u+=2){const p=c[u],_=c[u+1];if(p.global&&(p.lastIndex=0),p.test(h))return _}return null}}}const bl=new tu;class wi{constructor(e){this.manager=e!==void 0?e:bl,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}wi.DEFAULT_MATERIAL_NAME="__DEFAULT";const dn={};class nu extends Error{constructor(e,t){super(e),this.response=t}}class Al extends wi{constructor(e){super(e),this.mimeType="",this.responseType=""}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Vr.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(dn[e]!==void 0){dn[e].push({onLoad:t,onProgress:n,onError:r});return}dn[e]=[],dn[e].push({onLoad:t,onProgress:n,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=dn[e],u=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=d?parseInt(d):0,_=p!==0;let v=0;const m=new ReadableStream({start(f){b();function b(){u.read().then(({done:E,value:S})=>{if(E)f.close();else{v+=S.byteLength;const L=new ProgressEvent("progress",{lengthComputable:_,loaded:v,total:p});for(let w=0,C=h.length;w<C;w++){const P=h[w];P.onProgress&&P.onProgress(L)}f.enqueue(S),b()}},E=>{f.error(E)})}}});return new Response(m)}else throw new nu(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o==="")return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,p=new TextDecoder(d);return c.arrayBuffer().then(_=>p.decode(_))}}}).then(c=>{Vr.add(e,c);const h=dn[e];delete dn[e];for(let u=0,d=h.length;u<d;u++){const p=h[u];p.onLoad&&p.onLoad(c)}}).catch(c=>{const h=dn[e];if(h===void 0)throw this.manager.itemError(e),c;delete dn[e];for(let u=0,d=h.length;u<d;u++){const p=h[u];p.onError&&p.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class iu extends wi{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Vr.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=Ki("img");function l(){h(),Vr.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){h(),r&&r(u),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class ru extends wi{constructor(e){super(e)}load(e,t,n,r){const s=new Pt,a=new iu(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}}class wl extends St{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ke(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const ys=new ht,_o=new N,go=new N;class su{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Xe(512,512),this.mapType=an,this.map=null,this.mapPass=null,this.matrix=new ht,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Pa,this._frameExtents=new Xe(1,1),this._viewportCount=1,this._viewports=[new pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;_o.setFromMatrixPosition(e.matrixWorld),t.position.copy(_o),go.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(go),t.updateMatrixWorld(),ys.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ys),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(ys)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Rl extends Sl{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class au extends su{constructor(){super(new Rl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ou extends wl{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(St.DEFAULT_UP),this.updateMatrix(),this.target=new St,this.shadow=new au}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class lu extends wl{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class cu{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class hu extends Xt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class vo{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=$e(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos($e(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class uu extends Jn{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function xo(i,e,t,n){const r=fu(n);switch(t){case al:return i*e;case ll:return i*e/r.components*r.byteLength;case Aa:return i*e/r.components*r.byteLength;case cl:return i*e*2/r.components*r.byteLength;case wa:return i*e*2/r.components*r.byteLength;case ol:return i*e*3/r.components*r.byteLength;case $t:return i*e*4/r.components*r.byteLength;case Ra:return i*e*4/r.components*r.byteLength;case Rr:case Cr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Pr:case Dr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Ws:case qs:return Math.max(i,16)*Math.max(e,8)/4;case Gs:case Xs:return Math.max(i,8)*Math.max(e,8)/2;case Ys:case js:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Ks:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Zs:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case $s:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case Js:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case Qs:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case ea:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case ta:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case na:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case ia:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case ra:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case sa:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case aa:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case oa:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case la:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case ca:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Lr:case ha:case ua:return Math.ceil(i/4)*Math.ceil(e/4)*16;case hl:case fa:return Math.ceil(i/4)*Math.ceil(e/4)*8;case da:case pa:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function fu(i){switch(i){case an:case il:return{byteLength:1,components:1};case Xi:case rl:case Zi:return{byteLength:2,components:1};case Ta:case ba:return{byteLength:2,components:4};case Kn:case Ea:case gn:return{byteLength:4,components:1};case sl:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Sa}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Sa);/**
44
+ `},r=new tr(5,5,5),s=new Un({name:"CubemapFromEquirect",uniforms:bi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:It,blending:Dn});s.uniforms.tEquirect.value=t;const a=new $t(r,s),o=t.minFilter;return t.minFilter===jn&&(t.minFilter=nn),new $h(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}class Gi extends St{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Qh={type:"move"};class Ss{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Gi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Gi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Gi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const v of e.hand.values()){const m=t.getJointPose(v,n),f=this._getHandJoint(c,v);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],d=h.position.distanceTo(u.position),p=.02,_=.005;c.inputState.pinching&&d>p+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=p-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,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,this.dispatchEvent(Qh)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Gi;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class eu extends St{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new an,this.environmentIntensity=1,this.environmentRotation=new an,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const ys=new N,tu=new N,nu=new qe;class Cn{constructor(e=new N(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=ys.subVectors(n,t).cross(tu.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(ys),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||nu.getNormalMatrix(e),r=this.coplanarPoint(ys).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Hn=new er,Mr=new N;class Ua{constructor(e=new Cn,t=new Cn,n=new Cn,r=new Cn,s=new Cn,a=new Cn){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=vn){const n=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],h=r[5],u=r[6],d=r[7],p=r[8],_=r[9],v=r[10],m=r[11],f=r[12],b=r[13],E=r[14],S=r[15];if(n[0].setComponents(l-s,d-c,m-p,S-f).normalize(),n[1].setComponents(l+s,d+c,m+p,S+f).normalize(),n[2].setComponents(l+a,d+h,m+_,S+b).normalize(),n[3].setComponents(l-a,d-h,m-_,S-b).normalize(),n[4].setComponents(l-o,d-u,m-v,S-E).normalize(),t===vn)n[5].setComponents(l+o,d+u,m+v,S+E).normalize();else if(t===Vr)n[5].setComponents(o,u,v,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Hn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Hn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Hn)}intersectsSprite(e){return Hn.center.set(0,0,0),Hn.radius=.7071067811865476,Hn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Hn)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(Mr.x=r.normal.x>0?e.max.x:e.min.x,Mr.y=r.normal.y>0?e.max.y:e.min.y,Mr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Mr)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Fr extends yn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ke(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Gr=new N,Wr=new N,fo=new ht,Hi=new jr,Sr=new er,Es=new N,po=new N;class iu extends St{constructor(e=new Qt,t=new Fr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)Gr.fromBufferAttribute(t,r-1),Wr.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Gr.distanceTo(Wr);e.setAttribute("lineDistance",new Ct(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Sr.copy(n.boundingSphere),Sr.applyMatrix4(r),Sr.radius+=s,e.ray.intersectsSphere(Sr)===!1)return;fo.copy(r).invert(),Hi.copy(e.ray).applyMatrix4(fo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=n.index,d=n.attributes.position;if(h!==null){const p=Math.max(0,a.start),_=Math.min(h.count,a.start+a.count);for(let v=p,m=_-1;v<m;v+=c){const f=h.getX(v),b=h.getX(v+1),E=yr(this,e,Hi,l,f,b,v);E&&t.push(E)}if(this.isLineLoop){const v=h.getX(_-1),m=h.getX(p),f=yr(this,e,Hi,l,v,m,_-1);f&&t.push(f)}}else{const p=Math.max(0,a.start),_=Math.min(d.count,a.start+a.count);for(let v=p,m=_-1;v<m;v+=c){const f=yr(this,e,Hi,l,v,v+1,v);f&&t.push(f)}if(this.isLineLoop){const v=yr(this,e,Hi,l,_-1,p,_-1);v&&t.push(v)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function yr(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(Gr.fromBufferAttribute(o,r),Wr.fromBufferAttribute(o,s),t.distanceSqToSegment(Gr,Wr,Es,po)>n)return;Es.applyMatrix4(i.matrixWorld);const c=e.ray.origin.distanceTo(Es);if(!(c<e.near||c>e.far))return{distance:c,point:po.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const mo=new N,_o=new N;class go extends iu{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)mo.fromBufferAttribute(t,r),_o.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+mo.distanceTo(_o);e.setAttribute("lineDistance",new Ct(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Wi extends yn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ke(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const vo=new ht,xa=new jr,Er=new er,Tr=new N;class Ts extends St{constructor(e=new Qt,t=new Wi){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Er.copy(n.boundingSphere),Er.applyMatrix4(r),Er.radius+=s,e.ray.intersectsSphere(Er)===!1)return;vo.copy(r).invert(),xa.copy(e.ray).applyMatrix4(vo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,u=n.attributes.position;if(c!==null){const d=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let _=d,v=p;_<v;_++){const m=c.getX(_);Tr.fromBufferAttribute(u,m),xo(Tr,m,l,r,e,t,this)}}else{const d=Math.max(0,a.start),p=Math.min(u.count,a.start+a.count);for(let _=d,v=p;_<v;_++)Tr.fromBufferAttribute(u,_),xo(Tr,_,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function xo(i,e,t,n,r,s,a){const o=xa.distanceSqToPoint(i);if(o<t){const l=new N;xa.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class wl extends Pt{constructor(e,t,n=Kn,r,s,a,o=Jt,l=Jt,c,h=Ki,u=1){if(h!==Ki&&h!==Zi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const d={width:e,height:t,depth:u};super(d,r,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new La(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Kr extends Qt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,h=l+1,u=e/o,d=t/l,p=[],_=[],v=[],m=[];for(let f=0;f<h;f++){const b=f*d-a;for(let E=0;E<c;E++){const S=E*u-s;_.push(S,-b,0),v.push(0,0,1),m.push(E/o),m.push(1-f/l)}}for(let f=0;f<l;f++)for(let b=0;b<o;b++){const E=b+c*f,S=b+c*(f+1),D=b+1+c*(f+1),w=b+1+c*f;p.push(E,S,w),p.push(S,D,w)}this.setIndex(p),this.setAttribute("position",new Ct(_,3)),this.setAttribute("normal",new Ct(v,3)),this.setAttribute("uv",new Ct(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Kr(e.width,e.height,e.widthSegments,e.heightSegments)}}class Rl extends yn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ke(16777215),this.specular=new Ke(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ml,this.normalScale=new Xe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new an,this.combine=ba,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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ru extends yn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ph,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class su extends yn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Xr={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class au{constructor(e,t,n){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(h){o++,s===!1&&r.onStart!==void 0&&r.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,r.onProgress!==void 0&&r.onProgress(h,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){const u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=c.length;u<d;u+=2){const p=c[u],_=c[u+1];if(p.global&&(p.lastIndex=0),p.test(h))return _}return null}}}const Cl=new au;class Ri{constructor(e){this.manager=e!==void 0?e:Cl,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Ri.DEFAULT_MATERIAL_NAME="__DEFAULT";const fn={};class ou extends Error{constructor(e,t){super(e),this.response=t}}class Pl extends Ri{constructor(e){super(e),this.mimeType="",this.responseType=""}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Xr.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(fn[e]!==void 0){fn[e].push({onLoad:t,onProgress:n,onError:r});return}fn[e]=[],fn[e].push({onLoad:t,onProgress:n,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=fn[e],u=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=d?parseInt(d):0,_=p!==0;let v=0;const m=new ReadableStream({start(f){b();function b(){u.read().then(({done:E,value:S})=>{if(E)f.close();else{v+=S.byteLength;const D=new ProgressEvent("progress",{lengthComputable:_,loaded:v,total:p});for(let w=0,R=h.length;w<R;w++){const L=h[w];L.onProgress&&L.onProgress(D)}f.enqueue(S),b()}},E=>{f.error(E)})}}});return new Response(m)}else throw new ou(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o==="")return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,p=new TextDecoder(d);return c.arrayBuffer().then(_=>p.decode(_))}}}).then(c=>{Xr.add(e,c);const h=fn[e];delete fn[e];for(let u=0,d=h.length;u<d;u++){const p=h[u];p.onLoad&&p.onLoad(c)}}).catch(c=>{const h=fn[e];if(h===void 0)throw this.manager.itemError(e),c;delete fn[e];for(let u=0,d=h.length;u<d;u++){const p=h[u];p.onError&&p.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class lu extends Ri{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Xr.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=$i("img");function l(){h(),Xr.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){h(),r&&r(u),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class cu extends Ri{constructor(e){super(e)}load(e,t,n,r){const s=new Pt,a=new lu(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}}class Dl extends St{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ke(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const bs=new ht,Mo=new N,So=new N;class hu{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Xe(512,512),this.mapType=sn,this.map=null,this.mapPass=null,this.matrix=new ht,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ua,this._frameExtents=new Xe(1,1),this._viewportCount=1,this._viewports=[new pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Mo.setFromMatrixPosition(e.matrixWorld),t.position.copy(Mo),So.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(So),t.updateMatrixWorld(),bs.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bs),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(bs)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Ll extends bl{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class uu extends hu{constructor(){super(new Ll(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class fu extends Dl{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(St.DEFAULT_UP),this.updateMatrix(),this.target=new St,this.shadow=new uu}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class du extends Dl{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class pu{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class mu extends Wt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class yo{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=$e(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos($e(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class _u extends Jn{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function Eo(i,e,t,n){const r=gu(n);switch(t){case hl:return i*e;case fl:return i*e/r.components*r.byteLength;case Ca:return i*e/r.components*r.byteLength;case dl:return i*e*2/r.components*r.byteLength;case Pa:return i*e*2/r.components*r.byteLength;case ul:return i*e*3/r.components*r.byteLength;case Zt:return i*e*4/r.components*r.byteLength;case Da:return i*e*4/r.components*r.byteLength;case Pr:case Dr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Lr:case Ur:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Ys:case Ks:return Math.max(i,16)*Math.max(e,8)/4;case qs:case js:return Math.max(i,8)*Math.max(e,8)/2;case Zs:case $s:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Js:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Qs:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ea:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case ta:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case na:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case ia:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case ra:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case sa:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case aa:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case oa:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case la:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case ca:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case ha:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case ua:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case fa:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Ir:case da:case pa:return Math.ceil(i/4)*Math.ceil(e/4)*16;case pl:case ma:return Math.ceil(i/4)*Math.ceil(e/4)*8;case _a:case ga:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function gu(i){switch(i){case sn:case ol:return{byteLength:1,components:1};case Yi:case ll:case Ji:return{byteLength:2,components:1};case wa:case Ra:return{byteLength:2,components:4};case Kn:case Aa:case gn:return{byteLength:4,components:1};case cl:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ta}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ta);/**
45
45
  * @license
46
46
  * Copyright 2010-2025 Three.js Authors
47
47
  * SPDX-License-Identifier: MIT
48
- */function Cl(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function du(i){const e=new WeakMap;function t(o,l){const c=o.array,h=o.usage,u=c.byteLength,d=i.createBuffer();i.bindBuffer(l,d),i.bufferData(l,c,h),o.onUploadCallback();let p;if(c instanceof Float32Array)p=i.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?p=i.HALF_FLOAT:p=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=i.SHORT;else if(c instanceof Uint32Array)p=i.UNSIGNED_INT;else if(c instanceof Int32Array)p=i.INT;else if(c instanceof Int8Array)p=i.BYTE;else if(c instanceof Uint8Array)p=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,l,c){const h=l.array,u=l.updateRanges;if(i.bindBuffer(c,o),u.length===0)i.bufferSubData(c,0,h);else{u.sort((p,_)=>p.start-_.start);let d=0;for(let p=1;p<u.length;p++){const _=u[d],v=u[p];v.start<=_.start+_.count+1?_.count=Math.max(_.count,v.start+v.count-_.start):(++d,u[d]=v)}u.length=d+1;for(let p=0,_=u.length;p<_;p++){const v=u[p];i.bufferSubData(c,v.start*h.BYTES_PER_ELEMENT,h,v.start,v.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var pu=`#ifdef USE_ALPHAHASH
48
+ */function Ul(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function vu(i){const e=new WeakMap;function t(o,l){const c=o.array,h=o.usage,u=c.byteLength,d=i.createBuffer();i.bindBuffer(l,d),i.bufferData(l,c,h),o.onUploadCallback();let p;if(c instanceof Float32Array)p=i.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?p=i.HALF_FLOAT:p=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=i.SHORT;else if(c instanceof Uint32Array)p=i.UNSIGNED_INT;else if(c instanceof Int32Array)p=i.INT;else if(c instanceof Int8Array)p=i.BYTE;else if(c instanceof Uint8Array)p=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,l,c){const h=l.array,u=l.updateRanges;if(i.bindBuffer(c,o),u.length===0)i.bufferSubData(c,0,h);else{u.sort((p,_)=>p.start-_.start);let d=0;for(let p=1;p<u.length;p++){const _=u[d],v=u[p];v.start<=_.start+_.count+1?_.count=Math.max(_.count,v.start+v.count-_.start):(++d,u[d]=v)}u.length=d+1;for(let p=0,_=u.length;p<_;p++){const v=u[p];i.bufferSubData(c,v.start*h.BYTES_PER_ELEMENT,h,v.start,v.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var xu=`#ifdef USE_ALPHAHASH
49
49
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
50
- #endif`,mu=`#ifdef USE_ALPHAHASH
50
+ #endif`,Mu=`#ifdef USE_ALPHAHASH
51
51
  const float ALPHA_HASH_SCALE = 0.05;
52
52
  float hash2D( vec2 value ) {
53
53
  return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -82,20 +82,20 @@
82
82
  : cases.z;
83
83
  return clamp( threshold , 1.0e-6, 1.0 );
84
84
  }
85
- #endif`,_u=`#ifdef USE_ALPHAMAP
85
+ #endif`,Su=`#ifdef USE_ALPHAMAP
86
86
  diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
87
- #endif`,gu=`#ifdef USE_ALPHAMAP
87
+ #endif`,yu=`#ifdef USE_ALPHAMAP
88
88
  uniform sampler2D alphaMap;
89
- #endif`,vu=`#ifdef USE_ALPHATEST
89
+ #endif`,Eu=`#ifdef USE_ALPHATEST
90
90
  #ifdef ALPHA_TO_COVERAGE
91
91
  diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
92
92
  if ( diffuseColor.a == 0.0 ) discard;
93
93
  #else
94
94
  if ( diffuseColor.a < alphaTest ) discard;
95
95
  #endif
96
- #endif`,xu=`#ifdef USE_ALPHATEST
96
+ #endif`,Tu=`#ifdef USE_ALPHATEST
97
97
  uniform float alphaTest;
98
- #endif`,Mu=`#ifdef USE_AOMAP
98
+ #endif`,bu=`#ifdef USE_AOMAP
99
99
  float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
100
100
  reflectedLight.indirectDiffuse *= ambientOcclusion;
101
101
  #if defined( USE_CLEARCOAT )
@@ -108,10 +108,10 @@
108
108
  float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
109
109
  reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
110
110
  #endif
111
- #endif`,Su=`#ifdef USE_AOMAP
111
+ #endif`,Au=`#ifdef USE_AOMAP
112
112
  uniform sampler2D aoMap;
113
113
  uniform float aoMapIntensity;
114
- #endif`,yu=`#ifdef USE_BATCHING
114
+ #endif`,wu=`#ifdef USE_BATCHING
115
115
  #if ! defined( GL_ANGLE_multi_draw )
116
116
  #define gl_DrawID _gl_DrawID
117
117
  uniform int _gl_DrawID;
@@ -145,15 +145,15 @@
145
145
  int y = j / size;
146
146
  return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
147
147
  }
148
- #endif`,Eu=`#ifdef USE_BATCHING
148
+ #endif`,Ru=`#ifdef USE_BATCHING
149
149
  mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
150
- #endif`,Tu=`vec3 transformed = vec3( position );
150
+ #endif`,Cu=`vec3 transformed = vec3( position );
151
151
  #ifdef USE_ALPHAHASH
152
152
  vPosition = vec3( position );
153
- #endif`,bu=`vec3 objectNormal = vec3( normal );
153
+ #endif`,Pu=`vec3 objectNormal = vec3( normal );
154
154
  #ifdef USE_TANGENT
155
155
  vec3 objectTangent = vec3( tangent.xyz );
156
- #endif`,Au=`float G_BlinnPhong_Implicit( ) {
156
+ #endif`,Du=`float G_BlinnPhong_Implicit( ) {
157
157
  return 0.25;
158
158
  }
159
159
  float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -167,7 +167,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
167
167
  float G = G_BlinnPhong_Implicit( );
168
168
  float D = D_BlinnPhong( shininess, dotNH );
169
169
  return F * ( G * D );
170
- } // validated`,wu=`#ifdef USE_IRIDESCENCE
170
+ } // validated`,Lu=`#ifdef USE_IRIDESCENCE
171
171
  const mat3 XYZ_TO_REC709 = mat3(
172
172
  3.2404542, -0.9692660, 0.0556434,
173
173
  -1.5371385, 1.8760108, -0.2040259,
@@ -230,7 +230,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
230
230
  }
231
231
  return max( I, vec3( 0.0 ) );
232
232
  }
233
- #endif`,Ru=`#ifdef USE_BUMPMAP
233
+ #endif`,Uu=`#ifdef USE_BUMPMAP
234
234
  uniform sampler2D bumpMap;
235
235
  uniform float bumpScale;
236
236
  vec2 dHdxy_fwd() {
@@ -251,7 +251,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
251
251
  vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
252
252
  return normalize( abs( fDet ) * surf_norm - vGrad );
253
253
  }
254
- #endif`,Cu=`#if NUM_CLIPPING_PLANES > 0
254
+ #endif`,Iu=`#if NUM_CLIPPING_PLANES > 0
255
255
  vec4 plane;
256
256
  #ifdef ALPHA_TO_COVERAGE
257
257
  float distanceToPlane, distanceGradient;
@@ -297,26 +297,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
297
297
  if ( clipped ) discard;
298
298
  #endif
299
299
  #endif
300
- #endif`,Pu=`#if NUM_CLIPPING_PLANES > 0
300
+ #endif`,Nu=`#if NUM_CLIPPING_PLANES > 0
301
301
  varying vec3 vClipPosition;
302
302
  uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
303
- #endif`,Du=`#if NUM_CLIPPING_PLANES > 0
303
+ #endif`,Fu=`#if NUM_CLIPPING_PLANES > 0
304
304
  varying vec3 vClipPosition;
305
- #endif`,Lu=`#if NUM_CLIPPING_PLANES > 0
305
+ #endif`,Ou=`#if NUM_CLIPPING_PLANES > 0
306
306
  vClipPosition = - mvPosition.xyz;
307
- #endif`,Uu=`#if defined( USE_COLOR_ALPHA )
307
+ #endif`,Bu=`#if defined( USE_COLOR_ALPHA )
308
308
  diffuseColor *= vColor;
309
309
  #elif defined( USE_COLOR )
310
310
  diffuseColor.rgb *= vColor;
311
- #endif`,Iu=`#if defined( USE_COLOR_ALPHA )
311
+ #endif`,zu=`#if defined( USE_COLOR_ALPHA )
312
312
  varying vec4 vColor;
313
313
  #elif defined( USE_COLOR )
314
314
  varying vec3 vColor;
315
- #endif`,Nu=`#if defined( USE_COLOR_ALPHA )
315
+ #endif`,ku=`#if defined( USE_COLOR_ALPHA )
316
316
  varying vec4 vColor;
317
317
  #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
318
318
  varying vec3 vColor;
319
- #endif`,Fu=`#if defined( USE_COLOR_ALPHA )
319
+ #endif`,Hu=`#if defined( USE_COLOR_ALPHA )
320
320
  vColor = vec4( 1.0 );
321
321
  #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
322
322
  vColor = vec3( 1.0 );
@@ -330,7 +330,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
330
330
  #ifdef USE_BATCHING_COLOR
331
331
  vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
332
332
  vColor.xyz *= batchingColor.xyz;
333
- #endif`,Ou=`#define PI 3.141592653589793
333
+ #endif`,Vu=`#define PI 3.141592653589793
334
334
  #define PI2 6.283185307179586
335
335
  #define PI_HALF 1.5707963267948966
336
336
  #define RECIPROCAL_PI 0.3183098861837907
@@ -404,7 +404,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
404
404
  float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
405
405
  float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
406
406
  return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
407
- } // validated`,Bu=`#ifdef ENVMAP_TYPE_CUBE_UV
407
+ } // validated`,Gu=`#ifdef ENVMAP_TYPE_CUBE_UV
408
408
  #define cubeUV_minMipLevel 4.0
409
409
  #define cubeUV_minTileSize 16.0
410
410
  float getFace( vec3 direction ) {
@@ -497,7 +497,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
497
497
  return vec4( mix( color0, color1, mipF ), 1.0 );
498
498
  }
499
499
  }
500
- #endif`,zu=`vec3 transformedNormal = objectNormal;
500
+ #endif`,Wu=`vec3 transformedNormal = objectNormal;
501
501
  #ifdef USE_TANGENT
502
502
  vec3 transformedTangent = objectTangent;
503
503
  #endif
@@ -526,21 +526,21 @@ transformedNormal = normalMatrix * transformedNormal;
526
526
  #ifdef FLIP_SIDED
527
527
  transformedTangent = - transformedTangent;
528
528
  #endif
529
- #endif`,ku=`#ifdef USE_DISPLACEMENTMAP
529
+ #endif`,Xu=`#ifdef USE_DISPLACEMENTMAP
530
530
  uniform sampler2D displacementMap;
531
531
  uniform float displacementScale;
532
532
  uniform float displacementBias;
533
- #endif`,Hu=`#ifdef USE_DISPLACEMENTMAP
533
+ #endif`,qu=`#ifdef USE_DISPLACEMENTMAP
534
534
  transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
535
- #endif`,Vu=`#ifdef USE_EMISSIVEMAP
535
+ #endif`,Yu=`#ifdef USE_EMISSIVEMAP
536
536
  vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
537
537
  #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
538
538
  emissiveColor = sRGBTransferEOTF( emissiveColor );
539
539
  #endif
540
540
  totalEmissiveRadiance *= emissiveColor.rgb;
541
- #endif`,Gu=`#ifdef USE_EMISSIVEMAP
541
+ #endif`,ju=`#ifdef USE_EMISSIVEMAP
542
542
  uniform sampler2D emissiveMap;
543
- #endif`,Wu="gl_FragColor = linearToOutputTexel( gl_FragColor );",Xu=`vec4 LinearTransferOETF( in vec4 value ) {
543
+ #endif`,Ku="gl_FragColor = linearToOutputTexel( gl_FragColor );",Zu=`vec4 LinearTransferOETF( in vec4 value ) {
544
544
  return value;
545
545
  }
546
546
  vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -548,7 +548,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
548
548
  }
549
549
  vec4 sRGBTransferOETF( in vec4 value ) {
550
550
  return 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 );
551
- }`,qu=`#ifdef USE_ENVMAP
551
+ }`,$u=`#ifdef USE_ENVMAP
552
552
  #ifdef ENV_WORLDPOS
553
553
  vec3 cameraToFrag;
554
554
  if ( isOrthographic ) {
@@ -577,7 +577,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
577
577
  #elif defined( ENVMAP_BLENDING_ADD )
578
578
  outgoingLight += envColor.xyz * specularStrength * reflectivity;
579
579
  #endif
580
- #endif`,Yu=`#ifdef USE_ENVMAP
580
+ #endif`,Ju=`#ifdef USE_ENVMAP
581
581
  uniform float envMapIntensity;
582
582
  uniform float flipEnvMap;
583
583
  uniform mat3 envMapRotation;
@@ -587,7 +587,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
587
587
  uniform sampler2D envMap;
588
588
  #endif
589
589
 
590
- #endif`,ju=`#ifdef USE_ENVMAP
590
+ #endif`,Qu=`#ifdef USE_ENVMAP
591
591
  uniform float reflectivity;
592
592
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
593
593
  #define ENV_WORLDPOS
@@ -598,7 +598,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
598
598
  #else
599
599
  varying vec3 vReflect;
600
600
  #endif
601
- #endif`,Ku=`#ifdef USE_ENVMAP
601
+ #endif`,ef=`#ifdef USE_ENVMAP
602
602
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
603
603
  #define ENV_WORLDPOS
604
604
  #endif
@@ -609,7 +609,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
609
609
  varying vec3 vReflect;
610
610
  uniform float refractionRatio;
611
611
  #endif
612
- #endif`,Zu=`#ifdef USE_ENVMAP
612
+ #endif`,tf=`#ifdef USE_ENVMAP
613
613
  #ifdef ENV_WORLDPOS
614
614
  vWorldPosition = worldPosition.xyz;
615
615
  #else
@@ -626,18 +626,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
626
626
  vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
627
627
  #endif
628
628
  #endif
629
- #endif`,$u=`#ifdef USE_FOG
629
+ #endif`,nf=`#ifdef USE_FOG
630
630
  vFogDepth = - mvPosition.z;
631
- #endif`,Ju=`#ifdef USE_FOG
631
+ #endif`,rf=`#ifdef USE_FOG
632
632
  varying float vFogDepth;
633
- #endif`,Qu=`#ifdef USE_FOG
633
+ #endif`,sf=`#ifdef USE_FOG
634
634
  #ifdef FOG_EXP2
635
635
  float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
636
636
  #else
637
637
  float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
638
638
  #endif
639
639
  gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
640
- #endif`,ef=`#ifdef USE_FOG
640
+ #endif`,af=`#ifdef USE_FOG
641
641
  uniform vec3 fogColor;
642
642
  varying float vFogDepth;
643
643
  #ifdef FOG_EXP2
@@ -646,7 +646,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
646
646
  uniform float fogNear;
647
647
  uniform float fogFar;
648
648
  #endif
649
- #endif`,tf=`#ifdef USE_GRADIENTMAP
649
+ #endif`,of=`#ifdef USE_GRADIENTMAP
650
650
  uniform sampler2D gradientMap;
651
651
  #endif
652
652
  vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -658,12 +658,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
658
658
  vec2 fw = fwidth( coord ) * 0.5;
659
659
  return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
660
660
  #endif
661
- }`,nf=`#ifdef USE_LIGHTMAP
661
+ }`,lf=`#ifdef USE_LIGHTMAP
662
662
  uniform sampler2D lightMap;
663
663
  uniform float lightMapIntensity;
664
- #endif`,rf=`LambertMaterial material;
664
+ #endif`,cf=`LambertMaterial material;
665
665
  material.diffuseColor = diffuseColor.rgb;
666
- material.specularStrength = specularStrength;`,sf=`varying vec3 vViewPosition;
666
+ material.specularStrength = specularStrength;`,hf=`varying vec3 vViewPosition;
667
667
  struct LambertMaterial {
668
668
  vec3 diffuseColor;
669
669
  float specularStrength;
@@ -677,7 +677,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
677
677
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
678
678
  }
679
679
  #define RE_Direct RE_Direct_Lambert
680
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,af=`uniform bool receiveShadow;
680
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,uf=`uniform bool receiveShadow;
681
681
  uniform vec3 ambientLightColor;
682
682
  #if defined( USE_LIGHT_PROBES )
683
683
  uniform vec3 lightProbe[ 9 ];
@@ -793,7 +793,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
793
793
  vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
794
794
  return irradiance;
795
795
  }
796
- #endif`,of=`#ifdef USE_ENVMAP
796
+ #endif`,ff=`#ifdef USE_ENVMAP
797
797
  vec3 getIBLIrradiance( const in vec3 normal ) {
798
798
  #ifdef ENVMAP_TYPE_CUBE_UV
799
799
  vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
@@ -826,8 +826,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
826
826
  #endif
827
827
  }
828
828
  #endif
829
- #endif`,lf=`ToonMaterial material;
830
- material.diffuseColor = diffuseColor.rgb;`,cf=`varying vec3 vViewPosition;
829
+ #endif`,df=`ToonMaterial material;
830
+ material.diffuseColor = diffuseColor.rgb;`,pf=`varying vec3 vViewPosition;
831
831
  struct ToonMaterial {
832
832
  vec3 diffuseColor;
833
833
  };
@@ -839,11 +839,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
839
839
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
840
840
  }
841
841
  #define RE_Direct RE_Direct_Toon
842
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,hf=`BlinnPhongMaterial material;
842
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,mf=`BlinnPhongMaterial material;
843
843
  material.diffuseColor = diffuseColor.rgb;
844
844
  material.specularColor = specular;
845
845
  material.specularShininess = shininess;
846
- material.specularStrength = specularStrength;`,uf=`varying vec3 vViewPosition;
846
+ material.specularStrength = specularStrength;`,_f=`varying vec3 vViewPosition;
847
847
  struct BlinnPhongMaterial {
848
848
  vec3 diffuseColor;
849
849
  vec3 specularColor;
@@ -860,7 +860,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
860
860
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
861
861
  }
862
862
  #define RE_Direct RE_Direct_BlinnPhong
863
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,ff=`PhysicalMaterial material;
863
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,gf=`PhysicalMaterial material;
864
864
  material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
865
865
  vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
866
866
  float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
@@ -946,7 +946,7 @@ material.roughness = min( material.roughness, 1.0 );
946
946
  material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
947
947
  material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
948
948
  material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
949
- #endif`,df=`struct PhysicalMaterial {
949
+ #endif`,vf=`struct PhysicalMaterial {
950
950
  vec3 diffuseColor;
951
951
  float roughness;
952
952
  vec3 specularColor;
@@ -1247,7 +1247,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
1247
1247
  #define RE_IndirectSpecular RE_IndirectSpecular_Physical
1248
1248
  float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1249
1249
  return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1250
- }`,pf=`
1250
+ }`,xf=`
1251
1251
  vec3 geometryPosition = - vViewPosition;
1252
1252
  vec3 geometryNormal = normal;
1253
1253
  vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1362,7 +1362,7 @@ IncidentLight directLight;
1362
1362
  #if defined( RE_IndirectSpecular )
1363
1363
  vec3 radiance = vec3( 0.0 );
1364
1364
  vec3 clearcoatRadiance = vec3( 0.0 );
1365
- #endif`,mf=`#if defined( RE_IndirectDiffuse )
1365
+ #endif`,Mf=`#if defined( RE_IndirectDiffuse )
1366
1366
  #ifdef USE_LIGHTMAP
1367
1367
  vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1368
1368
  vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1381,32 +1381,32 @@ IncidentLight directLight;
1381
1381
  #ifdef USE_CLEARCOAT
1382
1382
  clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1383
1383
  #endif
1384
- #endif`,_f=`#if defined( RE_IndirectDiffuse )
1384
+ #endif`,Sf=`#if defined( RE_IndirectDiffuse )
1385
1385
  RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1386
1386
  #endif
1387
1387
  #if defined( RE_IndirectSpecular )
1388
1388
  RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1389
- #endif`,gf=`#if defined( USE_LOGDEPTHBUF )
1389
+ #endif`,yf=`#if defined( USE_LOGDEPTHBUF )
1390
1390
  gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1391
- #endif`,vf=`#if defined( USE_LOGDEPTHBUF )
1391
+ #endif`,Ef=`#if defined( USE_LOGDEPTHBUF )
1392
1392
  uniform float logDepthBufFC;
1393
1393
  varying float vFragDepth;
1394
1394
  varying float vIsPerspective;
1395
- #endif`,xf=`#ifdef USE_LOGDEPTHBUF
1395
+ #endif`,Tf=`#ifdef USE_LOGDEPTHBUF
1396
1396
  varying float vFragDepth;
1397
1397
  varying float vIsPerspective;
1398
- #endif`,Mf=`#ifdef USE_LOGDEPTHBUF
1398
+ #endif`,bf=`#ifdef USE_LOGDEPTHBUF
1399
1399
  vFragDepth = 1.0 + gl_Position.w;
1400
1400
  vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1401
- #endif`,Sf=`#ifdef USE_MAP
1401
+ #endif`,Af=`#ifdef USE_MAP
1402
1402
  vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1403
1403
  #ifdef DECODE_VIDEO_TEXTURE
1404
1404
  sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1405
1405
  #endif
1406
1406
  diffuseColor *= sampledDiffuseColor;
1407
- #endif`,yf=`#ifdef USE_MAP
1407
+ #endif`,wf=`#ifdef USE_MAP
1408
1408
  uniform sampler2D map;
1409
- #endif`,Ef=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1409
+ #endif`,Rf=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1410
1410
  #if defined( USE_POINTS_UV )
1411
1411
  vec2 uv = vUv;
1412
1412
  #else
@@ -1418,7 +1418,7 @@ IncidentLight directLight;
1418
1418
  #endif
1419
1419
  #ifdef USE_ALPHAMAP
1420
1420
  diffuseColor.a *= texture2D( alphaMap, uv ).g;
1421
- #endif`,Tf=`#if defined( USE_POINTS_UV )
1421
+ #endif`,Cf=`#if defined( USE_POINTS_UV )
1422
1422
  varying vec2 vUv;
1423
1423
  #else
1424
1424
  #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1430,19 +1430,19 @@ IncidentLight directLight;
1430
1430
  #endif
1431
1431
  #ifdef USE_ALPHAMAP
1432
1432
  uniform sampler2D alphaMap;
1433
- #endif`,bf=`float metalnessFactor = metalness;
1433
+ #endif`,Pf=`float metalnessFactor = metalness;
1434
1434
  #ifdef USE_METALNESSMAP
1435
1435
  vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1436
1436
  metalnessFactor *= texelMetalness.b;
1437
- #endif`,Af=`#ifdef USE_METALNESSMAP
1437
+ #endif`,Df=`#ifdef USE_METALNESSMAP
1438
1438
  uniform sampler2D metalnessMap;
1439
- #endif`,wf=`#ifdef USE_INSTANCING_MORPH
1439
+ #endif`,Lf=`#ifdef USE_INSTANCING_MORPH
1440
1440
  float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1441
1441
  float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1442
1442
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1443
1443
  morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1444
1444
  }
1445
- #endif`,Rf=`#if defined( USE_MORPHCOLORS )
1445
+ #endif`,Uf=`#if defined( USE_MORPHCOLORS )
1446
1446
  vColor *= morphTargetBaseInfluence;
1447
1447
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1448
1448
  #if defined( USE_COLOR_ALPHA )
@@ -1451,12 +1451,12 @@ IncidentLight directLight;
1451
1451
  if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1452
1452
  #endif
1453
1453
  }
1454
- #endif`,Cf=`#ifdef USE_MORPHNORMALS
1454
+ #endif`,If=`#ifdef USE_MORPHNORMALS
1455
1455
  objectNormal *= morphTargetBaseInfluence;
1456
1456
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1457
1457
  if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1458
1458
  }
1459
- #endif`,Pf=`#ifdef USE_MORPHTARGETS
1459
+ #endif`,Nf=`#ifdef USE_MORPHTARGETS
1460
1460
  #ifndef USE_INSTANCING_MORPH
1461
1461
  uniform float morphTargetBaseInfluence;
1462
1462
  uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1470,12 +1470,12 @@ IncidentLight directLight;
1470
1470
  ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1471
1471
  return texelFetch( morphTargetsTexture, morphUV, 0 );
1472
1472
  }
1473
- #endif`,Df=`#ifdef USE_MORPHTARGETS
1473
+ #endif`,Ff=`#ifdef USE_MORPHTARGETS
1474
1474
  transformed *= morphTargetBaseInfluence;
1475
1475
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1476
1476
  if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1477
1477
  }
1478
- #endif`,Lf=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1478
+ #endif`,Of=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1479
1479
  #ifdef FLAT_SHADED
1480
1480
  vec3 fdx = dFdx( vViewPosition );
1481
1481
  vec3 fdy = dFdy( vViewPosition );
@@ -1516,7 +1516,7 @@ IncidentLight directLight;
1516
1516
  tbn2[1] *= faceDirection;
1517
1517
  #endif
1518
1518
  #endif
1519
- vec3 nonPerturbedNormal = normal;`,Uf=`#ifdef USE_NORMALMAP_OBJECTSPACE
1519
+ vec3 nonPerturbedNormal = normal;`,Bf=`#ifdef USE_NORMALMAP_OBJECTSPACE
1520
1520
  normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1521
1521
  #ifdef FLIP_SIDED
1522
1522
  normal = - normal;
@@ -1531,25 +1531,25 @@ vec3 nonPerturbedNormal = normal;`,Uf=`#ifdef USE_NORMALMAP_OBJECTSPACE
1531
1531
  normal = normalize( tbn * mapN );
1532
1532
  #elif defined( USE_BUMPMAP )
1533
1533
  normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1534
- #endif`,If=`#ifndef FLAT_SHADED
1534
+ #endif`,zf=`#ifndef FLAT_SHADED
1535
1535
  varying vec3 vNormal;
1536
1536
  #ifdef USE_TANGENT
1537
1537
  varying vec3 vTangent;
1538
1538
  varying vec3 vBitangent;
1539
1539
  #endif
1540
- #endif`,Nf=`#ifndef FLAT_SHADED
1540
+ #endif`,kf=`#ifndef FLAT_SHADED
1541
1541
  varying vec3 vNormal;
1542
1542
  #ifdef USE_TANGENT
1543
1543
  varying vec3 vTangent;
1544
1544
  varying vec3 vBitangent;
1545
1545
  #endif
1546
- #endif`,Ff=`#ifndef FLAT_SHADED
1546
+ #endif`,Hf=`#ifndef FLAT_SHADED
1547
1547
  vNormal = normalize( transformedNormal );
1548
1548
  #ifdef USE_TANGENT
1549
1549
  vTangent = normalize( transformedTangent );
1550
1550
  vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1551
1551
  #endif
1552
- #endif`,Of=`#ifdef USE_NORMALMAP
1552
+ #endif`,Vf=`#ifdef USE_NORMALMAP
1553
1553
  uniform sampler2D normalMap;
1554
1554
  uniform vec2 normalScale;
1555
1555
  #endif
@@ -1571,13 +1571,13 @@ vec3 nonPerturbedNormal = normal;`,Uf=`#ifdef USE_NORMALMAP_OBJECTSPACE
1571
1571
  float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1572
1572
  return mat3( T * scale, B * scale, N );
1573
1573
  }
1574
- #endif`,Bf=`#ifdef USE_CLEARCOAT
1574
+ #endif`,Gf=`#ifdef USE_CLEARCOAT
1575
1575
  vec3 clearcoatNormal = nonPerturbedNormal;
1576
- #endif`,zf=`#ifdef USE_CLEARCOAT_NORMALMAP
1576
+ #endif`,Wf=`#ifdef USE_CLEARCOAT_NORMALMAP
1577
1577
  vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1578
1578
  clearcoatMapN.xy *= clearcoatNormalScale;
1579
1579
  clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1580
- #endif`,kf=`#ifdef USE_CLEARCOATMAP
1580
+ #endif`,Xf=`#ifdef USE_CLEARCOATMAP
1581
1581
  uniform sampler2D clearcoatMap;
1582
1582
  #endif
1583
1583
  #ifdef USE_CLEARCOAT_NORMALMAP
@@ -1586,18 +1586,18 @@ vec3 nonPerturbedNormal = normal;`,Uf=`#ifdef USE_NORMALMAP_OBJECTSPACE
1586
1586
  #endif
1587
1587
  #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1588
1588
  uniform sampler2D clearcoatRoughnessMap;
1589
- #endif`,Hf=`#ifdef USE_IRIDESCENCEMAP
1589
+ #endif`,qf=`#ifdef USE_IRIDESCENCEMAP
1590
1590
  uniform sampler2D iridescenceMap;
1591
1591
  #endif
1592
1592
  #ifdef USE_IRIDESCENCE_THICKNESSMAP
1593
1593
  uniform sampler2D iridescenceThicknessMap;
1594
- #endif`,Vf=`#ifdef OPAQUE
1594
+ #endif`,Yf=`#ifdef OPAQUE
1595
1595
  diffuseColor.a = 1.0;
1596
1596
  #endif
1597
1597
  #ifdef USE_TRANSMISSION
1598
1598
  diffuseColor.a *= material.transmissionAlpha;
1599
1599
  #endif
1600
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Gf=`vec3 packNormalToRGB( const in vec3 normal ) {
1600
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,jf=`vec3 packNormalToRGB( const in vec3 normal ) {
1601
1601
  return normalize( normal ) * 0.5 + 0.5;
1602
1602
  }
1603
1603
  vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1666,9 +1666,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const
1666
1666
  }
1667
1667
  float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1668
1668
  return ( near * far ) / ( ( far - near ) * depth - far );
1669
- }`,Wf=`#ifdef PREMULTIPLIED_ALPHA
1669
+ }`,Kf=`#ifdef PREMULTIPLIED_ALPHA
1670
1670
  gl_FragColor.rgb *= gl_FragColor.a;
1671
- #endif`,Xf=`vec4 mvPosition = vec4( transformed, 1.0 );
1671
+ #endif`,Zf=`vec4 mvPosition = vec4( transformed, 1.0 );
1672
1672
  #ifdef USE_BATCHING
1673
1673
  mvPosition = batchingMatrix * mvPosition;
1674
1674
  #endif
@@ -1676,22 +1676,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
1676
1676
  mvPosition = instanceMatrix * mvPosition;
1677
1677
  #endif
1678
1678
  mvPosition = modelViewMatrix * mvPosition;
1679
- gl_Position = projectionMatrix * mvPosition;`,qf=`#ifdef DITHERING
1679
+ gl_Position = projectionMatrix * mvPosition;`,$f=`#ifdef DITHERING
1680
1680
  gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1681
- #endif`,Yf=`#ifdef DITHERING
1681
+ #endif`,Jf=`#ifdef DITHERING
1682
1682
  vec3 dithering( vec3 color ) {
1683
1683
  float grid_position = rand( gl_FragCoord.xy );
1684
1684
  vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1685
1685
  dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1686
1686
  return color + dither_shift_RGB;
1687
1687
  }
1688
- #endif`,jf=`float roughnessFactor = roughness;
1688
+ #endif`,Qf=`float roughnessFactor = roughness;
1689
1689
  #ifdef USE_ROUGHNESSMAP
1690
1690
  vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1691
1691
  roughnessFactor *= texelRoughness.g;
1692
- #endif`,Kf=`#ifdef USE_ROUGHNESSMAP
1692
+ #endif`,ed=`#ifdef USE_ROUGHNESSMAP
1693
1693
  uniform sampler2D roughnessMap;
1694
- #endif`,Zf=`#if NUM_SPOT_LIGHT_COORDS > 0
1694
+ #endif`,td=`#if NUM_SPOT_LIGHT_COORDS > 0
1695
1695
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1696
1696
  #endif
1697
1697
  #if NUM_SPOT_LIGHT_MAPS > 0
@@ -1877,7 +1877,7 @@ gl_Position = projectionMatrix * mvPosition;`,qf=`#ifdef DITHERING
1877
1877
  }
1878
1878
  return mix( 1.0, shadow, shadowIntensity );
1879
1879
  }
1880
- #endif`,$f=`#if NUM_SPOT_LIGHT_COORDS > 0
1880
+ #endif`,nd=`#if NUM_SPOT_LIGHT_COORDS > 0
1881
1881
  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1882
1882
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1883
1883
  #endif
@@ -1918,7 +1918,7 @@ gl_Position = projectionMatrix * mvPosition;`,qf=`#ifdef DITHERING
1918
1918
  };
1919
1919
  uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1920
1920
  #endif
1921
- #endif`,Jf=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1921
+ #endif`,id=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1922
1922
  vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1923
1923
  vec4 shadowWorldPosition;
1924
1924
  #endif
@@ -1950,7 +1950,7 @@ gl_Position = projectionMatrix * mvPosition;`,qf=`#ifdef DITHERING
1950
1950
  vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1951
1951
  }
1952
1952
  #pragma unroll_loop_end
1953
- #endif`,Qf=`float getShadowMask() {
1953
+ #endif`,rd=`float getShadowMask() {
1954
1954
  float shadow = 1.0;
1955
1955
  #ifdef USE_SHADOWMAP
1956
1956
  #if NUM_DIR_LIGHT_SHADOWS > 0
@@ -1982,12 +1982,12 @@ gl_Position = projectionMatrix * mvPosition;`,qf=`#ifdef DITHERING
1982
1982
  #endif
1983
1983
  #endif
1984
1984
  return shadow;
1985
- }`,ed=`#ifdef USE_SKINNING
1985
+ }`,sd=`#ifdef USE_SKINNING
1986
1986
  mat4 boneMatX = getBoneMatrix( skinIndex.x );
1987
1987
  mat4 boneMatY = getBoneMatrix( skinIndex.y );
1988
1988
  mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1989
1989
  mat4 boneMatW = getBoneMatrix( skinIndex.w );
1990
- #endif`,td=`#ifdef USE_SKINNING
1990
+ #endif`,ad=`#ifdef USE_SKINNING
1991
1991
  uniform mat4 bindMatrix;
1992
1992
  uniform mat4 bindMatrixInverse;
1993
1993
  uniform highp sampler2D boneTexture;
@@ -2002,7 +2002,7 @@ gl_Position = projectionMatrix * mvPosition;`,qf=`#ifdef DITHERING
2002
2002
  vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2003
2003
  return mat4( v1, v2, v3, v4 );
2004
2004
  }
2005
- #endif`,nd=`#ifdef USE_SKINNING
2005
+ #endif`,od=`#ifdef USE_SKINNING
2006
2006
  vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2007
2007
  vec4 skinned = vec4( 0.0 );
2008
2008
  skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2010,7 +2010,7 @@ gl_Position = projectionMatrix * mvPosition;`,qf=`#ifdef DITHERING
2010
2010
  skinned += boneMatZ * skinVertex * skinWeight.z;
2011
2011
  skinned += boneMatW * skinVertex * skinWeight.w;
2012
2012
  transformed = ( bindMatrixInverse * skinned ).xyz;
2013
- #endif`,id=`#ifdef USE_SKINNING
2013
+ #endif`,ld=`#ifdef USE_SKINNING
2014
2014
  mat4 skinMatrix = mat4( 0.0 );
2015
2015
  skinMatrix += skinWeight.x * boneMatX;
2016
2016
  skinMatrix += skinWeight.y * boneMatY;
@@ -2021,17 +2021,17 @@ gl_Position = projectionMatrix * mvPosition;`,qf=`#ifdef DITHERING
2021
2021
  #ifdef USE_TANGENT
2022
2022
  objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2023
2023
  #endif
2024
- #endif`,rd=`float specularStrength;
2024
+ #endif`,cd=`float specularStrength;
2025
2025
  #ifdef USE_SPECULARMAP
2026
2026
  vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2027
2027
  specularStrength = texelSpecular.r;
2028
2028
  #else
2029
2029
  specularStrength = 1.0;
2030
- #endif`,sd=`#ifdef USE_SPECULARMAP
2030
+ #endif`,hd=`#ifdef USE_SPECULARMAP
2031
2031
  uniform sampler2D specularMap;
2032
- #endif`,ad=`#if defined( TONE_MAPPING )
2032
+ #endif`,ud=`#if defined( TONE_MAPPING )
2033
2033
  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2034
- #endif`,od=`#ifndef saturate
2034
+ #endif`,fd=`#ifndef saturate
2035
2035
  #define saturate( a ) clamp( a, 0.0, 1.0 )
2036
2036
  #endif
2037
2037
  uniform float toneMappingExposure;
@@ -2128,7 +2128,7 @@ vec3 NeutralToneMapping( vec3 color ) {
2128
2128
  float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2129
2129
  return mix( color, vec3( newPeak ), g );
2130
2130
  }
2131
- vec3 CustomToneMapping( vec3 color ) { return color; }`,ld=`#ifdef USE_TRANSMISSION
2131
+ vec3 CustomToneMapping( vec3 color ) { return color; }`,dd=`#ifdef USE_TRANSMISSION
2132
2132
  material.transmission = transmission;
2133
2133
  material.transmissionAlpha = 1.0;
2134
2134
  material.thickness = thickness;
@@ -2149,7 +2149,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ld=`#ifdef USE_TRANSMISS
2149
2149
  material.attenuationColor, material.attenuationDistance );
2150
2150
  material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2151
2151
  totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2152
- #endif`,cd=`#ifdef USE_TRANSMISSION
2152
+ #endif`,pd=`#ifdef USE_TRANSMISSION
2153
2153
  uniform float transmission;
2154
2154
  uniform float thickness;
2155
2155
  uniform float attenuationDistance;
@@ -2275,7 +2275,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ld=`#ifdef USE_TRANSMISS
2275
2275
  float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2276
2276
  return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2277
2277
  }
2278
- #endif`,hd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2278
+ #endif`,md=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2279
2279
  varying vec2 vUv;
2280
2280
  #endif
2281
2281
  #ifdef USE_MAP
@@ -2345,7 +2345,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ld=`#ifdef USE_TRANSMISS
2345
2345
  #ifdef USE_THICKNESSMAP
2346
2346
  uniform mat3 thicknessMapTransform;
2347
2347
  varying vec2 vThicknessMapUv;
2348
- #endif`,ud=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2348
+ #endif`,_d=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2349
2349
  varying vec2 vUv;
2350
2350
  #endif
2351
2351
  #ifdef USE_MAP
@@ -2439,7 +2439,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ld=`#ifdef USE_TRANSMISS
2439
2439
  #ifdef USE_THICKNESSMAP
2440
2440
  uniform mat3 thicknessMapTransform;
2441
2441
  varying vec2 vThicknessMapUv;
2442
- #endif`,fd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2442
+ #endif`,gd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2443
2443
  vUv = vec3( uv, 1 ).xy;
2444
2444
  #endif
2445
2445
  #ifdef USE_MAP
@@ -2510,7 +2510,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ld=`#ifdef USE_TRANSMISS
2510
2510
  #endif
2511
2511
  #ifdef USE_THICKNESSMAP
2512
2512
  vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2513
- #endif`,dd=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2513
+ #endif`,vd=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2514
2514
  vec4 worldPosition = vec4( transformed, 1.0 );
2515
2515
  #ifdef USE_BATCHING
2516
2516
  worldPosition = batchingMatrix * worldPosition;
@@ -2519,12 +2519,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ld=`#ifdef USE_TRANSMISS
2519
2519
  worldPosition = instanceMatrix * worldPosition;
2520
2520
  #endif
2521
2521
  worldPosition = modelMatrix * worldPosition;
2522
- #endif`;const pd=`varying vec2 vUv;
2522
+ #endif`;const xd=`varying vec2 vUv;
2523
2523
  uniform mat3 uvTransform;
2524
2524
  void main() {
2525
2525
  vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2526
2526
  gl_Position = vec4( position.xy, 1.0, 1.0 );
2527
- }`,md=`uniform sampler2D t2D;
2527
+ }`,Md=`uniform sampler2D t2D;
2528
2528
  uniform float backgroundIntensity;
2529
2529
  varying vec2 vUv;
2530
2530
  void main() {
@@ -2536,14 +2536,14 @@ void main() {
2536
2536
  gl_FragColor = texColor;
2537
2537
  #include <tonemapping_fragment>
2538
2538
  #include <colorspace_fragment>
2539
- }`,_d=`varying vec3 vWorldDirection;
2539
+ }`,Sd=`varying vec3 vWorldDirection;
2540
2540
  #include <common>
2541
2541
  void main() {
2542
2542
  vWorldDirection = transformDirection( position, modelMatrix );
2543
2543
  #include <begin_vertex>
2544
2544
  #include <project_vertex>
2545
2545
  gl_Position.z = gl_Position.w;
2546
- }`,gd=`#ifdef ENVMAP_TYPE_CUBE
2546
+ }`,yd=`#ifdef ENVMAP_TYPE_CUBE
2547
2547
  uniform samplerCube envMap;
2548
2548
  #elif defined( ENVMAP_TYPE_CUBE_UV )
2549
2549
  uniform sampler2D envMap;
@@ -2566,14 +2566,14 @@ void main() {
2566
2566
  gl_FragColor = texColor;
2567
2567
  #include <tonemapping_fragment>
2568
2568
  #include <colorspace_fragment>
2569
- }`,vd=`varying vec3 vWorldDirection;
2569
+ }`,Ed=`varying vec3 vWorldDirection;
2570
2570
  #include <common>
2571
2571
  void main() {
2572
2572
  vWorldDirection = transformDirection( position, modelMatrix );
2573
2573
  #include <begin_vertex>
2574
2574
  #include <project_vertex>
2575
2575
  gl_Position.z = gl_Position.w;
2576
- }`,xd=`uniform samplerCube tCube;
2576
+ }`,Td=`uniform samplerCube tCube;
2577
2577
  uniform float tFlip;
2578
2578
  uniform float opacity;
2579
2579
  varying vec3 vWorldDirection;
@@ -2583,7 +2583,7 @@ void main() {
2583
2583
  gl_FragColor.a *= opacity;
2584
2584
  #include <tonemapping_fragment>
2585
2585
  #include <colorspace_fragment>
2586
- }`,Md=`#include <common>
2586
+ }`,bd=`#include <common>
2587
2587
  #include <batching_pars_vertex>
2588
2588
  #include <uv_pars_vertex>
2589
2589
  #include <displacementmap_pars_vertex>
@@ -2610,7 +2610,7 @@ void main() {
2610
2610
  #include <logdepthbuf_vertex>
2611
2611
  #include <clipping_planes_vertex>
2612
2612
  vHighPrecisionZW = gl_Position.zw;
2613
- }`,Sd=`#if DEPTH_PACKING == 3200
2613
+ }`,Ad=`#if DEPTH_PACKING == 3200
2614
2614
  uniform float opacity;
2615
2615
  #endif
2616
2616
  #include <common>
@@ -2644,7 +2644,7 @@ void main() {
2644
2644
  #elif DEPTH_PACKING == 3203
2645
2645
  gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2646
2646
  #endif
2647
- }`,yd=`#define DISTANCE
2647
+ }`,wd=`#define DISTANCE
2648
2648
  varying vec3 vWorldPosition;
2649
2649
  #include <common>
2650
2650
  #include <batching_pars_vertex>
@@ -2671,7 +2671,7 @@ void main() {
2671
2671
  #include <worldpos_vertex>
2672
2672
  #include <clipping_planes_vertex>
2673
2673
  vWorldPosition = worldPosition.xyz;
2674
- }`,Ed=`#define DISTANCE
2674
+ }`,Rd=`#define DISTANCE
2675
2675
  uniform vec3 referencePosition;
2676
2676
  uniform float nearDistance;
2677
2677
  uniform float farDistance;
@@ -2695,13 +2695,13 @@ void main () {
2695
2695
  dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2696
2696
  dist = saturate( dist );
2697
2697
  gl_FragColor = packDepthToRGBA( dist );
2698
- }`,Td=`varying vec3 vWorldDirection;
2698
+ }`,Cd=`varying vec3 vWorldDirection;
2699
2699
  #include <common>
2700
2700
  void main() {
2701
2701
  vWorldDirection = transformDirection( position, modelMatrix );
2702
2702
  #include <begin_vertex>
2703
2703
  #include <project_vertex>
2704
- }`,bd=`uniform sampler2D tEquirect;
2704
+ }`,Pd=`uniform sampler2D tEquirect;
2705
2705
  varying vec3 vWorldDirection;
2706
2706
  #include <common>
2707
2707
  void main() {
@@ -2710,7 +2710,7 @@ void main() {
2710
2710
  gl_FragColor = texture2D( tEquirect, sampleUV );
2711
2711
  #include <tonemapping_fragment>
2712
2712
  #include <colorspace_fragment>
2713
- }`,Ad=`uniform float scale;
2713
+ }`,Dd=`uniform float scale;
2714
2714
  attribute float lineDistance;
2715
2715
  varying float vLineDistance;
2716
2716
  #include <common>
@@ -2732,7 +2732,7 @@ void main() {
2732
2732
  #include <logdepthbuf_vertex>
2733
2733
  #include <clipping_planes_vertex>
2734
2734
  #include <fog_vertex>
2735
- }`,wd=`uniform vec3 diffuse;
2735
+ }`,Ld=`uniform vec3 diffuse;
2736
2736
  uniform float opacity;
2737
2737
  uniform float dashSize;
2738
2738
  uniform float totalSize;
@@ -2760,7 +2760,7 @@ void main() {
2760
2760
  #include <colorspace_fragment>
2761
2761
  #include <fog_fragment>
2762
2762
  #include <premultiplied_alpha_fragment>
2763
- }`,Rd=`#include <common>
2763
+ }`,Ud=`#include <common>
2764
2764
  #include <batching_pars_vertex>
2765
2765
  #include <uv_pars_vertex>
2766
2766
  #include <envmap_pars_vertex>
@@ -2792,7 +2792,7 @@ void main() {
2792
2792
  #include <worldpos_vertex>
2793
2793
  #include <envmap_vertex>
2794
2794
  #include <fog_vertex>
2795
- }`,Cd=`uniform vec3 diffuse;
2795
+ }`,Id=`uniform vec3 diffuse;
2796
2796
  uniform float opacity;
2797
2797
  #ifndef FLAT_SHADED
2798
2798
  varying vec3 vNormal;
@@ -2840,7 +2840,7 @@ void main() {
2840
2840
  #include <fog_fragment>
2841
2841
  #include <premultiplied_alpha_fragment>
2842
2842
  #include <dithering_fragment>
2843
- }`,Pd=`#define LAMBERT
2843
+ }`,Nd=`#define LAMBERT
2844
2844
  varying vec3 vViewPosition;
2845
2845
  #include <common>
2846
2846
  #include <batching_pars_vertex>
@@ -2879,7 +2879,7 @@ void main() {
2879
2879
  #include <envmap_vertex>
2880
2880
  #include <shadowmap_vertex>
2881
2881
  #include <fog_vertex>
2882
- }`,Dd=`#define LAMBERT
2882
+ }`,Fd=`#define LAMBERT
2883
2883
  uniform vec3 diffuse;
2884
2884
  uniform vec3 emissive;
2885
2885
  uniform float opacity;
@@ -2936,7 +2936,7 @@ void main() {
2936
2936
  #include <fog_fragment>
2937
2937
  #include <premultiplied_alpha_fragment>
2938
2938
  #include <dithering_fragment>
2939
- }`,Ld=`#define MATCAP
2939
+ }`,Od=`#define MATCAP
2940
2940
  varying vec3 vViewPosition;
2941
2941
  #include <common>
2942
2942
  #include <batching_pars_vertex>
@@ -2970,7 +2970,7 @@ void main() {
2970
2970
  #include <clipping_planes_vertex>
2971
2971
  #include <fog_vertex>
2972
2972
  vViewPosition = - mvPosition.xyz;
2973
- }`,Ud=`#define MATCAP
2973
+ }`,Bd=`#define MATCAP
2974
2974
  uniform vec3 diffuse;
2975
2975
  uniform float opacity;
2976
2976
  uniform sampler2D matcap;
@@ -3016,7 +3016,7 @@ void main() {
3016
3016
  #include <fog_fragment>
3017
3017
  #include <premultiplied_alpha_fragment>
3018
3018
  #include <dithering_fragment>
3019
- }`,Id=`#define NORMAL
3019
+ }`,zd=`#define NORMAL
3020
3020
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3021
3021
  varying vec3 vViewPosition;
3022
3022
  #endif
@@ -3049,7 +3049,7 @@ void main() {
3049
3049
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3050
3050
  vViewPosition = - mvPosition.xyz;
3051
3051
  #endif
3052
- }`,Nd=`#define NORMAL
3052
+ }`,kd=`#define NORMAL
3053
3053
  uniform float opacity;
3054
3054
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3055
3055
  varying vec3 vViewPosition;
@@ -3071,7 +3071,7 @@ void main() {
3071
3071
  #ifdef OPAQUE
3072
3072
  gl_FragColor.a = 1.0;
3073
3073
  #endif
3074
- }`,Fd=`#define PHONG
3074
+ }`,Hd=`#define PHONG
3075
3075
  varying vec3 vViewPosition;
3076
3076
  #include <common>
3077
3077
  #include <batching_pars_vertex>
@@ -3110,7 +3110,7 @@ void main() {
3110
3110
  #include <envmap_vertex>
3111
3111
  #include <shadowmap_vertex>
3112
3112
  #include <fog_vertex>
3113
- }`,Od=`#define PHONG
3113
+ }`,Vd=`#define PHONG
3114
3114
  uniform vec3 diffuse;
3115
3115
  uniform vec3 emissive;
3116
3116
  uniform vec3 specular;
@@ -3169,7 +3169,7 @@ void main() {
3169
3169
  #include <fog_fragment>
3170
3170
  #include <premultiplied_alpha_fragment>
3171
3171
  #include <dithering_fragment>
3172
- }`,Bd=`#define STANDARD
3172
+ }`,Gd=`#define STANDARD
3173
3173
  varying vec3 vViewPosition;
3174
3174
  #ifdef USE_TRANSMISSION
3175
3175
  varying vec3 vWorldPosition;
@@ -3212,7 +3212,7 @@ void main() {
3212
3212
  #ifdef USE_TRANSMISSION
3213
3213
  vWorldPosition = worldPosition.xyz;
3214
3214
  #endif
3215
- }`,zd=`#define STANDARD
3215
+ }`,Wd=`#define STANDARD
3216
3216
  #ifdef PHYSICAL
3217
3217
  #define IOR
3218
3218
  #define USE_SPECULAR
@@ -3337,7 +3337,7 @@ void main() {
3337
3337
  #include <fog_fragment>
3338
3338
  #include <premultiplied_alpha_fragment>
3339
3339
  #include <dithering_fragment>
3340
- }`,kd=`#define TOON
3340
+ }`,Xd=`#define TOON
3341
3341
  varying vec3 vViewPosition;
3342
3342
  #include <common>
3343
3343
  #include <batching_pars_vertex>
@@ -3374,7 +3374,7 @@ void main() {
3374
3374
  #include <worldpos_vertex>
3375
3375
  #include <shadowmap_vertex>
3376
3376
  #include <fog_vertex>
3377
- }`,Hd=`#define TOON
3377
+ }`,qd=`#define TOON
3378
3378
  uniform vec3 diffuse;
3379
3379
  uniform vec3 emissive;
3380
3380
  uniform float opacity;
@@ -3427,7 +3427,7 @@ void main() {
3427
3427
  #include <fog_fragment>
3428
3428
  #include <premultiplied_alpha_fragment>
3429
3429
  #include <dithering_fragment>
3430
- }`,Vd=`uniform float size;
3430
+ }`,Yd=`uniform float size;
3431
3431
  uniform float scale;
3432
3432
  #include <common>
3433
3433
  #include <color_pars_vertex>
@@ -3458,7 +3458,7 @@ void main() {
3458
3458
  #include <clipping_planes_vertex>
3459
3459
  #include <worldpos_vertex>
3460
3460
  #include <fog_vertex>
3461
- }`,Gd=`uniform vec3 diffuse;
3461
+ }`,jd=`uniform vec3 diffuse;
3462
3462
  uniform float opacity;
3463
3463
  #include <common>
3464
3464
  #include <color_pars_fragment>
@@ -3483,7 +3483,7 @@ void main() {
3483
3483
  #include <colorspace_fragment>
3484
3484
  #include <fog_fragment>
3485
3485
  #include <premultiplied_alpha_fragment>
3486
- }`,Wd=`#include <common>
3486
+ }`,Kd=`#include <common>
3487
3487
  #include <batching_pars_vertex>
3488
3488
  #include <fog_pars_vertex>
3489
3489
  #include <morphtarget_pars_vertex>
@@ -3506,7 +3506,7 @@ void main() {
3506
3506
  #include <worldpos_vertex>
3507
3507
  #include <shadowmap_vertex>
3508
3508
  #include <fog_vertex>
3509
- }`,Xd=`uniform vec3 color;
3509
+ }`,Zd=`uniform vec3 color;
3510
3510
  uniform float opacity;
3511
3511
  #include <common>
3512
3512
  #include <packing>
@@ -3522,7 +3522,7 @@ void main() {
3522
3522
  #include <tonemapping_fragment>
3523
3523
  #include <colorspace_fragment>
3524
3524
  #include <fog_fragment>
3525
- }`,qd=`uniform float rotation;
3525
+ }`,$d=`uniform float rotation;
3526
3526
  uniform vec2 center;
3527
3527
  #include <common>
3528
3528
  #include <uv_pars_vertex>
@@ -3546,7 +3546,7 @@ void main() {
3546
3546
  #include <logdepthbuf_vertex>
3547
3547
  #include <clipping_planes_vertex>
3548
3548
  #include <fog_vertex>
3549
- }`,Yd=`uniform vec3 diffuse;
3549
+ }`,Jd=`uniform vec3 diffuse;
3550
3550
  uniform float opacity;
3551
3551
  #include <common>
3552
3552
  #include <uv_pars_fragment>
@@ -3571,7 +3571,7 @@ void main() {
3571
3571
  #include <tonemapping_fragment>
3572
3572
  #include <colorspace_fragment>
3573
3573
  #include <fog_fragment>
3574
- }`,je={alphahash_fragment:pu,alphahash_pars_fragment:mu,alphamap_fragment:_u,alphamap_pars_fragment:gu,alphatest_fragment:vu,alphatest_pars_fragment:xu,aomap_fragment:Mu,aomap_pars_fragment:Su,batching_pars_vertex:yu,batching_vertex:Eu,begin_vertex:Tu,beginnormal_vertex:bu,bsdfs:Au,iridescence_fragment:wu,bumpmap_pars_fragment:Ru,clipping_planes_fragment:Cu,clipping_planes_pars_fragment:Pu,clipping_planes_pars_vertex:Du,clipping_planes_vertex:Lu,color_fragment:Uu,color_pars_fragment:Iu,color_pars_vertex:Nu,color_vertex:Fu,common:Ou,cube_uv_reflection_fragment:Bu,defaultnormal_vertex:zu,displacementmap_pars_vertex:ku,displacementmap_vertex:Hu,emissivemap_fragment:Vu,emissivemap_pars_fragment:Gu,colorspace_fragment:Wu,colorspace_pars_fragment:Xu,envmap_fragment:qu,envmap_common_pars_fragment:Yu,envmap_pars_fragment:ju,envmap_pars_vertex:Ku,envmap_physical_pars_fragment:of,envmap_vertex:Zu,fog_vertex:$u,fog_pars_vertex:Ju,fog_fragment:Qu,fog_pars_fragment:ef,gradientmap_pars_fragment:tf,lightmap_pars_fragment:nf,lights_lambert_fragment:rf,lights_lambert_pars_fragment:sf,lights_pars_begin:af,lights_toon_fragment:lf,lights_toon_pars_fragment:cf,lights_phong_fragment:hf,lights_phong_pars_fragment:uf,lights_physical_fragment:ff,lights_physical_pars_fragment:df,lights_fragment_begin:pf,lights_fragment_maps:mf,lights_fragment_end:_f,logdepthbuf_fragment:gf,logdepthbuf_pars_fragment:vf,logdepthbuf_pars_vertex:xf,logdepthbuf_vertex:Mf,map_fragment:Sf,map_pars_fragment:yf,map_particle_fragment:Ef,map_particle_pars_fragment:Tf,metalnessmap_fragment:bf,metalnessmap_pars_fragment:Af,morphinstance_vertex:wf,morphcolor_vertex:Rf,morphnormal_vertex:Cf,morphtarget_pars_vertex:Pf,morphtarget_vertex:Df,normal_fragment_begin:Lf,normal_fragment_maps:Uf,normal_pars_fragment:If,normal_pars_vertex:Nf,normal_vertex:Ff,normalmap_pars_fragment:Of,clearcoat_normal_fragment_begin:Bf,clearcoat_normal_fragment_maps:zf,clearcoat_pars_fragment:kf,iridescence_pars_fragment:Hf,opaque_fragment:Vf,packing:Gf,premultiplied_alpha_fragment:Wf,project_vertex:Xf,dithering_fragment:qf,dithering_pars_fragment:Yf,roughnessmap_fragment:jf,roughnessmap_pars_fragment:Kf,shadowmap_pars_fragment:Zf,shadowmap_pars_vertex:$f,shadowmap_vertex:Jf,shadowmask_pars_fragment:Qf,skinbase_vertex:ed,skinning_pars_vertex:td,skinning_vertex:nd,skinnormal_vertex:id,specularmap_fragment:rd,specularmap_pars_fragment:sd,tonemapping_fragment:ad,tonemapping_pars_fragment:od,transmission_fragment:ld,transmission_pars_fragment:cd,uv_pars_fragment:hd,uv_pars_vertex:ud,uv_vertex:fd,worldpos_vertex:dd,background_vert:pd,background_frag:md,backgroundCube_vert:_d,backgroundCube_frag:gd,cube_vert:vd,cube_frag:xd,depth_vert:Md,depth_frag:Sd,distanceRGBA_vert:yd,distanceRGBA_frag:Ed,equirect_vert:Td,equirect_frag:bd,linedashed_vert:Ad,linedashed_frag:wd,meshbasic_vert:Rd,meshbasic_frag:Cd,meshlambert_vert:Pd,meshlambert_frag:Dd,meshmatcap_vert:Ld,meshmatcap_frag:Ud,meshnormal_vert:Id,meshnormal_frag:Nd,meshphong_vert:Fd,meshphong_frag:Od,meshphysical_vert:Bd,meshphysical_frag:zd,meshtoon_vert:kd,meshtoon_frag:Hd,points_vert:Vd,points_frag:Gd,shadow_vert:Wd,shadow_frag:Xd,sprite_vert:qd,sprite_frag:Yd},me={common:{diffuse:{value:new Ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qe}},envmap:{envMap:{value:null},envMapRotation:{value:new qe},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qe},normalScale:{value:new Xe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ke(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 Ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0},uvTransform:{value:new qe}},sprite:{diffuse:{value:new Ke(16777215)},opacity:{value:1},center:{value:new Xe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}}},nn={basic:{uniforms:Rt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.fog]),vertexShader:je.meshbasic_vert,fragmentShader:je.meshbasic_frag},lambert:{uniforms:Rt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Ke(0)}}]),vertexShader:je.meshlambert_vert,fragmentShader:je.meshlambert_frag},phong:{uniforms:Rt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Ke(0)},specular:{value:new Ke(1118481)},shininess:{value:30}}]),vertexShader:je.meshphong_vert,fragmentShader:je.meshphong_frag},standard:{uniforms:Rt([me.common,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.roughnessmap,me.metalnessmap,me.fog,me.lights,{emissive:{value:new Ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag},toon:{uniforms:Rt([me.common,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.gradientmap,me.fog,me.lights,{emissive:{value:new Ke(0)}}]),vertexShader:je.meshtoon_vert,fragmentShader:je.meshtoon_frag},matcap:{uniforms:Rt([me.common,me.bumpmap,me.normalmap,me.displacementmap,me.fog,{matcap:{value:null}}]),vertexShader:je.meshmatcap_vert,fragmentShader:je.meshmatcap_frag},points:{uniforms:Rt([me.points,me.fog]),vertexShader:je.points_vert,fragmentShader:je.points_frag},dashed:{uniforms:Rt([me.common,me.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:je.linedashed_vert,fragmentShader:je.linedashed_frag},depth:{uniforms:Rt([me.common,me.displacementmap]),vertexShader:je.depth_vert,fragmentShader:je.depth_frag},normal:{uniforms:Rt([me.common,me.bumpmap,me.normalmap,me.displacementmap,{opacity:{value:1}}]),vertexShader:je.meshnormal_vert,fragmentShader:je.meshnormal_frag},sprite:{uniforms:Rt([me.sprite,me.fog]),vertexShader:je.sprite_vert,fragmentShader:je.sprite_frag},background:{uniforms:{uvTransform:{value:new qe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:je.background_vert,fragmentShader:je.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new qe}},vertexShader:je.backgroundCube_vert,fragmentShader:je.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:je.cube_vert,fragmentShader:je.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:je.equirect_vert,fragmentShader:je.equirect_frag},distanceRGBA:{uniforms:Rt([me.common,me.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:je.distanceRGBA_vert,fragmentShader:je.distanceRGBA_frag},shadow:{uniforms:Rt([me.lights,me.fog,{color:{value:new Ke(0)},opacity:{value:1}}]),vertexShader:je.shadow_vert,fragmentShader:je.shadow_frag}};nn.physical={uniforms:Rt([nn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qe},clearcoatNormalScale:{value:new Xe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qe},sheen:{value:0},sheenColor:{value:new Ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qe},transmissionSamplerSize:{value:new Xe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qe},attenuationDistance:{value:0},attenuationColor:{value:new Ke(0)},specularColor:{value:new Ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qe},anisotropyVector:{value:new Xe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qe}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag};const Er={r:0,b:0,g:0},Vn=new on,jd=new ht;function Kd(i,e,t,n,r,s,a){const o=new Ke(0);let l=s===!0?0:1,c,h,u=null,d=0,p=null;function _(E){let S=E.isScene===!0?E.background:null;return S&&S.isTexture&&(S=(E.backgroundBlurriness>0?t:e).get(S)),S}function v(E){let S=!1;const L=_(E);L===null?f(o,l):L&&L.isColor&&(f(L,1),S=!0);const w=i.xr.getEnvironmentBlendMode();w==="additive"?n.buffers.color.setClear(0,0,0,1,a):w==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||S)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function m(E,S){const L=_(S);L&&(L.isCubeTexture||L.mapping===Wr)?(h===void 0&&(h=new Jt(new Qi(1,1,1),new Un({name:"BackgroundCubeMaterial",uniforms:Ti(nn.backgroundCube.uniforms),vertexShader:nn.backgroundCube.vertexShader,fragmentShader:nn.backgroundCube.fragmentShader,side:It,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(w,C,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),Vn.copy(S.backgroundRotation),Vn.x*=-1,Vn.y*=-1,Vn.z*=-1,L.isCubeTexture&&L.isRenderTargetTexture===!1&&(Vn.y*=-1,Vn.z*=-1),h.material.uniforms.envMap.value=L,h.material.uniforms.flipEnvMap.value=L.isCubeTexture&&L.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(jd.makeRotationFromEuler(Vn)),h.material.toneMapped=Qe.getTransfer(L.colorSpace)!==st,(u!==L||d!==L.version||p!==i.toneMapping)&&(h.material.needsUpdate=!0,u=L,d=L.version,p=i.toneMapping),h.layers.enableAll(),E.unshift(h,h.geometry,h.material,0,0,null)):L&&L.isTexture&&(c===void 0&&(c=new Jt(new qr(2,2),new Un({name:"BackgroundMaterial",uniforms:Ti(nn.background.uniforms),vertexShader:nn.background.vertexShader,fragmentShader:nn.background.fragmentShader,side:Sn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=L,c.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,c.material.toneMapped=Qe.getTransfer(L.colorSpace)!==st,L.matrixAutoUpdate===!0&&L.updateMatrix(),c.material.uniforms.uvTransform.value.copy(L.matrix),(u!==L||d!==L.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,u=L,d=L.version,p=i.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function f(E,S){E.getRGB(Er,Ml(i)),n.buffers.color.setClear(Er.r,Er.g,Er.b,S,a)}function b(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(E,S=1){o.set(E),l=S,f(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(E){l=E,f(o,l)},render:v,addToRenderList:m,dispose:b}}function Zd(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=d(null);let s=r,a=!1;function o(x,R,H,B,j){let J=!1;const W=u(B,H,R);s!==W&&(s=W,c(s.object)),J=p(x,B,H,j),J&&_(x,B,H,j),j!==null&&e.update(j,i.ELEMENT_ARRAY_BUFFER),(J||a)&&(a=!1,S(x,R,H,B),j!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(j).buffer))}function l(){return i.createVertexArray()}function c(x){return i.bindVertexArray(x)}function h(x){return i.deleteVertexArray(x)}function u(x,R,H){const B=H.wireframe===!0;let j=n[x.id];j===void 0&&(j={},n[x.id]=j);let J=j[R.id];J===void 0&&(J={},j[R.id]=J);let W=J[B];return W===void 0&&(W=d(l()),J[B]=W),W}function d(x){const R=[],H=[],B=[];for(let j=0;j<t;j++)R[j]=0,H[j]=0,B[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:R,enabledAttributes:H,attributeDivisors:B,object:x,attributes:{},index:null}}function p(x,R,H,B){const j=s.attributes,J=R.attributes;let W=0;const ne=H.getAttributes();for(const G in ne)if(ne[G].location>=0){const xe=j[G];let se=J[G];if(se===void 0&&(G==="instanceMatrix"&&x.instanceMatrix&&(se=x.instanceMatrix),G==="instanceColor"&&x.instanceColor&&(se=x.instanceColor)),xe===void 0||xe.attribute!==se||se&&xe.data!==se.data)return!0;W++}return s.attributesNum!==W||s.index!==B}function _(x,R,H,B){const j={},J=R.attributes;let W=0;const ne=H.getAttributes();for(const G in ne)if(ne[G].location>=0){let xe=J[G];xe===void 0&&(G==="instanceMatrix"&&x.instanceMatrix&&(xe=x.instanceMatrix),G==="instanceColor"&&x.instanceColor&&(xe=x.instanceColor));const se={};se.attribute=xe,xe&&xe.data&&(se.data=xe.data),j[G]=se,W++}s.attributes=j,s.attributesNum=W,s.index=B}function v(){const x=s.newAttributes;for(let R=0,H=x.length;R<H;R++)x[R]=0}function m(x){f(x,0)}function f(x,R){const H=s.newAttributes,B=s.enabledAttributes,j=s.attributeDivisors;H[x]=1,B[x]===0&&(i.enableVertexAttribArray(x),B[x]=1),j[x]!==R&&(i.vertexAttribDivisor(x,R),j[x]=R)}function b(){const x=s.newAttributes,R=s.enabledAttributes;for(let H=0,B=R.length;H<B;H++)R[H]!==x[H]&&(i.disableVertexAttribArray(H),R[H]=0)}function E(x,R,H,B,j,J,W){W===!0?i.vertexAttribIPointer(x,R,H,j,J):i.vertexAttribPointer(x,R,H,B,j,J)}function S(x,R,H,B){v();const j=B.attributes,J=H.getAttributes(),W=R.defaultAttributeValues;for(const ne in J){const G=J[ne];if(G.location>=0){let fe=j[ne];if(fe===void 0&&(ne==="instanceMatrix"&&x.instanceMatrix&&(fe=x.instanceMatrix),ne==="instanceColor"&&x.instanceColor&&(fe=x.instanceColor)),fe!==void 0){const xe=fe.normalized,se=fe.itemSize,We=e.get(fe);if(We===void 0)continue;const Ze=We.buffer,Y=We.type,le=We.bytesPerElement,Pe=Y===i.INT||Y===i.UNSIGNED_INT||fe.gpuType===Ea;if(fe.isInterleavedBufferAttribute){const ve=fe.data,Ue=ve.stride,Z=fe.offset;if(ve.isInstancedInterleavedBuffer){for(let Q=0;Q<G.locationSize;Q++)f(G.location+Q,ve.meshPerAttribute);x.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=ve.meshPerAttribute*ve.count)}else for(let Q=0;Q<G.locationSize;Q++)m(G.location+Q);i.bindBuffer(i.ARRAY_BUFFER,Ze);for(let Q=0;Q<G.locationSize;Q++)E(G.location+Q,se/G.locationSize,Y,xe,Ue*le,(Z+se/G.locationSize*Q)*le,Pe)}else{if(fe.isInstancedBufferAttribute){for(let ve=0;ve<G.locationSize;ve++)f(G.location+ve,fe.meshPerAttribute);x.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=fe.meshPerAttribute*fe.count)}else for(let ve=0;ve<G.locationSize;ve++)m(G.location+ve);i.bindBuffer(i.ARRAY_BUFFER,Ze);for(let ve=0;ve<G.locationSize;ve++)E(G.location+ve,se/G.locationSize,Y,xe,se*le,se/G.locationSize*ve*le,Pe)}}else if(W!==void 0){const xe=W[ne];if(xe!==void 0)switch(xe.length){case 2:i.vertexAttrib2fv(G.location,xe);break;case 3:i.vertexAttrib3fv(G.location,xe);break;case 4:i.vertexAttrib4fv(G.location,xe);break;default:i.vertexAttrib1fv(G.location,xe)}}}}b()}function L(){P();for(const x in n){const R=n[x];for(const H in R){const B=R[H];for(const j in B)h(B[j].object),delete B[j];delete R[H]}delete n[x]}}function w(x){if(n[x.id]===void 0)return;const R=n[x.id];for(const H in R){const B=R[H];for(const j in B)h(B[j].object),delete B[j];delete R[H]}delete n[x.id]}function C(x){for(const R in n){const H=n[R];if(H[x.id]===void 0)continue;const B=H[x.id];for(const j in B)h(B[j].object),delete B[j];delete H[x.id]}}function P(){y(),a=!0,s!==r&&(s=r,c(s.object))}function y(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:P,resetDefaultState:y,dispose:L,releaseStatesOfGeometry:w,releaseStatesOfProgram:C,initAttributes:v,enableAttribute:m,disableUnusedAttributes:b}}function $d(i,e,t){let n;function r(c){n=c}function s(c,h){i.drawArrays(n,c,h),t.update(h,n,1)}function a(c,h,u){u!==0&&(i.drawArraysInstanced(n,c,h,u),t.update(h,n,u))}function o(c,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,h,0,u);let p=0;for(let _=0;_<u;_++)p+=h[_];t.update(p,n,1)}function l(c,h,u,d){if(u===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let _=0;_<c.length;_++)a(c[_],h[_],d[_]);else{p.multiDrawArraysInstancedWEBGL(n,c,0,h,0,d,0,u);let _=0;for(let v=0;v<u;v++)_+=h[v]*d[v];t.update(_,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Jd(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(C){return!(C!==$t&&n.convert(C)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){const P=C===Zi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==an&&n.convert(C)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==gn&&!P)}function l(C){if(C==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=t.logarithmicDepthBuffer===!0,d=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),p=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),v=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),b=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),E=i.getParameter(i.MAX_VARYING_VECTORS),S=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),L=_>0,w=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reverseDepthBuffer:d,maxTextures:p,maxVertexTextures:_,maxTextureSize:v,maxCubemapSize:m,maxAttributes:f,maxVertexUniforms:b,maxVaryings:E,maxFragmentUniforms:S,vertexTextures:L,maxSamples:w}}function Qd(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new Cn,o=new qe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const p=u.length!==0||d||n!==0||r;return r=d,n=u.length,p},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,d){t=h(u,d,0)},this.setState=function(u,d,p){const _=u.clippingPlanes,v=u.clipIntersection,m=u.clipShadows,f=i.get(u);if(!r||_===null||_.length===0||s&&!m)s?h(null):c();else{const b=s?0:n,E=b*4;let S=f.clippingState||null;l.value=S,S=h(_,d,E,p);for(let L=0;L!==E;++L)S[L]=t[L];f.clippingState=S,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,p,_){const v=u!==null?u.length:0;let m=null;if(v!==0){if(m=l.value,_!==!0||m===null){const f=p+v*4,b=d.matrixWorldInverse;o.getNormalMatrix(b),(m===null||m.length<f)&&(m=new Float32Array(f));for(let E=0,S=p;E!==v;++E,S+=4)a.copy(u[E]).applyMatrix4(b,o),a.normal.toArray(m,S),m[S+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,m}}function ep(i){let e=new WeakMap;function t(a,o){return o===ks?a.mapping=Si:o===Hs&&(a.mapping=yi),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===ks||o===Hs)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new Yh(l.height);return c.fromEquirectangularTexture(i,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const mi=4,Mo=[.125,.215,.35,.446,.526,.582],qn=20,Es=new Rl,So=new Ke;let Ts=null,bs=0,As=0,ws=!1;const Wn=(1+Math.sqrt(5))/2,di=1/Wn,yo=[new N(-Wn,di,0),new N(Wn,di,0),new N(-di,0,Wn),new N(di,0,Wn),new N(0,Wn,-di),new N(0,Wn,di),new N(-1,1,-1),new N(1,1,-1),new N(-1,1,1),new N(1,1,1)],tp=new N;class Eo{constructor(e){this._renderer=e,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(e,t=0,n=.1,r=100,s={}){const{size:a=256,position:o=tp}=s;Ts=this._renderer.getRenderTarget(),bs=this._renderer.getActiveCubeFace(),As=this._renderer.getActiveMipmapLevel(),ws=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ao(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=bo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Ts,bs,As),this._renderer.xr.enabled=ws,e.scissorTest=!1,Tr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Si||e.mapping===yi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Ts=this._renderer.getRenderTarget(),bs=this._renderer.getActiveCubeFace(),As=this._renderer.getActiveMipmapLevel(),ws=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:rn,minFilter:rn,generateMipmaps:!1,type:Zi,format:$t,colorSpace:Ei,depthBuffer:!1},r=To(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=To(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=np(s)),this._blurMaterial=ip(s,e,t)}return r}_compileMaterial(e){const t=new Jt(this._lodPlanes[0],e);this._renderer.compile(t,Es)}_sceneToCubeUV(e,t,n,r,s){const l=new Xt(90,1,t,n),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,p=u.toneMapping;u.getClearColor(So),u.toneMapping=Ln,u.autoClear=!1;const _=new gl({name:"PMREM.Background",side:It,depthWrite:!1,depthTest:!1}),v=new Jt(new Qi,_);let m=!1;const f=e.background;f?f.isColor&&(_.color.copy(f),e.background=null,m=!0):(_.color.copy(So),m=!0);for(let b=0;b<6;b++){const E=b%3;E===0?(l.up.set(0,c[b],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+h[b],s.y,s.z)):E===1?(l.up.set(0,0,c[b]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+h[b],s.z)):(l.up.set(0,c[b],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+h[b]));const S=this._cubeSize;Tr(r,E*S,b>2?S:0,S,S),u.setRenderTarget(r),m&&u.render(v,l),u.render(e,l)}v.geometry.dispose(),v.material.dispose(),u.toneMapping=p,u.autoClear=d,e.background=f}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Si||e.mapping===yi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ao()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=bo());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Jt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;Tr(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,Es)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=yo[(r-s-1)%yo.length];this._blur(e,s-1,s,a,o)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new Jt(this._lodPlanes[r],c),d=c.uniforms,p=this._sizeLods[n]-1,_=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*qn-1),v=s/_,m=isFinite(s)?1+Math.floor(h*v):qn;m>qn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${qn}`);const f=[];let b=0;for(let C=0;C<qn;++C){const P=C/v,y=Math.exp(-P*P/2);f.push(y),C===0?b+=y:C<m&&(b+=2*y)}for(let C=0;C<f.length;C++)f[C]=f[C]/b;d.envMap.value=e.texture,d.samples.value=m,d.weights.value=f,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:E}=this;d.dTheta.value=_,d.mipInt.value=E-n;const S=this._sizeLods[r],L=3*S*(r>E-mi?r-E+mi:0),w=4*(this._cubeSize-S);Tr(t,L,w,3*S,2*S),l.setRenderTarget(t),l.render(u,Es)}}function np(i){const e=[],t=[],n=[];let r=i;const s=i-mi+1+Mo.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-mi?l=Mo[a-i+mi-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,u=1+c,d=[h,h,u,h,u,u,h,h,u,u,h,u],p=6,_=6,v=3,m=2,f=1,b=new Float32Array(v*_*p),E=new Float32Array(m*_*p),S=new Float32Array(f*_*p);for(let w=0;w<p;w++){const C=w%3*2/3-1,P=w>2?0:-1,y=[C,P,0,C+2/3,P,0,C+2/3,P+1,0,C,P,0,C+2/3,P+1,0,C,P+1,0];b.set(y,v*_*w),E.set(d,m*_*w);const x=[w,w,w,w,w,w];S.set(x,f*_*w)}const L=new en;L.setAttribute("position",new sn(b,v)),L.setAttribute("uv",new sn(E,m)),L.setAttribute("faceIndex",new sn(S,f)),e.push(L),r>mi&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function To(i,e,t){const n=new $n(i,e,t);return n.texture.mapping=Wr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Tr(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function ip(i,e,t){const n=new Float32Array(qn),r=new N(0,1,0);return new Un({name:"SphericalGaussianBlur",defines:{n:qn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Da(),fragmentShader:`
3574
+ }`,je={alphahash_fragment:xu,alphahash_pars_fragment:Mu,alphamap_fragment:Su,alphamap_pars_fragment:yu,alphatest_fragment:Eu,alphatest_pars_fragment:Tu,aomap_fragment:bu,aomap_pars_fragment:Au,batching_pars_vertex:wu,batching_vertex:Ru,begin_vertex:Cu,beginnormal_vertex:Pu,bsdfs:Du,iridescence_fragment:Lu,bumpmap_pars_fragment:Uu,clipping_planes_fragment:Iu,clipping_planes_pars_fragment:Nu,clipping_planes_pars_vertex:Fu,clipping_planes_vertex:Ou,color_fragment:Bu,color_pars_fragment:zu,color_pars_vertex:ku,color_vertex:Hu,common:Vu,cube_uv_reflection_fragment:Gu,defaultnormal_vertex:Wu,displacementmap_pars_vertex:Xu,displacementmap_vertex:qu,emissivemap_fragment:Yu,emissivemap_pars_fragment:ju,colorspace_fragment:Ku,colorspace_pars_fragment:Zu,envmap_fragment:$u,envmap_common_pars_fragment:Ju,envmap_pars_fragment:Qu,envmap_pars_vertex:ef,envmap_physical_pars_fragment:ff,envmap_vertex:tf,fog_vertex:nf,fog_pars_vertex:rf,fog_fragment:sf,fog_pars_fragment:af,gradientmap_pars_fragment:of,lightmap_pars_fragment:lf,lights_lambert_fragment:cf,lights_lambert_pars_fragment:hf,lights_pars_begin:uf,lights_toon_fragment:df,lights_toon_pars_fragment:pf,lights_phong_fragment:mf,lights_phong_pars_fragment:_f,lights_physical_fragment:gf,lights_physical_pars_fragment:vf,lights_fragment_begin:xf,lights_fragment_maps:Mf,lights_fragment_end:Sf,logdepthbuf_fragment:yf,logdepthbuf_pars_fragment:Ef,logdepthbuf_pars_vertex:Tf,logdepthbuf_vertex:bf,map_fragment:Af,map_pars_fragment:wf,map_particle_fragment:Rf,map_particle_pars_fragment:Cf,metalnessmap_fragment:Pf,metalnessmap_pars_fragment:Df,morphinstance_vertex:Lf,morphcolor_vertex:Uf,morphnormal_vertex:If,morphtarget_pars_vertex:Nf,morphtarget_vertex:Ff,normal_fragment_begin:Of,normal_fragment_maps:Bf,normal_pars_fragment:zf,normal_pars_vertex:kf,normal_vertex:Hf,normalmap_pars_fragment:Vf,clearcoat_normal_fragment_begin:Gf,clearcoat_normal_fragment_maps:Wf,clearcoat_pars_fragment:Xf,iridescence_pars_fragment:qf,opaque_fragment:Yf,packing:jf,premultiplied_alpha_fragment:Kf,project_vertex:Zf,dithering_fragment:$f,dithering_pars_fragment:Jf,roughnessmap_fragment:Qf,roughnessmap_pars_fragment:ed,shadowmap_pars_fragment:td,shadowmap_pars_vertex:nd,shadowmap_vertex:id,shadowmask_pars_fragment:rd,skinbase_vertex:sd,skinning_pars_vertex:ad,skinning_vertex:od,skinnormal_vertex:ld,specularmap_fragment:cd,specularmap_pars_fragment:hd,tonemapping_fragment:ud,tonemapping_pars_fragment:fd,transmission_fragment:dd,transmission_pars_fragment:pd,uv_pars_fragment:md,uv_pars_vertex:_d,uv_vertex:gd,worldpos_vertex:vd,background_vert:xd,background_frag:Md,backgroundCube_vert:Sd,backgroundCube_frag:yd,cube_vert:Ed,cube_frag:Td,depth_vert:bd,depth_frag:Ad,distanceRGBA_vert:wd,distanceRGBA_frag:Rd,equirect_vert:Cd,equirect_frag:Pd,linedashed_vert:Dd,linedashed_frag:Ld,meshbasic_vert:Ud,meshbasic_frag:Id,meshlambert_vert:Nd,meshlambert_frag:Fd,meshmatcap_vert:Od,meshmatcap_frag:Bd,meshnormal_vert:zd,meshnormal_frag:kd,meshphong_vert:Hd,meshphong_frag:Vd,meshphysical_vert:Gd,meshphysical_frag:Wd,meshtoon_vert:Xd,meshtoon_frag:qd,points_vert:Yd,points_frag:jd,shadow_vert:Kd,shadow_frag:Zd,sprite_vert:$d,sprite_frag:Jd},me={common:{diffuse:{value:new Ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qe}},envmap:{envMap:{value:null},envMapRotation:{value:new qe},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qe},normalScale:{value:new Xe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ke(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 Ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0},uvTransform:{value:new qe}},sprite:{diffuse:{value:new Ke(16777215)},opacity:{value:1},center:{value:new Xe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}}},tn={basic:{uniforms:Rt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.fog]),vertexShader:je.meshbasic_vert,fragmentShader:je.meshbasic_frag},lambert:{uniforms:Rt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Ke(0)}}]),vertexShader:je.meshlambert_vert,fragmentShader:je.meshlambert_frag},phong:{uniforms:Rt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Ke(0)},specular:{value:new Ke(1118481)},shininess:{value:30}}]),vertexShader:je.meshphong_vert,fragmentShader:je.meshphong_frag},standard:{uniforms:Rt([me.common,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.roughnessmap,me.metalnessmap,me.fog,me.lights,{emissive:{value:new Ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag},toon:{uniforms:Rt([me.common,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.gradientmap,me.fog,me.lights,{emissive:{value:new Ke(0)}}]),vertexShader:je.meshtoon_vert,fragmentShader:je.meshtoon_frag},matcap:{uniforms:Rt([me.common,me.bumpmap,me.normalmap,me.displacementmap,me.fog,{matcap:{value:null}}]),vertexShader:je.meshmatcap_vert,fragmentShader:je.meshmatcap_frag},points:{uniforms:Rt([me.points,me.fog]),vertexShader:je.points_vert,fragmentShader:je.points_frag},dashed:{uniforms:Rt([me.common,me.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:je.linedashed_vert,fragmentShader:je.linedashed_frag},depth:{uniforms:Rt([me.common,me.displacementmap]),vertexShader:je.depth_vert,fragmentShader:je.depth_frag},normal:{uniforms:Rt([me.common,me.bumpmap,me.normalmap,me.displacementmap,{opacity:{value:1}}]),vertexShader:je.meshnormal_vert,fragmentShader:je.meshnormal_frag},sprite:{uniforms:Rt([me.sprite,me.fog]),vertexShader:je.sprite_vert,fragmentShader:je.sprite_frag},background:{uniforms:{uvTransform:{value:new qe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:je.background_vert,fragmentShader:je.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new qe}},vertexShader:je.backgroundCube_vert,fragmentShader:je.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:je.cube_vert,fragmentShader:je.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:je.equirect_vert,fragmentShader:je.equirect_frag},distanceRGBA:{uniforms:Rt([me.common,me.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:je.distanceRGBA_vert,fragmentShader:je.distanceRGBA_frag},shadow:{uniforms:Rt([me.lights,me.fog,{color:{value:new Ke(0)},opacity:{value:1}}]),vertexShader:je.shadow_vert,fragmentShader:je.shadow_frag}};tn.physical={uniforms:Rt([tn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qe},clearcoatNormalScale:{value:new Xe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qe},sheen:{value:0},sheenColor:{value:new Ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qe},transmissionSamplerSize:{value:new Xe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qe},attenuationDistance:{value:0},attenuationColor:{value:new Ke(0)},specularColor:{value:new Ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qe},anisotropyVector:{value:new Xe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qe}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag};const br={r:0,b:0,g:0},Vn=new an,Qd=new ht;function ep(i,e,t,n,r,s,a){const o=new Ke(0);let l=s===!0?0:1,c,h,u=null,d=0,p=null;function _(E){let S=E.isScene===!0?E.background:null;return S&&S.isTexture&&(S=(E.backgroundBlurriness>0?t:e).get(S)),S}function v(E){let S=!1;const D=_(E);D===null?f(o,l):D&&D.isColor&&(f(D,1),S=!0);const w=i.xr.getEnvironmentBlendMode();w==="additive"?n.buffers.color.setClear(0,0,0,1,a):w==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||S)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function m(E,S){const D=_(S);D&&(D.isCubeTexture||D.mapping===Yr)?(h===void 0&&(h=new $t(new tr(1,1,1),new Un({name:"BackgroundCubeMaterial",uniforms:bi(tn.backgroundCube.uniforms),vertexShader:tn.backgroundCube.vertexShader,fragmentShader:tn.backgroundCube.fragmentShader,side:It,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(w,R,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),Vn.copy(S.backgroundRotation),Vn.x*=-1,Vn.y*=-1,Vn.z*=-1,D.isCubeTexture&&D.isRenderTargetTexture===!1&&(Vn.y*=-1,Vn.z*=-1),h.material.uniforms.envMap.value=D,h.material.uniforms.flipEnvMap.value=D.isCubeTexture&&D.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(Qd.makeRotationFromEuler(Vn)),h.material.toneMapped=Qe.getTransfer(D.colorSpace)!==rt,(u!==D||d!==D.version||p!==i.toneMapping)&&(h.material.needsUpdate=!0,u=D,d=D.version,p=i.toneMapping),h.layers.enableAll(),E.unshift(h,h.geometry,h.material,0,0,null)):D&&D.isTexture&&(c===void 0&&(c=new $t(new Kr(2,2),new Un({name:"BackgroundMaterial",uniforms:bi(tn.background.uniforms),vertexShader:tn.background.vertexShader,fragmentShader:tn.background.fragmentShader,side:Sn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=D,c.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,c.material.toneMapped=Qe.getTransfer(D.colorSpace)!==rt,D.matrixAutoUpdate===!0&&D.updateMatrix(),c.material.uniforms.uvTransform.value.copy(D.matrix),(u!==D||d!==D.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,u=D,d=D.version,p=i.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function f(E,S){E.getRGB(br,Tl(i)),n.buffers.color.setClear(br.r,br.g,br.b,S,a)}function b(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(E,S=1){o.set(E),l=S,f(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(E){l=E,f(o,l)},render:v,addToRenderList:m,dispose:b}}function tp(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=d(null);let s=r,a=!1;function o(x,C,H,B,j){let J=!1;const W=u(B,H,C);s!==W&&(s=W,c(s.object)),J=p(x,B,H,j),J&&_(x,B,H,j),j!==null&&e.update(j,i.ELEMENT_ARRAY_BUFFER),(J||a)&&(a=!1,S(x,C,H,B),j!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(j).buffer))}function l(){return i.createVertexArray()}function c(x){return i.bindVertexArray(x)}function h(x){return i.deleteVertexArray(x)}function u(x,C,H){const B=H.wireframe===!0;let j=n[x.id];j===void 0&&(j={},n[x.id]=j);let J=j[C.id];J===void 0&&(J={},j[C.id]=J);let W=J[B];return W===void 0&&(W=d(l()),J[B]=W),W}function d(x){const C=[],H=[],B=[];for(let j=0;j<t;j++)C[j]=0,H[j]=0,B[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:C,enabledAttributes:H,attributeDivisors:B,object:x,attributes:{},index:null}}function p(x,C,H,B){const j=s.attributes,J=C.attributes;let W=0;const ne=H.getAttributes();for(const G in ne)if(ne[G].location>=0){const xe=j[G];let se=J[G];if(se===void 0&&(G==="instanceMatrix"&&x.instanceMatrix&&(se=x.instanceMatrix),G==="instanceColor"&&x.instanceColor&&(se=x.instanceColor)),xe===void 0||xe.attribute!==se||se&&xe.data!==se.data)return!0;W++}return s.attributesNum!==W||s.index!==B}function _(x,C,H,B){const j={},J=C.attributes;let W=0;const ne=H.getAttributes();for(const G in ne)if(ne[G].location>=0){let xe=J[G];xe===void 0&&(G==="instanceMatrix"&&x.instanceMatrix&&(xe=x.instanceMatrix),G==="instanceColor"&&x.instanceColor&&(xe=x.instanceColor));const se={};se.attribute=xe,xe&&xe.data&&(se.data=xe.data),j[G]=se,W++}s.attributes=j,s.attributesNum=W,s.index=B}function v(){const x=s.newAttributes;for(let C=0,H=x.length;C<H;C++)x[C]=0}function m(x){f(x,0)}function f(x,C){const H=s.newAttributes,B=s.enabledAttributes,j=s.attributeDivisors;H[x]=1,B[x]===0&&(i.enableVertexAttribArray(x),B[x]=1),j[x]!==C&&(i.vertexAttribDivisor(x,C),j[x]=C)}function b(){const x=s.newAttributes,C=s.enabledAttributes;for(let H=0,B=C.length;H<B;H++)C[H]!==x[H]&&(i.disableVertexAttribArray(H),C[H]=0)}function E(x,C,H,B,j,J,W){W===!0?i.vertexAttribIPointer(x,C,H,j,J):i.vertexAttribPointer(x,C,H,B,j,J)}function S(x,C,H,B){v();const j=B.attributes,J=H.getAttributes(),W=C.defaultAttributeValues;for(const ne in J){const G=J[ne];if(G.location>=0){let fe=j[ne];if(fe===void 0&&(ne==="instanceMatrix"&&x.instanceMatrix&&(fe=x.instanceMatrix),ne==="instanceColor"&&x.instanceColor&&(fe=x.instanceColor)),fe!==void 0){const xe=fe.normalized,se=fe.itemSize,We=e.get(fe);if(We===void 0)continue;const Ze=We.buffer,Y=We.type,le=We.bytesPerElement,Pe=Y===i.INT||Y===i.UNSIGNED_INT||fe.gpuType===Aa;if(fe.isInterleavedBufferAttribute){const ve=fe.data,Ue=ve.stride,Z=fe.offset;if(ve.isInstancedInterleavedBuffer){for(let Q=0;Q<G.locationSize;Q++)f(G.location+Q,ve.meshPerAttribute);x.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=ve.meshPerAttribute*ve.count)}else for(let Q=0;Q<G.locationSize;Q++)m(G.location+Q);i.bindBuffer(i.ARRAY_BUFFER,Ze);for(let Q=0;Q<G.locationSize;Q++)E(G.location+Q,se/G.locationSize,Y,xe,Ue*le,(Z+se/G.locationSize*Q)*le,Pe)}else{if(fe.isInstancedBufferAttribute){for(let ve=0;ve<G.locationSize;ve++)f(G.location+ve,fe.meshPerAttribute);x.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=fe.meshPerAttribute*fe.count)}else for(let ve=0;ve<G.locationSize;ve++)m(G.location+ve);i.bindBuffer(i.ARRAY_BUFFER,Ze);for(let ve=0;ve<G.locationSize;ve++)E(G.location+ve,se/G.locationSize,Y,xe,se*le,se/G.locationSize*ve*le,Pe)}}else if(W!==void 0){const xe=W[ne];if(xe!==void 0)switch(xe.length){case 2:i.vertexAttrib2fv(G.location,xe);break;case 3:i.vertexAttrib3fv(G.location,xe);break;case 4:i.vertexAttrib4fv(G.location,xe);break;default:i.vertexAttrib1fv(G.location,xe)}}}}b()}function D(){L();for(const x in n){const C=n[x];for(const H in C){const B=C[H];for(const j in B)h(B[j].object),delete B[j];delete C[H]}delete n[x]}}function w(x){if(n[x.id]===void 0)return;const C=n[x.id];for(const H in C){const B=C[H];for(const j in B)h(B[j].object),delete B[j];delete C[H]}delete n[x.id]}function R(x){for(const C in n){const H=n[C];if(H[x.id]===void 0)continue;const B=H[x.id];for(const j in B)h(B[j].object),delete B[j];delete H[x.id]}}function L(){y(),a=!0,s!==r&&(s=r,c(s.object))}function y(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:L,resetDefaultState:y,dispose:D,releaseStatesOfGeometry:w,releaseStatesOfProgram:R,initAttributes:v,enableAttribute:m,disableUnusedAttributes:b}}function np(i,e,t){let n;function r(c){n=c}function s(c,h){i.drawArrays(n,c,h),t.update(h,n,1)}function a(c,h,u){u!==0&&(i.drawArraysInstanced(n,c,h,u),t.update(h,n,u))}function o(c,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,h,0,u);let p=0;for(let _=0;_<u;_++)p+=h[_];t.update(p,n,1)}function l(c,h,u,d){if(u===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let _=0;_<c.length;_++)a(c[_],h[_],d[_]);else{p.multiDrawArraysInstancedWEBGL(n,c,0,h,0,d,0,u);let _=0;for(let v=0;v<u;v++)_+=h[v]*d[v];t.update(_,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function ip(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const R=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(R){return!(R!==Zt&&n.convert(R)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(R){const L=R===Ji&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(R!==sn&&n.convert(R)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==gn&&!L)}function l(R){if(R==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=t.logarithmicDepthBuffer===!0,d=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),p=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),v=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),b=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),E=i.getParameter(i.MAX_VARYING_VECTORS),S=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),D=_>0,w=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reverseDepthBuffer:d,maxTextures:p,maxVertexTextures:_,maxTextureSize:v,maxCubemapSize:m,maxAttributes:f,maxVertexUniforms:b,maxVaryings:E,maxFragmentUniforms:S,vertexTextures:D,maxSamples:w}}function rp(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new Cn,o=new qe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const p=u.length!==0||d||n!==0||r;return r=d,n=u.length,p},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,d){t=h(u,d,0)},this.setState=function(u,d,p){const _=u.clippingPlanes,v=u.clipIntersection,m=u.clipShadows,f=i.get(u);if(!r||_===null||_.length===0||s&&!m)s?h(null):c();else{const b=s?0:n,E=b*4;let S=f.clippingState||null;l.value=S,S=h(_,d,E,p);for(let D=0;D!==E;++D)S[D]=t[D];f.clippingState=S,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,p,_){const v=u!==null?u.length:0;let m=null;if(v!==0){if(m=l.value,_!==!0||m===null){const f=p+v*4,b=d.matrixWorldInverse;o.getNormalMatrix(b),(m===null||m.length<f)&&(m=new Float32Array(f));for(let E=0,S=p;E!==v;++E,S+=4)a.copy(u[E]).applyMatrix4(b,o),a.normal.toArray(m,S),m[S+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,m}}function sp(i){let e=new WeakMap;function t(a,o){return o===Gs?a.mapping=yi:o===Ws&&(a.mapping=Ei),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Gs||o===Ws)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new Jh(l.height);return c.fromEquirectangularTexture(i,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const mi=4,To=[.125,.215,.35,.446,.526,.582],qn=20,As=new Ll,bo=new Ke;let ws=null,Rs=0,Cs=0,Ps=!1;const Wn=(1+Math.sqrt(5))/2,di=1/Wn,Ao=[new N(-Wn,di,0),new N(Wn,di,0),new N(-di,0,Wn),new N(di,0,Wn),new N(0,Wn,-di),new N(0,Wn,di),new N(-1,1,-1),new N(1,1,-1),new N(-1,1,1),new N(1,1,1)],ap=new N;class wo{constructor(e){this._renderer=e,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(e,t=0,n=.1,r=100,s={}){const{size:a=256,position:o=ap}=s;ws=this._renderer.getRenderTarget(),Rs=this._renderer.getActiveCubeFace(),Cs=this._renderer.getActiveMipmapLevel(),Ps=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Po(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Co(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(ws,Rs,Cs),this._renderer.xr.enabled=Ps,e.scissorTest=!1,Ar(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===yi||e.mapping===Ei?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ws=this._renderer.getRenderTarget(),Rs=this._renderer.getActiveCubeFace(),Cs=this._renderer.getActiveMipmapLevel(),Ps=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:nn,minFilter:nn,generateMipmaps:!1,type:Ji,format:Zt,colorSpace:Ti,depthBuffer:!1},r=Ro(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Ro(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=op(s)),this._blurMaterial=lp(s,e,t)}return r}_compileMaterial(e){const t=new $t(this._lodPlanes[0],e);this._renderer.compile(t,As)}_sceneToCubeUV(e,t,n,r,s){const l=new Wt(90,1,t,n),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,p=u.toneMapping;u.getClearColor(bo),u.toneMapping=Ln,u.autoClear=!1;const _=new Sl({name:"PMREM.Background",side:It,depthWrite:!1,depthTest:!1}),v=new $t(new tr,_);let m=!1;const f=e.background;f?f.isColor&&(_.color.copy(f),e.background=null,m=!0):(_.color.copy(bo),m=!0);for(let b=0;b<6;b++){const E=b%3;E===0?(l.up.set(0,c[b],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+h[b],s.y,s.z)):E===1?(l.up.set(0,0,c[b]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+h[b],s.z)):(l.up.set(0,c[b],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+h[b]));const S=this._cubeSize;Ar(r,E*S,b>2?S:0,S,S),u.setRenderTarget(r),m&&u.render(v,l),u.render(e,l)}v.geometry.dispose(),v.material.dispose(),u.toneMapping=p,u.autoClear=d,e.background=f}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===yi||e.mapping===Ei;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Po()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Co());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new $t(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;Ar(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,As)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=Ao[(r-s-1)%Ao.length];this._blur(e,s-1,s,a,o)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new $t(this._lodPlanes[r],c),d=c.uniforms,p=this._sizeLods[n]-1,_=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*qn-1),v=s/_,m=isFinite(s)?1+Math.floor(h*v):qn;m>qn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${qn}`);const f=[];let b=0;for(let R=0;R<qn;++R){const L=R/v,y=Math.exp(-L*L/2);f.push(y),R===0?b+=y:R<m&&(b+=2*y)}for(let R=0;R<f.length;R++)f[R]=f[R]/b;d.envMap.value=e.texture,d.samples.value=m,d.weights.value=f,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:E}=this;d.dTheta.value=_,d.mipInt.value=E-n;const S=this._sizeLods[r],D=3*S*(r>E-mi?r-E+mi:0),w=4*(this._cubeSize-S);Ar(t,D,w,3*S,2*S),l.setRenderTarget(t),l.render(u,As)}}function op(i){const e=[],t=[],n=[];let r=i;const s=i-mi+1+To.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-mi?l=To[a-i+mi-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,u=1+c,d=[h,h,u,h,u,u,h,h,u,u,h,u],p=6,_=6,v=3,m=2,f=1,b=new Float32Array(v*_*p),E=new Float32Array(m*_*p),S=new Float32Array(f*_*p);for(let w=0;w<p;w++){const R=w%3*2/3-1,L=w>2?0:-1,y=[R,L,0,R+2/3,L,0,R+2/3,L+1,0,R,L,0,R+2/3,L+1,0,R,L+1,0];b.set(y,v*_*w),E.set(d,m*_*w);const x=[w,w,w,w,w,w];S.set(x,f*_*w)}const D=new Qt;D.setAttribute("position",new rn(b,v)),D.setAttribute("uv",new rn(E,m)),D.setAttribute("faceIndex",new rn(S,f)),e.push(D),r>mi&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Ro(i,e,t){const n=new $n(i,e,t);return n.texture.mapping=Yr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ar(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function lp(i,e,t){const n=new Float32Array(qn),r=new N(0,1,0);return new Un({name:"SphericalGaussianBlur",defines:{n:qn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ia(),fragmentShader:`
3575
3575
 
3576
3576
  precision mediump float;
3577
3577
  precision mediump int;
@@ -3631,7 +3631,7 @@ void main() {
3631
3631
  }
3632
3632
 
3633
3633
  }
3634
- `,blending:Dn,depthTest:!1,depthWrite:!1})}function bo(){return new Un({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Da(),fragmentShader:`
3634
+ `,blending:Dn,depthTest:!1,depthWrite:!1})}function Co(){return new Un({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ia(),fragmentShader:`
3635
3635
 
3636
3636
  precision mediump float;
3637
3637
  precision mediump int;
@@ -3650,7 +3650,7 @@ void main() {
3650
3650
  gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3651
3651
 
3652
3652
  }
3653
- `,blending:Dn,depthTest:!1,depthWrite:!1})}function Ao(){return new Un({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Da(),fragmentShader:`
3653
+ `,blending:Dn,depthTest:!1,depthWrite:!1})}function Po(){return new Un({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ia(),fragmentShader:`
3654
3654
 
3655
3655
  precision mediump float;
3656
3656
  precision mediump int;
@@ -3666,7 +3666,7 @@ void main() {
3666
3666
  gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3667
3667
 
3668
3668
  }
3669
- `,blending:Dn,depthTest:!1,depthWrite:!1})}function Da(){return`
3669
+ `,blending:Dn,depthTest:!1,depthWrite:!1})}function Ia(){return`
3670
3670
 
3671
3671
  precision mediump float;
3672
3672
  precision mediump int;
@@ -3721,17 +3721,17 @@ void main() {
3721
3721
  gl_Position = vec4( position, 1.0 );
3722
3722
 
3723
3723
  }
3724
- `}function rp(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===ks||l===Hs,h=l===Si||l===yi;if(c||h){let u=e.get(o);const d=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return t===null&&(t=new Eo(i)),u=c?t.fromEquirectangular(o,u):t.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),u.texture;if(u!==void 0)return u.texture;{const p=o.image;return c&&p&&p.height>0||h&&p&&r(p)?(t===null&&(t=new Eo(i)),u=c?t.fromEquirectangular(o):t.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),o.addEventListener("dispose",s),u.texture):null}}}return o}function r(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function sp(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&vi("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function ap(i,e,t,n){const r={},s=new WeakMap;function a(u){const d=u.target;d.index!==null&&e.remove(d.index);for(const _ in d.attributes)e.remove(d.attributes[_]);d.removeEventListener("dispose",a),delete r[d.id];const p=s.get(d);p&&(e.remove(p),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(u,d){return r[d.id]===!0||(d.addEventListener("dispose",a),r[d.id]=!0,t.memory.geometries++),d}function l(u){const d=u.attributes;for(const p in d)e.update(d[p],i.ARRAY_BUFFER)}function c(u){const d=[],p=u.index,_=u.attributes.position;let v=0;if(p!==null){const b=p.array;v=p.version;for(let E=0,S=b.length;E<S;E+=3){const L=b[E+0],w=b[E+1],C=b[E+2];d.push(L,w,w,C,C,L)}}else if(_!==void 0){const b=_.array;v=_.version;for(let E=0,S=b.length/3-1;E<S;E+=3){const L=E+0,w=E+1,C=E+2;d.push(L,w,w,C,C,L)}}else return;const m=new(dl(d)?xl:vl)(d,1);m.version=v;const f=s.get(u);f&&e.remove(f),s.set(u,m)}function h(u){const d=s.get(u);if(d){const p=u.index;p!==null&&d.version<p.version&&c(u)}else c(u);return s.get(u)}return{get:o,update:l,getWireframeAttribute:h}}function op(i,e,t){let n;function r(d){n=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function l(d,p){i.drawElements(n,p,s,d*a),t.update(p,n,1)}function c(d,p,_){_!==0&&(i.drawElementsInstanced(n,p,s,d*a,_),t.update(p,n,_))}function h(d,p,_){if(_===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,p,0,s,d,0,_);let m=0;for(let f=0;f<_;f++)m+=p[f];t.update(m,n,1)}function u(d,p,_,v){if(_===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let f=0;f<d.length;f++)c(d[f]/a,p[f],v[f]);else{m.multiDrawElementsInstancedWEBGL(n,p,0,s,d,0,v,0,_);let f=0;for(let b=0;b<_;b++)f+=p[b]*v[b];t.update(f,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function lp(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function cp(i,e,t){const n=new WeakMap,r=new pt;function s(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0;let d=n.get(o);if(d===void 0||d.count!==u){let y=function(){C.dispose(),n.delete(o),o.removeEventListener("dispose",y)};d!==void 0&&d.texture.dispose();const p=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,v=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],b=o.morphAttributes.color||[];let E=0;p===!0&&(E=1),_===!0&&(E=2),v===!0&&(E=3);let S=o.attributes.position.count*E,L=1;S>e.maxTextureSize&&(L=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);const w=new Float32Array(S*L*4*u),C=new pl(w,S,L,u);C.type=gn,C.needsUpdate=!0;const P=E*4;for(let x=0;x<u;x++){const R=m[x],H=f[x],B=b[x],j=S*L*4*x;for(let J=0;J<R.count;J++){const W=J*P;p===!0&&(r.fromBufferAttribute(R,J),w[j+W+0]=r.x,w[j+W+1]=r.y,w[j+W+2]=r.z,w[j+W+3]=0),_===!0&&(r.fromBufferAttribute(H,J),w[j+W+4]=r.x,w[j+W+5]=r.y,w[j+W+6]=r.z,w[j+W+7]=0),v===!0&&(r.fromBufferAttribute(B,J),w[j+W+8]=r.x,w[j+W+9]=r.y,w[j+W+10]=r.z,w[j+W+11]=B.itemSize===4?r.w:1)}}d={count:u,texture:C,size:new Xe(S,L)},n.set(o,d),o.addEventListener("dispose",y)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let p=0;for(let v=0;v<c.length;v++)p+=c[v];const _=o.morphTargetsRelative?1:1-p;l.getUniforms().setValue(i,"morphTargetBaseInfluence",_),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:s}}function hp(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,u=e.get(l,h);if(r.get(u)!==c&&(e.update(u),r.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;r.get(d)!==c&&(d.update(),r.set(d,c))}return u}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}const Pl=new Pt,wo=new El(1,1),Dl=new pl,Ll=new Ph,Ul=new yl,Ro=[],Co=[],Po=new Float32Array(16),Do=new Float32Array(9),Lo=new Float32Array(4);function Ri(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=Ro[r];if(s===void 0&&(s=new Float32Array(r),Ro[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function gt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function vt(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Yr(i,e){let t=Co[e];t===void 0&&(t=new Int32Array(e),Co[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function up(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function fp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(gt(t,e))return;i.uniform2fv(this.addr,e),vt(t,e)}}function dp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(gt(t,e))return;i.uniform3fv(this.addr,e),vt(t,e)}}function pp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(gt(t,e))return;i.uniform4fv(this.addr,e),vt(t,e)}}function mp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(gt(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),vt(t,e)}else{if(gt(t,n))return;Lo.set(n),i.uniformMatrix2fv(this.addr,!1,Lo),vt(t,n)}}function _p(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(gt(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),vt(t,e)}else{if(gt(t,n))return;Do.set(n),i.uniformMatrix3fv(this.addr,!1,Do),vt(t,n)}}function gp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(gt(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),vt(t,e)}else{if(gt(t,n))return;Po.set(n),i.uniformMatrix4fv(this.addr,!1,Po),vt(t,n)}}function vp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function xp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(gt(t,e))return;i.uniform2iv(this.addr,e),vt(t,e)}}function Mp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(gt(t,e))return;i.uniform3iv(this.addr,e),vt(t,e)}}function Sp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(gt(t,e))return;i.uniform4iv(this.addr,e),vt(t,e)}}function yp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Ep(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(gt(t,e))return;i.uniform2uiv(this.addr,e),vt(t,e)}}function Tp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(gt(t,e))return;i.uniform3uiv(this.addr,e),vt(t,e)}}function bp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(gt(t,e))return;i.uniform4uiv(this.addr,e),vt(t,e)}}function Ap(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(wo.compareFunction=fl,s=wo):s=Pl,t.setTexture2D(e||s,r)}function wp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Ll,r)}function Rp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||Ul,r)}function Cp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Dl,r)}function Pp(i){switch(i){case 5126:return up;case 35664:return fp;case 35665:return dp;case 35666:return pp;case 35674:return mp;case 35675:return _p;case 35676:return gp;case 5124:case 35670:return vp;case 35667:case 35671:return xp;case 35668:case 35672:return Mp;case 35669:case 35673:return Sp;case 5125:return yp;case 36294:return Ep;case 36295:return Tp;case 36296:return bp;case 35678:case 36198:case 36298:case 36306:case 35682:return Ap;case 35679:case 36299:case 36307:return wp;case 35680:case 36300:case 36308:case 36293:return Rp;case 36289:case 36303:case 36311:case 36292:return Cp}}function Dp(i,e){i.uniform1fv(this.addr,e)}function Lp(i,e){const t=Ri(e,this.size,2);i.uniform2fv(this.addr,t)}function Up(i,e){const t=Ri(e,this.size,3);i.uniform3fv(this.addr,t)}function Ip(i,e){const t=Ri(e,this.size,4);i.uniform4fv(this.addr,t)}function Np(i,e){const t=Ri(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Fp(i,e){const t=Ri(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function Op(i,e){const t=Ri(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Bp(i,e){i.uniform1iv(this.addr,e)}function zp(i,e){i.uniform2iv(this.addr,e)}function kp(i,e){i.uniform3iv(this.addr,e)}function Hp(i,e){i.uniform4iv(this.addr,e)}function Vp(i,e){i.uniform1uiv(this.addr,e)}function Gp(i,e){i.uniform2uiv(this.addr,e)}function Wp(i,e){i.uniform3uiv(this.addr,e)}function Xp(i,e){i.uniform4uiv(this.addr,e)}function qp(i,e,t){const n=this.cache,r=e.length,s=Yr(t,r);gt(n,s)||(i.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||Pl,s[a])}function Yp(i,e,t){const n=this.cache,r=e.length,s=Yr(t,r);gt(n,s)||(i.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Ll,s[a])}function jp(i,e,t){const n=this.cache,r=e.length,s=Yr(t,r);gt(n,s)||(i.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Ul,s[a])}function Kp(i,e,t){const n=this.cache,r=e.length,s=Yr(t,r);gt(n,s)||(i.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Dl,s[a])}function Zp(i){switch(i){case 5126:return Dp;case 35664:return Lp;case 35665:return Up;case 35666:return Ip;case 35674:return Np;case 35675:return Fp;case 35676:return Op;case 5124:case 35670:return Bp;case 35667:case 35671:return zp;case 35668:case 35672:return kp;case 35669:case 35673:return Hp;case 5125:return Vp;case 36294:return Gp;case 36295:return Wp;case 36296:return Xp;case 35678:case 36198:case 36298:case 36306:case 35682:return qp;case 35679:case 36299:case 36307:return Yp;case 35680:case 36300:case 36308:case 36293:return jp;case 36289:case 36303:case 36311:case 36292:return Kp}}class $p{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Pp(t.type)}}class Jp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Zp(t.type)}}class Qp{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const Rs=/(\w+)(\])?(\[|\.)?/g;function Uo(i,e){i.seq.push(e),i.map[e.id]=e}function em(i,e,t){const n=i.name,r=n.length;for(Rs.lastIndex=0;;){const s=Rs.exec(n),a=Rs.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){Uo(t,c===void 0?new $p(o,i,e):new Jp(o,i,e));break}else{let u=t.map[o];u===void 0&&(u=new Qp(o),Uo(t,u)),t=u}}}class Nr{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);em(s,a,this)}}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function Io(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const tm=37297;let nm=0;function im(i,e){const t=i.split(`
3724
+ `}function cp(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Gs||l===Ws,h=l===yi||l===Ei;if(c||h){let u=e.get(o);const d=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return t===null&&(t=new wo(i)),u=c?t.fromEquirectangular(o,u):t.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),u.texture;if(u!==void 0)return u.texture;{const p=o.image;return c&&p&&p.height>0||h&&p&&r(p)?(t===null&&(t=new wo(i)),u=c?t.fromEquirectangular(o):t.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),o.addEventListener("dispose",s),u.texture):null}}}return o}function r(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function hp(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&xi("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function up(i,e,t,n){const r={},s=new WeakMap;function a(u){const d=u.target;d.index!==null&&e.remove(d.index);for(const _ in d.attributes)e.remove(d.attributes[_]);d.removeEventListener("dispose",a),delete r[d.id];const p=s.get(d);p&&(e.remove(p),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(u,d){return r[d.id]===!0||(d.addEventListener("dispose",a),r[d.id]=!0,t.memory.geometries++),d}function l(u){const d=u.attributes;for(const p in d)e.update(d[p],i.ARRAY_BUFFER)}function c(u){const d=[],p=u.index,_=u.attributes.position;let v=0;if(p!==null){const b=p.array;v=p.version;for(let E=0,S=b.length;E<S;E+=3){const D=b[E+0],w=b[E+1],R=b[E+2];d.push(D,w,w,R,R,D)}}else if(_!==void 0){const b=_.array;v=_.version;for(let E=0,S=b.length/3-1;E<S;E+=3){const D=E+0,w=E+1,R=E+2;d.push(D,w,w,R,R,D)}}else return;const m=new(gl(d)?El:yl)(d,1);m.version=v;const f=s.get(u);f&&e.remove(f),s.set(u,m)}function h(u){const d=s.get(u);if(d){const p=u.index;p!==null&&d.version<p.version&&c(u)}else c(u);return s.get(u)}return{get:o,update:l,getWireframeAttribute:h}}function fp(i,e,t){let n;function r(d){n=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function l(d,p){i.drawElements(n,p,s,d*a),t.update(p,n,1)}function c(d,p,_){_!==0&&(i.drawElementsInstanced(n,p,s,d*a,_),t.update(p,n,_))}function h(d,p,_){if(_===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,p,0,s,d,0,_);let m=0;for(let f=0;f<_;f++)m+=p[f];t.update(m,n,1)}function u(d,p,_,v){if(_===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let f=0;f<d.length;f++)c(d[f]/a,p[f],v[f]);else{m.multiDrawElementsInstancedWEBGL(n,p,0,s,d,0,v,0,_);let f=0;for(let b=0;b<_;b++)f+=p[b]*v[b];t.update(f,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function dp(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function pp(i,e,t){const n=new WeakMap,r=new pt;function s(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0;let d=n.get(o);if(d===void 0||d.count!==u){let y=function(){R.dispose(),n.delete(o),o.removeEventListener("dispose",y)};d!==void 0&&d.texture.dispose();const p=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,v=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],b=o.morphAttributes.color||[];let E=0;p===!0&&(E=1),_===!0&&(E=2),v===!0&&(E=3);let S=o.attributes.position.count*E,D=1;S>e.maxTextureSize&&(D=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);const w=new Float32Array(S*D*4*u),R=new vl(w,S,D,u);R.type=gn,R.needsUpdate=!0;const L=E*4;for(let x=0;x<u;x++){const C=m[x],H=f[x],B=b[x],j=S*D*4*x;for(let J=0;J<C.count;J++){const W=J*L;p===!0&&(r.fromBufferAttribute(C,J),w[j+W+0]=r.x,w[j+W+1]=r.y,w[j+W+2]=r.z,w[j+W+3]=0),_===!0&&(r.fromBufferAttribute(H,J),w[j+W+4]=r.x,w[j+W+5]=r.y,w[j+W+6]=r.z,w[j+W+7]=0),v===!0&&(r.fromBufferAttribute(B,J),w[j+W+8]=r.x,w[j+W+9]=r.y,w[j+W+10]=r.z,w[j+W+11]=B.itemSize===4?r.w:1)}}d={count:u,texture:R,size:new Xe(S,D)},n.set(o,d),o.addEventListener("dispose",y)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let p=0;for(let v=0;v<c.length;v++)p+=c[v];const _=o.morphTargetsRelative?1:1-p;l.getUniforms().setValue(i,"morphTargetBaseInfluence",_),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:s}}function mp(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,u=e.get(l,h);if(r.get(u)!==c&&(e.update(u),r.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;r.get(d)!==c&&(d.update(),r.set(d,c))}return u}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}const Il=new Pt,Do=new wl(1,1),Nl=new vl,Fl=new Nh,Ol=new Al,Lo=[],Uo=[],Io=new Float32Array(16),No=new Float32Array(9),Fo=new Float32Array(4);function Ci(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=Lo[r];if(s===void 0&&(s=new Float32Array(r),Lo[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function gt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function vt(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Zr(i,e){let t=Uo[e];t===void 0&&(t=new Int32Array(e),Uo[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function _p(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function gp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(gt(t,e))return;i.uniform2fv(this.addr,e),vt(t,e)}}function vp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(gt(t,e))return;i.uniform3fv(this.addr,e),vt(t,e)}}function xp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(gt(t,e))return;i.uniform4fv(this.addr,e),vt(t,e)}}function Mp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(gt(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),vt(t,e)}else{if(gt(t,n))return;Fo.set(n),i.uniformMatrix2fv(this.addr,!1,Fo),vt(t,n)}}function Sp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(gt(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),vt(t,e)}else{if(gt(t,n))return;No.set(n),i.uniformMatrix3fv(this.addr,!1,No),vt(t,n)}}function yp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(gt(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),vt(t,e)}else{if(gt(t,n))return;Io.set(n),i.uniformMatrix4fv(this.addr,!1,Io),vt(t,n)}}function Ep(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Tp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(gt(t,e))return;i.uniform2iv(this.addr,e),vt(t,e)}}function bp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(gt(t,e))return;i.uniform3iv(this.addr,e),vt(t,e)}}function Ap(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(gt(t,e))return;i.uniform4iv(this.addr,e),vt(t,e)}}function wp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Rp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(gt(t,e))return;i.uniform2uiv(this.addr,e),vt(t,e)}}function Cp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(gt(t,e))return;i.uniform3uiv(this.addr,e),vt(t,e)}}function Pp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(gt(t,e))return;i.uniform4uiv(this.addr,e),vt(t,e)}}function Dp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(Do.compareFunction=_l,s=Do):s=Il,t.setTexture2D(e||s,r)}function Lp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Fl,r)}function Up(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||Ol,r)}function Ip(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Nl,r)}function Np(i){switch(i){case 5126:return _p;case 35664:return gp;case 35665:return vp;case 35666:return xp;case 35674:return Mp;case 35675:return Sp;case 35676:return yp;case 5124:case 35670:return Ep;case 35667:case 35671:return Tp;case 35668:case 35672:return bp;case 35669:case 35673:return Ap;case 5125:return wp;case 36294:return Rp;case 36295:return Cp;case 36296:return Pp;case 35678:case 36198:case 36298:case 36306:case 35682:return Dp;case 35679:case 36299:case 36307:return Lp;case 35680:case 36300:case 36308:case 36293:return Up;case 36289:case 36303:case 36311:case 36292:return Ip}}function Fp(i,e){i.uniform1fv(this.addr,e)}function Op(i,e){const t=Ci(e,this.size,2);i.uniform2fv(this.addr,t)}function Bp(i,e){const t=Ci(e,this.size,3);i.uniform3fv(this.addr,t)}function zp(i,e){const t=Ci(e,this.size,4);i.uniform4fv(this.addr,t)}function kp(i,e){const t=Ci(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Hp(i,e){const t=Ci(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function Vp(i,e){const t=Ci(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Gp(i,e){i.uniform1iv(this.addr,e)}function Wp(i,e){i.uniform2iv(this.addr,e)}function Xp(i,e){i.uniform3iv(this.addr,e)}function qp(i,e){i.uniform4iv(this.addr,e)}function Yp(i,e){i.uniform1uiv(this.addr,e)}function jp(i,e){i.uniform2uiv(this.addr,e)}function Kp(i,e){i.uniform3uiv(this.addr,e)}function Zp(i,e){i.uniform4uiv(this.addr,e)}function $p(i,e,t){const n=this.cache,r=e.length,s=Zr(t,r);gt(n,s)||(i.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||Il,s[a])}function Jp(i,e,t){const n=this.cache,r=e.length,s=Zr(t,r);gt(n,s)||(i.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Fl,s[a])}function Qp(i,e,t){const n=this.cache,r=e.length,s=Zr(t,r);gt(n,s)||(i.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Ol,s[a])}function em(i,e,t){const n=this.cache,r=e.length,s=Zr(t,r);gt(n,s)||(i.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Nl,s[a])}function tm(i){switch(i){case 5126:return Fp;case 35664:return Op;case 35665:return Bp;case 35666:return zp;case 35674:return kp;case 35675:return Hp;case 35676:return Vp;case 5124:case 35670:return Gp;case 35667:case 35671:return Wp;case 35668:case 35672:return Xp;case 35669:case 35673:return qp;case 5125:return Yp;case 36294:return jp;case 36295:return Kp;case 36296:return Zp;case 35678:case 36198:case 36298:case 36306:case 35682:return $p;case 35679:case 36299:case 36307:return Jp;case 35680:case 36300:case 36308:case 36293:return Qp;case 36289:case 36303:case 36311:case 36292:return em}}class nm{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Np(t.type)}}class im{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=tm(t.type)}}class rm{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const Ds=/(\w+)(\])?(\[|\.)?/g;function Oo(i,e){i.seq.push(e),i.map[e.id]=e}function sm(i,e,t){const n=i.name,r=n.length;for(Ds.lastIndex=0;;){const s=Ds.exec(n),a=Ds.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){Oo(t,c===void 0?new nm(o,i,e):new im(o,i,e));break}else{let u=t.map[o];u===void 0&&(u=new rm(o),Oo(t,u)),t=u}}}class Or{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);sm(s,a,this)}}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function Bo(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const am=37297;let om=0;function lm(i,e){const t=i.split(`
3725
3725
  `),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
3726
- `)}const No=new qe;function rm(i){Qe._getMatrix(No,Qe.workingColorSpace,i);const e=`mat3( ${No.elements.map(t=>t.toFixed(4))} )`;switch(Qe.getTransfer(i)){case Br:return[e,"LinearTransferOETF"];case st:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function Fo(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`
3726
+ `)}const zo=new qe;function cm(i){Qe._getMatrix(zo,Qe.workingColorSpace,i);const e=`mat3( ${zo.elements.map(t=>t.toFixed(4))} )`;switch(Qe.getTransfer(i)){case Hr:return[e,"LinearTransferOETF"];case rt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function ko(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`
3727
3727
 
3728
3728
  `+r+`
3729
3729
 
3730
- `+im(i.getShaderSource(e),a)}else return r}function sm(i,e){const t=rm(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
3731
- `)}function am(i,e){let t;switch(e){case th:t="Linear";break;case nh:t="Reinhard";break;case ih:t="Cineon";break;case rh:t="ACESFilmic";break;case ah:t="AgX";break;case oh:t="Neutral";break;case sh:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const br=new N;function om(){Qe.getLuminanceCoefficients(br);const i=br.x.toFixed(4),e=br.y.toFixed(4),t=br.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
3732
- `)}function lm(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Gi).join(`
3733
- `)}function cm(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
3734
- `)}function hm(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function Gi(i){return i!==""}function Oo(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.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,t).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 Bo(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const um=/^[ \t]*#include +<([\w\d./]+)>/gm;function ga(i){return i.replace(um,dm)}const fm=new Map;function dm(i,e){let t=je[e];if(t===void 0){const n=fm.get(e);if(n!==void 0)t=je[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return ga(t)}const pm=/#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 zo(i){return i.replace(pm,mm)}function mm(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function ko(i){let e=`precision ${i.precision} float;
3730
+ `+lm(i.getShaderSource(e),a)}else return r}function hm(i,e){const t=cm(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
3731
+ `)}function um(i,e){let t;switch(e){case ah:t="Linear";break;case oh:t="Reinhard";break;case lh:t="Cineon";break;case ch:t="ACESFilmic";break;case uh:t="AgX";break;case fh:t="Neutral";break;case hh:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const wr=new N;function fm(){Qe.getLuminanceCoefficients(wr);const i=wr.x.toFixed(4),e=wr.y.toFixed(4),t=wr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
3732
+ `)}function dm(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Xi).join(`
3733
+ `)}function pm(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
3734
+ `)}function mm(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function Xi(i){return i!==""}function Ho(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.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,t).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 Vo(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const _m=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ma(i){return i.replace(_m,vm)}const gm=new Map;function vm(i,e){let t=je[e];if(t===void 0){const n=gm.get(e);if(n!==void 0)t=je[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Ma(t)}const xm=/#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 Go(i){return i.replace(xm,Mm)}function Mm(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Wo(i){let e=`precision ${i.precision} float;
3735
3735
  precision ${i.precision} int;
3736
3736
  precision ${i.precision} sampler2D;
3737
3737
  precision ${i.precision} samplerCube;
@@ -3751,30 +3751,30 @@ void main() {
3751
3751
  `;return i.precision==="highp"?e+=`
3752
3752
  #define HIGH_PRECISION`:i.precision==="mediump"?e+=`
3753
3753
  #define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
3754
- #define LOW_PRECISION`),e}function _m(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===tl?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===Ic?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===pn&&(e="SHADOWMAP_TYPE_VSM"),e}function gm(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case Si:case yi:e="ENVMAP_TYPE_CUBE";break;case Wr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function vm(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case yi:e="ENVMAP_MODE_REFRACTION";break}return e}function xm(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case ya:e="ENVMAP_BLENDING_MULTIPLY";break;case Qc:e="ENVMAP_BLENDING_MIX";break;case eh:e="ENVMAP_BLENDING_ADD";break}return e}function Mm(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function Sm(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=_m(t),c=gm(t),h=vm(t),u=xm(t),d=Mm(t),p=lm(t),_=cm(s),v=r.createProgram();let m,f,b=t.glslVersion?"#version "+t.glslVersion+`
3755
- `:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Gi).join(`
3754
+ #define LOW_PRECISION`),e}function Sm(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===sl?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===zc?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===dn&&(e="SHADOWMAP_TYPE_VSM"),e}function ym(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case yi:case Ei:e="ENVMAP_TYPE_CUBE";break;case Yr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Em(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case Ei:e="ENVMAP_MODE_REFRACTION";break}return e}function Tm(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case ba:e="ENVMAP_BLENDING_MULTIPLY";break;case rh:e="ENVMAP_BLENDING_MIX";break;case sh:e="ENVMAP_BLENDING_ADD";break}return e}function bm(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function Am(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Sm(t),c=ym(t),h=Em(t),u=Tm(t),d=bm(t),p=dm(t),_=pm(s),v=r.createProgram();let m,f,b=t.glslVersion?"#version "+t.glslVersion+`
3755
+ `:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Xi).join(`
3756
3756
  `),m.length>0&&(m+=`
3757
- `),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Gi).join(`
3757
+ `),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Xi).join(`
3758
3758
  `),f.length>0&&(f+=`
3759
- `)):(m=[ko(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
3760
- `].filter(Gi).join(`
3761
- `),f=[ko(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ln?"#define TONE_MAPPING":"",t.toneMapping!==Ln?je.tonemapping_pars_fragment:"",t.toneMapping!==Ln?am("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",je.colorspace_pars_fragment,sm("linearToOutputTexel",t.outputColorSpace),om(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3762
- `].filter(Gi).join(`
3763
- `)),a=ga(a),a=Oo(a,t),a=Bo(a,t),o=ga(o),o=Oo(o,t),o=Bo(o,t),a=zo(a),o=zo(o),t.isRawShaderMaterial!==!0&&(b=`#version 300 es
3759
+ `)):(m=[Wo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
3760
+ `].filter(Xi).join(`
3761
+ `),f=[Wo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ln?"#define TONE_MAPPING":"",t.toneMapping!==Ln?je.tonemapping_pars_fragment:"",t.toneMapping!==Ln?um("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",je.colorspace_pars_fragment,hm("linearToOutputTexel",t.outputColorSpace),fm(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3762
+ `].filter(Xi).join(`
3763
+ `)),a=Ma(a),a=Ho(a,t),a=Vo(a,t),o=Ma(o),o=Ho(o,t),o=Vo(o,t),a=Go(a),o=Go(o),t.isRawShaderMaterial!==!0&&(b=`#version 300 es
3764
3764
  `,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3765
3765
  `)+`
3766
- `+m,f=["#define varying in",t.glslVersion===Wa?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Wa?"":"#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(`
3766
+ `+m,f=["#define varying in",t.glslVersion===ja?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===ja?"":"#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(`
3767
3767
  `)+`
3768
- `+f);const E=b+m+a,S=b+f+o,L=Io(r,r.VERTEX_SHADER,E),w=Io(r,r.FRAGMENT_SHADER,S);r.attachShader(v,L),r.attachShader(v,w),t.index0AttributeName!==void 0?r.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v);function C(R){if(i.debug.checkShaderErrors){const H=r.getProgramInfoLog(v).trim(),B=r.getShaderInfoLog(L).trim(),j=r.getShaderInfoLog(w).trim();let J=!0,W=!0;if(r.getProgramParameter(v,r.LINK_STATUS)===!1)if(J=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,v,L,w);else{const ne=Fo(r,L,"vertex"),G=Fo(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(v,r.VALIDATE_STATUS)+`
3768
+ `+f);const E=b+m+a,S=b+f+o,D=Bo(r,r.VERTEX_SHADER,E),w=Bo(r,r.FRAGMENT_SHADER,S);r.attachShader(v,D),r.attachShader(v,w),t.index0AttributeName!==void 0?r.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v);function R(C){if(i.debug.checkShaderErrors){const H=r.getProgramInfoLog(v).trim(),B=r.getShaderInfoLog(D).trim(),j=r.getShaderInfoLog(w).trim();let J=!0,W=!0;if(r.getProgramParameter(v,r.LINK_STATUS)===!1)if(J=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,v,D,w);else{const ne=ko(r,D,"vertex"),G=ko(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(v,r.VALIDATE_STATUS)+`
3769
3769
 
3770
- Material Name: `+R.name+`
3771
- Material Type: `+R.type+`
3770
+ Material Name: `+C.name+`
3771
+ Material Type: `+C.type+`
3772
3772
 
3773
3773
  Program Info Log: `+H+`
3774
3774
  `+ne+`
3775
- `+G)}else H!==""?console.warn("THREE.WebGLProgram: Program Info Log:",H):(B===""||j==="")&&(W=!1);W&&(R.diagnostics={runnable:J,programLog:H,vertexShader:{log:B,prefix:m},fragmentShader:{log:j,prefix:f}})}r.deleteShader(L),r.deleteShader(w),P=new Nr(r,v),y=hm(r,v)}let P;this.getUniforms=function(){return P===void 0&&C(this),P};let y;this.getAttributes=function(){return y===void 0&&C(this),y};let x=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return x===!1&&(x=r.getProgramParameter(v,tm)),x},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=nm++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=L,this.fragmentShader=w,this}let ym=0;class Em{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Tm(e),t.set(e,n)),n}}class Tm{constructor(e){this.id=ym++,this.code=e,this.usedTimes=0}}function bm(i,e,t,n,r,s,a){const o=new ml,l=new Em,c=new Set,h=[],u=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.precision;const _={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"};function v(y){return c.add(y),y===0?"uv":`uv${y}`}function m(y,x,R,H,B){const j=H.fog,J=B.geometry,W=y.isMeshStandardMaterial?H.environment:null,ne=(y.isMeshStandardMaterial?t:e).get(y.envMap||W),G=ne&&ne.mapping===Wr?ne.image.height:null,fe=_[y.type];y.precision!==null&&(p=r.getMaxPrecision(y.precision),p!==y.precision&&console.warn("THREE.WebGLProgram.getParameters:",y.precision,"not supported, using",p,"instead."));const xe=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,se=xe!==void 0?xe.length:0;let We=0;J.morphAttributes.position!==void 0&&(We=1),J.morphAttributes.normal!==void 0&&(We=2),J.morphAttributes.color!==void 0&&(We=3);let Ze,Y,le,Pe;if(fe){const et=nn[fe];Ze=et.vertexShader,Y=et.fragmentShader}else Ze=y.vertexShader,Y=y.fragmentShader,l.update(y),le=l.getVertexShaderID(y),Pe=l.getFragmentShaderID(y);const ve=i.getRenderTarget(),Ue=i.state.buffers.depth.getReversed(),Z=B.isInstancedMesh===!0,Q=B.isBatchedMesh===!0,de=!!y.map,Se=!!y.matcap,oe=!!ne,A=!!y.aoMap,ae=!!y.lightMap,Re=!!y.bumpMap,Ye=!!y.normalMap,ie=!!y.displacementMap,Fe=!!y.emissiveMap,Ee=!!y.metalnessMap,Ve=!!y.roughnessMap,lt=y.anisotropy>0,T=y.clearcoat>0,g=y.dispersion>0,F=y.iridescence>0,q=y.sheen>0,K=y.transmission>0,V=lt&&!!y.anisotropyMap,De=T&&!!y.clearcoatMap,he=T&&!!y.clearcoatNormalMap,be=T&&!!y.clearcoatRoughnessMap,Le=F&&!!y.iridescenceMap,ee=F&&!!y.iridescenceThicknessMap,Me=q&&!!y.sheenColorMap,Oe=q&&!!y.sheenRoughnessMap,Ne=!!y.specularMap,ce=!!y.specularColorMap,ke=!!y.specularIntensityMap,D=K&&!!y.transmissionMap,pe=K&&!!y.thicknessMap,te=!!y.gradientMap,ye=!!y.alphaMap,O=y.alphaTest>0,X=!!y.alphaHash,ue=!!y.extensions;let Be=Ln;y.toneMapped&&(ve===null||ve.isXRRenderTarget===!0)&&(Be=i.toneMapping);const ot={shaderID:fe,shaderType:y.type,shaderName:y.name,vertexShader:Ze,fragmentShader:Y,defines:y.defines,customVertexShaderID:le,customFragmentShaderID:Pe,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:p,batching:Q,batchingColor:Q&&B._colorsTexture!==null,instancing:Z,instancingColor:Z&&B.instanceColor!==null,instancingMorph:Z&&B.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:ve===null?i.outputColorSpace:ve.isXRRenderTarget===!0?ve.texture.colorSpace:Ei,alphaToCoverage:!!y.alphaToCoverage,map:de,matcap:Se,envMap:oe,envMapMode:oe&&ne.mapping,envMapCubeUVHeight:G,aoMap:A,lightMap:ae,bumpMap:Re,normalMap:Ye,displacementMap:d&&ie,emissiveMap:Fe,normalMapObjectSpace:Ye&&y.normalMapType===uh,normalMapTangentSpace:Ye&&y.normalMapType===ul,metalnessMap:Ee,roughnessMap:Ve,anisotropy:lt,anisotropyMap:V,clearcoat:T,clearcoatMap:De,clearcoatNormalMap:he,clearcoatRoughnessMap:be,dispersion:g,iridescence:F,iridescenceMap:Le,iridescenceThicknessMap:ee,sheen:q,sheenColorMap:Me,sheenRoughnessMap:Oe,specularMap:Ne,specularColorMap:ce,specularIntensityMap:ke,transmission:K,transmissionMap:D,thicknessMap:pe,gradientMap:te,opaque:y.transparent===!1&&y.blending===gi&&y.alphaToCoverage===!1,alphaMap:ye,alphaTest:O,alphaHash:X,combine:y.combine,mapUv:de&&v(y.map.channel),aoMapUv:A&&v(y.aoMap.channel),lightMapUv:ae&&v(y.lightMap.channel),bumpMapUv:Re&&v(y.bumpMap.channel),normalMapUv:Ye&&v(y.normalMap.channel),displacementMapUv:ie&&v(y.displacementMap.channel),emissiveMapUv:Fe&&v(y.emissiveMap.channel),metalnessMapUv:Ee&&v(y.metalnessMap.channel),roughnessMapUv:Ve&&v(y.roughnessMap.channel),anisotropyMapUv:V&&v(y.anisotropyMap.channel),clearcoatMapUv:De&&v(y.clearcoatMap.channel),clearcoatNormalMapUv:he&&v(y.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:be&&v(y.clearcoatRoughnessMap.channel),iridescenceMapUv:Le&&v(y.iridescenceMap.channel),iridescenceThicknessMapUv:ee&&v(y.iridescenceThicknessMap.channel),sheenColorMapUv:Me&&v(y.sheenColorMap.channel),sheenRoughnessMapUv:Oe&&v(y.sheenRoughnessMap.channel),specularMapUv:Ne&&v(y.specularMap.channel),specularColorMapUv:ce&&v(y.specularColorMap.channel),specularIntensityMapUv:ke&&v(y.specularIntensityMap.channel),transmissionMapUv:D&&v(y.transmissionMap.channel),thicknessMapUv:pe&&v(y.thicknessMap.channel),alphaMapUv:ye&&v(y.alphaMap.channel),vertexTangents:!!J.attributes.tangent&&(Ye||lt),vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!J.attributes.uv&&(de||ye),fog:!!j,useFog:y.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:y.flatShading===!0,sizeAttenuation:y.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:Ue,skinning:B.isSkinnedMesh===!0,morphTargets:J.morphAttributes.position!==void 0,morphNormals:J.morphAttributes.normal!==void 0,morphColors:J.morphAttributes.color!==void 0,morphTargetsCount:se,morphTextureStride:We,numDirLights:x.directional.length,numPointLights:x.point.length,numSpotLights:x.spot.length,numSpotLightMaps:x.spotLightMap.length,numRectAreaLights:x.rectArea.length,numHemiLights:x.hemi.length,numDirLightShadows:x.directionalShadowMap.length,numPointLightShadows:x.pointShadowMap.length,numSpotLightShadows:x.spotShadowMap.length,numSpotLightShadowsWithMaps:x.numSpotLightShadowsWithMaps,numLightProbes:x.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:y.dithering,shadowMapEnabled:i.shadowMap.enabled&&R.length>0,shadowMapType:i.shadowMap.type,toneMapping:Be,decodeVideoTexture:de&&y.map.isVideoTexture===!0&&Qe.getTransfer(y.map.colorSpace)===st,decodeVideoTextureEmissive:Fe&&y.emissiveMap.isVideoTexture===!0&&Qe.getTransfer(y.emissiveMap.colorSpace)===st,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===_n,flipSided:y.side===It,useDepthPacking:y.depthPacking>=0,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionClipCullDistance:ue&&y.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ue&&y.extensions.multiDraw===!0||Q)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:y.customProgramCacheKey()};return ot.vertexUv1s=c.has(1),ot.vertexUv2s=c.has(2),ot.vertexUv3s=c.has(3),c.clear(),ot}function f(y){const x=[];if(y.shaderID?x.push(y.shaderID):(x.push(y.customVertexShaderID),x.push(y.customFragmentShaderID)),y.defines!==void 0)for(const R in y.defines)x.push(R),x.push(y.defines[R]);return y.isRawShaderMaterial===!1&&(b(x,y),E(x,y),x.push(i.outputColorSpace)),x.push(y.customProgramCacheKey),x.join()}function b(y,x){y.push(x.precision),y.push(x.outputColorSpace),y.push(x.envMapMode),y.push(x.envMapCubeUVHeight),y.push(x.mapUv),y.push(x.alphaMapUv),y.push(x.lightMapUv),y.push(x.aoMapUv),y.push(x.bumpMapUv),y.push(x.normalMapUv),y.push(x.displacementMapUv),y.push(x.emissiveMapUv),y.push(x.metalnessMapUv),y.push(x.roughnessMapUv),y.push(x.anisotropyMapUv),y.push(x.clearcoatMapUv),y.push(x.clearcoatNormalMapUv),y.push(x.clearcoatRoughnessMapUv),y.push(x.iridescenceMapUv),y.push(x.iridescenceThicknessMapUv),y.push(x.sheenColorMapUv),y.push(x.sheenRoughnessMapUv),y.push(x.specularMapUv),y.push(x.specularColorMapUv),y.push(x.specularIntensityMapUv),y.push(x.transmissionMapUv),y.push(x.thicknessMapUv),y.push(x.combine),y.push(x.fogExp2),y.push(x.sizeAttenuation),y.push(x.morphTargetsCount),y.push(x.morphAttributeCount),y.push(x.numDirLights),y.push(x.numPointLights),y.push(x.numSpotLights),y.push(x.numSpotLightMaps),y.push(x.numHemiLights),y.push(x.numRectAreaLights),y.push(x.numDirLightShadows),y.push(x.numPointLightShadows),y.push(x.numSpotLightShadows),y.push(x.numSpotLightShadowsWithMaps),y.push(x.numLightProbes),y.push(x.shadowMapType),y.push(x.toneMapping),y.push(x.numClippingPlanes),y.push(x.numClipIntersection),y.push(x.depthPacking)}function E(y,x){o.disableAll(),x.supportsVertexTextures&&o.enable(0),x.instancing&&o.enable(1),x.instancingColor&&o.enable(2),x.instancingMorph&&o.enable(3),x.matcap&&o.enable(4),x.envMap&&o.enable(5),x.normalMapObjectSpace&&o.enable(6),x.normalMapTangentSpace&&o.enable(7),x.clearcoat&&o.enable(8),x.iridescence&&o.enable(9),x.alphaTest&&o.enable(10),x.vertexColors&&o.enable(11),x.vertexAlphas&&o.enable(12),x.vertexUv1s&&o.enable(13),x.vertexUv2s&&o.enable(14),x.vertexUv3s&&o.enable(15),x.vertexTangents&&o.enable(16),x.anisotropy&&o.enable(17),x.alphaHash&&o.enable(18),x.batching&&o.enable(19),x.dispersion&&o.enable(20),x.batchingColor&&o.enable(21),y.push(o.mask),o.disableAll(),x.fog&&o.enable(0),x.useFog&&o.enable(1),x.flatShading&&o.enable(2),x.logarithmicDepthBuffer&&o.enable(3),x.reverseDepthBuffer&&o.enable(4),x.skinning&&o.enable(5),x.morphTargets&&o.enable(6),x.morphNormals&&o.enable(7),x.morphColors&&o.enable(8),x.premultipliedAlpha&&o.enable(9),x.shadowMapEnabled&&o.enable(10),x.doubleSided&&o.enable(11),x.flipSided&&o.enable(12),x.useDepthPacking&&o.enable(13),x.dithering&&o.enable(14),x.transmission&&o.enable(15),x.sheen&&o.enable(16),x.opaque&&o.enable(17),x.pointsUvs&&o.enable(18),x.decodeVideoTexture&&o.enable(19),x.decodeVideoTextureEmissive&&o.enable(20),x.alphaToCoverage&&o.enable(21),y.push(o.mask)}function S(y){const x=_[y.type];let R;if(x){const H=nn[x];R=Gh.clone(H.uniforms)}else R=y.uniforms;return R}function L(y,x){let R;for(let H=0,B=h.length;H<B;H++){const j=h[H];if(j.cacheKey===x){R=j,++R.usedTimes;break}}return R===void 0&&(R=new Sm(i,x,y,s),h.push(R)),R}function w(y){if(--y.usedTimes===0){const x=h.indexOf(y);h[x]=h[h.length-1],h.pop(),y.destroy()}}function C(y){l.remove(y)}function P(){l.dispose()}return{getParameters:m,getProgramCacheKey:f,getUniforms:S,acquireProgram:L,releaseProgram:w,releaseShaderCache:C,programs:h,dispose:P}}function Am(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function r(a,o,l){i.get(a)[o]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function wm(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function Ho(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Vo(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(u,d,p,_,v,m){let f=i[e];return f===void 0?(f={id:u.id,object:u,geometry:d,material:p,groupOrder:_,renderOrder:u.renderOrder,z:v,group:m},i[e]=f):(f.id=u.id,f.object=u,f.geometry=d,f.material=p,f.groupOrder=_,f.renderOrder=u.renderOrder,f.z=v,f.group=m),e++,f}function o(u,d,p,_,v,m){const f=a(u,d,p,_,v,m);p.transmission>0?n.push(f):p.transparent===!0?r.push(f):t.push(f)}function l(u,d,p,_,v,m){const f=a(u,d,p,_,v,m);p.transmission>0?n.unshift(f):p.transparent===!0?r.unshift(f):t.unshift(f)}function c(u,d){t.length>1&&t.sort(u||wm),n.length>1&&n.sort(d||Ho),r.length>1&&r.sort(d||Ho)}function h(){for(let u=e,d=i.length;u<d;u++){const p=i[u];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:h,sort:c}}function Rm(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Vo,i.set(n,[a])):r>=s.length?(a=new Vo,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Cm(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new N,color:new Ke};break;case"SpotLight":t={position:new N,direction:new N,color:new Ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new N,color:new Ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new N,skyColor:new Ke,groundColor:new Ke};break;case"RectAreaLight":t={color:new Ke,position:new N,halfWidth:new N,halfHeight:new N};break}return i[e.id]=t,t}}}function Pm(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xe,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Dm=0;function Lm(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Um(i){const e=new Cm,t=Pm(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-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,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new N);const r=new N,s=new ht,a=new ht;function o(c){let h=0,u=0,d=0;for(let y=0;y<9;y++)n.probe[y].set(0,0,0);let p=0,_=0,v=0,m=0,f=0,b=0,E=0,S=0,L=0,w=0,C=0;c.sort(Lm);for(let y=0,x=c.length;y<x;y++){const R=c[y],H=R.color,B=R.intensity,j=R.distance,J=R.shadow&&R.shadow.map?R.shadow.map.texture:null;if(R.isAmbientLight)h+=H.r*B,u+=H.g*B,d+=H.b*B;else if(R.isLightProbe){for(let W=0;W<9;W++)n.probe[W].addScaledVector(R.sh.coefficients[W],B);C++}else if(R.isDirectionalLight){const W=e.get(R);if(W.color.copy(R.color).multiplyScalar(R.intensity),R.castShadow){const ne=R.shadow,G=t.get(R);G.shadowIntensity=ne.intensity,G.shadowBias=ne.bias,G.shadowNormalBias=ne.normalBias,G.shadowRadius=ne.radius,G.shadowMapSize=ne.mapSize,n.directionalShadow[p]=G,n.directionalShadowMap[p]=J,n.directionalShadowMatrix[p]=R.shadow.matrix,b++}n.directional[p]=W,p++}else if(R.isSpotLight){const W=e.get(R);W.position.setFromMatrixPosition(R.matrixWorld),W.color.copy(H).multiplyScalar(B),W.distance=j,W.coneCos=Math.cos(R.angle),W.penumbraCos=Math.cos(R.angle*(1-R.penumbra)),W.decay=R.decay,n.spot[v]=W;const ne=R.shadow;if(R.map&&(n.spotLightMap[L]=R.map,L++,ne.updateMatrices(R),R.castShadow&&w++),n.spotLightMatrix[v]=ne.matrix,R.castShadow){const G=t.get(R);G.shadowIntensity=ne.intensity,G.shadowBias=ne.bias,G.shadowNormalBias=ne.normalBias,G.shadowRadius=ne.radius,G.shadowMapSize=ne.mapSize,n.spotShadow[v]=G,n.spotShadowMap[v]=J,S++}v++}else if(R.isRectAreaLight){const W=e.get(R);W.color.copy(H).multiplyScalar(B),W.halfWidth.set(R.width*.5,0,0),W.halfHeight.set(0,R.height*.5,0),n.rectArea[m]=W,m++}else if(R.isPointLight){const W=e.get(R);if(W.color.copy(R.color).multiplyScalar(R.intensity),W.distance=R.distance,W.decay=R.decay,R.castShadow){const ne=R.shadow,G=t.get(R);G.shadowIntensity=ne.intensity,G.shadowBias=ne.bias,G.shadowNormalBias=ne.normalBias,G.shadowRadius=ne.radius,G.shadowMapSize=ne.mapSize,G.shadowCameraNear=ne.camera.near,G.shadowCameraFar=ne.camera.far,n.pointShadow[_]=G,n.pointShadowMap[_]=J,n.pointShadowMatrix[_]=R.shadow.matrix,E++}n.point[_]=W,_++}else if(R.isHemisphereLight){const W=e.get(R);W.skyColor.copy(R.color).multiplyScalar(B),W.groundColor.copy(R.groundColor).multiplyScalar(B),n.hemi[f]=W,f++}}m>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=me.LTC_FLOAT_1,n.rectAreaLTC2=me.LTC_FLOAT_2):(n.rectAreaLTC1=me.LTC_HALF_1,n.rectAreaLTC2=me.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;const P=n.hash;(P.directionalLength!==p||P.pointLength!==_||P.spotLength!==v||P.rectAreaLength!==m||P.hemiLength!==f||P.numDirectionalShadows!==b||P.numPointShadows!==E||P.numSpotShadows!==S||P.numSpotMaps!==L||P.numLightProbes!==C)&&(n.directional.length=p,n.spot.length=v,n.rectArea.length=m,n.point.length=_,n.hemi.length=f,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=S,n.spotShadowMap.length=S,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=S+L-w,n.spotLightMap.length=L,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=C,P.directionalLength=p,P.pointLength=_,P.spotLength=v,P.rectAreaLength=m,P.hemiLength=f,P.numDirectionalShadows=b,P.numPointShadows=E,P.numSpotShadows=S,P.numSpotMaps=L,P.numLightProbes=C,n.version=Dm++)}function l(c,h){let u=0,d=0,p=0,_=0,v=0;const m=h.matrixWorldInverse;for(let f=0,b=c.length;f<b;f++){const E=c[f];if(E.isDirectionalLight){const S=n.directional[u];S.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),S.direction.sub(r),S.direction.transformDirection(m),u++}else if(E.isSpotLight){const S=n.spot[p];S.position.setFromMatrixPosition(E.matrixWorld),S.position.applyMatrix4(m),S.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),S.direction.sub(r),S.direction.transformDirection(m),p++}else if(E.isRectAreaLight){const S=n.rectArea[_];S.position.setFromMatrixPosition(E.matrixWorld),S.position.applyMatrix4(m),a.identity(),s.copy(E.matrixWorld),s.premultiply(m),a.extractRotation(s),S.halfWidth.set(E.width*.5,0,0),S.halfHeight.set(0,E.height*.5,0),S.halfWidth.applyMatrix4(a),S.halfHeight.applyMatrix4(a),_++}else if(E.isPointLight){const S=n.point[d];S.position.setFromMatrixPosition(E.matrixWorld),S.position.applyMatrix4(m),d++}else if(E.isHemisphereLight){const S=n.hemi[v];S.direction.setFromMatrixPosition(E.matrixWorld),S.direction.transformDirection(m),v++}}}return{setup:o,setupView:l,state:n}}function Go(i){const e=new Um(i),t=[],n=[];function r(h){c.camera=h,t.length=0,n.length=0}function s(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function l(h){e.setupView(t,h)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function Im(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Go(i),e.set(r,[o])):s>=a.length?(o=new Go(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const Nm=`void main() {
3775
+ `+G)}else H!==""?console.warn("THREE.WebGLProgram: Program Info Log:",H):(B===""||j==="")&&(W=!1);W&&(C.diagnostics={runnable:J,programLog:H,vertexShader:{log:B,prefix:m},fragmentShader:{log:j,prefix:f}})}r.deleteShader(D),r.deleteShader(w),L=new Or(r,v),y=mm(r,v)}let L;this.getUniforms=function(){return L===void 0&&R(this),L};let y;this.getAttributes=function(){return y===void 0&&R(this),y};let x=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return x===!1&&(x=r.getProgramParameter(v,am)),x},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=om++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=D,this.fragmentShader=w,this}let wm=0;class Rm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Cm(e),t.set(e,n)),n}}class Cm{constructor(e){this.id=wm++,this.code=e,this.usedTimes=0}}function Pm(i,e,t,n,r,s,a){const o=new xl,l=new Rm,c=new Set,h=[],u=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.precision;const _={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"};function v(y){return c.add(y),y===0?"uv":`uv${y}`}function m(y,x,C,H,B){const j=H.fog,J=B.geometry,W=y.isMeshStandardMaterial?H.environment:null,ne=(y.isMeshStandardMaterial?t:e).get(y.envMap||W),G=ne&&ne.mapping===Yr?ne.image.height:null,fe=_[y.type];y.precision!==null&&(p=r.getMaxPrecision(y.precision),p!==y.precision&&console.warn("THREE.WebGLProgram.getParameters:",y.precision,"not supported, using",p,"instead."));const xe=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,se=xe!==void 0?xe.length:0;let We=0;J.morphAttributes.position!==void 0&&(We=1),J.morphAttributes.normal!==void 0&&(We=2),J.morphAttributes.color!==void 0&&(We=3);let Ze,Y,le,Pe;if(fe){const et=tn[fe];Ze=et.vertexShader,Y=et.fragmentShader}else Ze=y.vertexShader,Y=y.fragmentShader,l.update(y),le=l.getVertexShaderID(y),Pe=l.getFragmentShaderID(y);const ve=i.getRenderTarget(),Ue=i.state.buffers.depth.getReversed(),Z=B.isInstancedMesh===!0,Q=B.isBatchedMesh===!0,de=!!y.map,Se=!!y.matcap,oe=!!ne,A=!!y.aoMap,ae=!!y.lightMap,Re=!!y.bumpMap,Ye=!!y.normalMap,ie=!!y.displacementMap,Fe=!!y.emissiveMap,Ee=!!y.metalnessMap,Ve=!!y.roughnessMap,lt=y.anisotropy>0,T=y.clearcoat>0,g=y.dispersion>0,F=y.iridescence>0,q=y.sheen>0,K=y.transmission>0,V=lt&&!!y.anisotropyMap,De=T&&!!y.clearcoatMap,he=T&&!!y.clearcoatNormalMap,Ae=T&&!!y.clearcoatRoughnessMap,Le=F&&!!y.iridescenceMap,ee=F&&!!y.iridescenceThicknessMap,Me=q&&!!y.sheenColorMap,Oe=q&&!!y.sheenRoughnessMap,Ne=!!y.specularMap,ce=!!y.specularColorMap,ke=!!y.specularIntensityMap,P=K&&!!y.transmissionMap,pe=K&&!!y.thicknessMap,te=!!y.gradientMap,ye=!!y.alphaMap,O=y.alphaTest>0,X=!!y.alphaHash,ue=!!y.extensions;let Be=Ln;y.toneMapped&&(ve===null||ve.isXRRenderTarget===!0)&&(Be=i.toneMapping);const at={shaderID:fe,shaderType:y.type,shaderName:y.name,vertexShader:Ze,fragmentShader:Y,defines:y.defines,customVertexShaderID:le,customFragmentShaderID:Pe,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:p,batching:Q,batchingColor:Q&&B._colorsTexture!==null,instancing:Z,instancingColor:Z&&B.instanceColor!==null,instancingMorph:Z&&B.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:ve===null?i.outputColorSpace:ve.isXRRenderTarget===!0?ve.texture.colorSpace:Ti,alphaToCoverage:!!y.alphaToCoverage,map:de,matcap:Se,envMap:oe,envMapMode:oe&&ne.mapping,envMapCubeUVHeight:G,aoMap:A,lightMap:ae,bumpMap:Re,normalMap:Ye,displacementMap:d&&ie,emissiveMap:Fe,normalMapObjectSpace:Ye&&y.normalMapType===_h,normalMapTangentSpace:Ye&&y.normalMapType===ml,metalnessMap:Ee,roughnessMap:Ve,anisotropy:lt,anisotropyMap:V,clearcoat:T,clearcoatMap:De,clearcoatNormalMap:he,clearcoatRoughnessMap:Ae,dispersion:g,iridescence:F,iridescenceMap:Le,iridescenceThicknessMap:ee,sheen:q,sheenColorMap:Me,sheenRoughnessMap:Oe,specularMap:Ne,specularColorMap:ce,specularIntensityMap:ke,transmission:K,transmissionMap:P,thicknessMap:pe,gradientMap:te,opaque:y.transparent===!1&&y.blending===vi&&y.alphaToCoverage===!1,alphaMap:ye,alphaTest:O,alphaHash:X,combine:y.combine,mapUv:de&&v(y.map.channel),aoMapUv:A&&v(y.aoMap.channel),lightMapUv:ae&&v(y.lightMap.channel),bumpMapUv:Re&&v(y.bumpMap.channel),normalMapUv:Ye&&v(y.normalMap.channel),displacementMapUv:ie&&v(y.displacementMap.channel),emissiveMapUv:Fe&&v(y.emissiveMap.channel),metalnessMapUv:Ee&&v(y.metalnessMap.channel),roughnessMapUv:Ve&&v(y.roughnessMap.channel),anisotropyMapUv:V&&v(y.anisotropyMap.channel),clearcoatMapUv:De&&v(y.clearcoatMap.channel),clearcoatNormalMapUv:he&&v(y.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ae&&v(y.clearcoatRoughnessMap.channel),iridescenceMapUv:Le&&v(y.iridescenceMap.channel),iridescenceThicknessMapUv:ee&&v(y.iridescenceThicknessMap.channel),sheenColorMapUv:Me&&v(y.sheenColorMap.channel),sheenRoughnessMapUv:Oe&&v(y.sheenRoughnessMap.channel),specularMapUv:Ne&&v(y.specularMap.channel),specularColorMapUv:ce&&v(y.specularColorMap.channel),specularIntensityMapUv:ke&&v(y.specularIntensityMap.channel),transmissionMapUv:P&&v(y.transmissionMap.channel),thicknessMapUv:pe&&v(y.thicknessMap.channel),alphaMapUv:ye&&v(y.alphaMap.channel),vertexTangents:!!J.attributes.tangent&&(Ye||lt),vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!J.attributes.uv&&(de||ye),fog:!!j,useFog:y.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:y.flatShading===!0,sizeAttenuation:y.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:Ue,skinning:B.isSkinnedMesh===!0,morphTargets:J.morphAttributes.position!==void 0,morphNormals:J.morphAttributes.normal!==void 0,morphColors:J.morphAttributes.color!==void 0,morphTargetsCount:se,morphTextureStride:We,numDirLights:x.directional.length,numPointLights:x.point.length,numSpotLights:x.spot.length,numSpotLightMaps:x.spotLightMap.length,numRectAreaLights:x.rectArea.length,numHemiLights:x.hemi.length,numDirLightShadows:x.directionalShadowMap.length,numPointLightShadows:x.pointShadowMap.length,numSpotLightShadows:x.spotShadowMap.length,numSpotLightShadowsWithMaps:x.numSpotLightShadowsWithMaps,numLightProbes:x.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:y.dithering,shadowMapEnabled:i.shadowMap.enabled&&C.length>0,shadowMapType:i.shadowMap.type,toneMapping:Be,decodeVideoTexture:de&&y.map.isVideoTexture===!0&&Qe.getTransfer(y.map.colorSpace)===rt,decodeVideoTextureEmissive:Fe&&y.emissiveMap.isVideoTexture===!0&&Qe.getTransfer(y.emissiveMap.colorSpace)===rt,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===_n,flipSided:y.side===It,useDepthPacking:y.depthPacking>=0,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionClipCullDistance:ue&&y.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ue&&y.extensions.multiDraw===!0||Q)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:y.customProgramCacheKey()};return at.vertexUv1s=c.has(1),at.vertexUv2s=c.has(2),at.vertexUv3s=c.has(3),c.clear(),at}function f(y){const x=[];if(y.shaderID?x.push(y.shaderID):(x.push(y.customVertexShaderID),x.push(y.customFragmentShaderID)),y.defines!==void 0)for(const C in y.defines)x.push(C),x.push(y.defines[C]);return y.isRawShaderMaterial===!1&&(b(x,y),E(x,y),x.push(i.outputColorSpace)),x.push(y.customProgramCacheKey),x.join()}function b(y,x){y.push(x.precision),y.push(x.outputColorSpace),y.push(x.envMapMode),y.push(x.envMapCubeUVHeight),y.push(x.mapUv),y.push(x.alphaMapUv),y.push(x.lightMapUv),y.push(x.aoMapUv),y.push(x.bumpMapUv),y.push(x.normalMapUv),y.push(x.displacementMapUv),y.push(x.emissiveMapUv),y.push(x.metalnessMapUv),y.push(x.roughnessMapUv),y.push(x.anisotropyMapUv),y.push(x.clearcoatMapUv),y.push(x.clearcoatNormalMapUv),y.push(x.clearcoatRoughnessMapUv),y.push(x.iridescenceMapUv),y.push(x.iridescenceThicknessMapUv),y.push(x.sheenColorMapUv),y.push(x.sheenRoughnessMapUv),y.push(x.specularMapUv),y.push(x.specularColorMapUv),y.push(x.specularIntensityMapUv),y.push(x.transmissionMapUv),y.push(x.thicknessMapUv),y.push(x.combine),y.push(x.fogExp2),y.push(x.sizeAttenuation),y.push(x.morphTargetsCount),y.push(x.morphAttributeCount),y.push(x.numDirLights),y.push(x.numPointLights),y.push(x.numSpotLights),y.push(x.numSpotLightMaps),y.push(x.numHemiLights),y.push(x.numRectAreaLights),y.push(x.numDirLightShadows),y.push(x.numPointLightShadows),y.push(x.numSpotLightShadows),y.push(x.numSpotLightShadowsWithMaps),y.push(x.numLightProbes),y.push(x.shadowMapType),y.push(x.toneMapping),y.push(x.numClippingPlanes),y.push(x.numClipIntersection),y.push(x.depthPacking)}function E(y,x){o.disableAll(),x.supportsVertexTextures&&o.enable(0),x.instancing&&o.enable(1),x.instancingColor&&o.enable(2),x.instancingMorph&&o.enable(3),x.matcap&&o.enable(4),x.envMap&&o.enable(5),x.normalMapObjectSpace&&o.enable(6),x.normalMapTangentSpace&&o.enable(7),x.clearcoat&&o.enable(8),x.iridescence&&o.enable(9),x.alphaTest&&o.enable(10),x.vertexColors&&o.enable(11),x.vertexAlphas&&o.enable(12),x.vertexUv1s&&o.enable(13),x.vertexUv2s&&o.enable(14),x.vertexUv3s&&o.enable(15),x.vertexTangents&&o.enable(16),x.anisotropy&&o.enable(17),x.alphaHash&&o.enable(18),x.batching&&o.enable(19),x.dispersion&&o.enable(20),x.batchingColor&&o.enable(21),y.push(o.mask),o.disableAll(),x.fog&&o.enable(0),x.useFog&&o.enable(1),x.flatShading&&o.enable(2),x.logarithmicDepthBuffer&&o.enable(3),x.reverseDepthBuffer&&o.enable(4),x.skinning&&o.enable(5),x.morphTargets&&o.enable(6),x.morphNormals&&o.enable(7),x.morphColors&&o.enable(8),x.premultipliedAlpha&&o.enable(9),x.shadowMapEnabled&&o.enable(10),x.doubleSided&&o.enable(11),x.flipSided&&o.enable(12),x.useDepthPacking&&o.enable(13),x.dithering&&o.enable(14),x.transmission&&o.enable(15),x.sheen&&o.enable(16),x.opaque&&o.enable(17),x.pointsUvs&&o.enable(18),x.decodeVideoTexture&&o.enable(19),x.decodeVideoTextureEmissive&&o.enable(20),x.alphaToCoverage&&o.enable(21),y.push(o.mask)}function S(y){const x=_[y.type];let C;if(x){const H=tn[x];C=jh.clone(H.uniforms)}else C=y.uniforms;return C}function D(y,x){let C;for(let H=0,B=h.length;H<B;H++){const j=h[H];if(j.cacheKey===x){C=j,++C.usedTimes;break}}return C===void 0&&(C=new Am(i,x,y,s),h.push(C)),C}function w(y){if(--y.usedTimes===0){const x=h.indexOf(y);h[x]=h[h.length-1],h.pop(),y.destroy()}}function R(y){l.remove(y)}function L(){l.dispose()}return{getParameters:m,getProgramCacheKey:f,getUniforms:S,acquireProgram:D,releaseProgram:w,releaseShaderCache:R,programs:h,dispose:L}}function Dm(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function r(a,o,l){i.get(a)[o]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function Lm(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function Xo(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function qo(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(u,d,p,_,v,m){let f=i[e];return f===void 0?(f={id:u.id,object:u,geometry:d,material:p,groupOrder:_,renderOrder:u.renderOrder,z:v,group:m},i[e]=f):(f.id=u.id,f.object=u,f.geometry=d,f.material=p,f.groupOrder=_,f.renderOrder=u.renderOrder,f.z=v,f.group=m),e++,f}function o(u,d,p,_,v,m){const f=a(u,d,p,_,v,m);p.transmission>0?n.push(f):p.transparent===!0?r.push(f):t.push(f)}function l(u,d,p,_,v,m){const f=a(u,d,p,_,v,m);p.transmission>0?n.unshift(f):p.transparent===!0?r.unshift(f):t.unshift(f)}function c(u,d){t.length>1&&t.sort(u||Lm),n.length>1&&n.sort(d||Xo),r.length>1&&r.sort(d||Xo)}function h(){for(let u=e,d=i.length;u<d;u++){const p=i[u];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:h,sort:c}}function Um(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new qo,i.set(n,[a])):r>=s.length?(a=new qo,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Im(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new N,color:new Ke};break;case"SpotLight":t={position:new N,direction:new N,color:new Ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new N,color:new Ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new N,skyColor:new Ke,groundColor:new Ke};break;case"RectAreaLight":t={color:new Ke,position:new N,halfWidth:new N,halfHeight:new N};break}return i[e.id]=t,t}}}function Nm(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xe,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Fm=0;function Om(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Bm(i){const e=new Im,t=Nm(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-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,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new N);const r=new N,s=new ht,a=new ht;function o(c){let h=0,u=0,d=0;for(let y=0;y<9;y++)n.probe[y].set(0,0,0);let p=0,_=0,v=0,m=0,f=0,b=0,E=0,S=0,D=0,w=0,R=0;c.sort(Om);for(let y=0,x=c.length;y<x;y++){const C=c[y],H=C.color,B=C.intensity,j=C.distance,J=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)h+=H.r*B,u+=H.g*B,d+=H.b*B;else if(C.isLightProbe){for(let W=0;W<9;W++)n.probe[W].addScaledVector(C.sh.coefficients[W],B);R++}else if(C.isDirectionalLight){const W=e.get(C);if(W.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){const ne=C.shadow,G=t.get(C);G.shadowIntensity=ne.intensity,G.shadowBias=ne.bias,G.shadowNormalBias=ne.normalBias,G.shadowRadius=ne.radius,G.shadowMapSize=ne.mapSize,n.directionalShadow[p]=G,n.directionalShadowMap[p]=J,n.directionalShadowMatrix[p]=C.shadow.matrix,b++}n.directional[p]=W,p++}else if(C.isSpotLight){const W=e.get(C);W.position.setFromMatrixPosition(C.matrixWorld),W.color.copy(H).multiplyScalar(B),W.distance=j,W.coneCos=Math.cos(C.angle),W.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),W.decay=C.decay,n.spot[v]=W;const ne=C.shadow;if(C.map&&(n.spotLightMap[D]=C.map,D++,ne.updateMatrices(C),C.castShadow&&w++),n.spotLightMatrix[v]=ne.matrix,C.castShadow){const G=t.get(C);G.shadowIntensity=ne.intensity,G.shadowBias=ne.bias,G.shadowNormalBias=ne.normalBias,G.shadowRadius=ne.radius,G.shadowMapSize=ne.mapSize,n.spotShadow[v]=G,n.spotShadowMap[v]=J,S++}v++}else if(C.isRectAreaLight){const W=e.get(C);W.color.copy(H).multiplyScalar(B),W.halfWidth.set(C.width*.5,0,0),W.halfHeight.set(0,C.height*.5,0),n.rectArea[m]=W,m++}else if(C.isPointLight){const W=e.get(C);if(W.color.copy(C.color).multiplyScalar(C.intensity),W.distance=C.distance,W.decay=C.decay,C.castShadow){const ne=C.shadow,G=t.get(C);G.shadowIntensity=ne.intensity,G.shadowBias=ne.bias,G.shadowNormalBias=ne.normalBias,G.shadowRadius=ne.radius,G.shadowMapSize=ne.mapSize,G.shadowCameraNear=ne.camera.near,G.shadowCameraFar=ne.camera.far,n.pointShadow[_]=G,n.pointShadowMap[_]=J,n.pointShadowMatrix[_]=C.shadow.matrix,E++}n.point[_]=W,_++}else if(C.isHemisphereLight){const W=e.get(C);W.skyColor.copy(C.color).multiplyScalar(B),W.groundColor.copy(C.groundColor).multiplyScalar(B),n.hemi[f]=W,f++}}m>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=me.LTC_FLOAT_1,n.rectAreaLTC2=me.LTC_FLOAT_2):(n.rectAreaLTC1=me.LTC_HALF_1,n.rectAreaLTC2=me.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;const L=n.hash;(L.directionalLength!==p||L.pointLength!==_||L.spotLength!==v||L.rectAreaLength!==m||L.hemiLength!==f||L.numDirectionalShadows!==b||L.numPointShadows!==E||L.numSpotShadows!==S||L.numSpotMaps!==D||L.numLightProbes!==R)&&(n.directional.length=p,n.spot.length=v,n.rectArea.length=m,n.point.length=_,n.hemi.length=f,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=S,n.spotShadowMap.length=S,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=S+D-w,n.spotLightMap.length=D,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=R,L.directionalLength=p,L.pointLength=_,L.spotLength=v,L.rectAreaLength=m,L.hemiLength=f,L.numDirectionalShadows=b,L.numPointShadows=E,L.numSpotShadows=S,L.numSpotMaps=D,L.numLightProbes=R,n.version=Fm++)}function l(c,h){let u=0,d=0,p=0,_=0,v=0;const m=h.matrixWorldInverse;for(let f=0,b=c.length;f<b;f++){const E=c[f];if(E.isDirectionalLight){const S=n.directional[u];S.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),S.direction.sub(r),S.direction.transformDirection(m),u++}else if(E.isSpotLight){const S=n.spot[p];S.position.setFromMatrixPosition(E.matrixWorld),S.position.applyMatrix4(m),S.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),S.direction.sub(r),S.direction.transformDirection(m),p++}else if(E.isRectAreaLight){const S=n.rectArea[_];S.position.setFromMatrixPosition(E.matrixWorld),S.position.applyMatrix4(m),a.identity(),s.copy(E.matrixWorld),s.premultiply(m),a.extractRotation(s),S.halfWidth.set(E.width*.5,0,0),S.halfHeight.set(0,E.height*.5,0),S.halfWidth.applyMatrix4(a),S.halfHeight.applyMatrix4(a),_++}else if(E.isPointLight){const S=n.point[d];S.position.setFromMatrixPosition(E.matrixWorld),S.position.applyMatrix4(m),d++}else if(E.isHemisphereLight){const S=n.hemi[v];S.direction.setFromMatrixPosition(E.matrixWorld),S.direction.transformDirection(m),v++}}}return{setup:o,setupView:l,state:n}}function Yo(i){const e=new Bm(i),t=[],n=[];function r(h){c.camera=h,t.length=0,n.length=0}function s(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function l(h){e.setupView(t,h)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function zm(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Yo(i),e.set(r,[o])):s>=a.length?(o=new Yo(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const km=`void main() {
3776
3776
  gl_Position = vec4( position, 1.0 );
3777
- }`,Fm=`uniform sampler2D shadow_pass;
3777
+ }`,Hm=`uniform sampler2D shadow_pass;
3778
3778
  uniform vec2 resolution;
3779
3779
  uniform float radius;
3780
3780
  #include <packing>
@@ -3800,12 +3800,12 @@ void main() {
3800
3800
  squared_mean = squared_mean / samples;
3801
3801
  float std_dev = sqrt( squared_mean - mean * mean );
3802
3802
  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3803
- }`;function Om(i,e,t){let n=new Pa;const r=new Xe,s=new Xe,a=new pt,o=new Qh({depthPacking:hh}),l=new eu,c={},h=t.maxTextureSize,u={[Sn]:It,[It]:Sn,[_n]:_n},d=new Un({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Xe},radius:{value:4}},vertexShader:Nm,fragmentShader:Fm}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const _=new en;_.setAttribute("position",new sn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Jt(_,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=tl;let f=this.type;this.render=function(w,C,P){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||w.length===0)return;const y=i.getRenderTarget(),x=i.getActiveCubeFace(),R=i.getActiveMipmapLevel(),H=i.state;H.setBlending(Dn),H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);const B=f!==pn&&this.type===pn,j=f===pn&&this.type!==pn;for(let J=0,W=w.length;J<W;J++){const ne=w[J],G=ne.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",ne,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;r.copy(G.mapSize);const fe=G.getFrameExtents();if(r.multiply(fe),s.copy(G.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/fe.x),r.x=s.x*fe.x,G.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/fe.y),r.y=s.y*fe.y,G.mapSize.y=s.y)),G.map===null||B===!0||j===!0){const se=this.type!==pn?{minFilter:Qt,magFilter:Qt}:{};G.map!==null&&G.map.dispose(),G.map=new $n(r.x,r.y,se),G.map.texture.name=ne.name+".shadowMap",G.camera.updateProjectionMatrix()}i.setRenderTarget(G.map),i.clear();const xe=G.getViewportCount();for(let se=0;se<xe;se++){const We=G.getViewport(se);a.set(s.x*We.x,s.y*We.y,s.x*We.z,s.y*We.w),H.viewport(a),G.updateMatrices(ne,se),n=G.getFrustum(),S(C,P,G.camera,ne,this.type)}G.isPointLightShadow!==!0&&this.type===pn&&b(G,P),G.needsUpdate=!1}f=this.type,m.needsUpdate=!1,i.setRenderTarget(y,x,R)};function b(w,C){const P=e.update(v);d.defines.VSM_SAMPLES!==w.blurSamples&&(d.defines.VSM_SAMPLES=w.blurSamples,p.defines.VSM_SAMPLES=w.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new $n(r.x,r.y)),d.uniforms.shadow_pass.value=w.map.texture,d.uniforms.resolution.value=w.mapSize,d.uniforms.radius.value=w.radius,i.setRenderTarget(w.mapPass),i.clear(),i.renderBufferDirect(C,null,P,d,v,null),p.uniforms.shadow_pass.value=w.mapPass.texture,p.uniforms.resolution.value=w.mapSize,p.uniforms.radius.value=w.radius,i.setRenderTarget(w.map),i.clear(),i.renderBufferDirect(C,null,P,p,v,null)}function E(w,C,P,y){let x=null;const R=P.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(R!==void 0)x=R;else if(x=P.isPointLight===!0?l:o,i.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){const H=x.uuid,B=C.uuid;let j=c[H];j===void 0&&(j={},c[H]=j);let J=j[B];J===void 0&&(J=x.clone(),j[B]=J,C.addEventListener("dispose",L)),x=J}if(x.visible=C.visible,x.wireframe=C.wireframe,y===pn?x.side=C.shadowSide!==null?C.shadowSide:C.side:x.side=C.shadowSide!==null?C.shadowSide:u[C.side],x.alphaMap=C.alphaMap,x.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,x.map=C.map,x.clipShadows=C.clipShadows,x.clippingPlanes=C.clippingPlanes,x.clipIntersection=C.clipIntersection,x.displacementMap=C.displacementMap,x.displacementScale=C.displacementScale,x.displacementBias=C.displacementBias,x.wireframeLinewidth=C.wireframeLinewidth,x.linewidth=C.linewidth,P.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const H=i.properties.get(x);H.light=P}return x}function S(w,C,P,y,x){if(w.visible===!1)return;if(w.layers.test(C.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&x===pn)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,w.matrixWorld);const B=e.update(w),j=w.material;if(Array.isArray(j)){const J=B.groups;for(let W=0,ne=J.length;W<ne;W++){const G=J[W],fe=j[G.materialIndex];if(fe&&fe.visible){const xe=E(w,fe,y,x);w.onBeforeShadow(i,w,C,P,B,xe,G),i.renderBufferDirect(P,null,B,xe,w,G),w.onAfterShadow(i,w,C,P,B,xe,G)}}}else if(j.visible){const J=E(w,j,y,x);w.onBeforeShadow(i,w,C,P,B,J,null),i.renderBufferDirect(P,null,B,J,w,null),w.onAfterShadow(i,w,C,P,B,J,null)}}const H=w.children;for(let B=0,j=H.length;B<j;B++)S(H[B],C,P,y,x)}function L(w){w.target.removeEventListener("dispose",L);for(const P in c){const y=c[P],x=w.target.uuid;x in y&&(y[x].dispose(),delete y[x])}}}const Bm={[Us]:Is,[Ns]:Bs,[Fs]:zs,[Mi]:Os,[Is]:Us,[Bs]:Ns,[zs]:Fs,[Os]:Mi};function zm(i,e){function t(){let D=!1;const pe=new pt;let te=null;const ye=new pt(0,0,0,0);return{setMask:function(O){te!==O&&!D&&(i.colorMask(O,O,O,O),te=O)},setLocked:function(O){D=O},setClear:function(O,X,ue,Be,ot){ot===!0&&(O*=Be,X*=Be,ue*=Be),pe.set(O,X,ue,Be),ye.equals(pe)===!1&&(i.clearColor(O,X,ue,Be),ye.copy(pe))},reset:function(){D=!1,te=null,ye.set(-1,0,0,0)}}}function n(){let D=!1,pe=!1,te=null,ye=null,O=null;return{setReversed:function(X){if(pe!==X){const ue=e.get("EXT_clip_control");X?ue.clipControlEXT(ue.LOWER_LEFT_EXT,ue.ZERO_TO_ONE_EXT):ue.clipControlEXT(ue.LOWER_LEFT_EXT,ue.NEGATIVE_ONE_TO_ONE_EXT),pe=X;const Be=O;O=null,this.setClear(Be)}},getReversed:function(){return pe},setTest:function(X){X?ve(i.DEPTH_TEST):Ue(i.DEPTH_TEST)},setMask:function(X){te!==X&&!D&&(i.depthMask(X),te=X)},setFunc:function(X){if(pe&&(X=Bm[X]),ye!==X){switch(X){case Us:i.depthFunc(i.NEVER);break;case Is:i.depthFunc(i.ALWAYS);break;case Ns:i.depthFunc(i.LESS);break;case Mi:i.depthFunc(i.LEQUAL);break;case Fs:i.depthFunc(i.EQUAL);break;case Os:i.depthFunc(i.GEQUAL);break;case Bs:i.depthFunc(i.GREATER);break;case zs:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}ye=X}},setLocked:function(X){D=X},setClear:function(X){O!==X&&(pe&&(X=1-X),i.clearDepth(X),O=X)},reset:function(){D=!1,te=null,ye=null,O=null,pe=!1}}}function r(){let D=!1,pe=null,te=null,ye=null,O=null,X=null,ue=null,Be=null,ot=null;return{setTest:function(et){D||(et?ve(i.STENCIL_TEST):Ue(i.STENCIL_TEST))},setMask:function(et){pe!==et&&!D&&(i.stencilMask(et),pe=et)},setFunc:function(et,Ce,_e){(te!==et||ye!==Ce||O!==_e)&&(i.stencilFunc(et,Ce,_e),te=et,ye=Ce,O=_e)},setOp:function(et,Ce,_e){(X!==et||ue!==Ce||Be!==_e)&&(i.stencilOp(et,Ce,_e),X=et,ue=Ce,Be=_e)},setLocked:function(et){D=et},setClear:function(et){ot!==et&&(i.clearStencil(et),ot=et)},reset:function(){D=!1,pe=null,te=null,ye=null,O=null,X=null,ue=null,Be=null,ot=null}}}const s=new t,a=new n,o=new r,l=new WeakMap,c=new WeakMap;let h={},u={},d=new WeakMap,p=[],_=null,v=!1,m=null,f=null,b=null,E=null,S=null,L=null,w=null,C=new Ke(0,0,0),P=0,y=!1,x=null,R=null,H=null,B=null,j=null;const J=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let W=!1,ne=0;const G=i.getParameter(i.VERSION);G.indexOf("WebGL")!==-1?(ne=parseFloat(/^WebGL (\d)/.exec(G)[1]),W=ne>=1):G.indexOf("OpenGL ES")!==-1&&(ne=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),W=ne>=2);let fe=null,xe={};const se=i.getParameter(i.SCISSOR_BOX),We=i.getParameter(i.VIEWPORT),Ze=new pt().fromArray(se),Y=new pt().fromArray(We);function le(D,pe,te,ye){const O=new Uint8Array(4),X=i.createTexture();i.bindTexture(D,X),i.texParameteri(D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(D,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let ue=0;ue<te;ue++)D===i.TEXTURE_3D||D===i.TEXTURE_2D_ARRAY?i.texImage3D(pe,0,i.RGBA,1,1,ye,0,i.RGBA,i.UNSIGNED_BYTE,O):i.texImage2D(pe+ue,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,O);return X}const Pe={};Pe[i.TEXTURE_2D]=le(i.TEXTURE_2D,i.TEXTURE_2D,1),Pe[i.TEXTURE_CUBE_MAP]=le(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Pe[i.TEXTURE_2D_ARRAY]=le(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Pe[i.TEXTURE_3D]=le(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ve(i.DEPTH_TEST),a.setFunc(Mi),Re(!1),Ye(Ba),ve(i.CULL_FACE),A(Dn);function ve(D){h[D]!==!0&&(i.enable(D),h[D]=!0)}function Ue(D){h[D]!==!1&&(i.disable(D),h[D]=!1)}function Z(D,pe){return u[D]!==pe?(i.bindFramebuffer(D,pe),u[D]=pe,D===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=pe),D===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=pe),!0):!1}function Q(D,pe){let te=p,ye=!1;if(D){te=d.get(pe),te===void 0&&(te=[],d.set(pe,te));const O=D.textures;if(te.length!==O.length||te[0]!==i.COLOR_ATTACHMENT0){for(let X=0,ue=O.length;X<ue;X++)te[X]=i.COLOR_ATTACHMENT0+X;te.length=O.length,ye=!0}}else te[0]!==i.BACK&&(te[0]=i.BACK,ye=!0);ye&&i.drawBuffers(te)}function de(D){return _!==D?(i.useProgram(D),_=D,!0):!1}const Se={[Xn]:i.FUNC_ADD,[Fc]:i.FUNC_SUBTRACT,[Oc]:i.FUNC_REVERSE_SUBTRACT};Se[Bc]=i.MIN,Se[zc]=i.MAX;const oe={[kc]:i.ZERO,[Hc]:i.ONE,[Vc]:i.SRC_COLOR,[Ds]:i.SRC_ALPHA,[jc]:i.SRC_ALPHA_SATURATE,[qc]:i.DST_COLOR,[Wc]:i.DST_ALPHA,[Gc]:i.ONE_MINUS_SRC_COLOR,[Ls]:i.ONE_MINUS_SRC_ALPHA,[Yc]:i.ONE_MINUS_DST_COLOR,[Xc]:i.ONE_MINUS_DST_ALPHA,[Kc]:i.CONSTANT_COLOR,[Zc]:i.ONE_MINUS_CONSTANT_COLOR,[$c]:i.CONSTANT_ALPHA,[Jc]:i.ONE_MINUS_CONSTANT_ALPHA};function A(D,pe,te,ye,O,X,ue,Be,ot,et){if(D===Dn){v===!0&&(Ue(i.BLEND),v=!1);return}if(v===!1&&(ve(i.BLEND),v=!0),D!==Nc){if(D!==m||et!==y){if((f!==Xn||S!==Xn)&&(i.blendEquation(i.FUNC_ADD),f=Xn,S=Xn),et)switch(D){case gi:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case za:i.blendFunc(i.ONE,i.ONE);break;case ka:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Ha:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}else switch(D){case gi:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case za:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case ka:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Ha:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}b=null,E=null,L=null,w=null,C.set(0,0,0),P=0,m=D,y=et}return}O=O||pe,X=X||te,ue=ue||ye,(pe!==f||O!==S)&&(i.blendEquationSeparate(Se[pe],Se[O]),f=pe,S=O),(te!==b||ye!==E||X!==L||ue!==w)&&(i.blendFuncSeparate(oe[te],oe[ye],oe[X],oe[ue]),b=te,E=ye,L=X,w=ue),(Be.equals(C)===!1||ot!==P)&&(i.blendColor(Be.r,Be.g,Be.b,ot),C.copy(Be),P=ot),m=D,y=!1}function ae(D,pe){D.side===_n?Ue(i.CULL_FACE):ve(i.CULL_FACE);let te=D.side===It;pe&&(te=!te),Re(te),D.blending===gi&&D.transparent===!1?A(Dn):A(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.blendColor,D.blendAlpha,D.premultipliedAlpha),a.setFunc(D.depthFunc),a.setTest(D.depthTest),a.setMask(D.depthWrite),s.setMask(D.colorWrite);const ye=D.stencilWrite;o.setTest(ye),ye&&(o.setMask(D.stencilWriteMask),o.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),o.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),Fe(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?ve(i.SAMPLE_ALPHA_TO_COVERAGE):Ue(i.SAMPLE_ALPHA_TO_COVERAGE)}function Re(D){x!==D&&(D?i.frontFace(i.CW):i.frontFace(i.CCW),x=D)}function Ye(D){D!==Lc?(ve(i.CULL_FACE),D!==R&&(D===Ba?i.cullFace(i.BACK):D===Uc?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Ue(i.CULL_FACE),R=D}function ie(D){D!==H&&(W&&i.lineWidth(D),H=D)}function Fe(D,pe,te){D?(ve(i.POLYGON_OFFSET_FILL),(B!==pe||j!==te)&&(i.polygonOffset(pe,te),B=pe,j=te)):Ue(i.POLYGON_OFFSET_FILL)}function Ee(D){D?ve(i.SCISSOR_TEST):Ue(i.SCISSOR_TEST)}function Ve(D){D===void 0&&(D=i.TEXTURE0+J-1),fe!==D&&(i.activeTexture(D),fe=D)}function lt(D,pe,te){te===void 0&&(fe===null?te=i.TEXTURE0+J-1:te=fe);let ye=xe[te];ye===void 0&&(ye={type:void 0,texture:void 0},xe[te]=ye),(ye.type!==D||ye.texture!==pe)&&(fe!==te&&(i.activeTexture(te),fe=te),i.bindTexture(D,pe||Pe[D]),ye.type=D,ye.texture=pe)}function T(){const D=xe[fe];D!==void 0&&D.type!==void 0&&(i.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function g(){try{i.compressedTexImage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function F(){try{i.compressedTexImage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function q(){try{i.texSubImage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function K(){try{i.texSubImage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function V(){try{i.compressedTexSubImage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function De(){try{i.compressedTexSubImage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function he(){try{i.texStorage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function be(){try{i.texStorage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Le(){try{i.texImage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function ee(){try{i.texImage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Me(D){Ze.equals(D)===!1&&(i.scissor(D.x,D.y,D.z,D.w),Ze.copy(D))}function Oe(D){Y.equals(D)===!1&&(i.viewport(D.x,D.y,D.z,D.w),Y.copy(D))}function Ne(D,pe){let te=c.get(pe);te===void 0&&(te=new WeakMap,c.set(pe,te));let ye=te.get(D);ye===void 0&&(ye=i.getUniformBlockIndex(pe,D.name),te.set(D,ye))}function ce(D,pe){const ye=c.get(pe).get(D);l.get(pe)!==ye&&(i.uniformBlockBinding(pe,ye,D.__bindingPointIndex),l.set(pe,ye))}function ke(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),h={},fe=null,xe={},u={},d=new WeakMap,p=[],_=null,v=!1,m=null,f=null,b=null,E=null,S=null,L=null,w=null,C=new Ke(0,0,0),P=0,y=!1,x=null,R=null,H=null,B=null,j=null,Ze.set(0,0,i.canvas.width,i.canvas.height),Y.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ve,disable:Ue,bindFramebuffer:Z,drawBuffers:Q,useProgram:de,setBlending:A,setMaterial:ae,setFlipSided:Re,setCullFace:Ye,setLineWidth:ie,setPolygonOffset:Fe,setScissorTest:Ee,activeTexture:Ve,bindTexture:lt,unbindTexture:T,compressedTexImage2D:g,compressedTexImage3D:F,texImage2D:Le,texImage3D:ee,updateUBOMapping:Ne,uniformBlockBinding:ce,texStorage2D:he,texStorage3D:be,texSubImage2D:q,texSubImage3D:K,compressedTexSubImage2D:V,compressedTexSubImage3D:De,scissor:Me,viewport:Oe,reset:ke}}function km(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Xe,h=new WeakMap;let u;const d=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(T,g){return p?new OffscreenCanvas(T,g):Ki("canvas")}function v(T,g,F){let q=1;const K=lt(T);if((K.width>F||K.height>F)&&(q=F/Math.max(K.width,K.height)),q<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){const V=Math.floor(q*K.width),De=Math.floor(q*K.height);u===void 0&&(u=_(V,De));const he=g?_(V,De):u;return he.width=V,he.height=De,he.getContext("2d").drawImage(T,0,0,V,De),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+K.width+"x"+K.height+") to ("+V+"x"+De+")."),he}else return"data"in T&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+K.width+"x"+K.height+")."),T;return T}function m(T){return T.generateMipmaps}function f(T){i.generateMipmap(T)}function b(T){return T.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:T.isWebGL3DRenderTarget?i.TEXTURE_3D:T.isWebGLArrayRenderTarget||T.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function E(T,g,F,q,K=!1){if(T!==null){if(i[T]!==void 0)return i[T];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let V=g;if(g===i.RED&&(F===i.FLOAT&&(V=i.R32F),F===i.HALF_FLOAT&&(V=i.R16F),F===i.UNSIGNED_BYTE&&(V=i.R8)),g===i.RED_INTEGER&&(F===i.UNSIGNED_BYTE&&(V=i.R8UI),F===i.UNSIGNED_SHORT&&(V=i.R16UI),F===i.UNSIGNED_INT&&(V=i.R32UI),F===i.BYTE&&(V=i.R8I),F===i.SHORT&&(V=i.R16I),F===i.INT&&(V=i.R32I)),g===i.RG&&(F===i.FLOAT&&(V=i.RG32F),F===i.HALF_FLOAT&&(V=i.RG16F),F===i.UNSIGNED_BYTE&&(V=i.RG8)),g===i.RG_INTEGER&&(F===i.UNSIGNED_BYTE&&(V=i.RG8UI),F===i.UNSIGNED_SHORT&&(V=i.RG16UI),F===i.UNSIGNED_INT&&(V=i.RG32UI),F===i.BYTE&&(V=i.RG8I),F===i.SHORT&&(V=i.RG16I),F===i.INT&&(V=i.RG32I)),g===i.RGB_INTEGER&&(F===i.UNSIGNED_BYTE&&(V=i.RGB8UI),F===i.UNSIGNED_SHORT&&(V=i.RGB16UI),F===i.UNSIGNED_INT&&(V=i.RGB32UI),F===i.BYTE&&(V=i.RGB8I),F===i.SHORT&&(V=i.RGB16I),F===i.INT&&(V=i.RGB32I)),g===i.RGBA_INTEGER&&(F===i.UNSIGNED_BYTE&&(V=i.RGBA8UI),F===i.UNSIGNED_SHORT&&(V=i.RGBA16UI),F===i.UNSIGNED_INT&&(V=i.RGBA32UI),F===i.BYTE&&(V=i.RGBA8I),F===i.SHORT&&(V=i.RGBA16I),F===i.INT&&(V=i.RGBA32I)),g===i.RGB&&F===i.UNSIGNED_INT_5_9_9_9_REV&&(V=i.RGB9_E5),g===i.RGBA){const De=K?Br:Qe.getTransfer(q);F===i.FLOAT&&(V=i.RGBA32F),F===i.HALF_FLOAT&&(V=i.RGBA16F),F===i.UNSIGNED_BYTE&&(V=De===st?i.SRGB8_ALPHA8:i.RGBA8),F===i.UNSIGNED_SHORT_4_4_4_4&&(V=i.RGBA4),F===i.UNSIGNED_SHORT_5_5_5_1&&(V=i.RGB5_A1)}return(V===i.R16F||V===i.R32F||V===i.RG16F||V===i.RG32F||V===i.RGBA16F||V===i.RGBA32F)&&e.get("EXT_color_buffer_float"),V}function S(T,g){let F;return T?g===null||g===Kn||g===qi?F=i.DEPTH24_STENCIL8:g===gn?F=i.DEPTH32F_STENCIL8:g===Xi&&(F=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):g===null||g===Kn||g===qi?F=i.DEPTH_COMPONENT24:g===gn?F=i.DEPTH_COMPONENT32F:g===Xi&&(F=i.DEPTH_COMPONENT16),F}function L(T,g){return m(T)===!0||T.isFramebufferTexture&&T.minFilter!==Qt&&T.minFilter!==rn?Math.log2(Math.max(g.width,g.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?g.mipmaps.length:1}function w(T){const g=T.target;g.removeEventListener("dispose",w),P(g),g.isVideoTexture&&h.delete(g)}function C(T){const g=T.target;g.removeEventListener("dispose",C),x(g)}function P(T){const g=n.get(T);if(g.__webglInit===void 0)return;const F=T.source,q=d.get(F);if(q){const K=q[g.__cacheKey];K.usedTimes--,K.usedTimes===0&&y(T),Object.keys(q).length===0&&d.delete(F)}n.remove(T)}function y(T){const g=n.get(T);i.deleteTexture(g.__webglTexture);const F=T.source,q=d.get(F);delete q[g.__cacheKey],a.memory.textures--}function x(T){const g=n.get(T);if(T.depthTexture&&(T.depthTexture.dispose(),n.remove(T.depthTexture)),T.isWebGLCubeRenderTarget)for(let q=0;q<6;q++){if(Array.isArray(g.__webglFramebuffer[q]))for(let K=0;K<g.__webglFramebuffer[q].length;K++)i.deleteFramebuffer(g.__webglFramebuffer[q][K]);else i.deleteFramebuffer(g.__webglFramebuffer[q]);g.__webglDepthbuffer&&i.deleteRenderbuffer(g.__webglDepthbuffer[q])}else{if(Array.isArray(g.__webglFramebuffer))for(let q=0;q<g.__webglFramebuffer.length;q++)i.deleteFramebuffer(g.__webglFramebuffer[q]);else i.deleteFramebuffer(g.__webglFramebuffer);if(g.__webglDepthbuffer&&i.deleteRenderbuffer(g.__webglDepthbuffer),g.__webglMultisampledFramebuffer&&i.deleteFramebuffer(g.__webglMultisampledFramebuffer),g.__webglColorRenderbuffer)for(let q=0;q<g.__webglColorRenderbuffer.length;q++)g.__webglColorRenderbuffer[q]&&i.deleteRenderbuffer(g.__webglColorRenderbuffer[q]);g.__webglDepthRenderbuffer&&i.deleteRenderbuffer(g.__webglDepthRenderbuffer)}const F=T.textures;for(let q=0,K=F.length;q<K;q++){const V=n.get(F[q]);V.__webglTexture&&(i.deleteTexture(V.__webglTexture),a.memory.textures--),n.remove(F[q])}n.remove(T)}let R=0;function H(){R=0}function B(){const T=R;return T>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+r.maxTextures),R+=1,T}function j(T){const g=[];return g.push(T.wrapS),g.push(T.wrapT),g.push(T.wrapR||0),g.push(T.magFilter),g.push(T.minFilter),g.push(T.anisotropy),g.push(T.internalFormat),g.push(T.format),g.push(T.type),g.push(T.generateMipmaps),g.push(T.premultiplyAlpha),g.push(T.flipY),g.push(T.unpackAlignment),g.push(T.colorSpace),g.join()}function J(T,g){const F=n.get(T);if(T.isVideoTexture&&Ee(T),T.isRenderTargetTexture===!1&&T.version>0&&F.__version!==T.version){const q=T.image;if(q===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Pe(F,T,g);return}}t.bindTexture(i.TEXTURE_2D,F.__webglTexture,i.TEXTURE0+g)}function W(T,g){const F=n.get(T);if(T.version>0&&F.__version!==T.version){Pe(F,T,g);return}t.bindTexture(i.TEXTURE_2D_ARRAY,F.__webglTexture,i.TEXTURE0+g)}function ne(T,g){const F=n.get(T);if(T.version>0&&F.__version!==T.version){Pe(F,T,g);return}t.bindTexture(i.TEXTURE_3D,F.__webglTexture,i.TEXTURE0+g)}function G(T,g){const F=n.get(T);if(T.version>0&&F.__version!==T.version){ve(F,T,g);return}t.bindTexture(i.TEXTURE_CUBE_MAP,F.__webglTexture,i.TEXTURE0+g)}const fe={[Or]:i.REPEAT,[Yn]:i.CLAMP_TO_EDGE,[Vs]:i.MIRRORED_REPEAT},xe={[Qt]:i.NEAREST,[lh]:i.NEAREST_MIPMAP_NEAREST,[tr]:i.NEAREST_MIPMAP_LINEAR,[rn]:i.LINEAR,[Zr]:i.LINEAR_MIPMAP_NEAREST,[jn]:i.LINEAR_MIPMAP_LINEAR},se={[fh]:i.NEVER,[vh]:i.ALWAYS,[dh]:i.LESS,[fl]:i.LEQUAL,[ph]:i.EQUAL,[gh]:i.GEQUAL,[mh]:i.GREATER,[_h]:i.NOTEQUAL};function We(T,g){if(g.type===gn&&e.has("OES_texture_float_linear")===!1&&(g.magFilter===rn||g.magFilter===Zr||g.magFilter===tr||g.magFilter===jn||g.minFilter===rn||g.minFilter===Zr||g.minFilter===tr||g.minFilter===jn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(T,i.TEXTURE_WRAP_S,fe[g.wrapS]),i.texParameteri(T,i.TEXTURE_WRAP_T,fe[g.wrapT]),(T===i.TEXTURE_3D||T===i.TEXTURE_2D_ARRAY)&&i.texParameteri(T,i.TEXTURE_WRAP_R,fe[g.wrapR]),i.texParameteri(T,i.TEXTURE_MAG_FILTER,xe[g.magFilter]),i.texParameteri(T,i.TEXTURE_MIN_FILTER,xe[g.minFilter]),g.compareFunction&&(i.texParameteri(T,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(T,i.TEXTURE_COMPARE_FUNC,se[g.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(g.magFilter===Qt||g.minFilter!==tr&&g.minFilter!==jn||g.type===gn&&e.has("OES_texture_float_linear")===!1)return;if(g.anisotropy>1||n.get(g).__currentAnisotropy){const F=e.get("EXT_texture_filter_anisotropic");i.texParameterf(T,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(g.anisotropy,r.getMaxAnisotropy())),n.get(g).__currentAnisotropy=g.anisotropy}}}function Ze(T,g){let F=!1;T.__webglInit===void 0&&(T.__webglInit=!0,g.addEventListener("dispose",w));const q=g.source;let K=d.get(q);K===void 0&&(K={},d.set(q,K));const V=j(g);if(V!==T.__cacheKey){K[V]===void 0&&(K[V]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,F=!0),K[V].usedTimes++;const De=K[T.__cacheKey];De!==void 0&&(K[T.__cacheKey].usedTimes--,De.usedTimes===0&&y(g)),T.__cacheKey=V,T.__webglTexture=K[V].texture}return F}function Y(T,g,F){return Math.floor(Math.floor(T/F)/g)}function le(T,g,F,q){const V=T.updateRanges;if(V.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,g.width,g.height,F,q,g.data);else{V.sort((ee,Me)=>ee.start-Me.start);let De=0;for(let ee=1;ee<V.length;ee++){const Me=V[De],Oe=V[ee],Ne=Me.start+Me.count,ce=Y(Oe.start,g.width,4),ke=Y(Me.start,g.width,4);Oe.start<=Ne+1&&ce===ke&&Y(Oe.start+Oe.count-1,g.width,4)===ce?Me.count=Math.max(Me.count,Oe.start+Oe.count-Me.start):(++De,V[De]=Oe)}V.length=De+1;const he=i.getParameter(i.UNPACK_ROW_LENGTH),be=i.getParameter(i.UNPACK_SKIP_PIXELS),Le=i.getParameter(i.UNPACK_SKIP_ROWS);i.pixelStorei(i.UNPACK_ROW_LENGTH,g.width);for(let ee=0,Me=V.length;ee<Me;ee++){const Oe=V[ee],Ne=Math.floor(Oe.start/4),ce=Math.ceil(Oe.count/4),ke=Ne%g.width,D=Math.floor(Ne/g.width),pe=ce,te=1;i.pixelStorei(i.UNPACK_SKIP_PIXELS,ke),i.pixelStorei(i.UNPACK_SKIP_ROWS,D),t.texSubImage2D(i.TEXTURE_2D,0,ke,D,pe,te,F,q,g.data)}T.clearUpdateRanges(),i.pixelStorei(i.UNPACK_ROW_LENGTH,he),i.pixelStorei(i.UNPACK_SKIP_PIXELS,be),i.pixelStorei(i.UNPACK_SKIP_ROWS,Le)}}function Pe(T,g,F){let q=i.TEXTURE_2D;(g.isDataArrayTexture||g.isCompressedArrayTexture)&&(q=i.TEXTURE_2D_ARRAY),g.isData3DTexture&&(q=i.TEXTURE_3D);const K=Ze(T,g),V=g.source;t.bindTexture(q,T.__webglTexture,i.TEXTURE0+F);const De=n.get(V);if(V.version!==De.__version||K===!0){t.activeTexture(i.TEXTURE0+F);const he=Qe.getPrimaries(Qe.workingColorSpace),be=g.colorSpace===Pn?null:Qe.getPrimaries(g.colorSpace),Le=g.colorSpace===Pn||he===be?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,g.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,g.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Le);let ee=v(g.image,!1,r.maxTextureSize);ee=Ve(g,ee);const Me=s.convert(g.format,g.colorSpace),Oe=s.convert(g.type);let Ne=E(g.internalFormat,Me,Oe,g.colorSpace,g.isVideoTexture);We(q,g);let ce;const ke=g.mipmaps,D=g.isVideoTexture!==!0,pe=De.__version===void 0||K===!0,te=V.dataReady,ye=L(g,ee);if(g.isDepthTexture)Ne=S(g.format===ji,g.type),pe&&(D?t.texStorage2D(i.TEXTURE_2D,1,Ne,ee.width,ee.height):t.texImage2D(i.TEXTURE_2D,0,Ne,ee.width,ee.height,0,Me,Oe,null));else if(g.isDataTexture)if(ke.length>0){D&&pe&&t.texStorage2D(i.TEXTURE_2D,ye,Ne,ke[0].width,ke[0].height);for(let O=0,X=ke.length;O<X;O++)ce=ke[O],D?te&&t.texSubImage2D(i.TEXTURE_2D,O,0,0,ce.width,ce.height,Me,Oe,ce.data):t.texImage2D(i.TEXTURE_2D,O,Ne,ce.width,ce.height,0,Me,Oe,ce.data);g.generateMipmaps=!1}else D?(pe&&t.texStorage2D(i.TEXTURE_2D,ye,Ne,ee.width,ee.height),te&&le(g,ee,Me,Oe)):t.texImage2D(i.TEXTURE_2D,0,Ne,ee.width,ee.height,0,Me,Oe,ee.data);else if(g.isCompressedTexture)if(g.isCompressedArrayTexture){D&&pe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ye,Ne,ke[0].width,ke[0].height,ee.depth);for(let O=0,X=ke.length;O<X;O++)if(ce=ke[O],g.format!==$t)if(Me!==null)if(D){if(te)if(g.layerUpdates.size>0){const ue=xo(ce.width,ce.height,g.format,g.type);for(const Be of g.layerUpdates){const ot=ce.data.subarray(Be*ue/ce.data.BYTES_PER_ELEMENT,(Be+1)*ue/ce.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,O,0,0,Be,ce.width,ce.height,1,Me,ot)}g.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,O,0,0,0,ce.width,ce.height,ee.depth,Me,ce.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,O,Ne,ce.width,ce.height,ee.depth,0,ce.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else D?te&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,O,0,0,0,ce.width,ce.height,ee.depth,Me,Oe,ce.data):t.texImage3D(i.TEXTURE_2D_ARRAY,O,Ne,ce.width,ce.height,ee.depth,0,Me,Oe,ce.data)}else{D&&pe&&t.texStorage2D(i.TEXTURE_2D,ye,Ne,ke[0].width,ke[0].height);for(let O=0,X=ke.length;O<X;O++)ce=ke[O],g.format!==$t?Me!==null?D?te&&t.compressedTexSubImage2D(i.TEXTURE_2D,O,0,0,ce.width,ce.height,Me,ce.data):t.compressedTexImage2D(i.TEXTURE_2D,O,Ne,ce.width,ce.height,0,ce.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):D?te&&t.texSubImage2D(i.TEXTURE_2D,O,0,0,ce.width,ce.height,Me,Oe,ce.data):t.texImage2D(i.TEXTURE_2D,O,Ne,ce.width,ce.height,0,Me,Oe,ce.data)}else if(g.isDataArrayTexture)if(D){if(pe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ye,Ne,ee.width,ee.height,ee.depth),te)if(g.layerUpdates.size>0){const O=xo(ee.width,ee.height,g.format,g.type);for(const X of g.layerUpdates){const ue=ee.data.subarray(X*O/ee.data.BYTES_PER_ELEMENT,(X+1)*O/ee.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,X,ee.width,ee.height,1,Me,Oe,ue)}g.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,ee.width,ee.height,ee.depth,Me,Oe,ee.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Ne,ee.width,ee.height,ee.depth,0,Me,Oe,ee.data);else if(g.isData3DTexture)D?(pe&&t.texStorage3D(i.TEXTURE_3D,ye,Ne,ee.width,ee.height,ee.depth),te&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,ee.width,ee.height,ee.depth,Me,Oe,ee.data)):t.texImage3D(i.TEXTURE_3D,0,Ne,ee.width,ee.height,ee.depth,0,Me,Oe,ee.data);else if(g.isFramebufferTexture){if(pe)if(D)t.texStorage2D(i.TEXTURE_2D,ye,Ne,ee.width,ee.height);else{let O=ee.width,X=ee.height;for(let ue=0;ue<ye;ue++)t.texImage2D(i.TEXTURE_2D,ue,Ne,O,X,0,Me,Oe,null),O>>=1,X>>=1}}else if(ke.length>0){if(D&&pe){const O=lt(ke[0]);t.texStorage2D(i.TEXTURE_2D,ye,Ne,O.width,O.height)}for(let O=0,X=ke.length;O<X;O++)ce=ke[O],D?te&&t.texSubImage2D(i.TEXTURE_2D,O,0,0,Me,Oe,ce):t.texImage2D(i.TEXTURE_2D,O,Ne,Me,Oe,ce);g.generateMipmaps=!1}else if(D){if(pe){const O=lt(ee);t.texStorage2D(i.TEXTURE_2D,ye,Ne,O.width,O.height)}te&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Me,Oe,ee)}else t.texImage2D(i.TEXTURE_2D,0,Ne,Me,Oe,ee);m(g)&&f(q),De.__version=V.version,g.onUpdate&&g.onUpdate(g)}T.__version=g.version}function ve(T,g,F){if(g.image.length!==6)return;const q=Ze(T,g),K=g.source;t.bindTexture(i.TEXTURE_CUBE_MAP,T.__webglTexture,i.TEXTURE0+F);const V=n.get(K);if(K.version!==V.__version||q===!0){t.activeTexture(i.TEXTURE0+F);const De=Qe.getPrimaries(Qe.workingColorSpace),he=g.colorSpace===Pn?null:Qe.getPrimaries(g.colorSpace),be=g.colorSpace===Pn||De===he?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,g.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,g.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,be);const Le=g.isCompressedTexture||g.image[0].isCompressedTexture,ee=g.image[0]&&g.image[0].isDataTexture,Me=[];for(let X=0;X<6;X++)!Le&&!ee?Me[X]=v(g.image[X],!0,r.maxCubemapSize):Me[X]=ee?g.image[X].image:g.image[X],Me[X]=Ve(g,Me[X]);const Oe=Me[0],Ne=s.convert(g.format,g.colorSpace),ce=s.convert(g.type),ke=E(g.internalFormat,Ne,ce,g.colorSpace),D=g.isVideoTexture!==!0,pe=V.__version===void 0||q===!0,te=K.dataReady;let ye=L(g,Oe);We(i.TEXTURE_CUBE_MAP,g);let O;if(Le){D&&pe&&t.texStorage2D(i.TEXTURE_CUBE_MAP,ye,ke,Oe.width,Oe.height);for(let X=0;X<6;X++){O=Me[X].mipmaps;for(let ue=0;ue<O.length;ue++){const Be=O[ue];g.format!==$t?Ne!==null?D?te&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue,0,0,Be.width,Be.height,Ne,Be.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue,ke,Be.width,Be.height,0,Be.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):D?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue,0,0,Be.width,Be.height,Ne,ce,Be.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue,ke,Be.width,Be.height,0,Ne,ce,Be.data)}}}else{if(O=g.mipmaps,D&&pe){O.length>0&&ye++;const X=lt(Me[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ye,ke,X.width,X.height)}for(let X=0;X<6;X++)if(ee){D?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,0,0,Me[X].width,Me[X].height,Ne,ce,Me[X].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,ke,Me[X].width,Me[X].height,0,Ne,ce,Me[X].data);for(let ue=0;ue<O.length;ue++){const ot=O[ue].image[X].image;D?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue+1,0,0,ot.width,ot.height,Ne,ce,ot.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue+1,ke,ot.width,ot.height,0,Ne,ce,ot.data)}}else{D?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,0,0,Ne,ce,Me[X]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,ke,Ne,ce,Me[X]);for(let ue=0;ue<O.length;ue++){const Be=O[ue];D?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue+1,0,0,Ne,ce,Be.image[X]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue+1,ke,Ne,ce,Be.image[X])}}}m(g)&&f(i.TEXTURE_CUBE_MAP),V.__version=K.version,g.onUpdate&&g.onUpdate(g)}T.__version=g.version}function Ue(T,g,F,q,K,V){const De=s.convert(F.format,F.colorSpace),he=s.convert(F.type),be=E(F.internalFormat,De,he,F.colorSpace),Le=n.get(g),ee=n.get(F);if(ee.__renderTarget=g,!Le.__hasExternalTextures){const Me=Math.max(1,g.width>>V),Oe=Math.max(1,g.height>>V);K===i.TEXTURE_3D||K===i.TEXTURE_2D_ARRAY?t.texImage3D(K,V,be,Me,Oe,g.depth,0,De,he,null):t.texImage2D(K,V,be,Me,Oe,0,De,he,null)}t.bindFramebuffer(i.FRAMEBUFFER,T),Fe(g)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,q,K,ee.__webglTexture,0,ie(g)):(K===i.TEXTURE_2D||K>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,q,K,ee.__webglTexture,V),t.bindFramebuffer(i.FRAMEBUFFER,null)}function Z(T,g,F){if(i.bindRenderbuffer(i.RENDERBUFFER,T),g.depthBuffer){const q=g.depthTexture,K=q&&q.isDepthTexture?q.type:null,V=S(g.stencilBuffer,K),De=g.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,he=ie(g);Fe(g)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,he,V,g.width,g.height):F?i.renderbufferStorageMultisample(i.RENDERBUFFER,he,V,g.width,g.height):i.renderbufferStorage(i.RENDERBUFFER,V,g.width,g.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,De,i.RENDERBUFFER,T)}else{const q=g.textures;for(let K=0;K<q.length;K++){const V=q[K],De=s.convert(V.format,V.colorSpace),he=s.convert(V.type),be=E(V.internalFormat,De,he,V.colorSpace),Le=ie(g);F&&Fe(g)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Le,be,g.width,g.height):Fe(g)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Le,be,g.width,g.height):i.renderbufferStorage(i.RENDERBUFFER,be,g.width,g.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Q(T,g){if(g&&g.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,T),!(g.depthTexture&&g.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const q=n.get(g.depthTexture);q.__renderTarget=g,(!q.__webglTexture||g.depthTexture.image.width!==g.width||g.depthTexture.image.height!==g.height)&&(g.depthTexture.image.width=g.width,g.depthTexture.image.height=g.height,g.depthTexture.needsUpdate=!0),J(g.depthTexture,0);const K=q.__webglTexture,V=ie(g);if(g.depthTexture.format===Yi)Fe(g)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,K,0,V):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,K,0);else if(g.depthTexture.format===ji)Fe(g)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,K,0,V):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,K,0);else throw new Error("Unknown depthTexture format")}function de(T){const g=n.get(T),F=T.isWebGLCubeRenderTarget===!0;if(g.__boundDepthTexture!==T.depthTexture){const q=T.depthTexture;if(g.__depthDisposeCallback&&g.__depthDisposeCallback(),q){const K=()=>{delete g.__boundDepthTexture,delete g.__depthDisposeCallback,q.removeEventListener("dispose",K)};q.addEventListener("dispose",K),g.__depthDisposeCallback=K}g.__boundDepthTexture=q}if(T.depthTexture&&!g.__autoAllocateDepthBuffer){if(F)throw new Error("target.depthTexture not supported in Cube render targets");const q=T.texture.mipmaps;q&&q.length>0?Q(g.__webglFramebuffer[0],T):Q(g.__webglFramebuffer,T)}else if(F){g.__webglDepthbuffer=[];for(let q=0;q<6;q++)if(t.bindFramebuffer(i.FRAMEBUFFER,g.__webglFramebuffer[q]),g.__webglDepthbuffer[q]===void 0)g.__webglDepthbuffer[q]=i.createRenderbuffer(),Z(g.__webglDepthbuffer[q],T,!1);else{const K=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,V=g.__webglDepthbuffer[q];i.bindRenderbuffer(i.RENDERBUFFER,V),i.framebufferRenderbuffer(i.FRAMEBUFFER,K,i.RENDERBUFFER,V)}}else{const q=T.texture.mipmaps;if(q&&q.length>0?t.bindFramebuffer(i.FRAMEBUFFER,g.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,g.__webglFramebuffer),g.__webglDepthbuffer===void 0)g.__webglDepthbuffer=i.createRenderbuffer(),Z(g.__webglDepthbuffer,T,!1);else{const K=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,V=g.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,V),i.framebufferRenderbuffer(i.FRAMEBUFFER,K,i.RENDERBUFFER,V)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Se(T,g,F){const q=n.get(T);g!==void 0&&Ue(q.__webglFramebuffer,T,T.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),F!==void 0&&de(T)}function oe(T){const g=T.texture,F=n.get(T),q=n.get(g);T.addEventListener("dispose",C);const K=T.textures,V=T.isWebGLCubeRenderTarget===!0,De=K.length>1;if(De||(q.__webglTexture===void 0&&(q.__webglTexture=i.createTexture()),q.__version=g.version,a.memory.textures++),V){F.__webglFramebuffer=[];for(let he=0;he<6;he++)if(g.mipmaps&&g.mipmaps.length>0){F.__webglFramebuffer[he]=[];for(let be=0;be<g.mipmaps.length;be++)F.__webglFramebuffer[he][be]=i.createFramebuffer()}else F.__webglFramebuffer[he]=i.createFramebuffer()}else{if(g.mipmaps&&g.mipmaps.length>0){F.__webglFramebuffer=[];for(let he=0;he<g.mipmaps.length;he++)F.__webglFramebuffer[he]=i.createFramebuffer()}else F.__webglFramebuffer=i.createFramebuffer();if(De)for(let he=0,be=K.length;he<be;he++){const Le=n.get(K[he]);Le.__webglTexture===void 0&&(Le.__webglTexture=i.createTexture(),a.memory.textures++)}if(T.samples>0&&Fe(T)===!1){F.__webglMultisampledFramebuffer=i.createFramebuffer(),F.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let he=0;he<K.length;he++){const be=K[he];F.__webglColorRenderbuffer[he]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,F.__webglColorRenderbuffer[he]);const Le=s.convert(be.format,be.colorSpace),ee=s.convert(be.type),Me=E(be.internalFormat,Le,ee,be.colorSpace,T.isXRRenderTarget===!0),Oe=ie(T);i.renderbufferStorageMultisample(i.RENDERBUFFER,Oe,Me,T.width,T.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.RENDERBUFFER,F.__webglColorRenderbuffer[he])}i.bindRenderbuffer(i.RENDERBUFFER,null),T.depthBuffer&&(F.__webglDepthRenderbuffer=i.createRenderbuffer(),Z(F.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(V){t.bindTexture(i.TEXTURE_CUBE_MAP,q.__webglTexture),We(i.TEXTURE_CUBE_MAP,g);for(let he=0;he<6;he++)if(g.mipmaps&&g.mipmaps.length>0)for(let be=0;be<g.mipmaps.length;be++)Ue(F.__webglFramebuffer[he][be],T,g,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+he,be);else Ue(F.__webglFramebuffer[he],T,g,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+he,0);m(g)&&f(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(De){for(let he=0,be=K.length;he<be;he++){const Le=K[he],ee=n.get(Le);t.bindTexture(i.TEXTURE_2D,ee.__webglTexture),We(i.TEXTURE_2D,Le),Ue(F.__webglFramebuffer,T,Le,i.COLOR_ATTACHMENT0+he,i.TEXTURE_2D,0),m(Le)&&f(i.TEXTURE_2D)}t.unbindTexture()}else{let he=i.TEXTURE_2D;if((T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(he=T.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(he,q.__webglTexture),We(he,g),g.mipmaps&&g.mipmaps.length>0)for(let be=0;be<g.mipmaps.length;be++)Ue(F.__webglFramebuffer[be],T,g,i.COLOR_ATTACHMENT0,he,be);else Ue(F.__webglFramebuffer,T,g,i.COLOR_ATTACHMENT0,he,0);m(g)&&f(he),t.unbindTexture()}T.depthBuffer&&de(T)}function A(T){const g=T.textures;for(let F=0,q=g.length;F<q;F++){const K=g[F];if(m(K)){const V=b(T),De=n.get(K).__webglTexture;t.bindTexture(V,De),f(V),t.unbindTexture()}}}const ae=[],Re=[];function Ye(T){if(T.samples>0){if(Fe(T)===!1){const g=T.textures,F=T.width,q=T.height;let K=i.COLOR_BUFFER_BIT;const V=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,De=n.get(T),he=g.length>1;if(he)for(let Le=0;Le<g.length;Le++)t.bindFramebuffer(i.FRAMEBUFFER,De.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Le,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,De.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Le,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,De.__webglMultisampledFramebuffer);const be=T.texture.mipmaps;be&&be.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,De.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,De.__webglFramebuffer);for(let Le=0;Le<g.length;Le++){if(T.resolveDepthBuffer&&(T.depthBuffer&&(K|=i.DEPTH_BUFFER_BIT),T.stencilBuffer&&T.resolveStencilBuffer&&(K|=i.STENCIL_BUFFER_BIT)),he){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,De.__webglColorRenderbuffer[Le]);const ee=n.get(g[Le]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,ee,0)}i.blitFramebuffer(0,0,F,q,0,0,F,q,K,i.NEAREST),l===!0&&(ae.length=0,Re.length=0,ae.push(i.COLOR_ATTACHMENT0+Le),T.depthBuffer&&T.resolveDepthBuffer===!1&&(ae.push(V),Re.push(V),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,Re)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ae))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),he)for(let Le=0;Le<g.length;Le++){t.bindFramebuffer(i.FRAMEBUFFER,De.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Le,i.RENDERBUFFER,De.__webglColorRenderbuffer[Le]);const ee=n.get(g[Le]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,De.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Le,i.TEXTURE_2D,ee,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,De.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.resolveDepthBuffer===!1&&l){const g=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[g])}}}function ie(T){return Math.min(r.maxSamples,T.samples)}function Fe(T){const g=n.get(T);return T.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&g.__useRenderToTexture!==!1}function Ee(T){const g=a.render.frame;h.get(T)!==g&&(h.set(T,g),T.update())}function Ve(T,g){const F=T.colorSpace,q=T.format,K=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||F!==Ei&&F!==Pn&&(Qe.getTransfer(F)===st?(q!==$t||K!==an)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",F)),g}function lt(T){return typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement?(c.width=T.naturalWidth||T.width,c.height=T.naturalHeight||T.height):typeof VideoFrame<"u"&&T instanceof VideoFrame?(c.width=T.displayWidth,c.height=T.displayHeight):(c.width=T.width,c.height=T.height),c}this.allocateTextureUnit=B,this.resetTextureUnits=H,this.setTexture2D=J,this.setTexture2DArray=W,this.setTexture3D=ne,this.setTextureCube=G,this.rebindTextures=Se,this.setupRenderTarget=oe,this.updateRenderTargetMipmap=A,this.updateMultisampleRenderTarget=Ye,this.setupDepthRenderbuffer=de,this.setupFrameBufferTexture=Ue,this.useMultisampledRTT=Fe}function Hm(i,e){function t(n,r=Pn){let s;const a=Qe.getTransfer(r);if(n===an)return i.UNSIGNED_BYTE;if(n===Ta)return i.UNSIGNED_SHORT_4_4_4_4;if(n===ba)return i.UNSIGNED_SHORT_5_5_5_1;if(n===sl)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===il)return i.BYTE;if(n===rl)return i.SHORT;if(n===Xi)return i.UNSIGNED_SHORT;if(n===Ea)return i.INT;if(n===Kn)return i.UNSIGNED_INT;if(n===gn)return i.FLOAT;if(n===Zi)return i.HALF_FLOAT;if(n===al)return i.ALPHA;if(n===ol)return i.RGB;if(n===$t)return i.RGBA;if(n===Yi)return i.DEPTH_COMPONENT;if(n===ji)return i.DEPTH_STENCIL;if(n===ll)return i.RED;if(n===Aa)return i.RED_INTEGER;if(n===cl)return i.RG;if(n===wa)return i.RG_INTEGER;if(n===Ra)return i.RGBA_INTEGER;if(n===Rr||n===Cr||n===Pr||n===Dr)if(a===st)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Rr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Cr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Pr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Dr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Rr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Cr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Pr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Dr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Gs||n===Ws||n===Xs||n===qs)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Gs)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ws)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Xs)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===qs)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Ys||n===js||n===Ks)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Ys||n===js)return a===st?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Ks)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Zs||n===$s||n===Js||n===Qs||n===ea||n===ta||n===na||n===ia||n===ra||n===sa||n===aa||n===oa||n===la||n===ca)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Zs)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===$s)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Js)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Qs)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ea)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ta)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===na)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ia)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ra)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===sa)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===aa)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===oa)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===la)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ca)return a===st?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Lr||n===ha||n===ua)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Lr)return a===st?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===ha)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ua)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===hl||n===fa||n===da||n===pa)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Lr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===fa)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===da)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===pa)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===qi?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const Vm=`
3803
+ }`;function Vm(i,e,t){let n=new Ua;const r=new Xe,s=new Xe,a=new pt,o=new ru({depthPacking:mh}),l=new su,c={},h=t.maxTextureSize,u={[Sn]:It,[It]:Sn,[_n]:_n},d=new Un({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Xe},radius:{value:4}},vertexShader:km,fragmentShader:Hm}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const _=new Qt;_.setAttribute("position",new rn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new $t(_,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=sl;let f=this.type;this.render=function(w,R,L){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||w.length===0)return;const y=i.getRenderTarget(),x=i.getActiveCubeFace(),C=i.getActiveMipmapLevel(),H=i.state;H.setBlending(Dn),H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);const B=f!==dn&&this.type===dn,j=f===dn&&this.type!==dn;for(let J=0,W=w.length;J<W;J++){const ne=w[J],G=ne.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",ne,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;r.copy(G.mapSize);const fe=G.getFrameExtents();if(r.multiply(fe),s.copy(G.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/fe.x),r.x=s.x*fe.x,G.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/fe.y),r.y=s.y*fe.y,G.mapSize.y=s.y)),G.map===null||B===!0||j===!0){const se=this.type!==dn?{minFilter:Jt,magFilter:Jt}:{};G.map!==null&&G.map.dispose(),G.map=new $n(r.x,r.y,se),G.map.texture.name=ne.name+".shadowMap",G.camera.updateProjectionMatrix()}i.setRenderTarget(G.map),i.clear();const xe=G.getViewportCount();for(let se=0;se<xe;se++){const We=G.getViewport(se);a.set(s.x*We.x,s.y*We.y,s.x*We.z,s.y*We.w),H.viewport(a),G.updateMatrices(ne,se),n=G.getFrustum(),S(R,L,G.camera,ne,this.type)}G.isPointLightShadow!==!0&&this.type===dn&&b(G,L),G.needsUpdate=!1}f=this.type,m.needsUpdate=!1,i.setRenderTarget(y,x,C)};function b(w,R){const L=e.update(v);d.defines.VSM_SAMPLES!==w.blurSamples&&(d.defines.VSM_SAMPLES=w.blurSamples,p.defines.VSM_SAMPLES=w.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new $n(r.x,r.y)),d.uniforms.shadow_pass.value=w.map.texture,d.uniforms.resolution.value=w.mapSize,d.uniforms.radius.value=w.radius,i.setRenderTarget(w.mapPass),i.clear(),i.renderBufferDirect(R,null,L,d,v,null),p.uniforms.shadow_pass.value=w.mapPass.texture,p.uniforms.resolution.value=w.mapSize,p.uniforms.radius.value=w.radius,i.setRenderTarget(w.map),i.clear(),i.renderBufferDirect(R,null,L,p,v,null)}function E(w,R,L,y){let x=null;const C=L.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(C!==void 0)x=C;else if(x=L.isPointLight===!0?l:o,i.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0||R.alphaToCoverage===!0){const H=x.uuid,B=R.uuid;let j=c[H];j===void 0&&(j={},c[H]=j);let J=j[B];J===void 0&&(J=x.clone(),j[B]=J,R.addEventListener("dispose",D)),x=J}if(x.visible=R.visible,x.wireframe=R.wireframe,y===dn?x.side=R.shadowSide!==null?R.shadowSide:R.side:x.side=R.shadowSide!==null?R.shadowSide:u[R.side],x.alphaMap=R.alphaMap,x.alphaTest=R.alphaToCoverage===!0?.5:R.alphaTest,x.map=R.map,x.clipShadows=R.clipShadows,x.clippingPlanes=R.clippingPlanes,x.clipIntersection=R.clipIntersection,x.displacementMap=R.displacementMap,x.displacementScale=R.displacementScale,x.displacementBias=R.displacementBias,x.wireframeLinewidth=R.wireframeLinewidth,x.linewidth=R.linewidth,L.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const H=i.properties.get(x);H.light=L}return x}function S(w,R,L,y,x){if(w.visible===!1)return;if(w.layers.test(R.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&x===dn)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,w.matrixWorld);const B=e.update(w),j=w.material;if(Array.isArray(j)){const J=B.groups;for(let W=0,ne=J.length;W<ne;W++){const G=J[W],fe=j[G.materialIndex];if(fe&&fe.visible){const xe=E(w,fe,y,x);w.onBeforeShadow(i,w,R,L,B,xe,G),i.renderBufferDirect(L,null,B,xe,w,G),w.onAfterShadow(i,w,R,L,B,xe,G)}}}else if(j.visible){const J=E(w,j,y,x);w.onBeforeShadow(i,w,R,L,B,J,null),i.renderBufferDirect(L,null,B,J,w,null),w.onAfterShadow(i,w,R,L,B,J,null)}}const H=w.children;for(let B=0,j=H.length;B<j;B++)S(H[B],R,L,y,x)}function D(w){w.target.removeEventListener("dispose",D);for(const L in c){const y=c[L],x=w.target.uuid;x in y&&(y[x].dispose(),delete y[x])}}}const Gm={[Fs]:Os,[Bs]:Hs,[zs]:Vs,[Si]:ks,[Os]:Fs,[Hs]:Bs,[Vs]:zs,[ks]:Si};function Wm(i,e){function t(){let P=!1;const pe=new pt;let te=null;const ye=new pt(0,0,0,0);return{setMask:function(O){te!==O&&!P&&(i.colorMask(O,O,O,O),te=O)},setLocked:function(O){P=O},setClear:function(O,X,ue,Be,at){at===!0&&(O*=Be,X*=Be,ue*=Be),pe.set(O,X,ue,Be),ye.equals(pe)===!1&&(i.clearColor(O,X,ue,Be),ye.copy(pe))},reset:function(){P=!1,te=null,ye.set(-1,0,0,0)}}}function n(){let P=!1,pe=!1,te=null,ye=null,O=null;return{setReversed:function(X){if(pe!==X){const ue=e.get("EXT_clip_control");X?ue.clipControlEXT(ue.LOWER_LEFT_EXT,ue.ZERO_TO_ONE_EXT):ue.clipControlEXT(ue.LOWER_LEFT_EXT,ue.NEGATIVE_ONE_TO_ONE_EXT),pe=X;const Be=O;O=null,this.setClear(Be)}},getReversed:function(){return pe},setTest:function(X){X?ve(i.DEPTH_TEST):Ue(i.DEPTH_TEST)},setMask:function(X){te!==X&&!P&&(i.depthMask(X),te=X)},setFunc:function(X){if(pe&&(X=Gm[X]),ye!==X){switch(X){case Fs:i.depthFunc(i.NEVER);break;case Os:i.depthFunc(i.ALWAYS);break;case Bs:i.depthFunc(i.LESS);break;case Si:i.depthFunc(i.LEQUAL);break;case zs:i.depthFunc(i.EQUAL);break;case ks:i.depthFunc(i.GEQUAL);break;case Hs:i.depthFunc(i.GREATER);break;case Vs:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}ye=X}},setLocked:function(X){P=X},setClear:function(X){O!==X&&(pe&&(X=1-X),i.clearDepth(X),O=X)},reset:function(){P=!1,te=null,ye=null,O=null,pe=!1}}}function r(){let P=!1,pe=null,te=null,ye=null,O=null,X=null,ue=null,Be=null,at=null;return{setTest:function(et){P||(et?ve(i.STENCIL_TEST):Ue(i.STENCIL_TEST))},setMask:function(et){pe!==et&&!P&&(i.stencilMask(et),pe=et)},setFunc:function(et,Ce,_e){(te!==et||ye!==Ce||O!==_e)&&(i.stencilFunc(et,Ce,_e),te=et,ye=Ce,O=_e)},setOp:function(et,Ce,_e){(X!==et||ue!==Ce||Be!==_e)&&(i.stencilOp(et,Ce,_e),X=et,ue=Ce,Be=_e)},setLocked:function(et){P=et},setClear:function(et){at!==et&&(i.clearStencil(et),at=et)},reset:function(){P=!1,pe=null,te=null,ye=null,O=null,X=null,ue=null,Be=null,at=null}}}const s=new t,a=new n,o=new r,l=new WeakMap,c=new WeakMap;let h={},u={},d=new WeakMap,p=[],_=null,v=!1,m=null,f=null,b=null,E=null,S=null,D=null,w=null,R=new Ke(0,0,0),L=0,y=!1,x=null,C=null,H=null,B=null,j=null;const J=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let W=!1,ne=0;const G=i.getParameter(i.VERSION);G.indexOf("WebGL")!==-1?(ne=parseFloat(/^WebGL (\d)/.exec(G)[1]),W=ne>=1):G.indexOf("OpenGL ES")!==-1&&(ne=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),W=ne>=2);let fe=null,xe={};const se=i.getParameter(i.SCISSOR_BOX),We=i.getParameter(i.VIEWPORT),Ze=new pt().fromArray(se),Y=new pt().fromArray(We);function le(P,pe,te,ye){const O=new Uint8Array(4),X=i.createTexture();i.bindTexture(P,X),i.texParameteri(P,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(P,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let ue=0;ue<te;ue++)P===i.TEXTURE_3D||P===i.TEXTURE_2D_ARRAY?i.texImage3D(pe,0,i.RGBA,1,1,ye,0,i.RGBA,i.UNSIGNED_BYTE,O):i.texImage2D(pe+ue,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,O);return X}const Pe={};Pe[i.TEXTURE_2D]=le(i.TEXTURE_2D,i.TEXTURE_2D,1),Pe[i.TEXTURE_CUBE_MAP]=le(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Pe[i.TEXTURE_2D_ARRAY]=le(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Pe[i.TEXTURE_3D]=le(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ve(i.DEPTH_TEST),a.setFunc(Si),Re(!1),Ye(Va),ve(i.CULL_FACE),A(Dn);function ve(P){h[P]!==!0&&(i.enable(P),h[P]=!0)}function Ue(P){h[P]!==!1&&(i.disable(P),h[P]=!1)}function Z(P,pe){return u[P]!==pe?(i.bindFramebuffer(P,pe),u[P]=pe,P===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=pe),P===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=pe),!0):!1}function Q(P,pe){let te=p,ye=!1;if(P){te=d.get(pe),te===void 0&&(te=[],d.set(pe,te));const O=P.textures;if(te.length!==O.length||te[0]!==i.COLOR_ATTACHMENT0){for(let X=0,ue=O.length;X<ue;X++)te[X]=i.COLOR_ATTACHMENT0+X;te.length=O.length,ye=!0}}else te[0]!==i.BACK&&(te[0]=i.BACK,ye=!0);ye&&i.drawBuffers(te)}function de(P){return _!==P?(i.useProgram(P),_=P,!0):!1}const Se={[Xn]:i.FUNC_ADD,[Hc]:i.FUNC_SUBTRACT,[Vc]:i.FUNC_REVERSE_SUBTRACT};Se[Gc]=i.MIN,Se[Wc]=i.MAX;const oe={[Xc]:i.ZERO,[qc]:i.ONE,[Yc]:i.SRC_COLOR,[Is]:i.SRC_ALPHA,[Qc]:i.SRC_ALPHA_SATURATE,[$c]:i.DST_COLOR,[Kc]:i.DST_ALPHA,[jc]:i.ONE_MINUS_SRC_COLOR,[Ns]:i.ONE_MINUS_SRC_ALPHA,[Jc]:i.ONE_MINUS_DST_COLOR,[Zc]:i.ONE_MINUS_DST_ALPHA,[eh]:i.CONSTANT_COLOR,[th]:i.ONE_MINUS_CONSTANT_COLOR,[nh]:i.CONSTANT_ALPHA,[ih]:i.ONE_MINUS_CONSTANT_ALPHA};function A(P,pe,te,ye,O,X,ue,Be,at,et){if(P===Dn){v===!0&&(Ue(i.BLEND),v=!1);return}if(v===!1&&(ve(i.BLEND),v=!0),P!==kc){if(P!==m||et!==y){if((f!==Xn||S!==Xn)&&(i.blendEquation(i.FUNC_ADD),f=Xn,S=Xn),et)switch(P){case vi:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Ga:i.blendFunc(i.ONE,i.ONE);break;case Wa:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Xa:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",P);break}else switch(P){case vi:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Ga:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case Wa:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Xa:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",P);break}b=null,E=null,D=null,w=null,R.set(0,0,0),L=0,m=P,y=et}return}O=O||pe,X=X||te,ue=ue||ye,(pe!==f||O!==S)&&(i.blendEquationSeparate(Se[pe],Se[O]),f=pe,S=O),(te!==b||ye!==E||X!==D||ue!==w)&&(i.blendFuncSeparate(oe[te],oe[ye],oe[X],oe[ue]),b=te,E=ye,D=X,w=ue),(Be.equals(R)===!1||at!==L)&&(i.blendColor(Be.r,Be.g,Be.b,at),R.copy(Be),L=at),m=P,y=!1}function ae(P,pe){P.side===_n?Ue(i.CULL_FACE):ve(i.CULL_FACE);let te=P.side===It;pe&&(te=!te),Re(te),P.blending===vi&&P.transparent===!1?A(Dn):A(P.blending,P.blendEquation,P.blendSrc,P.blendDst,P.blendEquationAlpha,P.blendSrcAlpha,P.blendDstAlpha,P.blendColor,P.blendAlpha,P.premultipliedAlpha),a.setFunc(P.depthFunc),a.setTest(P.depthTest),a.setMask(P.depthWrite),s.setMask(P.colorWrite);const ye=P.stencilWrite;o.setTest(ye),ye&&(o.setMask(P.stencilWriteMask),o.setFunc(P.stencilFunc,P.stencilRef,P.stencilFuncMask),o.setOp(P.stencilFail,P.stencilZFail,P.stencilZPass)),Fe(P.polygonOffset,P.polygonOffsetFactor,P.polygonOffsetUnits),P.alphaToCoverage===!0?ve(i.SAMPLE_ALPHA_TO_COVERAGE):Ue(i.SAMPLE_ALPHA_TO_COVERAGE)}function Re(P){x!==P&&(P?i.frontFace(i.CW):i.frontFace(i.CCW),x=P)}function Ye(P){P!==Oc?(ve(i.CULL_FACE),P!==C&&(P===Va?i.cullFace(i.BACK):P===Bc?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Ue(i.CULL_FACE),C=P}function ie(P){P!==H&&(W&&i.lineWidth(P),H=P)}function Fe(P,pe,te){P?(ve(i.POLYGON_OFFSET_FILL),(B!==pe||j!==te)&&(i.polygonOffset(pe,te),B=pe,j=te)):Ue(i.POLYGON_OFFSET_FILL)}function Ee(P){P?ve(i.SCISSOR_TEST):Ue(i.SCISSOR_TEST)}function Ve(P){P===void 0&&(P=i.TEXTURE0+J-1),fe!==P&&(i.activeTexture(P),fe=P)}function lt(P,pe,te){te===void 0&&(fe===null?te=i.TEXTURE0+J-1:te=fe);let ye=xe[te];ye===void 0&&(ye={type:void 0,texture:void 0},xe[te]=ye),(ye.type!==P||ye.texture!==pe)&&(fe!==te&&(i.activeTexture(te),fe=te),i.bindTexture(P,pe||Pe[P]),ye.type=P,ye.texture=pe)}function T(){const P=xe[fe];P!==void 0&&P.type!==void 0&&(i.bindTexture(P.type,null),P.type=void 0,P.texture=void 0)}function g(){try{i.compressedTexImage2D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function F(){try{i.compressedTexImage3D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function q(){try{i.texSubImage2D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function K(){try{i.texSubImage3D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function V(){try{i.compressedTexSubImage2D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function De(){try{i.compressedTexSubImage3D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function he(){try{i.texStorage2D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function Ae(){try{i.texStorage3D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function Le(){try{i.texImage2D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function ee(){try{i.texImage3D(...arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function Me(P){Ze.equals(P)===!1&&(i.scissor(P.x,P.y,P.z,P.w),Ze.copy(P))}function Oe(P){Y.equals(P)===!1&&(i.viewport(P.x,P.y,P.z,P.w),Y.copy(P))}function Ne(P,pe){let te=c.get(pe);te===void 0&&(te=new WeakMap,c.set(pe,te));let ye=te.get(P);ye===void 0&&(ye=i.getUniformBlockIndex(pe,P.name),te.set(P,ye))}function ce(P,pe){const ye=c.get(pe).get(P);l.get(pe)!==ye&&(i.uniformBlockBinding(pe,ye,P.__bindingPointIndex),l.set(pe,ye))}function ke(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),h={},fe=null,xe={},u={},d=new WeakMap,p=[],_=null,v=!1,m=null,f=null,b=null,E=null,S=null,D=null,w=null,R=new Ke(0,0,0),L=0,y=!1,x=null,C=null,H=null,B=null,j=null,Ze.set(0,0,i.canvas.width,i.canvas.height),Y.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ve,disable:Ue,bindFramebuffer:Z,drawBuffers:Q,useProgram:de,setBlending:A,setMaterial:ae,setFlipSided:Re,setCullFace:Ye,setLineWidth:ie,setPolygonOffset:Fe,setScissorTest:Ee,activeTexture:Ve,bindTexture:lt,unbindTexture:T,compressedTexImage2D:g,compressedTexImage3D:F,texImage2D:Le,texImage3D:ee,updateUBOMapping:Ne,uniformBlockBinding:ce,texStorage2D:he,texStorage3D:Ae,texSubImage2D:q,texSubImage3D:K,compressedTexSubImage2D:V,compressedTexSubImage3D:De,scissor:Me,viewport:Oe,reset:ke}}function Xm(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Xe,h=new WeakMap;let u;const d=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(T,g){return p?new OffscreenCanvas(T,g):$i("canvas")}function v(T,g,F){let q=1;const K=lt(T);if((K.width>F||K.height>F)&&(q=F/Math.max(K.width,K.height)),q<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){const V=Math.floor(q*K.width),De=Math.floor(q*K.height);u===void 0&&(u=_(V,De));const he=g?_(V,De):u;return he.width=V,he.height=De,he.getContext("2d").drawImage(T,0,0,V,De),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+K.width+"x"+K.height+") to ("+V+"x"+De+")."),he}else return"data"in T&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+K.width+"x"+K.height+")."),T;return T}function m(T){return T.generateMipmaps}function f(T){i.generateMipmap(T)}function b(T){return T.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:T.isWebGL3DRenderTarget?i.TEXTURE_3D:T.isWebGLArrayRenderTarget||T.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function E(T,g,F,q,K=!1){if(T!==null){if(i[T]!==void 0)return i[T];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let V=g;if(g===i.RED&&(F===i.FLOAT&&(V=i.R32F),F===i.HALF_FLOAT&&(V=i.R16F),F===i.UNSIGNED_BYTE&&(V=i.R8)),g===i.RED_INTEGER&&(F===i.UNSIGNED_BYTE&&(V=i.R8UI),F===i.UNSIGNED_SHORT&&(V=i.R16UI),F===i.UNSIGNED_INT&&(V=i.R32UI),F===i.BYTE&&(V=i.R8I),F===i.SHORT&&(V=i.R16I),F===i.INT&&(V=i.R32I)),g===i.RG&&(F===i.FLOAT&&(V=i.RG32F),F===i.HALF_FLOAT&&(V=i.RG16F),F===i.UNSIGNED_BYTE&&(V=i.RG8)),g===i.RG_INTEGER&&(F===i.UNSIGNED_BYTE&&(V=i.RG8UI),F===i.UNSIGNED_SHORT&&(V=i.RG16UI),F===i.UNSIGNED_INT&&(V=i.RG32UI),F===i.BYTE&&(V=i.RG8I),F===i.SHORT&&(V=i.RG16I),F===i.INT&&(V=i.RG32I)),g===i.RGB_INTEGER&&(F===i.UNSIGNED_BYTE&&(V=i.RGB8UI),F===i.UNSIGNED_SHORT&&(V=i.RGB16UI),F===i.UNSIGNED_INT&&(V=i.RGB32UI),F===i.BYTE&&(V=i.RGB8I),F===i.SHORT&&(V=i.RGB16I),F===i.INT&&(V=i.RGB32I)),g===i.RGBA_INTEGER&&(F===i.UNSIGNED_BYTE&&(V=i.RGBA8UI),F===i.UNSIGNED_SHORT&&(V=i.RGBA16UI),F===i.UNSIGNED_INT&&(V=i.RGBA32UI),F===i.BYTE&&(V=i.RGBA8I),F===i.SHORT&&(V=i.RGBA16I),F===i.INT&&(V=i.RGBA32I)),g===i.RGB&&F===i.UNSIGNED_INT_5_9_9_9_REV&&(V=i.RGB9_E5),g===i.RGBA){const De=K?Hr:Qe.getTransfer(q);F===i.FLOAT&&(V=i.RGBA32F),F===i.HALF_FLOAT&&(V=i.RGBA16F),F===i.UNSIGNED_BYTE&&(V=De===rt?i.SRGB8_ALPHA8:i.RGBA8),F===i.UNSIGNED_SHORT_4_4_4_4&&(V=i.RGBA4),F===i.UNSIGNED_SHORT_5_5_5_1&&(V=i.RGB5_A1)}return(V===i.R16F||V===i.R32F||V===i.RG16F||V===i.RG32F||V===i.RGBA16F||V===i.RGBA32F)&&e.get("EXT_color_buffer_float"),V}function S(T,g){let F;return T?g===null||g===Kn||g===ji?F=i.DEPTH24_STENCIL8:g===gn?F=i.DEPTH32F_STENCIL8:g===Yi&&(F=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):g===null||g===Kn||g===ji?F=i.DEPTH_COMPONENT24:g===gn?F=i.DEPTH_COMPONENT32F:g===Yi&&(F=i.DEPTH_COMPONENT16),F}function D(T,g){return m(T)===!0||T.isFramebufferTexture&&T.minFilter!==Jt&&T.minFilter!==nn?Math.log2(Math.max(g.width,g.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?g.mipmaps.length:1}function w(T){const g=T.target;g.removeEventListener("dispose",w),L(g),g.isVideoTexture&&h.delete(g)}function R(T){const g=T.target;g.removeEventListener("dispose",R),x(g)}function L(T){const g=n.get(T);if(g.__webglInit===void 0)return;const F=T.source,q=d.get(F);if(q){const K=q[g.__cacheKey];K.usedTimes--,K.usedTimes===0&&y(T),Object.keys(q).length===0&&d.delete(F)}n.remove(T)}function y(T){const g=n.get(T);i.deleteTexture(g.__webglTexture);const F=T.source,q=d.get(F);delete q[g.__cacheKey],a.memory.textures--}function x(T){const g=n.get(T);if(T.depthTexture&&(T.depthTexture.dispose(),n.remove(T.depthTexture)),T.isWebGLCubeRenderTarget)for(let q=0;q<6;q++){if(Array.isArray(g.__webglFramebuffer[q]))for(let K=0;K<g.__webglFramebuffer[q].length;K++)i.deleteFramebuffer(g.__webglFramebuffer[q][K]);else i.deleteFramebuffer(g.__webglFramebuffer[q]);g.__webglDepthbuffer&&i.deleteRenderbuffer(g.__webglDepthbuffer[q])}else{if(Array.isArray(g.__webglFramebuffer))for(let q=0;q<g.__webglFramebuffer.length;q++)i.deleteFramebuffer(g.__webglFramebuffer[q]);else i.deleteFramebuffer(g.__webglFramebuffer);if(g.__webglDepthbuffer&&i.deleteRenderbuffer(g.__webglDepthbuffer),g.__webglMultisampledFramebuffer&&i.deleteFramebuffer(g.__webglMultisampledFramebuffer),g.__webglColorRenderbuffer)for(let q=0;q<g.__webglColorRenderbuffer.length;q++)g.__webglColorRenderbuffer[q]&&i.deleteRenderbuffer(g.__webglColorRenderbuffer[q]);g.__webglDepthRenderbuffer&&i.deleteRenderbuffer(g.__webglDepthRenderbuffer)}const F=T.textures;for(let q=0,K=F.length;q<K;q++){const V=n.get(F[q]);V.__webglTexture&&(i.deleteTexture(V.__webglTexture),a.memory.textures--),n.remove(F[q])}n.remove(T)}let C=0;function H(){C=0}function B(){const T=C;return T>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+r.maxTextures),C+=1,T}function j(T){const g=[];return g.push(T.wrapS),g.push(T.wrapT),g.push(T.wrapR||0),g.push(T.magFilter),g.push(T.minFilter),g.push(T.anisotropy),g.push(T.internalFormat),g.push(T.format),g.push(T.type),g.push(T.generateMipmaps),g.push(T.premultiplyAlpha),g.push(T.flipY),g.push(T.unpackAlignment),g.push(T.colorSpace),g.join()}function J(T,g){const F=n.get(T);if(T.isVideoTexture&&Ee(T),T.isRenderTargetTexture===!1&&T.version>0&&F.__version!==T.version){const q=T.image;if(q===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Pe(F,T,g);return}}t.bindTexture(i.TEXTURE_2D,F.__webglTexture,i.TEXTURE0+g)}function W(T,g){const F=n.get(T);if(T.version>0&&F.__version!==T.version){Pe(F,T,g);return}t.bindTexture(i.TEXTURE_2D_ARRAY,F.__webglTexture,i.TEXTURE0+g)}function ne(T,g){const F=n.get(T);if(T.version>0&&F.__version!==T.version){Pe(F,T,g);return}t.bindTexture(i.TEXTURE_3D,F.__webglTexture,i.TEXTURE0+g)}function G(T,g){const F=n.get(T);if(T.version>0&&F.__version!==T.version){ve(F,T,g);return}t.bindTexture(i.TEXTURE_CUBE_MAP,F.__webglTexture,i.TEXTURE0+g)}const fe={[kr]:i.REPEAT,[Yn]:i.CLAMP_TO_EDGE,[Xs]:i.MIRRORED_REPEAT},xe={[Jt]:i.NEAREST,[dh]:i.NEAREST_MIPMAP_NEAREST,[ir]:i.NEAREST_MIPMAP_LINEAR,[nn]:i.LINEAR,[Qr]:i.LINEAR_MIPMAP_NEAREST,[jn]:i.LINEAR_MIPMAP_LINEAR},se={[gh]:i.NEVER,[Eh]:i.ALWAYS,[vh]:i.LESS,[_l]:i.LEQUAL,[xh]:i.EQUAL,[yh]:i.GEQUAL,[Mh]:i.GREATER,[Sh]:i.NOTEQUAL};function We(T,g){if(g.type===gn&&e.has("OES_texture_float_linear")===!1&&(g.magFilter===nn||g.magFilter===Qr||g.magFilter===ir||g.magFilter===jn||g.minFilter===nn||g.minFilter===Qr||g.minFilter===ir||g.minFilter===jn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(T,i.TEXTURE_WRAP_S,fe[g.wrapS]),i.texParameteri(T,i.TEXTURE_WRAP_T,fe[g.wrapT]),(T===i.TEXTURE_3D||T===i.TEXTURE_2D_ARRAY)&&i.texParameteri(T,i.TEXTURE_WRAP_R,fe[g.wrapR]),i.texParameteri(T,i.TEXTURE_MAG_FILTER,xe[g.magFilter]),i.texParameteri(T,i.TEXTURE_MIN_FILTER,xe[g.minFilter]),g.compareFunction&&(i.texParameteri(T,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(T,i.TEXTURE_COMPARE_FUNC,se[g.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(g.magFilter===Jt||g.minFilter!==ir&&g.minFilter!==jn||g.type===gn&&e.has("OES_texture_float_linear")===!1)return;if(g.anisotropy>1||n.get(g).__currentAnisotropy){const F=e.get("EXT_texture_filter_anisotropic");i.texParameterf(T,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(g.anisotropy,r.getMaxAnisotropy())),n.get(g).__currentAnisotropy=g.anisotropy}}}function Ze(T,g){let F=!1;T.__webglInit===void 0&&(T.__webglInit=!0,g.addEventListener("dispose",w));const q=g.source;let K=d.get(q);K===void 0&&(K={},d.set(q,K));const V=j(g);if(V!==T.__cacheKey){K[V]===void 0&&(K[V]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,F=!0),K[V].usedTimes++;const De=K[T.__cacheKey];De!==void 0&&(K[T.__cacheKey].usedTimes--,De.usedTimes===0&&y(g)),T.__cacheKey=V,T.__webglTexture=K[V].texture}return F}function Y(T,g,F){return Math.floor(Math.floor(T/F)/g)}function le(T,g,F,q){const V=T.updateRanges;if(V.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,g.width,g.height,F,q,g.data);else{V.sort((ee,Me)=>ee.start-Me.start);let De=0;for(let ee=1;ee<V.length;ee++){const Me=V[De],Oe=V[ee],Ne=Me.start+Me.count,ce=Y(Oe.start,g.width,4),ke=Y(Me.start,g.width,4);Oe.start<=Ne+1&&ce===ke&&Y(Oe.start+Oe.count-1,g.width,4)===ce?Me.count=Math.max(Me.count,Oe.start+Oe.count-Me.start):(++De,V[De]=Oe)}V.length=De+1;const he=i.getParameter(i.UNPACK_ROW_LENGTH),Ae=i.getParameter(i.UNPACK_SKIP_PIXELS),Le=i.getParameter(i.UNPACK_SKIP_ROWS);i.pixelStorei(i.UNPACK_ROW_LENGTH,g.width);for(let ee=0,Me=V.length;ee<Me;ee++){const Oe=V[ee],Ne=Math.floor(Oe.start/4),ce=Math.ceil(Oe.count/4),ke=Ne%g.width,P=Math.floor(Ne/g.width),pe=ce,te=1;i.pixelStorei(i.UNPACK_SKIP_PIXELS,ke),i.pixelStorei(i.UNPACK_SKIP_ROWS,P),t.texSubImage2D(i.TEXTURE_2D,0,ke,P,pe,te,F,q,g.data)}T.clearUpdateRanges(),i.pixelStorei(i.UNPACK_ROW_LENGTH,he),i.pixelStorei(i.UNPACK_SKIP_PIXELS,Ae),i.pixelStorei(i.UNPACK_SKIP_ROWS,Le)}}function Pe(T,g,F){let q=i.TEXTURE_2D;(g.isDataArrayTexture||g.isCompressedArrayTexture)&&(q=i.TEXTURE_2D_ARRAY),g.isData3DTexture&&(q=i.TEXTURE_3D);const K=Ze(T,g),V=g.source;t.bindTexture(q,T.__webglTexture,i.TEXTURE0+F);const De=n.get(V);if(V.version!==De.__version||K===!0){t.activeTexture(i.TEXTURE0+F);const he=Qe.getPrimaries(Qe.workingColorSpace),Ae=g.colorSpace===Pn?null:Qe.getPrimaries(g.colorSpace),Le=g.colorSpace===Pn||he===Ae?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,g.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,g.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Le);let ee=v(g.image,!1,r.maxTextureSize);ee=Ve(g,ee);const Me=s.convert(g.format,g.colorSpace),Oe=s.convert(g.type);let Ne=E(g.internalFormat,Me,Oe,g.colorSpace,g.isVideoTexture);We(q,g);let ce;const ke=g.mipmaps,P=g.isVideoTexture!==!0,pe=De.__version===void 0||K===!0,te=V.dataReady,ye=D(g,ee);if(g.isDepthTexture)Ne=S(g.format===Zi,g.type),pe&&(P?t.texStorage2D(i.TEXTURE_2D,1,Ne,ee.width,ee.height):t.texImage2D(i.TEXTURE_2D,0,Ne,ee.width,ee.height,0,Me,Oe,null));else if(g.isDataTexture)if(ke.length>0){P&&pe&&t.texStorage2D(i.TEXTURE_2D,ye,Ne,ke[0].width,ke[0].height);for(let O=0,X=ke.length;O<X;O++)ce=ke[O],P?te&&t.texSubImage2D(i.TEXTURE_2D,O,0,0,ce.width,ce.height,Me,Oe,ce.data):t.texImage2D(i.TEXTURE_2D,O,Ne,ce.width,ce.height,0,Me,Oe,ce.data);g.generateMipmaps=!1}else P?(pe&&t.texStorage2D(i.TEXTURE_2D,ye,Ne,ee.width,ee.height),te&&le(g,ee,Me,Oe)):t.texImage2D(i.TEXTURE_2D,0,Ne,ee.width,ee.height,0,Me,Oe,ee.data);else if(g.isCompressedTexture)if(g.isCompressedArrayTexture){P&&pe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ye,Ne,ke[0].width,ke[0].height,ee.depth);for(let O=0,X=ke.length;O<X;O++)if(ce=ke[O],g.format!==Zt)if(Me!==null)if(P){if(te)if(g.layerUpdates.size>0){const ue=Eo(ce.width,ce.height,g.format,g.type);for(const Be of g.layerUpdates){const at=ce.data.subarray(Be*ue/ce.data.BYTES_PER_ELEMENT,(Be+1)*ue/ce.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,O,0,0,Be,ce.width,ce.height,1,Me,at)}g.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,O,0,0,0,ce.width,ce.height,ee.depth,Me,ce.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,O,Ne,ce.width,ce.height,ee.depth,0,ce.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else P?te&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,O,0,0,0,ce.width,ce.height,ee.depth,Me,Oe,ce.data):t.texImage3D(i.TEXTURE_2D_ARRAY,O,Ne,ce.width,ce.height,ee.depth,0,Me,Oe,ce.data)}else{P&&pe&&t.texStorage2D(i.TEXTURE_2D,ye,Ne,ke[0].width,ke[0].height);for(let O=0,X=ke.length;O<X;O++)ce=ke[O],g.format!==Zt?Me!==null?P?te&&t.compressedTexSubImage2D(i.TEXTURE_2D,O,0,0,ce.width,ce.height,Me,ce.data):t.compressedTexImage2D(i.TEXTURE_2D,O,Ne,ce.width,ce.height,0,ce.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):P?te&&t.texSubImage2D(i.TEXTURE_2D,O,0,0,ce.width,ce.height,Me,Oe,ce.data):t.texImage2D(i.TEXTURE_2D,O,Ne,ce.width,ce.height,0,Me,Oe,ce.data)}else if(g.isDataArrayTexture)if(P){if(pe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ye,Ne,ee.width,ee.height,ee.depth),te)if(g.layerUpdates.size>0){const O=Eo(ee.width,ee.height,g.format,g.type);for(const X of g.layerUpdates){const ue=ee.data.subarray(X*O/ee.data.BYTES_PER_ELEMENT,(X+1)*O/ee.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,X,ee.width,ee.height,1,Me,Oe,ue)}g.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,ee.width,ee.height,ee.depth,Me,Oe,ee.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Ne,ee.width,ee.height,ee.depth,0,Me,Oe,ee.data);else if(g.isData3DTexture)P?(pe&&t.texStorage3D(i.TEXTURE_3D,ye,Ne,ee.width,ee.height,ee.depth),te&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,ee.width,ee.height,ee.depth,Me,Oe,ee.data)):t.texImage3D(i.TEXTURE_3D,0,Ne,ee.width,ee.height,ee.depth,0,Me,Oe,ee.data);else if(g.isFramebufferTexture){if(pe)if(P)t.texStorage2D(i.TEXTURE_2D,ye,Ne,ee.width,ee.height);else{let O=ee.width,X=ee.height;for(let ue=0;ue<ye;ue++)t.texImage2D(i.TEXTURE_2D,ue,Ne,O,X,0,Me,Oe,null),O>>=1,X>>=1}}else if(ke.length>0){if(P&&pe){const O=lt(ke[0]);t.texStorage2D(i.TEXTURE_2D,ye,Ne,O.width,O.height)}for(let O=0,X=ke.length;O<X;O++)ce=ke[O],P?te&&t.texSubImage2D(i.TEXTURE_2D,O,0,0,Me,Oe,ce):t.texImage2D(i.TEXTURE_2D,O,Ne,Me,Oe,ce);g.generateMipmaps=!1}else if(P){if(pe){const O=lt(ee);t.texStorage2D(i.TEXTURE_2D,ye,Ne,O.width,O.height)}te&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Me,Oe,ee)}else t.texImage2D(i.TEXTURE_2D,0,Ne,Me,Oe,ee);m(g)&&f(q),De.__version=V.version,g.onUpdate&&g.onUpdate(g)}T.__version=g.version}function ve(T,g,F){if(g.image.length!==6)return;const q=Ze(T,g),K=g.source;t.bindTexture(i.TEXTURE_CUBE_MAP,T.__webglTexture,i.TEXTURE0+F);const V=n.get(K);if(K.version!==V.__version||q===!0){t.activeTexture(i.TEXTURE0+F);const De=Qe.getPrimaries(Qe.workingColorSpace),he=g.colorSpace===Pn?null:Qe.getPrimaries(g.colorSpace),Ae=g.colorSpace===Pn||De===he?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,g.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,g.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ae);const Le=g.isCompressedTexture||g.image[0].isCompressedTexture,ee=g.image[0]&&g.image[0].isDataTexture,Me=[];for(let X=0;X<6;X++)!Le&&!ee?Me[X]=v(g.image[X],!0,r.maxCubemapSize):Me[X]=ee?g.image[X].image:g.image[X],Me[X]=Ve(g,Me[X]);const Oe=Me[0],Ne=s.convert(g.format,g.colorSpace),ce=s.convert(g.type),ke=E(g.internalFormat,Ne,ce,g.colorSpace),P=g.isVideoTexture!==!0,pe=V.__version===void 0||q===!0,te=K.dataReady;let ye=D(g,Oe);We(i.TEXTURE_CUBE_MAP,g);let O;if(Le){P&&pe&&t.texStorage2D(i.TEXTURE_CUBE_MAP,ye,ke,Oe.width,Oe.height);for(let X=0;X<6;X++){O=Me[X].mipmaps;for(let ue=0;ue<O.length;ue++){const Be=O[ue];g.format!==Zt?Ne!==null?P?te&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue,0,0,Be.width,Be.height,Ne,Be.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue,ke,Be.width,Be.height,0,Be.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):P?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue,0,0,Be.width,Be.height,Ne,ce,Be.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue,ke,Be.width,Be.height,0,Ne,ce,Be.data)}}}else{if(O=g.mipmaps,P&&pe){O.length>0&&ye++;const X=lt(Me[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ye,ke,X.width,X.height)}for(let X=0;X<6;X++)if(ee){P?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,0,0,Me[X].width,Me[X].height,Ne,ce,Me[X].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,ke,Me[X].width,Me[X].height,0,Ne,ce,Me[X].data);for(let ue=0;ue<O.length;ue++){const at=O[ue].image[X].image;P?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue+1,0,0,at.width,at.height,Ne,ce,at.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue+1,ke,at.width,at.height,0,Ne,ce,at.data)}}else{P?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,0,0,Ne,ce,Me[X]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,ke,Ne,ce,Me[X]);for(let ue=0;ue<O.length;ue++){const Be=O[ue];P?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue+1,0,0,Ne,ce,Be.image[X]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,ue+1,ke,Ne,ce,Be.image[X])}}}m(g)&&f(i.TEXTURE_CUBE_MAP),V.__version=K.version,g.onUpdate&&g.onUpdate(g)}T.__version=g.version}function Ue(T,g,F,q,K,V){const De=s.convert(F.format,F.colorSpace),he=s.convert(F.type),Ae=E(F.internalFormat,De,he,F.colorSpace),Le=n.get(g),ee=n.get(F);if(ee.__renderTarget=g,!Le.__hasExternalTextures){const Me=Math.max(1,g.width>>V),Oe=Math.max(1,g.height>>V);K===i.TEXTURE_3D||K===i.TEXTURE_2D_ARRAY?t.texImage3D(K,V,Ae,Me,Oe,g.depth,0,De,he,null):t.texImage2D(K,V,Ae,Me,Oe,0,De,he,null)}t.bindFramebuffer(i.FRAMEBUFFER,T),Fe(g)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,q,K,ee.__webglTexture,0,ie(g)):(K===i.TEXTURE_2D||K>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,q,K,ee.__webglTexture,V),t.bindFramebuffer(i.FRAMEBUFFER,null)}function Z(T,g,F){if(i.bindRenderbuffer(i.RENDERBUFFER,T),g.depthBuffer){const q=g.depthTexture,K=q&&q.isDepthTexture?q.type:null,V=S(g.stencilBuffer,K),De=g.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,he=ie(g);Fe(g)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,he,V,g.width,g.height):F?i.renderbufferStorageMultisample(i.RENDERBUFFER,he,V,g.width,g.height):i.renderbufferStorage(i.RENDERBUFFER,V,g.width,g.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,De,i.RENDERBUFFER,T)}else{const q=g.textures;for(let K=0;K<q.length;K++){const V=q[K],De=s.convert(V.format,V.colorSpace),he=s.convert(V.type),Ae=E(V.internalFormat,De,he,V.colorSpace),Le=ie(g);F&&Fe(g)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Le,Ae,g.width,g.height):Fe(g)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Le,Ae,g.width,g.height):i.renderbufferStorage(i.RENDERBUFFER,Ae,g.width,g.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Q(T,g){if(g&&g.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,T),!(g.depthTexture&&g.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const q=n.get(g.depthTexture);q.__renderTarget=g,(!q.__webglTexture||g.depthTexture.image.width!==g.width||g.depthTexture.image.height!==g.height)&&(g.depthTexture.image.width=g.width,g.depthTexture.image.height=g.height,g.depthTexture.needsUpdate=!0),J(g.depthTexture,0);const K=q.__webglTexture,V=ie(g);if(g.depthTexture.format===Ki)Fe(g)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,K,0,V):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,K,0);else if(g.depthTexture.format===Zi)Fe(g)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,K,0,V):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,K,0);else throw new Error("Unknown depthTexture format")}function de(T){const g=n.get(T),F=T.isWebGLCubeRenderTarget===!0;if(g.__boundDepthTexture!==T.depthTexture){const q=T.depthTexture;if(g.__depthDisposeCallback&&g.__depthDisposeCallback(),q){const K=()=>{delete g.__boundDepthTexture,delete g.__depthDisposeCallback,q.removeEventListener("dispose",K)};q.addEventListener("dispose",K),g.__depthDisposeCallback=K}g.__boundDepthTexture=q}if(T.depthTexture&&!g.__autoAllocateDepthBuffer){if(F)throw new Error("target.depthTexture not supported in Cube render targets");const q=T.texture.mipmaps;q&&q.length>0?Q(g.__webglFramebuffer[0],T):Q(g.__webglFramebuffer,T)}else if(F){g.__webglDepthbuffer=[];for(let q=0;q<6;q++)if(t.bindFramebuffer(i.FRAMEBUFFER,g.__webglFramebuffer[q]),g.__webglDepthbuffer[q]===void 0)g.__webglDepthbuffer[q]=i.createRenderbuffer(),Z(g.__webglDepthbuffer[q],T,!1);else{const K=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,V=g.__webglDepthbuffer[q];i.bindRenderbuffer(i.RENDERBUFFER,V),i.framebufferRenderbuffer(i.FRAMEBUFFER,K,i.RENDERBUFFER,V)}}else{const q=T.texture.mipmaps;if(q&&q.length>0?t.bindFramebuffer(i.FRAMEBUFFER,g.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,g.__webglFramebuffer),g.__webglDepthbuffer===void 0)g.__webglDepthbuffer=i.createRenderbuffer(),Z(g.__webglDepthbuffer,T,!1);else{const K=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,V=g.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,V),i.framebufferRenderbuffer(i.FRAMEBUFFER,K,i.RENDERBUFFER,V)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Se(T,g,F){const q=n.get(T);g!==void 0&&Ue(q.__webglFramebuffer,T,T.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),F!==void 0&&de(T)}function oe(T){const g=T.texture,F=n.get(T),q=n.get(g);T.addEventListener("dispose",R);const K=T.textures,V=T.isWebGLCubeRenderTarget===!0,De=K.length>1;if(De||(q.__webglTexture===void 0&&(q.__webglTexture=i.createTexture()),q.__version=g.version,a.memory.textures++),V){F.__webglFramebuffer=[];for(let he=0;he<6;he++)if(g.mipmaps&&g.mipmaps.length>0){F.__webglFramebuffer[he]=[];for(let Ae=0;Ae<g.mipmaps.length;Ae++)F.__webglFramebuffer[he][Ae]=i.createFramebuffer()}else F.__webglFramebuffer[he]=i.createFramebuffer()}else{if(g.mipmaps&&g.mipmaps.length>0){F.__webglFramebuffer=[];for(let he=0;he<g.mipmaps.length;he++)F.__webglFramebuffer[he]=i.createFramebuffer()}else F.__webglFramebuffer=i.createFramebuffer();if(De)for(let he=0,Ae=K.length;he<Ae;he++){const Le=n.get(K[he]);Le.__webglTexture===void 0&&(Le.__webglTexture=i.createTexture(),a.memory.textures++)}if(T.samples>0&&Fe(T)===!1){F.__webglMultisampledFramebuffer=i.createFramebuffer(),F.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let he=0;he<K.length;he++){const Ae=K[he];F.__webglColorRenderbuffer[he]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,F.__webglColorRenderbuffer[he]);const Le=s.convert(Ae.format,Ae.colorSpace),ee=s.convert(Ae.type),Me=E(Ae.internalFormat,Le,ee,Ae.colorSpace,T.isXRRenderTarget===!0),Oe=ie(T);i.renderbufferStorageMultisample(i.RENDERBUFFER,Oe,Me,T.width,T.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.RENDERBUFFER,F.__webglColorRenderbuffer[he])}i.bindRenderbuffer(i.RENDERBUFFER,null),T.depthBuffer&&(F.__webglDepthRenderbuffer=i.createRenderbuffer(),Z(F.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(V){t.bindTexture(i.TEXTURE_CUBE_MAP,q.__webglTexture),We(i.TEXTURE_CUBE_MAP,g);for(let he=0;he<6;he++)if(g.mipmaps&&g.mipmaps.length>0)for(let Ae=0;Ae<g.mipmaps.length;Ae++)Ue(F.__webglFramebuffer[he][Ae],T,g,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+he,Ae);else Ue(F.__webglFramebuffer[he],T,g,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+he,0);m(g)&&f(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(De){for(let he=0,Ae=K.length;he<Ae;he++){const Le=K[he],ee=n.get(Le);t.bindTexture(i.TEXTURE_2D,ee.__webglTexture),We(i.TEXTURE_2D,Le),Ue(F.__webglFramebuffer,T,Le,i.COLOR_ATTACHMENT0+he,i.TEXTURE_2D,0),m(Le)&&f(i.TEXTURE_2D)}t.unbindTexture()}else{let he=i.TEXTURE_2D;if((T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(he=T.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(he,q.__webglTexture),We(he,g),g.mipmaps&&g.mipmaps.length>0)for(let Ae=0;Ae<g.mipmaps.length;Ae++)Ue(F.__webglFramebuffer[Ae],T,g,i.COLOR_ATTACHMENT0,he,Ae);else Ue(F.__webglFramebuffer,T,g,i.COLOR_ATTACHMENT0,he,0);m(g)&&f(he),t.unbindTexture()}T.depthBuffer&&de(T)}function A(T){const g=T.textures;for(let F=0,q=g.length;F<q;F++){const K=g[F];if(m(K)){const V=b(T),De=n.get(K).__webglTexture;t.bindTexture(V,De),f(V),t.unbindTexture()}}}const ae=[],Re=[];function Ye(T){if(T.samples>0){if(Fe(T)===!1){const g=T.textures,F=T.width,q=T.height;let K=i.COLOR_BUFFER_BIT;const V=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,De=n.get(T),he=g.length>1;if(he)for(let Le=0;Le<g.length;Le++)t.bindFramebuffer(i.FRAMEBUFFER,De.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Le,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,De.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Le,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,De.__webglMultisampledFramebuffer);const Ae=T.texture.mipmaps;Ae&&Ae.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,De.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,De.__webglFramebuffer);for(let Le=0;Le<g.length;Le++){if(T.resolveDepthBuffer&&(T.depthBuffer&&(K|=i.DEPTH_BUFFER_BIT),T.stencilBuffer&&T.resolveStencilBuffer&&(K|=i.STENCIL_BUFFER_BIT)),he){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,De.__webglColorRenderbuffer[Le]);const ee=n.get(g[Le]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,ee,0)}i.blitFramebuffer(0,0,F,q,0,0,F,q,K,i.NEAREST),l===!0&&(ae.length=0,Re.length=0,ae.push(i.COLOR_ATTACHMENT0+Le),T.depthBuffer&&T.resolveDepthBuffer===!1&&(ae.push(V),Re.push(V),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,Re)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ae))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),he)for(let Le=0;Le<g.length;Le++){t.bindFramebuffer(i.FRAMEBUFFER,De.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Le,i.RENDERBUFFER,De.__webglColorRenderbuffer[Le]);const ee=n.get(g[Le]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,De.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Le,i.TEXTURE_2D,ee,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,De.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.resolveDepthBuffer===!1&&l){const g=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[g])}}}function ie(T){return Math.min(r.maxSamples,T.samples)}function Fe(T){const g=n.get(T);return T.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&g.__useRenderToTexture!==!1}function Ee(T){const g=a.render.frame;h.get(T)!==g&&(h.set(T,g),T.update())}function Ve(T,g){const F=T.colorSpace,q=T.format,K=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||F!==Ti&&F!==Pn&&(Qe.getTransfer(F)===rt?(q!==Zt||K!==sn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",F)),g}function lt(T){return typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement?(c.width=T.naturalWidth||T.width,c.height=T.naturalHeight||T.height):typeof VideoFrame<"u"&&T instanceof VideoFrame?(c.width=T.displayWidth,c.height=T.displayHeight):(c.width=T.width,c.height=T.height),c}this.allocateTextureUnit=B,this.resetTextureUnits=H,this.setTexture2D=J,this.setTexture2DArray=W,this.setTexture3D=ne,this.setTextureCube=G,this.rebindTextures=Se,this.setupRenderTarget=oe,this.updateRenderTargetMipmap=A,this.updateMultisampleRenderTarget=Ye,this.setupDepthRenderbuffer=de,this.setupFrameBufferTexture=Ue,this.useMultisampledRTT=Fe}function qm(i,e){function t(n,r=Pn){let s;const a=Qe.getTransfer(r);if(n===sn)return i.UNSIGNED_BYTE;if(n===wa)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Ra)return i.UNSIGNED_SHORT_5_5_5_1;if(n===cl)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===ol)return i.BYTE;if(n===ll)return i.SHORT;if(n===Yi)return i.UNSIGNED_SHORT;if(n===Aa)return i.INT;if(n===Kn)return i.UNSIGNED_INT;if(n===gn)return i.FLOAT;if(n===Ji)return i.HALF_FLOAT;if(n===hl)return i.ALPHA;if(n===ul)return i.RGB;if(n===Zt)return i.RGBA;if(n===Ki)return i.DEPTH_COMPONENT;if(n===Zi)return i.DEPTH_STENCIL;if(n===fl)return i.RED;if(n===Ca)return i.RED_INTEGER;if(n===dl)return i.RG;if(n===Pa)return i.RG_INTEGER;if(n===Da)return i.RGBA_INTEGER;if(n===Pr||n===Dr||n===Lr||n===Ur)if(a===rt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Pr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Dr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Lr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ur)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Pr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Dr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Lr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ur)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===qs||n===Ys||n===js||n===Ks)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===qs)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ys)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===js)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Ks)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Zs||n===$s||n===Js)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Zs||n===$s)return a===rt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Js)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Qs||n===ea||n===ta||n===na||n===ia||n===ra||n===sa||n===aa||n===oa||n===la||n===ca||n===ha||n===ua||n===fa)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Qs)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ea)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ta)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===na)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ia)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ra)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===sa)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===aa)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===oa)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===la)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===ca)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ha)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===ua)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===fa)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ir||n===da||n===pa)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ir)return a===rt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===da)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===pa)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===pl||n===ma||n===_a||n===ga)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Ir)return s.COMPRESSED_RED_RGTC1_EXT;if(n===ma)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===_a)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===ga)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===ji?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const Ym=`
3804
3804
  void main() {
3805
3805
 
3806
3806
  gl_Position = vec4( position, 1.0 );
3807
3807
 
3808
- }`,Gm=`
3808
+ }`,jm=`
3809
3809
  uniform sampler2DArray depthColor;
3810
3810
  uniform float depthWidth;
3811
3811
  uniform float depthHeight;
@@ -3824,9 +3824,9 @@ void main() {
3824
3824
 
3825
3825
  }
3826
3826
 
3827
- }`;class Wm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new Pt,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Un({vertexShader:Vm,fragmentShader:Gm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Jt(new qr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Xm extends Jn{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,d=null,p=null,_=null;const v=new Wm,m=t.getContextAttributes();let f=null,b=null;const E=[],S=[],L=new Xe;let w=null;const C=new Xt;C.viewport=new pt;const P=new Xt;P.viewport=new pt;const y=[C,P],x=new hu;let R=null,H=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let le=E[Y];return le===void 0&&(le=new vs,E[Y]=le),le.getTargetRaySpace()},this.getControllerGrip=function(Y){let le=E[Y];return le===void 0&&(le=new vs,E[Y]=le),le.getGripSpace()},this.getHand=function(Y){let le=E[Y];return le===void 0&&(le=new vs,E[Y]=le),le.getHandSpace()};function B(Y){const le=S.indexOf(Y.inputSource);if(le===-1)return;const Pe=E[le];Pe!==void 0&&(Pe.update(Y.inputSource,Y.frame,c||a),Pe.dispatchEvent({type:Y.type,data:Y.inputSource}))}function j(){r.removeEventListener("select",B),r.removeEventListener("selectstart",B),r.removeEventListener("selectend",B),r.removeEventListener("squeeze",B),r.removeEventListener("squeezestart",B),r.removeEventListener("squeezeend",B),r.removeEventListener("end",j),r.removeEventListener("inputsourceschange",J);for(let Y=0;Y<E.length;Y++){const le=S[Y];le!==null&&(S[Y]=null,E[Y].disconnect(le))}R=null,H=null,v.reset(),e.setRenderTarget(f),p=null,d=null,u=null,r=null,b=null,Ze.stop(),n.isPresenting=!1,e.setPixelRatio(w),e.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){s=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){o=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(Y){c=Y},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return u},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(Y){if(r=Y,r!==null){if(f=e.getRenderTarget(),r.addEventListener("select",B),r.addEventListener("selectstart",B),r.addEventListener("selectend",B),r.addEventListener("squeeze",B),r.addEventListener("squeezestart",B),r.addEventListener("squeezeend",B),r.addEventListener("end",j),r.addEventListener("inputsourceschange",J),m.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(L),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let Pe=null,ve=null,Ue=null;m.depth&&(Ue=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Pe=m.stencil?ji:Yi,ve=m.stencil?qi:Kn);const Z={colorFormat:t.RGBA8,depthFormat:Ue,scaleFactor:s};u=new XRWebGLBinding(r,t),d=u.createProjectionLayer(Z),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),b=new $n(d.textureWidth,d.textureHeight,{format:$t,type:an,depthTexture:new El(d.textureWidth,d.textureHeight,ve,void 0,void 0,void 0,void 0,void 0,void 0,Pe),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const Pe={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,Pe),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),b=new $n(p.framebufferWidth,p.framebufferHeight,{format:$t,type:an,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),Ze.setContext(r),Ze.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return v.getDepthTexture()};function J(Y){for(let le=0;le<Y.removed.length;le++){const Pe=Y.removed[le],ve=S.indexOf(Pe);ve>=0&&(S[ve]=null,E[ve].disconnect(Pe))}for(let le=0;le<Y.added.length;le++){const Pe=Y.added[le];let ve=S.indexOf(Pe);if(ve===-1){for(let Z=0;Z<E.length;Z++)if(Z>=S.length){S.push(Pe),ve=Z;break}else if(S[Z]===null){S[Z]=Pe,ve=Z;break}if(ve===-1)break}const Ue=E[ve];Ue&&Ue.connect(Pe)}}const W=new N,ne=new N;function G(Y,le,Pe){W.setFromMatrixPosition(le.matrixWorld),ne.setFromMatrixPosition(Pe.matrixWorld);const ve=W.distanceTo(ne),Ue=le.projectionMatrix.elements,Z=Pe.projectionMatrix.elements,Q=Ue[14]/(Ue[10]-1),de=Ue[14]/(Ue[10]+1),Se=(Ue[9]+1)/Ue[5],oe=(Ue[9]-1)/Ue[5],A=(Ue[8]-1)/Ue[0],ae=(Z[8]+1)/Z[0],Re=Q*A,Ye=Q*ae,ie=ve/(-A+ae),Fe=ie*-A;if(le.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(Fe),Y.translateZ(ie),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),Ue[10]===-1)Y.projectionMatrix.copy(le.projectionMatrix),Y.projectionMatrixInverse.copy(le.projectionMatrixInverse);else{const Ee=Q+ie,Ve=de+ie,lt=Re-Fe,T=Ye+(ve-Fe),g=Se*de/Ve*Ee,F=oe*de/Ve*Ee;Y.projectionMatrix.makePerspective(lt,T,g,F,Ee,Ve),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function fe(Y,le){le===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(le.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(r===null)return;let le=Y.near,Pe=Y.far;v.texture!==null&&(v.depthNear>0&&(le=v.depthNear),v.depthFar>0&&(Pe=v.depthFar)),x.near=P.near=C.near=le,x.far=P.far=C.far=Pe,(R!==x.near||H!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),R=x.near,H=x.far),C.layers.mask=Y.layers.mask|2,P.layers.mask=Y.layers.mask|4,x.layers.mask=C.layers.mask|P.layers.mask;const ve=Y.parent,Ue=x.cameras;fe(x,ve);for(let Z=0;Z<Ue.length;Z++)fe(Ue[Z],ve);Ue.length===2?G(x,C,P):x.projectionMatrix.copy(C.projectionMatrix),xe(Y,x,ve)};function xe(Y,le,Pe){Pe===null?Y.matrix.copy(le.matrixWorld):(Y.matrix.copy(Pe.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(le.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(le.projectionMatrix),Y.projectionMatrixInverse.copy(le.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=ma*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(d===null&&p===null))return l},this.setFoveation=function(Y){l=Y,d!==null&&(d.fixedFoveation=Y),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=Y)},this.hasDepthSensing=function(){return v.texture!==null},this.getDepthSensingMesh=function(){return v.getMesh(x)};let se=null;function We(Y,le){if(h=le.getViewerPose(c||a),_=le,h!==null){const Pe=h.views;p!==null&&(e.setRenderTargetFramebuffer(b,p.framebuffer),e.setRenderTarget(b));let ve=!1;Pe.length!==x.cameras.length&&(x.cameras.length=0,ve=!0);for(let Q=0;Q<Pe.length;Q++){const de=Pe[Q];let Se=null;if(p!==null)Se=p.getViewport(de);else{const A=u.getViewSubImage(d,de);Se=A.viewport,Q===0&&(e.setRenderTargetTextures(b,A.colorTexture,A.depthStencilTexture),e.setRenderTarget(b))}let oe=y[Q];oe===void 0&&(oe=new Xt,oe.layers.enable(Q),oe.viewport=new pt,y[Q]=oe),oe.matrix.fromArray(de.transform.matrix),oe.matrix.decompose(oe.position,oe.quaternion,oe.scale),oe.projectionMatrix.fromArray(de.projectionMatrix),oe.projectionMatrixInverse.copy(oe.projectionMatrix).invert(),oe.viewport.set(Se.x,Se.y,Se.width,Se.height),Q===0&&(x.matrix.copy(oe.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),ve===!0&&x.cameras.push(oe)}const Ue=r.enabledFeatures;if(Ue&&Ue.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&u){const Q=u.getDepthInformation(Pe[0]);Q&&Q.isValid&&Q.texture&&v.init(e,Q,r.renderState)}}for(let Pe=0;Pe<E.length;Pe++){const ve=S[Pe],Ue=E[Pe];ve!==null&&Ue!==void 0&&Ue.update(ve,le,c||a)}se&&se(Y,le),le.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:le}),_=null}const Ze=new Cl;Ze.setAnimationLoop(We),this.setAnimationLoop=function(Y){se=Y},this.dispose=function(){}}}const Gn=new on,qm=new ht;function Ym(i,e){function t(m,f){m.matrixAutoUpdate===!0&&m.updateMatrix(),f.value.copy(m.matrix)}function n(m,f){f.color.getRGB(m.fogColor.value,Ml(i)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function r(m,f,b,E,S){f.isMeshBasicMaterial||f.isMeshLambertMaterial?s(m,f):f.isMeshToonMaterial?(s(m,f),u(m,f)):f.isMeshPhongMaterial?(s(m,f),h(m,f)):f.isMeshStandardMaterial?(s(m,f),d(m,f),f.isMeshPhysicalMaterial&&p(m,f,S)):f.isMeshMatcapMaterial?(s(m,f),_(m,f)):f.isMeshDepthMaterial?s(m,f):f.isMeshDistanceMaterial?(s(m,f),v(m,f)):f.isMeshNormalMaterial?s(m,f):f.isLineBasicMaterial?(a(m,f),f.isLineDashedMaterial&&o(m,f)):f.isPointsMaterial?l(m,f,b,E):f.isSpriteMaterial?c(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(m,f){m.opacity.value=f.opacity,f.color&&m.diffuse.value.copy(f.color),f.emissive&&m.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.bumpMap&&(m.bumpMap.value=f.bumpMap,t(f.bumpMap,m.bumpMapTransform),m.bumpScale.value=f.bumpScale,f.side===It&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,t(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===It&&m.normalScale.value.negate()),f.displacementMap&&(m.displacementMap.value=f.displacementMap,t(f.displacementMap,m.displacementMapTransform),m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,m.emissiveMapTransform)),f.specularMap&&(m.specularMap.value=f.specularMap,t(f.specularMap,m.specularMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const b=e.get(f),E=b.envMap,S=b.envMapRotation;E&&(m.envMap.value=E,Gn.copy(S),Gn.x*=-1,Gn.y*=-1,Gn.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(Gn.y*=-1,Gn.z*=-1),m.envMapRotation.value.setFromMatrix4(qm.makeRotationFromEuler(Gn)),m.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap&&(m.lightMap.value=f.lightMap,m.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,m.lightMapTransform)),f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,m.aoMapTransform))}function a(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform))}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,b,E){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*b,m.scale.value=E*.5,f.map&&(m.map.value=f.map,t(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function h(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function u(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function d(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,b){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===It&&m.clearcoatNormalScale.value.negate())),f.dispersion>0&&(m.dispersion.value=f.dispersion),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=b.texture,m.transmissionSamplerSize.value.set(b.width,b.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,f){f.matcap&&(m.matcap.value=f.matcap)}function v(m,f){const b=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(b.matrixWorld),m.nearDistance.value=b.shadow.camera.near,m.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function jm(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,E){const S=E.program;n.uniformBlockBinding(b,S)}function c(b,E){let S=r[b.id];S===void 0&&(_(b),S=h(b),r[b.id]=S,b.addEventListener("dispose",m));const L=E.program;n.updateUBOMapping(b,L);const w=e.render.frame;s[b.id]!==w&&(d(b),s[b.id]=w)}function h(b){const E=u();b.__bindingPointIndex=E;const S=i.createBuffer(),L=b.__size,w=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,S),i.bufferData(i.UNIFORM_BUFFER,L,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,E,S),S}function u(){for(let b=0;b<o;b++)if(a.indexOf(b)===-1)return a.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(b){const E=r[b.id],S=b.uniforms,L=b.__cache;i.bindBuffer(i.UNIFORM_BUFFER,E);for(let w=0,C=S.length;w<C;w++){const P=Array.isArray(S[w])?S[w]:[S[w]];for(let y=0,x=P.length;y<x;y++){const R=P[y];if(p(R,w,y,L)===!0){const H=R.__offset,B=Array.isArray(R.value)?R.value:[R.value];let j=0;for(let J=0;J<B.length;J++){const W=B[J],ne=v(W);typeof W=="number"||typeof W=="boolean"?(R.__data[0]=W,i.bufferSubData(i.UNIFORM_BUFFER,H+j,R.__data)):W.isMatrix3?(R.__data[0]=W.elements[0],R.__data[1]=W.elements[1],R.__data[2]=W.elements[2],R.__data[3]=0,R.__data[4]=W.elements[3],R.__data[5]=W.elements[4],R.__data[6]=W.elements[5],R.__data[7]=0,R.__data[8]=W.elements[6],R.__data[9]=W.elements[7],R.__data[10]=W.elements[8],R.__data[11]=0):(W.toArray(R.__data,j),j+=ne.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,H,R.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function p(b,E,S,L){const w=b.value,C=E+"_"+S;if(L[C]===void 0)return typeof w=="number"||typeof w=="boolean"?L[C]=w:L[C]=w.clone(),!0;{const P=L[C];if(typeof w=="number"||typeof w=="boolean"){if(P!==w)return L[C]=w,!0}else if(P.equals(w)===!1)return P.copy(w),!0}return!1}function _(b){const E=b.uniforms;let S=0;const L=16;for(let C=0,P=E.length;C<P;C++){const y=Array.isArray(E[C])?E[C]:[E[C]];for(let x=0,R=y.length;x<R;x++){const H=y[x],B=Array.isArray(H.value)?H.value:[H.value];for(let j=0,J=B.length;j<J;j++){const W=B[j],ne=v(W),G=S%L,fe=G%ne.boundary,xe=G+fe;S+=fe,xe!==0&&L-xe<ne.storage&&(S+=L-xe),H.__data=new Float32Array(ne.storage/Float32Array.BYTES_PER_ELEMENT),H.__offset=S,S+=ne.storage}}}const w=S%L;return w>0&&(S+=L-w),b.__size=S,b.__cache={},this}function v(b){const E={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(E.boundary=4,E.storage=4):b.isVector2?(E.boundary=8,E.storage=8):b.isVector3||b.isColor?(E.boundary=16,E.storage=12):b.isVector4?(E.boundary=16,E.storage=16):b.isMatrix3?(E.boundary=48,E.storage=48):b.isMatrix4?(E.boundary=64,E.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),E}function m(b){const E=b.target;E.removeEventListener("dispose",m);const S=a.indexOf(E.__bindingPointIndex);a.splice(S,1),i.deleteBuffer(r[E.id]),delete r[E.id],delete s[E.id]}function f(){for(const b in r)i.deleteBuffer(r[b]);a=[],r={},s={}}return{bind:l,update:c,dispose:f}}class Km{constructor(e={}){const{canvas:t=Sh(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=a;const _=new Uint32Array(4),v=new Int32Array(4);let m=null,f=null;const b=[],E=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Ln,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const S=this;let L=!1;this._outputColorSpace=Et;let w=0,C=0,P=null,y=-1,x=null;const R=new pt,H=new pt;let B=null;const j=new Ke(0);let J=0,W=t.width,ne=t.height,G=1,fe=null,xe=null;const se=new pt(0,0,W,ne),We=new pt(0,0,W,ne);let Ze=!1;const Y=new Pa;let le=!1,Pe=!1;const ve=new ht,Ue=new ht,Z=new N,Q=new pt,de={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Se=!1;function oe(){return P===null?G:1}let A=n;function ae(M,U){return t.getContext(M,U)}try{const M={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Sa}`),t.addEventListener("webglcontextlost",ye,!1),t.addEventListener("webglcontextrestored",O,!1),t.addEventListener("webglcontextcreationerror",X,!1),A===null){const U="webgl2";if(A=ae(U,M),A===null)throw ae(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(M){throw console.error("THREE.WebGLRenderer: "+M.message),M}let Re,Ye,ie,Fe,Ee,Ve,lt,T,g,F,q,K,V,De,he,be,Le,ee,Me,Oe,Ne,ce,ke,D;function pe(){Re=new sp(A),Re.init(),ce=new Hm(A,Re),Ye=new Jd(A,Re,e,ce),ie=new zm(A,Re),Ye.reverseDepthBuffer&&d&&ie.buffers.depth.setReversed(!0),Fe=new lp(A),Ee=new Am,Ve=new km(A,Re,ie,Ee,Ye,ce,Fe),lt=new ep(S),T=new rp(S),g=new du(A),ke=new Zd(A,g),F=new ap(A,g,Fe,ke),q=new hp(A,F,g,Fe),Me=new cp(A,Ye,Ve),be=new Qd(Ee),K=new bm(S,lt,T,Re,Ye,ke,be),V=new Ym(S,Ee),De=new Rm,he=new Im(Re),ee=new Kd(S,lt,T,ie,q,p,l),Le=new Om(S,q,Ye),D=new jm(A,Fe,Ye,ie),Oe=new $d(A,Re,Fe),Ne=new op(A,Re,Fe),Fe.programs=K.programs,S.capabilities=Ye,S.extensions=Re,S.properties=Ee,S.renderLists=De,S.shadowMap=Le,S.state=ie,S.info=Fe}pe();const te=new Xm(S,A);this.xr=te,this.getContext=function(){return A},this.getContextAttributes=function(){return A.getContextAttributes()},this.forceContextLoss=function(){const M=Re.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){const M=Re.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(M){M!==void 0&&(G=M,this.setSize(W,ne,!1))},this.getSize=function(M){return M.set(W,ne)},this.setSize=function(M,U,z=!0){if(te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}W=M,ne=U,t.width=Math.floor(M*G),t.height=Math.floor(U*G),z===!0&&(t.style.width=M+"px",t.style.height=U+"px"),this.setViewport(0,0,M,U)},this.getDrawingBufferSize=function(M){return M.set(W*G,ne*G).floor()},this.setDrawingBufferSize=function(M,U,z){W=M,ne=U,G=z,t.width=Math.floor(M*z),t.height=Math.floor(U*z),this.setViewport(0,0,M,U)},this.getCurrentViewport=function(M){return M.copy(R)},this.getViewport=function(M){return M.copy(se)},this.setViewport=function(M,U,z,k){M.isVector4?se.set(M.x,M.y,M.z,M.w):se.set(M,U,z,k),ie.viewport(R.copy(se).multiplyScalar(G).round())},this.getScissor=function(M){return M.copy(We)},this.setScissor=function(M,U,z,k){M.isVector4?We.set(M.x,M.y,M.z,M.w):We.set(M,U,z,k),ie.scissor(H.copy(We).multiplyScalar(G).round())},this.getScissorTest=function(){return Ze},this.setScissorTest=function(M){ie.setScissorTest(Ze=M)},this.setOpaqueSort=function(M){fe=M},this.setTransparentSort=function(M){xe=M},this.getClearColor=function(M){return M.copy(ee.getClearColor())},this.setClearColor=function(){ee.setClearColor(...arguments)},this.getClearAlpha=function(){return ee.getClearAlpha()},this.setClearAlpha=function(){ee.setClearAlpha(...arguments)},this.clear=function(M=!0,U=!0,z=!0){let k=0;if(M){let I=!1;if(P!==null){const re=P.texture.format;I=re===Ra||re===wa||re===Aa}if(I){const re=P.texture.type,ge=re===an||re===Kn||re===Xi||re===qi||re===Ta||re===ba,we=ee.getClearColor(),Te=ee.getClearAlpha(),He=we.r,Ge=we.g,Ie=we.b;ge?(_[0]=He,_[1]=Ge,_[2]=Ie,_[3]=Te,A.clearBufferuiv(A.COLOR,0,_)):(v[0]=He,v[1]=Ge,v[2]=Ie,v[3]=Te,A.clearBufferiv(A.COLOR,0,v))}else k|=A.COLOR_BUFFER_BIT}U&&(k|=A.DEPTH_BUFFER_BIT),z&&(k|=A.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),A.clear(k)},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(){t.removeEventListener("webglcontextlost",ye,!1),t.removeEventListener("webglcontextrestored",O,!1),t.removeEventListener("webglcontextcreationerror",X,!1),ee.dispose(),De.dispose(),he.dispose(),Ee.dispose(),lt.dispose(),T.dispose(),q.dispose(),ke.dispose(),D.dispose(),K.dispose(),te.dispose(),te.removeEventListener("sessionstart",xt),te.removeEventListener("sessionend",tn),ut.stop()};function ye(M){M.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function O(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;const M=Fe.autoReset,U=Le.enabled,z=Le.autoUpdate,k=Le.needsUpdate,I=Le.type;pe(),Fe.autoReset=M,Le.enabled=U,Le.autoUpdate=z,Le.needsUpdate=k,Le.type=I}function X(M){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function ue(M){const U=M.target;U.removeEventListener("dispose",ue),Be(U)}function Be(M){ot(M),Ee.remove(M)}function ot(M){const U=Ee.get(M).programs;U!==void 0&&(U.forEach(function(z){K.releaseProgram(z)}),M.isShaderMaterial&&K.releaseShaderCache(M))}this.renderBufferDirect=function(M,U,z,k,I,re){U===null&&(U=de);const ge=I.isMesh&&I.matrixWorld.determinant()<0,we=Ui(M,U,z,k,I);ie.setMaterial(k,ge);let Te=z.index,He=1;if(k.wireframe===!0){if(Te=F.getWireframeAttribute(z),Te===void 0)return;He=2}const Ge=z.drawRange,Ie=z.attributes.position;let Je=Ge.start*He,rt=(Ge.start+Ge.count)*He;re!==null&&(Je=Math.max(Je,re.start*He),rt=Math.min(rt,(re.start+re.count)*He)),Te!==null?(Je=Math.max(Je,0),rt=Math.min(rt,Te.count)):Ie!=null&&(Je=Math.max(Je,0),rt=Math.min(rt,Ie.count));const ft=rt-Je;if(ft<0||ft===1/0)return;ke.setup(I,k,we,z,Te);let dt,tt=Oe;if(Te!==null&&(dt=g.get(Te),tt=Ne,tt.setIndex(dt)),I.isMesh)k.wireframe===!0?(ie.setLineWidth(k.wireframeLinewidth*oe()),tt.setMode(A.LINES)):tt.setMode(A.TRIANGLES);else if(I.isLine){let ze=k.linewidth;ze===void 0&&(ze=1),ie.setLineWidth(ze*oe()),I.isLineSegments?tt.setMode(A.LINES):I.isLineLoop?tt.setMode(A.LINE_LOOP):tt.setMode(A.LINE_STRIP)}else I.isPoints?tt.setMode(A.POINTS):I.isSprite&&tt.setMode(A.TRIANGLES);if(I.isBatchedMesh)if(I._multiDrawInstances!==null)vi("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),tt.renderMultiDrawInstances(I._multiDrawStarts,I._multiDrawCounts,I._multiDrawCount,I._multiDrawInstances);else if(Re.get("WEBGL_multi_draw"))tt.renderMultiDraw(I._multiDrawStarts,I._multiDrawCounts,I._multiDrawCount);else{const ze=I._multiDrawStarts,yt=I._multiDrawCounts,nt=I._multiDrawCount,qt=Te?g.get(Te).bytesPerElement:1,Qn=Ee.get(k).currentProgram.getUniforms();for(let Ft=0;Ft<nt;Ft++)Qn.setValue(A,"_gl_DrawID",Ft),tt.render(ze[Ft]/qt,yt[Ft])}else if(I.isInstancedMesh)tt.renderInstances(Je,ft,I.count);else if(z.isInstancedBufferGeometry){const ze=z._maxInstanceCount!==void 0?z._maxInstanceCount:1/0,yt=Math.min(z.instanceCount,ze);tt.renderInstances(Je,ft,yt)}else tt.render(Je,ft)};function et(M,U,z){M.transparent===!0&&M.side===_n&&M.forceSinglePass===!1?(M.side=It,M.needsUpdate=!0,Nn(M,U,z),M.side=Sn,M.needsUpdate=!0,Nn(M,U,z),M.side=_n):Nn(M,U,z)}this.compile=function(M,U,z=null){z===null&&(z=M),f=he.get(z),f.init(U),E.push(f),z.traverseVisible(function(I){I.isLight&&I.layers.test(U.layers)&&(f.pushLight(I),I.castShadow&&f.pushShadow(I))}),M!==z&&M.traverseVisible(function(I){I.isLight&&I.layers.test(U.layers)&&(f.pushLight(I),I.castShadow&&f.pushShadow(I))}),f.setupLights();const k=new Set;return M.traverse(function(I){if(!(I.isMesh||I.isPoints||I.isLine||I.isSprite))return;const re=I.material;if(re)if(Array.isArray(re))for(let ge=0;ge<re.length;ge++){const we=re[ge];et(we,z,I),k.add(we)}else et(re,z,I),k.add(re)}),f=E.pop(),k},this.compileAsync=function(M,U,z=null){const k=this.compile(M,U,z);return new Promise(I=>{function re(){if(k.forEach(function(ge){Ee.get(ge).currentProgram.isReady()&&k.delete(ge)}),k.size===0){I(M);return}setTimeout(re,10)}Re.get("KHR_parallel_shader_compile")!==null?re():setTimeout(re,10)})};let Ce=null;function _e(M){Ce&&Ce(M)}function xt(){ut.stop()}function tn(){ut.start()}const ut=new Cl;ut.setAnimationLoop(_e),typeof self<"u"&&ut.setContext(self),this.setAnimationLoop=function(M){Ce=M,te.setAnimationLoop(M),M===null?ut.stop():ut.start()},te.addEventListener("sessionstart",xt),te.addEventListener("sessionend",tn),this.render=function(M,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;if(M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),te.enabled===!0&&te.isPresenting===!0&&(te.cameraAutoUpdate===!0&&te.updateCamera(U),U=te.getCamera()),M.isScene===!0&&M.onBeforeRender(S,M,U,P),f=he.get(M,E.length),f.init(U),E.push(f),Ue.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),Y.setFromProjectionMatrix(Ue),Pe=this.localClippingEnabled,le=be.init(this.clippingPlanes,Pe),m=De.get(M,b.length),m.init(),b.push(m),te.enabled===!0&&te.isPresenting===!0){const re=S.xr.getDepthSensingMesh();re!==null&&At(re,U,-1/0,S.sortObjects)}At(M,U,0,S.sortObjects),m.finish(),S.sortObjects===!0&&m.sort(fe,xe),Se=te.enabled===!1||te.isPresenting===!1||te.hasDepthSensing()===!1,Se&&ee.addToRenderList(m,M),this.info.render.frame++,le===!0&&be.beginShadows();const z=f.state.shadowsArray;Le.render(z,M,U),le===!0&&be.endShadows(),this.info.autoReset===!0&&this.info.reset();const k=m.opaque,I=m.transmissive;if(f.setupLights(),U.isArrayCamera){const re=U.cameras;if(I.length>0)for(let ge=0,we=re.length;ge<we;ge++){const Te=re[ge];Ci(k,I,M,Te)}Se&&ee.render(M);for(let ge=0,we=re.length;ge<we;ge++){const Te=re[ge];zt(m,M,Te,Te.viewport)}}else I.length>0&&Ci(k,I,M,U),Se&&ee.render(M),zt(m,M,U);P!==null&&C===0&&(Ve.updateMultisampleRenderTarget(P),Ve.updateRenderTargetMipmap(P)),M.isScene===!0&&M.onAfterRender(S,M,U),ke.resetDefaultState(),y=-1,x=null,E.pop(),E.length>0?(f=E[E.length-1],le===!0&&be.setGlobalState(S.clippingPlanes,f.state.camera)):f=null,b.pop(),b.length>0?m=b[b.length-1]:m=null};function At(M,U,z,k){if(M.visible===!1)return;if(M.layers.test(U.layers)){if(M.isGroup)z=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(U);else if(M.isLight)f.pushLight(M),M.castShadow&&f.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Y.intersectsSprite(M)){k&&Q.setFromMatrixPosition(M.matrixWorld).applyMatrix4(Ue);const ge=q.update(M),we=M.material;we.visible&&m.push(M,ge,we,z,Q.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Y.intersectsObject(M))){const ge=q.update(M),we=M.material;if(k&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),Q.copy(M.boundingSphere.center)):(ge.boundingSphere===null&&ge.computeBoundingSphere(),Q.copy(ge.boundingSphere.center)),Q.applyMatrix4(M.matrixWorld).applyMatrix4(Ue)),Array.isArray(we)){const Te=ge.groups;for(let He=0,Ge=Te.length;He<Ge;He++){const Ie=Te[He],Je=we[Ie.materialIndex];Je&&Je.visible&&m.push(M,ge,Je,z,Q.z,Ie)}}else we.visible&&m.push(M,ge,we,z,Q.z,null)}}const re=M.children;for(let ge=0,we=re.length;ge<we;ge++)At(re[ge],U,z,k)}function zt(M,U,z,k){const I=M.opaque,re=M.transmissive,ge=M.transparent;f.setupLightsView(z),le===!0&&be.setGlobalState(S.clippingPlanes,z),k&&ie.viewport(R.copy(k)),I.length>0&&In(I,U,z),re.length>0&&In(re,U,z),ge.length>0&&In(ge,U,z),ie.buffers.depth.setTest(!0),ie.buffers.depth.setMask(!0),ie.buffers.color.setMask(!0),ie.setPolygonOffset(!1)}function Ci(M,U,z,k){if((z.isScene===!0?z.overrideMaterial:null)!==null)return;f.state.transmissionRenderTarget[k.id]===void 0&&(f.state.transmissionRenderTarget[k.id]=new $n(1,1,{generateMipmaps:!0,type:Re.has("EXT_color_buffer_half_float")||Re.has("EXT_color_buffer_float")?Zi:an,minFilter:jn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Qe.workingColorSpace}));const re=f.state.transmissionRenderTarget[k.id],ge=k.viewport||R;re.setSize(ge.z*S.transmissionResolutionScale,ge.w*S.transmissionResolutionScale);const we=S.getRenderTarget();S.setRenderTarget(re),S.getClearColor(j),J=S.getClearAlpha(),J<1&&S.setClearColor(16777215,.5),S.clear(),Se&&ee.render(z);const Te=S.toneMapping;S.toneMapping=Ln;const He=k.viewport;if(k.viewport!==void 0&&(k.viewport=void 0),f.setupLightsView(k),le===!0&&be.setGlobalState(S.clippingPlanes,k),In(M,z,k),Ve.updateMultisampleRenderTarget(re),Ve.updateRenderTargetMipmap(re),Re.has("WEBGL_multisampled_render_to_texture")===!1){let Ge=!1;for(let Ie=0,Je=U.length;Ie<Je;Ie++){const rt=U[Ie],ft=rt.object,dt=rt.geometry,tt=rt.material,ze=rt.group;if(tt.side===_n&&ft.layers.test(k.layers)){const yt=tt.side;tt.side=It,tt.needsUpdate=!0,Pi(ft,z,k,dt,tt,ze),tt.side=yt,tt.needsUpdate=!0,Ge=!0}}Ge===!0&&(Ve.updateMultisampleRenderTarget(re),Ve.updateRenderTargetMipmap(re))}S.setRenderTarget(we),S.setClearColor(j,J),He!==void 0&&(k.viewport=He),S.toneMapping=Te}function In(M,U,z){const k=U.isScene===!0?U.overrideMaterial:null;for(let I=0,re=M.length;I<re;I++){const ge=M[I],we=ge.object,Te=ge.geometry,He=ge.group;let Ge=ge.material;Ge.allowOverride===!0&&k!==null&&(Ge=k),we.layers.test(z.layers)&&Pi(we,U,z,Te,Ge,He)}}function Pi(M,U,z,k,I,re){M.onBeforeRender(S,U,z,k,I,re),M.modelViewMatrix.multiplyMatrices(z.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),I.onBeforeRender(S,U,z,k,M,re),I.transparent===!0&&I.side===_n&&I.forceSinglePass===!1?(I.side=It,I.needsUpdate=!0,S.renderBufferDirect(z,U,k,I,M,re),I.side=Sn,I.needsUpdate=!0,S.renderBufferDirect(z,U,k,I,M,re),I.side=_n):S.renderBufferDirect(z,U,k,I,M,re),M.onAfterRender(S,U,z,k,I,re)}function Nn(M,U,z){U.isScene!==!0&&(U=de);const k=Ee.get(M),I=f.state.lights,re=f.state.shadowsArray,ge=I.state.version,we=K.getParameters(M,I.state,re,U,z),Te=K.getProgramCacheKey(we);let He=k.programs;k.environment=M.isMeshStandardMaterial?U.environment:null,k.fog=U.fog,k.envMap=(M.isMeshStandardMaterial?T:lt).get(M.envMap||k.environment),k.envMapRotation=k.environment!==null&&M.envMap===null?U.environmentRotation:M.envMapRotation,He===void 0&&(M.addEventListener("dispose",ue),He=new Map,k.programs=He);let Ge=He.get(Te);if(Ge!==void 0){if(k.currentProgram===Ge&&k.lightsStateVersion===ge)return Li(M,we),Ge}else we.uniforms=K.getUniforms(M),M.onBeforeCompile(we,S),Ge=K.acquireProgram(we,Te),He.set(Te,Ge),k.uniforms=we.uniforms;const Ie=k.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Ie.clippingPlanes=be.uniform),Li(M,we),k.needsLights=Fn(M),k.lightsStateVersion=ge,k.needsLights&&(Ie.ambientLightColor.value=I.state.ambient,Ie.lightProbe.value=I.state.probe,Ie.directionalLights.value=I.state.directional,Ie.directionalLightShadows.value=I.state.directionalShadow,Ie.spotLights.value=I.state.spot,Ie.spotLightShadows.value=I.state.spotShadow,Ie.rectAreaLights.value=I.state.rectArea,Ie.ltc_1.value=I.state.rectAreaLTC1,Ie.ltc_2.value=I.state.rectAreaLTC2,Ie.pointLights.value=I.state.point,Ie.pointLightShadows.value=I.state.pointShadow,Ie.hemisphereLights.value=I.state.hemi,Ie.directionalShadowMap.value=I.state.directionalShadowMap,Ie.directionalShadowMatrix.value=I.state.directionalShadowMatrix,Ie.spotShadowMap.value=I.state.spotShadowMap,Ie.spotLightMatrix.value=I.state.spotLightMatrix,Ie.spotLightMap.value=I.state.spotLightMap,Ie.pointShadowMap.value=I.state.pointShadowMap,Ie.pointShadowMatrix.value=I.state.pointShadowMatrix),k.currentProgram=Ge,k.uniformsList=null,Ge}function Di(M){if(M.uniformsList===null){const U=M.currentProgram.getUniforms();M.uniformsList=Nr.seqWithValue(U.seq,M.uniforms)}return M.uniformsList}function Li(M,U){const z=Ee.get(M);z.outputColorSpace=U.outputColorSpace,z.batching=U.batching,z.batchingColor=U.batchingColor,z.instancing=U.instancing,z.instancingColor=U.instancingColor,z.instancingMorph=U.instancingMorph,z.skinning=U.skinning,z.morphTargets=U.morphTargets,z.morphNormals=U.morphNormals,z.morphColors=U.morphColors,z.morphTargetsCount=U.morphTargetsCount,z.numClippingPlanes=U.numClippingPlanes,z.numIntersection=U.numClipIntersection,z.vertexAlphas=U.vertexAlphas,z.vertexTangents=U.vertexTangents,z.toneMapping=U.toneMapping}function Ui(M,U,z,k,I){U.isScene!==!0&&(U=de),Ve.resetTextureUnits();const re=U.fog,ge=k.isMeshStandardMaterial?U.environment:null,we=P===null?S.outputColorSpace:P.isXRRenderTarget===!0?P.texture.colorSpace:Ei,Te=(k.isMeshStandardMaterial?T:lt).get(k.envMap||ge),He=k.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,Ge=!!z.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),Ie=!!z.morphAttributes.position,Je=!!z.morphAttributes.normal,rt=!!z.morphAttributes.color;let ft=Ln;k.toneMapped&&(P===null||P.isXRRenderTarget===!0)&&(ft=S.toneMapping);const dt=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,tt=dt!==void 0?dt.length:0,ze=Ee.get(k),yt=f.state.lights;if(le===!0&&(Pe===!0||M!==x)){const wt=M===x&&k.id===y;be.setState(k,M,wt)}let nt=!1;k.version===ze.__version?(ze.needsLights&&ze.lightsStateVersion!==yt.state.version||ze.outputColorSpace!==we||I.isBatchedMesh&&ze.batching===!1||!I.isBatchedMesh&&ze.batching===!0||I.isBatchedMesh&&ze.batchingColor===!0&&I.colorTexture===null||I.isBatchedMesh&&ze.batchingColor===!1&&I.colorTexture!==null||I.isInstancedMesh&&ze.instancing===!1||!I.isInstancedMesh&&ze.instancing===!0||I.isSkinnedMesh&&ze.skinning===!1||!I.isSkinnedMesh&&ze.skinning===!0||I.isInstancedMesh&&ze.instancingColor===!0&&I.instanceColor===null||I.isInstancedMesh&&ze.instancingColor===!1&&I.instanceColor!==null||I.isInstancedMesh&&ze.instancingMorph===!0&&I.morphTexture===null||I.isInstancedMesh&&ze.instancingMorph===!1&&I.morphTexture!==null||ze.envMap!==Te||k.fog===!0&&ze.fog!==re||ze.numClippingPlanes!==void 0&&(ze.numClippingPlanes!==be.numPlanes||ze.numIntersection!==be.numIntersection)||ze.vertexAlphas!==He||ze.vertexTangents!==Ge||ze.morphTargets!==Ie||ze.morphNormals!==Je||ze.morphColors!==rt||ze.toneMapping!==ft||ze.morphTargetsCount!==tt)&&(nt=!0):(nt=!0,ze.__version=k.version);let qt=ze.currentProgram;nt===!0&&(qt=Nn(k,U,I));let Qn=!1,Ft=!1,Ii=!1;const ct=qt.getUniforms(),kt=ze.uniforms;if(ie.useProgram(qt.program)&&(Qn=!0,Ft=!0,Ii=!0),k.id!==y&&(y=k.id,Ft=!0),Qn||x!==M){ie.buffers.depth.getReversed()?(ve.copy(M.projectionMatrix),Eh(ve),Th(ve),ct.setValue(A,"projectionMatrix",ve)):ct.setValue(A,"projectionMatrix",M.projectionMatrix),ct.setValue(A,"viewMatrix",M.matrixWorldInverse);const Dt=ct.map.cameraPosition;Dt!==void 0&&Dt.setValue(A,Z.setFromMatrixPosition(M.matrixWorld)),Ye.logarithmicDepthBuffer&&ct.setValue(A,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)&&ct.setValue(A,"isOrthographic",M.isOrthographicCamera===!0),x!==M&&(x=M,Ft=!0,Ii=!0)}if(I.isSkinnedMesh){ct.setOptional(A,I,"bindMatrix"),ct.setOptional(A,I,"bindMatrixInverse");const wt=I.skeleton;wt&&(wt.boneTexture===null&&wt.computeBoneTexture(),ct.setValue(A,"boneTexture",wt.boneTexture,Ve))}I.isBatchedMesh&&(ct.setOptional(A,I,"batchingTexture"),ct.setValue(A,"batchingTexture",I._matricesTexture,Ve),ct.setOptional(A,I,"batchingIdTexture"),ct.setValue(A,"batchingIdTexture",I._indirectTexture,Ve),ct.setOptional(A,I,"batchingColorTexture"),I._colorsTexture!==null&&ct.setValue(A,"batchingColorTexture",I._colorsTexture,Ve));const Ht=z.morphAttributes;if((Ht.position!==void 0||Ht.normal!==void 0||Ht.color!==void 0)&&Me.update(I,z,qt),(Ft||ze.receiveShadow!==I.receiveShadow)&&(ze.receiveShadow=I.receiveShadow,ct.setValue(A,"receiveShadow",I.receiveShadow)),k.isMeshGouraudMaterial&&k.envMap!==null&&(kt.envMap.value=Te,kt.flipEnvMap.value=Te.isCubeTexture&&Te.isRenderTargetTexture===!1?-1:1),k.isMeshStandardMaterial&&k.envMap===null&&U.environment!==null&&(kt.envMapIntensity.value=U.environmentIntensity),Ft&&(ct.setValue(A,"toneMappingExposure",S.toneMappingExposure),ze.needsLights&&Nt(kt,Ii),re&&k.fog===!0&&V.refreshFogUniforms(kt,re),V.refreshMaterialUniforms(kt,k,G,ne,f.state.transmissionRenderTarget[M.id]),Nr.upload(A,Di(ze),kt,Ve)),k.isShaderMaterial&&k.uniformsNeedUpdate===!0&&(Nr.upload(A,Di(ze),kt,Ve),k.uniformsNeedUpdate=!1),k.isSpriteMaterial&&ct.setValue(A,"center",I.center),ct.setValue(A,"modelViewMatrix",I.modelViewMatrix),ct.setValue(A,"normalMatrix",I.normalMatrix),ct.setValue(A,"modelMatrix",I.matrixWorld),k.isShaderMaterial||k.isRawShaderMaterial){const wt=k.uniformsGroups;for(let Dt=0,jr=wt.length;Dt<jr;Dt++){const On=wt[Dt];D.update(On,qt),D.bind(On,qt)}}return qt}function Nt(M,U){M.ambientLightColor.needsUpdate=U,M.lightProbe.needsUpdate=U,M.directionalLights.needsUpdate=U,M.directionalLightShadows.needsUpdate=U,M.pointLights.needsUpdate=U,M.pointLightShadows.needsUpdate=U,M.spotLights.needsUpdate=U,M.spotLightShadows.needsUpdate=U,M.rectAreaLights.needsUpdate=U,M.hemisphereLights.needsUpdate=U}function Fn(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return P},this.setRenderTargetTextures=function(M,U,z){const k=Ee.get(M);k.__autoAllocateDepthBuffer=M.resolveDepthBuffer===!1,k.__autoAllocateDepthBuffer===!1&&(k.__useRenderToTexture=!1),Ee.get(M.texture).__webglTexture=U,Ee.get(M.depthTexture).__webglTexture=k.__autoAllocateDepthBuffer?void 0:z,k.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(M,U){const z=Ee.get(M);z.__webglFramebuffer=U,z.__useDefaultFramebuffer=U===void 0};const Wl=A.createFramebuffer();this.setRenderTarget=function(M,U=0,z=0){P=M,w=U,C=z;let k=!0,I=null,re=!1,ge=!1;if(M){const Te=Ee.get(M);if(Te.__useDefaultFramebuffer!==void 0)ie.bindFramebuffer(A.FRAMEBUFFER,null),k=!1;else if(Te.__webglFramebuffer===void 0)Ve.setupRenderTarget(M);else if(Te.__hasExternalTextures)Ve.rebindTextures(M,Ee.get(M.texture).__webglTexture,Ee.get(M.depthTexture).__webglTexture);else if(M.depthBuffer){const Ie=M.depthTexture;if(Te.__boundDepthTexture!==Ie){if(Ie!==null&&Ee.has(Ie)&&(M.width!==Ie.image.width||M.height!==Ie.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Ve.setupDepthRenderbuffer(M)}}const He=M.texture;(He.isData3DTexture||He.isDataArrayTexture||He.isCompressedArrayTexture)&&(ge=!0);const Ge=Ee.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(Ge[U])?I=Ge[U][z]:I=Ge[U],re=!0):M.samples>0&&Ve.useMultisampledRTT(M)===!1?I=Ee.get(M).__webglMultisampledFramebuffer:Array.isArray(Ge)?I=Ge[z]:I=Ge,R.copy(M.viewport),H.copy(M.scissor),B=M.scissorTest}else R.copy(se).multiplyScalar(G).floor(),H.copy(We).multiplyScalar(G).floor(),B=Ze;if(z!==0&&(I=Wl),ie.bindFramebuffer(A.FRAMEBUFFER,I)&&k&&ie.drawBuffers(M,I),ie.viewport(R),ie.scissor(H),ie.setScissorTest(B),re){const Te=Ee.get(M.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_CUBE_MAP_POSITIVE_X+U,Te.__webglTexture,z)}else if(ge){const Te=Ee.get(M.texture),He=U;A.framebufferTextureLayer(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,Te.__webglTexture,z,He)}else if(M!==null&&z!==0){const Te=Ee.get(M.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,Te.__webglTexture,z)}y=-1},this.readRenderTargetPixels=function(M,U,z,k,I,re,ge,we=0){if(!(M&&M.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Te=Ee.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&ge!==void 0&&(Te=Te[ge]),Te){ie.bindFramebuffer(A.FRAMEBUFFER,Te);try{const He=M.textures[we],Ge=He.format,Ie=He.type;if(!Ye.textureFormatReadable(Ge)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ye.textureTypeReadable(Ie)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=M.width-k&&z>=0&&z<=M.height-I&&(M.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+we),A.readPixels(U,z,k,I,ce.convert(Ge),ce.convert(Ie),re))}finally{const He=P!==null?Ee.get(P).__webglFramebuffer:null;ie.bindFramebuffer(A.FRAMEBUFFER,He)}}},this.readRenderTargetPixelsAsync=async function(M,U,z,k,I,re,ge,we=0){if(!(M&&M.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Te=Ee.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&ge!==void 0&&(Te=Te[ge]),Te)if(U>=0&&U<=M.width-k&&z>=0&&z<=M.height-I){ie.bindFramebuffer(A.FRAMEBUFFER,Te);const He=M.textures[we],Ge=He.format,Ie=He.type;if(!Ye.textureFormatReadable(Ge))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ye.textureTypeReadable(Ie))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Je=A.createBuffer();A.bindBuffer(A.PIXEL_PACK_BUFFER,Je),A.bufferData(A.PIXEL_PACK_BUFFER,re.byteLength,A.STREAM_READ),M.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+we),A.readPixels(U,z,k,I,ce.convert(Ge),ce.convert(Ie),0);const rt=P!==null?Ee.get(P).__webglFramebuffer:null;ie.bindFramebuffer(A.FRAMEBUFFER,rt);const ft=A.fenceSync(A.SYNC_GPU_COMMANDS_COMPLETE,0);return A.flush(),await yh(A,ft,4),A.bindBuffer(A.PIXEL_PACK_BUFFER,Je),A.getBufferSubData(A.PIXEL_PACK_BUFFER,0,re),A.deleteBuffer(Je),A.deleteSync(ft),re}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(M,U=null,z=0){const k=Math.pow(2,-z),I=Math.floor(M.image.width*k),re=Math.floor(M.image.height*k),ge=U!==null?U.x:0,we=U!==null?U.y:0;Ve.setTexture2D(M,0),A.copyTexSubImage2D(A.TEXTURE_2D,z,0,0,ge,we,I,re),ie.unbindTexture()};const Xl=A.createFramebuffer(),ql=A.createFramebuffer();this.copyTextureToTexture=function(M,U,z=null,k=null,I=0,re=null){re===null&&(I!==0?(vi("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),re=I,I=0):re=0);let ge,we,Te,He,Ge,Ie,Je,rt,ft;const dt=M.isCompressedTexture?M.mipmaps[re]:M.image;if(z!==null)ge=z.max.x-z.min.x,we=z.max.y-z.min.y,Te=z.isBox3?z.max.z-z.min.z:1,He=z.min.x,Ge=z.min.y,Ie=z.isBox3?z.min.z:0;else{const Ht=Math.pow(2,-I);ge=Math.floor(dt.width*Ht),we=Math.floor(dt.height*Ht),M.isDataArrayTexture?Te=dt.depth:M.isData3DTexture?Te=Math.floor(dt.depth*Ht):Te=1,He=0,Ge=0,Ie=0}k!==null?(Je=k.x,rt=k.y,ft=k.z):(Je=0,rt=0,ft=0);const tt=ce.convert(U.format),ze=ce.convert(U.type);let yt;U.isData3DTexture?(Ve.setTexture3D(U,0),yt=A.TEXTURE_3D):U.isDataArrayTexture||U.isCompressedArrayTexture?(Ve.setTexture2DArray(U,0),yt=A.TEXTURE_2D_ARRAY):(Ve.setTexture2D(U,0),yt=A.TEXTURE_2D),A.pixelStorei(A.UNPACK_FLIP_Y_WEBGL,U.flipY),A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),A.pixelStorei(A.UNPACK_ALIGNMENT,U.unpackAlignment);const nt=A.getParameter(A.UNPACK_ROW_LENGTH),qt=A.getParameter(A.UNPACK_IMAGE_HEIGHT),Qn=A.getParameter(A.UNPACK_SKIP_PIXELS),Ft=A.getParameter(A.UNPACK_SKIP_ROWS),Ii=A.getParameter(A.UNPACK_SKIP_IMAGES);A.pixelStorei(A.UNPACK_ROW_LENGTH,dt.width),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,dt.height),A.pixelStorei(A.UNPACK_SKIP_PIXELS,He),A.pixelStorei(A.UNPACK_SKIP_ROWS,Ge),A.pixelStorei(A.UNPACK_SKIP_IMAGES,Ie);const ct=M.isDataArrayTexture||M.isData3DTexture,kt=U.isDataArrayTexture||U.isData3DTexture;if(M.isDepthTexture){const Ht=Ee.get(M),wt=Ee.get(U),Dt=Ee.get(Ht.__renderTarget),jr=Ee.get(wt.__renderTarget);ie.bindFramebuffer(A.READ_FRAMEBUFFER,Dt.__webglFramebuffer),ie.bindFramebuffer(A.DRAW_FRAMEBUFFER,jr.__webglFramebuffer);for(let On=0;On<Te;On++)ct&&(A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,Ee.get(M).__webglTexture,I,Ie+On),A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,Ee.get(U).__webglTexture,re,ft+On)),A.blitFramebuffer(He,Ge,ge,we,Je,rt,ge,we,A.DEPTH_BUFFER_BIT,A.NEAREST);ie.bindFramebuffer(A.READ_FRAMEBUFFER,null),ie.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else if(I!==0||M.isRenderTargetTexture||Ee.has(M)){const Ht=Ee.get(M),wt=Ee.get(U);ie.bindFramebuffer(A.READ_FRAMEBUFFER,Xl),ie.bindFramebuffer(A.DRAW_FRAMEBUFFER,ql);for(let Dt=0;Dt<Te;Dt++)ct?A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,Ht.__webglTexture,I,Ie+Dt):A.framebufferTexture2D(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,Ht.__webglTexture,I),kt?A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,wt.__webglTexture,re,ft+Dt):A.framebufferTexture2D(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,wt.__webglTexture,re),I!==0?A.blitFramebuffer(He,Ge,ge,we,Je,rt,ge,we,A.COLOR_BUFFER_BIT,A.NEAREST):kt?A.copyTexSubImage3D(yt,re,Je,rt,ft+Dt,He,Ge,ge,we):A.copyTexSubImage2D(yt,re,Je,rt,He,Ge,ge,we);ie.bindFramebuffer(A.READ_FRAMEBUFFER,null),ie.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else kt?M.isDataTexture||M.isData3DTexture?A.texSubImage3D(yt,re,Je,rt,ft,ge,we,Te,tt,ze,dt.data):U.isCompressedArrayTexture?A.compressedTexSubImage3D(yt,re,Je,rt,ft,ge,we,Te,tt,dt.data):A.texSubImage3D(yt,re,Je,rt,ft,ge,we,Te,tt,ze,dt):M.isDataTexture?A.texSubImage2D(A.TEXTURE_2D,re,Je,rt,ge,we,tt,ze,dt.data):M.isCompressedTexture?A.compressedTexSubImage2D(A.TEXTURE_2D,re,Je,rt,dt.width,dt.height,tt,dt.data):A.texSubImage2D(A.TEXTURE_2D,re,Je,rt,ge,we,tt,ze,dt);A.pixelStorei(A.UNPACK_ROW_LENGTH,nt),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,qt),A.pixelStorei(A.UNPACK_SKIP_PIXELS,Qn),A.pixelStorei(A.UNPACK_SKIP_ROWS,Ft),A.pixelStorei(A.UNPACK_SKIP_IMAGES,Ii),re===0&&U.generateMipmaps&&A.generateMipmap(yt),ie.unbindTexture()},this.copyTextureToTexture3D=function(M,U,z=null,k=null,I=0){return vi('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(M,U,z,k,I)},this.initRenderTarget=function(M){Ee.get(M).__webglFramebuffer===void 0&&Ve.setupRenderTarget(M)},this.initTexture=function(M){M.isCubeTexture?Ve.setTextureCube(M,0):M.isData3DTexture?Ve.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?Ve.setTexture2DArray(M,0):Ve.setTexture2D(M,0),ie.unbindTexture()},this.resetState=function(){w=0,C=0,P=null,ie.reset(),ke.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return vn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Qe._getDrawingBufferColorSpace(e),t.unpackColorSpace=Qe._getUnpackColorSpace()}}const Zm=/^[og]\s*(.+)?/,$m=/^mtllib /,Jm=/^usemtl /,Qm=/^usemap /,Wo=/\s+/,Xo=new N,Cs=new N,qo=new N,Yo=new N,Gt=new N,Ar=new Ke;function e_(){const i={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(r,s){const a=this._finalize(!1);a&&(a.inherited||a.groupCount<=0)&&this.materials.splice(a.index,1);const o={index:this.materials.length,name:r||"",mtllib:Array.isArray(s)&&s.length>0?s[s.length-1]:"",smooth:a!==void 0?a.smooth:this.smooth,groupStart:a!==void 0?a.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(l){const c={index:typeof l=="number"?l:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return c.clone=this.clone.bind(c),c}};return this.materials.push(o),o},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(r){const s=this.currentMaterial();if(s&&s.groupEnd===-1&&(s.groupEnd=this.geometry.vertices.length/3,s.groupCount=s.groupEnd-s.groupStart,s.inherited=!1),r&&this.materials.length>1)for(let a=this.materials.length-1;a>=0;a--)this.materials[a].groupCount<=0&&this.materials.splice(a,1);return r&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),s}},n&&n.name&&typeof n.clone=="function"){const r=n.clone(0);r.inherited=!0,this.object.materials.push(r)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){const r=this.vertices,s=this.object.geometry.vertices;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){const r=this.normals,s=this.object.geometry.normals;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){const r=this.vertices,s=this.object.geometry.normals;Xo.fromArray(r,e),Cs.fromArray(r,t),qo.fromArray(r,n),Gt.subVectors(qo,Cs),Yo.subVectors(Xo,Cs),Gt.cross(Yo),Gt.normalize(),s.push(Gt.x,Gt.y,Gt.z),s.push(Gt.x,Gt.y,Gt.z),s.push(Gt.x,Gt.y,Gt.z)},addColor:function(e,t,n){const r=this.colors,s=this.object.geometry.colors;r[e]!==void 0&&s.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&s.push(r[t+0],r[t+1],r[t+2]),r[n]!==void 0&&s.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){const r=this.uvs,s=this.object.geometry.uvs;s.push(r[e+0],r[e+1]),s.push(r[t+0],r[t+1]),s.push(r[n+0],r[n+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,s,a,o,l,c){const h=this.vertices.length;let u=this.parseVertexIndex(e,h),d=this.parseVertexIndex(t,h),p=this.parseVertexIndex(n,h);if(this.addVertex(u,d,p),this.addColor(u,d,p),o!==void 0&&o!==""){const _=this.normals.length;u=this.parseNormalIndex(o,_),d=this.parseNormalIndex(l,_),p=this.parseNormalIndex(c,_),this.addNormal(u,d,p)}else this.addFaceNormal(u,d,p);if(r!==void 0&&r!==""){const _=this.uvs.length;u=this.parseUVIndex(r,_),d=this.parseUVIndex(s,_),p=this.parseUVIndex(a,_),this.addUV(u,d,p),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let n=0,r=e.length;n<r;n++){const s=this.parseVertexIndex(e[n],t);this.addVertexPoint(s),this.addColor(s)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const n=this.vertices.length,r=this.uvs.length;for(let s=0,a=e.length;s<a;s++)this.addVertexLine(this.parseVertexIndex(e[s],n));for(let s=0,a=t.length;s<a;s++)this.addUVLine(this.parseUVIndex(t[s],r))}};return i.startObject("",!1),i}class t_ extends wi{constructor(e){super(e),this.materials=null}load(e,t,n,r){const s=this,a=new Al(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(o))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},n,r)}setMaterials(e){return this.materials=e,this}parse(e){const t=new e_;e.indexOf(`\r
3827
+ }`;class Km{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new Pt,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Un({vertexShader:Ym,fragmentShader:jm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new $t(new Kr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Zm extends Jn{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,d=null,p=null,_=null;const v=new Km,m=t.getContextAttributes();let f=null,b=null;const E=[],S=[],D=new Xe;let w=null;const R=new Wt;R.viewport=new pt;const L=new Wt;L.viewport=new pt;const y=[R,L],x=new mu;let C=null,H=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let le=E[Y];return le===void 0&&(le=new Ss,E[Y]=le),le.getTargetRaySpace()},this.getControllerGrip=function(Y){let le=E[Y];return le===void 0&&(le=new Ss,E[Y]=le),le.getGripSpace()},this.getHand=function(Y){let le=E[Y];return le===void 0&&(le=new Ss,E[Y]=le),le.getHandSpace()};function B(Y){const le=S.indexOf(Y.inputSource);if(le===-1)return;const Pe=E[le];Pe!==void 0&&(Pe.update(Y.inputSource,Y.frame,c||a),Pe.dispatchEvent({type:Y.type,data:Y.inputSource}))}function j(){r.removeEventListener("select",B),r.removeEventListener("selectstart",B),r.removeEventListener("selectend",B),r.removeEventListener("squeeze",B),r.removeEventListener("squeezestart",B),r.removeEventListener("squeezeend",B),r.removeEventListener("end",j),r.removeEventListener("inputsourceschange",J);for(let Y=0;Y<E.length;Y++){const le=S[Y];le!==null&&(S[Y]=null,E[Y].disconnect(le))}C=null,H=null,v.reset(),e.setRenderTarget(f),p=null,d=null,u=null,r=null,b=null,Ze.stop(),n.isPresenting=!1,e.setPixelRatio(w),e.setSize(D.width,D.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){s=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){o=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(Y){c=Y},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return u},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(Y){if(r=Y,r!==null){if(f=e.getRenderTarget(),r.addEventListener("select",B),r.addEventListener("selectstart",B),r.addEventListener("selectend",B),r.addEventListener("squeeze",B),r.addEventListener("squeezestart",B),r.addEventListener("squeezeend",B),r.addEventListener("end",j),r.addEventListener("inputsourceschange",J),m.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(D),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let Pe=null,ve=null,Ue=null;m.depth&&(Ue=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Pe=m.stencil?Zi:Ki,ve=m.stencil?ji:Kn);const Z={colorFormat:t.RGBA8,depthFormat:Ue,scaleFactor:s};u=new XRWebGLBinding(r,t),d=u.createProjectionLayer(Z),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),b=new $n(d.textureWidth,d.textureHeight,{format:Zt,type:sn,depthTexture:new wl(d.textureWidth,d.textureHeight,ve,void 0,void 0,void 0,void 0,void 0,void 0,Pe),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const Pe={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,Pe),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),b=new $n(p.framebufferWidth,p.framebufferHeight,{format:Zt,type:sn,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),Ze.setContext(r),Ze.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return v.getDepthTexture()};function J(Y){for(let le=0;le<Y.removed.length;le++){const Pe=Y.removed[le],ve=S.indexOf(Pe);ve>=0&&(S[ve]=null,E[ve].disconnect(Pe))}for(let le=0;le<Y.added.length;le++){const Pe=Y.added[le];let ve=S.indexOf(Pe);if(ve===-1){for(let Z=0;Z<E.length;Z++)if(Z>=S.length){S.push(Pe),ve=Z;break}else if(S[Z]===null){S[Z]=Pe,ve=Z;break}if(ve===-1)break}const Ue=E[ve];Ue&&Ue.connect(Pe)}}const W=new N,ne=new N;function G(Y,le,Pe){W.setFromMatrixPosition(le.matrixWorld),ne.setFromMatrixPosition(Pe.matrixWorld);const ve=W.distanceTo(ne),Ue=le.projectionMatrix.elements,Z=Pe.projectionMatrix.elements,Q=Ue[14]/(Ue[10]-1),de=Ue[14]/(Ue[10]+1),Se=(Ue[9]+1)/Ue[5],oe=(Ue[9]-1)/Ue[5],A=(Ue[8]-1)/Ue[0],ae=(Z[8]+1)/Z[0],Re=Q*A,Ye=Q*ae,ie=ve/(-A+ae),Fe=ie*-A;if(le.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(Fe),Y.translateZ(ie),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),Ue[10]===-1)Y.projectionMatrix.copy(le.projectionMatrix),Y.projectionMatrixInverse.copy(le.projectionMatrixInverse);else{const Ee=Q+ie,Ve=de+ie,lt=Re-Fe,T=Ye+(ve-Fe),g=Se*de/Ve*Ee,F=oe*de/Ve*Ee;Y.projectionMatrix.makePerspective(lt,T,g,F,Ee,Ve),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function fe(Y,le){le===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(le.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(r===null)return;let le=Y.near,Pe=Y.far;v.texture!==null&&(v.depthNear>0&&(le=v.depthNear),v.depthFar>0&&(Pe=v.depthFar)),x.near=L.near=R.near=le,x.far=L.far=R.far=Pe,(C!==x.near||H!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),C=x.near,H=x.far),R.layers.mask=Y.layers.mask|2,L.layers.mask=Y.layers.mask|4,x.layers.mask=R.layers.mask|L.layers.mask;const ve=Y.parent,Ue=x.cameras;fe(x,ve);for(let Z=0;Z<Ue.length;Z++)fe(Ue[Z],ve);Ue.length===2?G(x,R,L):x.projectionMatrix.copy(R.projectionMatrix),xe(Y,x,ve)};function xe(Y,le,Pe){Pe===null?Y.matrix.copy(le.matrixWorld):(Y.matrix.copy(Pe.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(le.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(le.projectionMatrix),Y.projectionMatrixInverse.copy(le.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=va*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(d===null&&p===null))return l},this.setFoveation=function(Y){l=Y,d!==null&&(d.fixedFoveation=Y),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=Y)},this.hasDepthSensing=function(){return v.texture!==null},this.getDepthSensingMesh=function(){return v.getMesh(x)};let se=null;function We(Y,le){if(h=le.getViewerPose(c||a),_=le,h!==null){const Pe=h.views;p!==null&&(e.setRenderTargetFramebuffer(b,p.framebuffer),e.setRenderTarget(b));let ve=!1;Pe.length!==x.cameras.length&&(x.cameras.length=0,ve=!0);for(let Q=0;Q<Pe.length;Q++){const de=Pe[Q];let Se=null;if(p!==null)Se=p.getViewport(de);else{const A=u.getViewSubImage(d,de);Se=A.viewport,Q===0&&(e.setRenderTargetTextures(b,A.colorTexture,A.depthStencilTexture),e.setRenderTarget(b))}let oe=y[Q];oe===void 0&&(oe=new Wt,oe.layers.enable(Q),oe.viewport=new pt,y[Q]=oe),oe.matrix.fromArray(de.transform.matrix),oe.matrix.decompose(oe.position,oe.quaternion,oe.scale),oe.projectionMatrix.fromArray(de.projectionMatrix),oe.projectionMatrixInverse.copy(oe.projectionMatrix).invert(),oe.viewport.set(Se.x,Se.y,Se.width,Se.height),Q===0&&(x.matrix.copy(oe.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),ve===!0&&x.cameras.push(oe)}const Ue=r.enabledFeatures;if(Ue&&Ue.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&u){const Q=u.getDepthInformation(Pe[0]);Q&&Q.isValid&&Q.texture&&v.init(e,Q,r.renderState)}}for(let Pe=0;Pe<E.length;Pe++){const ve=S[Pe],Ue=E[Pe];ve!==null&&Ue!==void 0&&Ue.update(ve,le,c||a)}se&&se(Y,le),le.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:le}),_=null}const Ze=new Ul;Ze.setAnimationLoop(We),this.setAnimationLoop=function(Y){se=Y},this.dispose=function(){}}}const Gn=new an,$m=new ht;function Jm(i,e){function t(m,f){m.matrixAutoUpdate===!0&&m.updateMatrix(),f.value.copy(m.matrix)}function n(m,f){f.color.getRGB(m.fogColor.value,Tl(i)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function r(m,f,b,E,S){f.isMeshBasicMaterial||f.isMeshLambertMaterial?s(m,f):f.isMeshToonMaterial?(s(m,f),u(m,f)):f.isMeshPhongMaterial?(s(m,f),h(m,f)):f.isMeshStandardMaterial?(s(m,f),d(m,f),f.isMeshPhysicalMaterial&&p(m,f,S)):f.isMeshMatcapMaterial?(s(m,f),_(m,f)):f.isMeshDepthMaterial?s(m,f):f.isMeshDistanceMaterial?(s(m,f),v(m,f)):f.isMeshNormalMaterial?s(m,f):f.isLineBasicMaterial?(a(m,f),f.isLineDashedMaterial&&o(m,f)):f.isPointsMaterial?l(m,f,b,E):f.isSpriteMaterial?c(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(m,f){m.opacity.value=f.opacity,f.color&&m.diffuse.value.copy(f.color),f.emissive&&m.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.bumpMap&&(m.bumpMap.value=f.bumpMap,t(f.bumpMap,m.bumpMapTransform),m.bumpScale.value=f.bumpScale,f.side===It&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,t(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===It&&m.normalScale.value.negate()),f.displacementMap&&(m.displacementMap.value=f.displacementMap,t(f.displacementMap,m.displacementMapTransform),m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,m.emissiveMapTransform)),f.specularMap&&(m.specularMap.value=f.specularMap,t(f.specularMap,m.specularMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const b=e.get(f),E=b.envMap,S=b.envMapRotation;E&&(m.envMap.value=E,Gn.copy(S),Gn.x*=-1,Gn.y*=-1,Gn.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(Gn.y*=-1,Gn.z*=-1),m.envMapRotation.value.setFromMatrix4($m.makeRotationFromEuler(Gn)),m.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap&&(m.lightMap.value=f.lightMap,m.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,m.lightMapTransform)),f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,m.aoMapTransform))}function a(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform))}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,b,E){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*b,m.scale.value=E*.5,f.map&&(m.map.value=f.map,t(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function h(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function u(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function d(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,b){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===It&&m.clearcoatNormalScale.value.negate())),f.dispersion>0&&(m.dispersion.value=f.dispersion),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=b.texture,m.transmissionSamplerSize.value.set(b.width,b.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,f){f.matcap&&(m.matcap.value=f.matcap)}function v(m,f){const b=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(b.matrixWorld),m.nearDistance.value=b.shadow.camera.near,m.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Qm(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,E){const S=E.program;n.uniformBlockBinding(b,S)}function c(b,E){let S=r[b.id];S===void 0&&(_(b),S=h(b),r[b.id]=S,b.addEventListener("dispose",m));const D=E.program;n.updateUBOMapping(b,D);const w=e.render.frame;s[b.id]!==w&&(d(b),s[b.id]=w)}function h(b){const E=u();b.__bindingPointIndex=E;const S=i.createBuffer(),D=b.__size,w=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,S),i.bufferData(i.UNIFORM_BUFFER,D,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,E,S),S}function u(){for(let b=0;b<o;b++)if(a.indexOf(b)===-1)return a.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(b){const E=r[b.id],S=b.uniforms,D=b.__cache;i.bindBuffer(i.UNIFORM_BUFFER,E);for(let w=0,R=S.length;w<R;w++){const L=Array.isArray(S[w])?S[w]:[S[w]];for(let y=0,x=L.length;y<x;y++){const C=L[y];if(p(C,w,y,D)===!0){const H=C.__offset,B=Array.isArray(C.value)?C.value:[C.value];let j=0;for(let J=0;J<B.length;J++){const W=B[J],ne=v(W);typeof W=="number"||typeof W=="boolean"?(C.__data[0]=W,i.bufferSubData(i.UNIFORM_BUFFER,H+j,C.__data)):W.isMatrix3?(C.__data[0]=W.elements[0],C.__data[1]=W.elements[1],C.__data[2]=W.elements[2],C.__data[3]=0,C.__data[4]=W.elements[3],C.__data[5]=W.elements[4],C.__data[6]=W.elements[5],C.__data[7]=0,C.__data[8]=W.elements[6],C.__data[9]=W.elements[7],C.__data[10]=W.elements[8],C.__data[11]=0):(W.toArray(C.__data,j),j+=ne.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,H,C.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function p(b,E,S,D){const w=b.value,R=E+"_"+S;if(D[R]===void 0)return typeof w=="number"||typeof w=="boolean"?D[R]=w:D[R]=w.clone(),!0;{const L=D[R];if(typeof w=="number"||typeof w=="boolean"){if(L!==w)return D[R]=w,!0}else if(L.equals(w)===!1)return L.copy(w),!0}return!1}function _(b){const E=b.uniforms;let S=0;const D=16;for(let R=0,L=E.length;R<L;R++){const y=Array.isArray(E[R])?E[R]:[E[R]];for(let x=0,C=y.length;x<C;x++){const H=y[x],B=Array.isArray(H.value)?H.value:[H.value];for(let j=0,J=B.length;j<J;j++){const W=B[j],ne=v(W),G=S%D,fe=G%ne.boundary,xe=G+fe;S+=fe,xe!==0&&D-xe<ne.storage&&(S+=D-xe),H.__data=new Float32Array(ne.storage/Float32Array.BYTES_PER_ELEMENT),H.__offset=S,S+=ne.storage}}}const w=S%D;return w>0&&(S+=D-w),b.__size=S,b.__cache={},this}function v(b){const E={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(E.boundary=4,E.storage=4):b.isVector2?(E.boundary=8,E.storage=8):b.isVector3||b.isColor?(E.boundary=16,E.storage=12):b.isVector4?(E.boundary=16,E.storage=16):b.isMatrix3?(E.boundary=48,E.storage=48):b.isMatrix4?(E.boundary=64,E.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),E}function m(b){const E=b.target;E.removeEventListener("dispose",m);const S=a.indexOf(E.__bindingPointIndex);a.splice(S,1),i.deleteBuffer(r[E.id]),delete r[E.id],delete s[E.id]}function f(){for(const b in r)i.deleteBuffer(r[b]);a=[],r={},s={}}return{bind:l,update:c,dispose:f}}class e_{constructor(e={}){const{canvas:t=Ah(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=a;const _=new Uint32Array(4),v=new Int32Array(4);let m=null,f=null;const b=[],E=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Ln,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const S=this;let D=!1;this._outputColorSpace=Et;let w=0,R=0,L=null,y=-1,x=null;const C=new pt,H=new pt;let B=null;const j=new Ke(0);let J=0,W=t.width,ne=t.height,G=1,fe=null,xe=null;const se=new pt(0,0,W,ne),We=new pt(0,0,W,ne);let Ze=!1;const Y=new Ua;let le=!1,Pe=!1;const ve=new ht,Ue=new ht,Z=new N,Q=new pt,de={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Se=!1;function oe(){return L===null?G:1}let A=n;function ae(M,U){return t.getContext(M,U)}try{const M={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ta}`),t.addEventListener("webglcontextlost",ye,!1),t.addEventListener("webglcontextrestored",O,!1),t.addEventListener("webglcontextcreationerror",X,!1),A===null){const U="webgl2";if(A=ae(U,M),A===null)throw ae(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(M){throw console.error("THREE.WebGLRenderer: "+M.message),M}let Re,Ye,ie,Fe,Ee,Ve,lt,T,g,F,q,K,V,De,he,Ae,Le,ee,Me,Oe,Ne,ce,ke,P;function pe(){Re=new hp(A),Re.init(),ce=new qm(A,Re),Ye=new ip(A,Re,e,ce),ie=new Wm(A,Re),Ye.reverseDepthBuffer&&d&&ie.buffers.depth.setReversed(!0),Fe=new dp(A),Ee=new Dm,Ve=new Xm(A,Re,ie,Ee,Ye,ce,Fe),lt=new sp(S),T=new cp(S),g=new vu(A),ke=new tp(A,g),F=new up(A,g,Fe,ke),q=new mp(A,F,g,Fe),Me=new pp(A,Ye,Ve),Ae=new rp(Ee),K=new Pm(S,lt,T,Re,Ye,ke,Ae),V=new Jm(S,Ee),De=new Um,he=new zm(Re),ee=new ep(S,lt,T,ie,q,p,l),Le=new Vm(S,q,Ye),P=new Qm(A,Fe,Ye,ie),Oe=new np(A,Re,Fe),Ne=new fp(A,Re,Fe),Fe.programs=K.programs,S.capabilities=Ye,S.extensions=Re,S.properties=Ee,S.renderLists=De,S.shadowMap=Le,S.state=ie,S.info=Fe}pe();const te=new Zm(S,A);this.xr=te,this.getContext=function(){return A},this.getContextAttributes=function(){return A.getContextAttributes()},this.forceContextLoss=function(){const M=Re.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){const M=Re.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(M){M!==void 0&&(G=M,this.setSize(W,ne,!1))},this.getSize=function(M){return M.set(W,ne)},this.setSize=function(M,U,z=!0){if(te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}W=M,ne=U,t.width=Math.floor(M*G),t.height=Math.floor(U*G),z===!0&&(t.style.width=M+"px",t.style.height=U+"px"),this.setViewport(0,0,M,U)},this.getDrawingBufferSize=function(M){return M.set(W*G,ne*G).floor()},this.setDrawingBufferSize=function(M,U,z){W=M,ne=U,G=z,t.width=Math.floor(M*z),t.height=Math.floor(U*z),this.setViewport(0,0,M,U)},this.getCurrentViewport=function(M){return M.copy(C)},this.getViewport=function(M){return M.copy(se)},this.setViewport=function(M,U,z,k){M.isVector4?se.set(M.x,M.y,M.z,M.w):se.set(M,U,z,k),ie.viewport(C.copy(se).multiplyScalar(G).round())},this.getScissor=function(M){return M.copy(We)},this.setScissor=function(M,U,z,k){M.isVector4?We.set(M.x,M.y,M.z,M.w):We.set(M,U,z,k),ie.scissor(H.copy(We).multiplyScalar(G).round())},this.getScissorTest=function(){return Ze},this.setScissorTest=function(M){ie.setScissorTest(Ze=M)},this.setOpaqueSort=function(M){fe=M},this.setTransparentSort=function(M){xe=M},this.getClearColor=function(M){return M.copy(ee.getClearColor())},this.setClearColor=function(){ee.setClearColor(...arguments)},this.getClearAlpha=function(){return ee.getClearAlpha()},this.setClearAlpha=function(){ee.setClearAlpha(...arguments)},this.clear=function(M=!0,U=!0,z=!0){let k=0;if(M){let I=!1;if(L!==null){const re=L.texture.format;I=re===Da||re===Pa||re===Ca}if(I){const re=L.texture.type,ge=re===sn||re===Kn||re===Yi||re===ji||re===wa||re===Ra,we=ee.getClearColor(),Te=ee.getClearAlpha(),He=we.r,Ge=we.g,Ie=we.b;ge?(_[0]=He,_[1]=Ge,_[2]=Ie,_[3]=Te,A.clearBufferuiv(A.COLOR,0,_)):(v[0]=He,v[1]=Ge,v[2]=Ie,v[3]=Te,A.clearBufferiv(A.COLOR,0,v))}else k|=A.COLOR_BUFFER_BIT}U&&(k|=A.DEPTH_BUFFER_BIT),z&&(k|=A.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),A.clear(k)},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(){t.removeEventListener("webglcontextlost",ye,!1),t.removeEventListener("webglcontextrestored",O,!1),t.removeEventListener("webglcontextcreationerror",X,!1),ee.dispose(),De.dispose(),he.dispose(),Ee.dispose(),lt.dispose(),T.dispose(),q.dispose(),ke.dispose(),P.dispose(),K.dispose(),te.dispose(),te.removeEventListener("sessionstart",xt),te.removeEventListener("sessionend",en),ut.stop()};function ye(M){M.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function O(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1;const M=Fe.autoReset,U=Le.enabled,z=Le.autoUpdate,k=Le.needsUpdate,I=Le.type;pe(),Fe.autoReset=M,Le.enabled=U,Le.autoUpdate=z,Le.needsUpdate=k,Le.type=I}function X(M){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function ue(M){const U=M.target;U.removeEventListener("dispose",ue),Be(U)}function Be(M){at(M),Ee.remove(M)}function at(M){const U=Ee.get(M).programs;U!==void 0&&(U.forEach(function(z){K.releaseProgram(z)}),M.isShaderMaterial&&K.releaseShaderCache(M))}this.renderBufferDirect=function(M,U,z,k,I,re){U===null&&(U=de);const ge=I.isMesh&&I.matrixWorld.determinant()<0,we=Ii(M,U,z,k,I);ie.setMaterial(k,ge);let Te=z.index,He=1;if(k.wireframe===!0){if(Te=F.getWireframeAttribute(z),Te===void 0)return;He=2}const Ge=z.drawRange,Ie=z.attributes.position;let Je=Ge.start*He,it=(Ge.start+Ge.count)*He;re!==null&&(Je=Math.max(Je,re.start*He),it=Math.min(it,(re.start+re.count)*He)),Te!==null?(Je=Math.max(Je,0),it=Math.min(it,Te.count)):Ie!=null&&(Je=Math.max(Je,0),it=Math.min(it,Ie.count));const ft=it-Je;if(ft<0||ft===1/0)return;ke.setup(I,k,we,z,Te);let dt,tt=Oe;if(Te!==null&&(dt=g.get(Te),tt=Ne,tt.setIndex(dt)),I.isMesh)k.wireframe===!0?(ie.setLineWidth(k.wireframeLinewidth*oe()),tt.setMode(A.LINES)):tt.setMode(A.TRIANGLES);else if(I.isLine){let ze=k.linewidth;ze===void 0&&(ze=1),ie.setLineWidth(ze*oe()),I.isLineSegments?tt.setMode(A.LINES):I.isLineLoop?tt.setMode(A.LINE_LOOP):tt.setMode(A.LINE_STRIP)}else I.isPoints?tt.setMode(A.POINTS):I.isSprite&&tt.setMode(A.TRIANGLES);if(I.isBatchedMesh)if(I._multiDrawInstances!==null)xi("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),tt.renderMultiDrawInstances(I._multiDrawStarts,I._multiDrawCounts,I._multiDrawCount,I._multiDrawInstances);else if(Re.get("WEBGL_multi_draw"))tt.renderMultiDraw(I._multiDrawStarts,I._multiDrawCounts,I._multiDrawCount);else{const ze=I._multiDrawStarts,yt=I._multiDrawCounts,nt=I._multiDrawCount,Xt=Te?g.get(Te).bytesPerElement:1,Qn=Ee.get(k).currentProgram.getUniforms();for(let Ft=0;Ft<nt;Ft++)Qn.setValue(A,"_gl_DrawID",Ft),tt.render(ze[Ft]/Xt,yt[Ft])}else if(I.isInstancedMesh)tt.renderInstances(Je,ft,I.count);else if(z.isInstancedBufferGeometry){const ze=z._maxInstanceCount!==void 0?z._maxInstanceCount:1/0,yt=Math.min(z.instanceCount,ze);tt.renderInstances(Je,ft,yt)}else tt.render(Je,ft)};function et(M,U,z){M.transparent===!0&&M.side===_n&&M.forceSinglePass===!1?(M.side=It,M.needsUpdate=!0,Nn(M,U,z),M.side=Sn,M.needsUpdate=!0,Nn(M,U,z),M.side=_n):Nn(M,U,z)}this.compile=function(M,U,z=null){z===null&&(z=M),f=he.get(z),f.init(U),E.push(f),z.traverseVisible(function(I){I.isLight&&I.layers.test(U.layers)&&(f.pushLight(I),I.castShadow&&f.pushShadow(I))}),M!==z&&M.traverseVisible(function(I){I.isLight&&I.layers.test(U.layers)&&(f.pushLight(I),I.castShadow&&f.pushShadow(I))}),f.setupLights();const k=new Set;return M.traverse(function(I){if(!(I.isMesh||I.isPoints||I.isLine||I.isSprite))return;const re=I.material;if(re)if(Array.isArray(re))for(let ge=0;ge<re.length;ge++){const we=re[ge];et(we,z,I),k.add(we)}else et(re,z,I),k.add(re)}),f=E.pop(),k},this.compileAsync=function(M,U,z=null){const k=this.compile(M,U,z);return new Promise(I=>{function re(){if(k.forEach(function(ge){Ee.get(ge).currentProgram.isReady()&&k.delete(ge)}),k.size===0){I(M);return}setTimeout(re,10)}Re.get("KHR_parallel_shader_compile")!==null?re():setTimeout(re,10)})};let Ce=null;function _e(M){Ce&&Ce(M)}function xt(){ut.stop()}function en(){ut.start()}const ut=new Ul;ut.setAnimationLoop(_e),typeof self<"u"&&ut.setContext(self),this.setAnimationLoop=function(M){Ce=M,te.setAnimationLoop(M),M===null?ut.stop():ut.start()},te.addEventListener("sessionstart",xt),te.addEventListener("sessionend",en),this.render=function(M,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(D===!0)return;if(M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),te.enabled===!0&&te.isPresenting===!0&&(te.cameraAutoUpdate===!0&&te.updateCamera(U),U=te.getCamera()),M.isScene===!0&&M.onBeforeRender(S,M,U,L),f=he.get(M,E.length),f.init(U),E.push(f),Ue.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),Y.setFromProjectionMatrix(Ue),Pe=this.localClippingEnabled,le=Ae.init(this.clippingPlanes,Pe),m=De.get(M,b.length),m.init(),b.push(m),te.enabled===!0&&te.isPresenting===!0){const re=S.xr.getDepthSensingMesh();re!==null&&At(re,U,-1/0,S.sortObjects)}At(M,U,0,S.sortObjects),m.finish(),S.sortObjects===!0&&m.sort(fe,xe),Se=te.enabled===!1||te.isPresenting===!1||te.hasDepthSensing()===!1,Se&&ee.addToRenderList(m,M),this.info.render.frame++,le===!0&&Ae.beginShadows();const z=f.state.shadowsArray;Le.render(z,M,U),le===!0&&Ae.endShadows(),this.info.autoReset===!0&&this.info.reset();const k=m.opaque,I=m.transmissive;if(f.setupLights(),U.isArrayCamera){const re=U.cameras;if(I.length>0)for(let ge=0,we=re.length;ge<we;ge++){const Te=re[ge];Pi(k,I,M,Te)}Se&&ee.render(M);for(let ge=0,we=re.length;ge<we;ge++){const Te=re[ge];zt(m,M,Te,Te.viewport)}}else I.length>0&&Pi(k,I,M,U),Se&&ee.render(M),zt(m,M,U);L!==null&&R===0&&(Ve.updateMultisampleRenderTarget(L),Ve.updateRenderTargetMipmap(L)),M.isScene===!0&&M.onAfterRender(S,M,U),ke.resetDefaultState(),y=-1,x=null,E.pop(),E.length>0?(f=E[E.length-1],le===!0&&Ae.setGlobalState(S.clippingPlanes,f.state.camera)):f=null,b.pop(),b.length>0?m=b[b.length-1]:m=null};function At(M,U,z,k){if(M.visible===!1)return;if(M.layers.test(U.layers)){if(M.isGroup)z=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(U);else if(M.isLight)f.pushLight(M),M.castShadow&&f.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Y.intersectsSprite(M)){k&&Q.setFromMatrixPosition(M.matrixWorld).applyMatrix4(Ue);const ge=q.update(M),we=M.material;we.visible&&m.push(M,ge,we,z,Q.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Y.intersectsObject(M))){const ge=q.update(M),we=M.material;if(k&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),Q.copy(M.boundingSphere.center)):(ge.boundingSphere===null&&ge.computeBoundingSphere(),Q.copy(ge.boundingSphere.center)),Q.applyMatrix4(M.matrixWorld).applyMatrix4(Ue)),Array.isArray(we)){const Te=ge.groups;for(let He=0,Ge=Te.length;He<Ge;He++){const Ie=Te[He],Je=we[Ie.materialIndex];Je&&Je.visible&&m.push(M,ge,Je,z,Q.z,Ie)}}else we.visible&&m.push(M,ge,we,z,Q.z,null)}}const re=M.children;for(let ge=0,we=re.length;ge<we;ge++)At(re[ge],U,z,k)}function zt(M,U,z,k){const I=M.opaque,re=M.transmissive,ge=M.transparent;f.setupLightsView(z),le===!0&&Ae.setGlobalState(S.clippingPlanes,z),k&&ie.viewport(C.copy(k)),I.length>0&&In(I,U,z),re.length>0&&In(re,U,z),ge.length>0&&In(ge,U,z),ie.buffers.depth.setTest(!0),ie.buffers.depth.setMask(!0),ie.buffers.color.setMask(!0),ie.setPolygonOffset(!1)}function Pi(M,U,z,k){if((z.isScene===!0?z.overrideMaterial:null)!==null)return;f.state.transmissionRenderTarget[k.id]===void 0&&(f.state.transmissionRenderTarget[k.id]=new $n(1,1,{generateMipmaps:!0,type:Re.has("EXT_color_buffer_half_float")||Re.has("EXT_color_buffer_float")?Ji:sn,minFilter:jn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Qe.workingColorSpace}));const re=f.state.transmissionRenderTarget[k.id],ge=k.viewport||C;re.setSize(ge.z*S.transmissionResolutionScale,ge.w*S.transmissionResolutionScale);const we=S.getRenderTarget();S.setRenderTarget(re),S.getClearColor(j),J=S.getClearAlpha(),J<1&&S.setClearColor(16777215,.5),S.clear(),Se&&ee.render(z);const Te=S.toneMapping;S.toneMapping=Ln;const He=k.viewport;if(k.viewport!==void 0&&(k.viewport=void 0),f.setupLightsView(k),le===!0&&Ae.setGlobalState(S.clippingPlanes,k),In(M,z,k),Ve.updateMultisampleRenderTarget(re),Ve.updateRenderTargetMipmap(re),Re.has("WEBGL_multisampled_render_to_texture")===!1){let Ge=!1;for(let Ie=0,Je=U.length;Ie<Je;Ie++){const it=U[Ie],ft=it.object,dt=it.geometry,tt=it.material,ze=it.group;if(tt.side===_n&&ft.layers.test(k.layers)){const yt=tt.side;tt.side=It,tt.needsUpdate=!0,Di(ft,z,k,dt,tt,ze),tt.side=yt,tt.needsUpdate=!0,Ge=!0}}Ge===!0&&(Ve.updateMultisampleRenderTarget(re),Ve.updateRenderTargetMipmap(re))}S.setRenderTarget(we),S.setClearColor(j,J),He!==void 0&&(k.viewport=He),S.toneMapping=Te}function In(M,U,z){const k=U.isScene===!0?U.overrideMaterial:null;for(let I=0,re=M.length;I<re;I++){const ge=M[I],we=ge.object,Te=ge.geometry,He=ge.group;let Ge=ge.material;Ge.allowOverride===!0&&k!==null&&(Ge=k),we.layers.test(z.layers)&&Di(we,U,z,Te,Ge,He)}}function Di(M,U,z,k,I,re){M.onBeforeRender(S,U,z,k,I,re),M.modelViewMatrix.multiplyMatrices(z.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),I.onBeforeRender(S,U,z,k,M,re),I.transparent===!0&&I.side===_n&&I.forceSinglePass===!1?(I.side=It,I.needsUpdate=!0,S.renderBufferDirect(z,U,k,I,M,re),I.side=Sn,I.needsUpdate=!0,S.renderBufferDirect(z,U,k,I,M,re),I.side=_n):S.renderBufferDirect(z,U,k,I,M,re),M.onAfterRender(S,U,z,k,I,re)}function Nn(M,U,z){U.isScene!==!0&&(U=de);const k=Ee.get(M),I=f.state.lights,re=f.state.shadowsArray,ge=I.state.version,we=K.getParameters(M,I.state,re,U,z),Te=K.getProgramCacheKey(we);let He=k.programs;k.environment=M.isMeshStandardMaterial?U.environment:null,k.fog=U.fog,k.envMap=(M.isMeshStandardMaterial?T:lt).get(M.envMap||k.environment),k.envMapRotation=k.environment!==null&&M.envMap===null?U.environmentRotation:M.envMapRotation,He===void 0&&(M.addEventListener("dispose",ue),He=new Map,k.programs=He);let Ge=He.get(Te);if(Ge!==void 0){if(k.currentProgram===Ge&&k.lightsStateVersion===ge)return Ui(M,we),Ge}else we.uniforms=K.getUniforms(M),M.onBeforeCompile(we,S),Ge=K.acquireProgram(we,Te),He.set(Te,Ge),k.uniforms=we.uniforms;const Ie=k.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Ie.clippingPlanes=Ae.uniform),Ui(M,we),k.needsLights=Fn(M),k.lightsStateVersion=ge,k.needsLights&&(Ie.ambientLightColor.value=I.state.ambient,Ie.lightProbe.value=I.state.probe,Ie.directionalLights.value=I.state.directional,Ie.directionalLightShadows.value=I.state.directionalShadow,Ie.spotLights.value=I.state.spot,Ie.spotLightShadows.value=I.state.spotShadow,Ie.rectAreaLights.value=I.state.rectArea,Ie.ltc_1.value=I.state.rectAreaLTC1,Ie.ltc_2.value=I.state.rectAreaLTC2,Ie.pointLights.value=I.state.point,Ie.pointLightShadows.value=I.state.pointShadow,Ie.hemisphereLights.value=I.state.hemi,Ie.directionalShadowMap.value=I.state.directionalShadowMap,Ie.directionalShadowMatrix.value=I.state.directionalShadowMatrix,Ie.spotShadowMap.value=I.state.spotShadowMap,Ie.spotLightMatrix.value=I.state.spotLightMatrix,Ie.spotLightMap.value=I.state.spotLightMap,Ie.pointShadowMap.value=I.state.pointShadowMap,Ie.pointShadowMatrix.value=I.state.pointShadowMatrix),k.currentProgram=Ge,k.uniformsList=null,Ge}function Li(M){if(M.uniformsList===null){const U=M.currentProgram.getUniforms();M.uniformsList=Or.seqWithValue(U.seq,M.uniforms)}return M.uniformsList}function Ui(M,U){const z=Ee.get(M);z.outputColorSpace=U.outputColorSpace,z.batching=U.batching,z.batchingColor=U.batchingColor,z.instancing=U.instancing,z.instancingColor=U.instancingColor,z.instancingMorph=U.instancingMorph,z.skinning=U.skinning,z.morphTargets=U.morphTargets,z.morphNormals=U.morphNormals,z.morphColors=U.morphColors,z.morphTargetsCount=U.morphTargetsCount,z.numClippingPlanes=U.numClippingPlanes,z.numIntersection=U.numClipIntersection,z.vertexAlphas=U.vertexAlphas,z.vertexTangents=U.vertexTangents,z.toneMapping=U.toneMapping}function Ii(M,U,z,k,I){U.isScene!==!0&&(U=de),Ve.resetTextureUnits();const re=U.fog,ge=k.isMeshStandardMaterial?U.environment:null,we=L===null?S.outputColorSpace:L.isXRRenderTarget===!0?L.texture.colorSpace:Ti,Te=(k.isMeshStandardMaterial?T:lt).get(k.envMap||ge),He=k.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,Ge=!!z.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),Ie=!!z.morphAttributes.position,Je=!!z.morphAttributes.normal,it=!!z.morphAttributes.color;let ft=Ln;k.toneMapped&&(L===null||L.isXRRenderTarget===!0)&&(ft=S.toneMapping);const dt=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,tt=dt!==void 0?dt.length:0,ze=Ee.get(k),yt=f.state.lights;if(le===!0&&(Pe===!0||M!==x)){const wt=M===x&&k.id===y;Ae.setState(k,M,wt)}let nt=!1;k.version===ze.__version?(ze.needsLights&&ze.lightsStateVersion!==yt.state.version||ze.outputColorSpace!==we||I.isBatchedMesh&&ze.batching===!1||!I.isBatchedMesh&&ze.batching===!0||I.isBatchedMesh&&ze.batchingColor===!0&&I.colorTexture===null||I.isBatchedMesh&&ze.batchingColor===!1&&I.colorTexture!==null||I.isInstancedMesh&&ze.instancing===!1||!I.isInstancedMesh&&ze.instancing===!0||I.isSkinnedMesh&&ze.skinning===!1||!I.isSkinnedMesh&&ze.skinning===!0||I.isInstancedMesh&&ze.instancingColor===!0&&I.instanceColor===null||I.isInstancedMesh&&ze.instancingColor===!1&&I.instanceColor!==null||I.isInstancedMesh&&ze.instancingMorph===!0&&I.morphTexture===null||I.isInstancedMesh&&ze.instancingMorph===!1&&I.morphTexture!==null||ze.envMap!==Te||k.fog===!0&&ze.fog!==re||ze.numClippingPlanes!==void 0&&(ze.numClippingPlanes!==Ae.numPlanes||ze.numIntersection!==Ae.numIntersection)||ze.vertexAlphas!==He||ze.vertexTangents!==Ge||ze.morphTargets!==Ie||ze.morphNormals!==Je||ze.morphColors!==it||ze.toneMapping!==ft||ze.morphTargetsCount!==tt)&&(nt=!0):(nt=!0,ze.__version=k.version);let Xt=ze.currentProgram;nt===!0&&(Xt=Nn(k,U,I));let Qn=!1,Ft=!1,Ni=!1;const ct=Xt.getUniforms(),kt=ze.uniforms;if(ie.useProgram(Xt.program)&&(Qn=!0,Ft=!0,Ni=!0),k.id!==y&&(y=k.id,Ft=!0),Qn||x!==M){ie.buffers.depth.getReversed()?(ve.copy(M.projectionMatrix),Rh(ve),Ch(ve),ct.setValue(A,"projectionMatrix",ve)):ct.setValue(A,"projectionMatrix",M.projectionMatrix),ct.setValue(A,"viewMatrix",M.matrixWorldInverse);const Dt=ct.map.cameraPosition;Dt!==void 0&&Dt.setValue(A,Z.setFromMatrixPosition(M.matrixWorld)),Ye.logarithmicDepthBuffer&&ct.setValue(A,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)&&ct.setValue(A,"isOrthographic",M.isOrthographicCamera===!0),x!==M&&(x=M,Ft=!0,Ni=!0)}if(I.isSkinnedMesh){ct.setOptional(A,I,"bindMatrix"),ct.setOptional(A,I,"bindMatrixInverse");const wt=I.skeleton;wt&&(wt.boneTexture===null&&wt.computeBoneTexture(),ct.setValue(A,"boneTexture",wt.boneTexture,Ve))}I.isBatchedMesh&&(ct.setOptional(A,I,"batchingTexture"),ct.setValue(A,"batchingTexture",I._matricesTexture,Ve),ct.setOptional(A,I,"batchingIdTexture"),ct.setValue(A,"batchingIdTexture",I._indirectTexture,Ve),ct.setOptional(A,I,"batchingColorTexture"),I._colorsTexture!==null&&ct.setValue(A,"batchingColorTexture",I._colorsTexture,Ve));const Ht=z.morphAttributes;if((Ht.position!==void 0||Ht.normal!==void 0||Ht.color!==void 0)&&Me.update(I,z,Xt),(Ft||ze.receiveShadow!==I.receiveShadow)&&(ze.receiveShadow=I.receiveShadow,ct.setValue(A,"receiveShadow",I.receiveShadow)),k.isMeshGouraudMaterial&&k.envMap!==null&&(kt.envMap.value=Te,kt.flipEnvMap.value=Te.isCubeTexture&&Te.isRenderTargetTexture===!1?-1:1),k.isMeshStandardMaterial&&k.envMap===null&&U.environment!==null&&(kt.envMapIntensity.value=U.environmentIntensity),Ft&&(ct.setValue(A,"toneMappingExposure",S.toneMappingExposure),ze.needsLights&&Nt(kt,Ni),re&&k.fog===!0&&V.refreshFogUniforms(kt,re),V.refreshMaterialUniforms(kt,k,G,ne,f.state.transmissionRenderTarget[M.id]),Or.upload(A,Li(ze),kt,Ve)),k.isShaderMaterial&&k.uniformsNeedUpdate===!0&&(Or.upload(A,Li(ze),kt,Ve),k.uniformsNeedUpdate=!1),k.isSpriteMaterial&&ct.setValue(A,"center",I.center),ct.setValue(A,"modelViewMatrix",I.modelViewMatrix),ct.setValue(A,"normalMatrix",I.normalMatrix),ct.setValue(A,"modelMatrix",I.matrixWorld),k.isShaderMaterial||k.isRawShaderMaterial){const wt=k.uniformsGroups;for(let Dt=0,$r=wt.length;Dt<$r;Dt++){const On=wt[Dt];P.update(On,Xt),P.bind(On,Xt)}}return Xt}function Nt(M,U){M.ambientLightColor.needsUpdate=U,M.lightProbe.needsUpdate=U,M.directionalLights.needsUpdate=U,M.directionalLightShadows.needsUpdate=U,M.pointLights.needsUpdate=U,M.pointLightShadows.needsUpdate=U,M.spotLights.needsUpdate=U,M.spotLightShadows.needsUpdate=U,M.rectAreaLights.needsUpdate=U,M.hemisphereLights.needsUpdate=U}function Fn(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return L},this.setRenderTargetTextures=function(M,U,z){const k=Ee.get(M);k.__autoAllocateDepthBuffer=M.resolveDepthBuffer===!1,k.__autoAllocateDepthBuffer===!1&&(k.__useRenderToTexture=!1),Ee.get(M.texture).__webglTexture=U,Ee.get(M.depthTexture).__webglTexture=k.__autoAllocateDepthBuffer?void 0:z,k.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(M,U){const z=Ee.get(M);z.__webglFramebuffer=U,z.__useDefaultFramebuffer=U===void 0};const jl=A.createFramebuffer();this.setRenderTarget=function(M,U=0,z=0){L=M,w=U,R=z;let k=!0,I=null,re=!1,ge=!1;if(M){const Te=Ee.get(M);if(Te.__useDefaultFramebuffer!==void 0)ie.bindFramebuffer(A.FRAMEBUFFER,null),k=!1;else if(Te.__webglFramebuffer===void 0)Ve.setupRenderTarget(M);else if(Te.__hasExternalTextures)Ve.rebindTextures(M,Ee.get(M.texture).__webglTexture,Ee.get(M.depthTexture).__webglTexture);else if(M.depthBuffer){const Ie=M.depthTexture;if(Te.__boundDepthTexture!==Ie){if(Ie!==null&&Ee.has(Ie)&&(M.width!==Ie.image.width||M.height!==Ie.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Ve.setupDepthRenderbuffer(M)}}const He=M.texture;(He.isData3DTexture||He.isDataArrayTexture||He.isCompressedArrayTexture)&&(ge=!0);const Ge=Ee.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(Ge[U])?I=Ge[U][z]:I=Ge[U],re=!0):M.samples>0&&Ve.useMultisampledRTT(M)===!1?I=Ee.get(M).__webglMultisampledFramebuffer:Array.isArray(Ge)?I=Ge[z]:I=Ge,C.copy(M.viewport),H.copy(M.scissor),B=M.scissorTest}else C.copy(se).multiplyScalar(G).floor(),H.copy(We).multiplyScalar(G).floor(),B=Ze;if(z!==0&&(I=jl),ie.bindFramebuffer(A.FRAMEBUFFER,I)&&k&&ie.drawBuffers(M,I),ie.viewport(C),ie.scissor(H),ie.setScissorTest(B),re){const Te=Ee.get(M.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_CUBE_MAP_POSITIVE_X+U,Te.__webglTexture,z)}else if(ge){const Te=Ee.get(M.texture),He=U;A.framebufferTextureLayer(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,Te.__webglTexture,z,He)}else if(M!==null&&z!==0){const Te=Ee.get(M.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,Te.__webglTexture,z)}y=-1},this.readRenderTargetPixels=function(M,U,z,k,I,re,ge,we=0){if(!(M&&M.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Te=Ee.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&ge!==void 0&&(Te=Te[ge]),Te){ie.bindFramebuffer(A.FRAMEBUFFER,Te);try{const He=M.textures[we],Ge=He.format,Ie=He.type;if(!Ye.textureFormatReadable(Ge)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ye.textureTypeReadable(Ie)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=M.width-k&&z>=0&&z<=M.height-I&&(M.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+we),A.readPixels(U,z,k,I,ce.convert(Ge),ce.convert(Ie),re))}finally{const He=L!==null?Ee.get(L).__webglFramebuffer:null;ie.bindFramebuffer(A.FRAMEBUFFER,He)}}},this.readRenderTargetPixelsAsync=async function(M,U,z,k,I,re,ge,we=0){if(!(M&&M.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Te=Ee.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&ge!==void 0&&(Te=Te[ge]),Te)if(U>=0&&U<=M.width-k&&z>=0&&z<=M.height-I){ie.bindFramebuffer(A.FRAMEBUFFER,Te);const He=M.textures[we],Ge=He.format,Ie=He.type;if(!Ye.textureFormatReadable(Ge))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ye.textureTypeReadable(Ie))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Je=A.createBuffer();A.bindBuffer(A.PIXEL_PACK_BUFFER,Je),A.bufferData(A.PIXEL_PACK_BUFFER,re.byteLength,A.STREAM_READ),M.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+we),A.readPixels(U,z,k,I,ce.convert(Ge),ce.convert(Ie),0);const it=L!==null?Ee.get(L).__webglFramebuffer:null;ie.bindFramebuffer(A.FRAMEBUFFER,it);const ft=A.fenceSync(A.SYNC_GPU_COMMANDS_COMPLETE,0);return A.flush(),await wh(A,ft,4),A.bindBuffer(A.PIXEL_PACK_BUFFER,Je),A.getBufferSubData(A.PIXEL_PACK_BUFFER,0,re),A.deleteBuffer(Je),A.deleteSync(ft),re}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(M,U=null,z=0){const k=Math.pow(2,-z),I=Math.floor(M.image.width*k),re=Math.floor(M.image.height*k),ge=U!==null?U.x:0,we=U!==null?U.y:0;Ve.setTexture2D(M,0),A.copyTexSubImage2D(A.TEXTURE_2D,z,0,0,ge,we,I,re),ie.unbindTexture()};const Kl=A.createFramebuffer(),Zl=A.createFramebuffer();this.copyTextureToTexture=function(M,U,z=null,k=null,I=0,re=null){re===null&&(I!==0?(xi("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),re=I,I=0):re=0);let ge,we,Te,He,Ge,Ie,Je,it,ft;const dt=M.isCompressedTexture?M.mipmaps[re]:M.image;if(z!==null)ge=z.max.x-z.min.x,we=z.max.y-z.min.y,Te=z.isBox3?z.max.z-z.min.z:1,He=z.min.x,Ge=z.min.y,Ie=z.isBox3?z.min.z:0;else{const Ht=Math.pow(2,-I);ge=Math.floor(dt.width*Ht),we=Math.floor(dt.height*Ht),M.isDataArrayTexture?Te=dt.depth:M.isData3DTexture?Te=Math.floor(dt.depth*Ht):Te=1,He=0,Ge=0,Ie=0}k!==null?(Je=k.x,it=k.y,ft=k.z):(Je=0,it=0,ft=0);const tt=ce.convert(U.format),ze=ce.convert(U.type);let yt;U.isData3DTexture?(Ve.setTexture3D(U,0),yt=A.TEXTURE_3D):U.isDataArrayTexture||U.isCompressedArrayTexture?(Ve.setTexture2DArray(U,0),yt=A.TEXTURE_2D_ARRAY):(Ve.setTexture2D(U,0),yt=A.TEXTURE_2D),A.pixelStorei(A.UNPACK_FLIP_Y_WEBGL,U.flipY),A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),A.pixelStorei(A.UNPACK_ALIGNMENT,U.unpackAlignment);const nt=A.getParameter(A.UNPACK_ROW_LENGTH),Xt=A.getParameter(A.UNPACK_IMAGE_HEIGHT),Qn=A.getParameter(A.UNPACK_SKIP_PIXELS),Ft=A.getParameter(A.UNPACK_SKIP_ROWS),Ni=A.getParameter(A.UNPACK_SKIP_IMAGES);A.pixelStorei(A.UNPACK_ROW_LENGTH,dt.width),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,dt.height),A.pixelStorei(A.UNPACK_SKIP_PIXELS,He),A.pixelStorei(A.UNPACK_SKIP_ROWS,Ge),A.pixelStorei(A.UNPACK_SKIP_IMAGES,Ie);const ct=M.isDataArrayTexture||M.isData3DTexture,kt=U.isDataArrayTexture||U.isData3DTexture;if(M.isDepthTexture){const Ht=Ee.get(M),wt=Ee.get(U),Dt=Ee.get(Ht.__renderTarget),$r=Ee.get(wt.__renderTarget);ie.bindFramebuffer(A.READ_FRAMEBUFFER,Dt.__webglFramebuffer),ie.bindFramebuffer(A.DRAW_FRAMEBUFFER,$r.__webglFramebuffer);for(let On=0;On<Te;On++)ct&&(A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,Ee.get(M).__webglTexture,I,Ie+On),A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,Ee.get(U).__webglTexture,re,ft+On)),A.blitFramebuffer(He,Ge,ge,we,Je,it,ge,we,A.DEPTH_BUFFER_BIT,A.NEAREST);ie.bindFramebuffer(A.READ_FRAMEBUFFER,null),ie.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else if(I!==0||M.isRenderTargetTexture||Ee.has(M)){const Ht=Ee.get(M),wt=Ee.get(U);ie.bindFramebuffer(A.READ_FRAMEBUFFER,Kl),ie.bindFramebuffer(A.DRAW_FRAMEBUFFER,Zl);for(let Dt=0;Dt<Te;Dt++)ct?A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,Ht.__webglTexture,I,Ie+Dt):A.framebufferTexture2D(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,Ht.__webglTexture,I),kt?A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,wt.__webglTexture,re,ft+Dt):A.framebufferTexture2D(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,wt.__webglTexture,re),I!==0?A.blitFramebuffer(He,Ge,ge,we,Je,it,ge,we,A.COLOR_BUFFER_BIT,A.NEAREST):kt?A.copyTexSubImage3D(yt,re,Je,it,ft+Dt,He,Ge,ge,we):A.copyTexSubImage2D(yt,re,Je,it,He,Ge,ge,we);ie.bindFramebuffer(A.READ_FRAMEBUFFER,null),ie.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else kt?M.isDataTexture||M.isData3DTexture?A.texSubImage3D(yt,re,Je,it,ft,ge,we,Te,tt,ze,dt.data):U.isCompressedArrayTexture?A.compressedTexSubImage3D(yt,re,Je,it,ft,ge,we,Te,tt,dt.data):A.texSubImage3D(yt,re,Je,it,ft,ge,we,Te,tt,ze,dt):M.isDataTexture?A.texSubImage2D(A.TEXTURE_2D,re,Je,it,ge,we,tt,ze,dt.data):M.isCompressedTexture?A.compressedTexSubImage2D(A.TEXTURE_2D,re,Je,it,dt.width,dt.height,tt,dt.data):A.texSubImage2D(A.TEXTURE_2D,re,Je,it,ge,we,tt,ze,dt);A.pixelStorei(A.UNPACK_ROW_LENGTH,nt),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,Xt),A.pixelStorei(A.UNPACK_SKIP_PIXELS,Qn),A.pixelStorei(A.UNPACK_SKIP_ROWS,Ft),A.pixelStorei(A.UNPACK_SKIP_IMAGES,Ni),re===0&&U.generateMipmaps&&A.generateMipmap(yt),ie.unbindTexture()},this.copyTextureToTexture3D=function(M,U,z=null,k=null,I=0){return xi('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(M,U,z,k,I)},this.initRenderTarget=function(M){Ee.get(M).__webglFramebuffer===void 0&&Ve.setupRenderTarget(M)},this.initTexture=function(M){M.isCubeTexture?Ve.setTextureCube(M,0):M.isData3DTexture?Ve.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?Ve.setTexture2DArray(M,0):Ve.setTexture2D(M,0),ie.unbindTexture()},this.resetState=function(){w=0,R=0,L=null,ie.reset(),ke.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return vn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Qe._getDrawingBufferColorSpace(e),t.unpackColorSpace=Qe._getUnpackColorSpace()}}const t_=/^[og]\s*(.+)?/,n_=/^mtllib /,i_=/^usemtl /,r_=/^usemap /,jo=/\s+/,Ko=new N,Ls=new N,Zo=new N,$o=new N,Gt=new N,Rr=new Ke;function s_(){const i={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(r,s){const a=this._finalize(!1);a&&(a.inherited||a.groupCount<=0)&&this.materials.splice(a.index,1);const o={index:this.materials.length,name:r||"",mtllib:Array.isArray(s)&&s.length>0?s[s.length-1]:"",smooth:a!==void 0?a.smooth:this.smooth,groupStart:a!==void 0?a.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(l){const c={index:typeof l=="number"?l:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return c.clone=this.clone.bind(c),c}};return this.materials.push(o),o},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(r){const s=this.currentMaterial();if(s&&s.groupEnd===-1&&(s.groupEnd=this.geometry.vertices.length/3,s.groupCount=s.groupEnd-s.groupStart,s.inherited=!1),r&&this.materials.length>1)for(let a=this.materials.length-1;a>=0;a--)this.materials[a].groupCount<=0&&this.materials.splice(a,1);return r&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),s}},n&&n.name&&typeof n.clone=="function"){const r=n.clone(0);r.inherited=!0,this.object.materials.push(r)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){const r=this.vertices,s=this.object.geometry.vertices;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){const r=this.normals,s=this.object.geometry.normals;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){const r=this.vertices,s=this.object.geometry.normals;Ko.fromArray(r,e),Ls.fromArray(r,t),Zo.fromArray(r,n),Gt.subVectors(Zo,Ls),$o.subVectors(Ko,Ls),Gt.cross($o),Gt.normalize(),s.push(Gt.x,Gt.y,Gt.z),s.push(Gt.x,Gt.y,Gt.z),s.push(Gt.x,Gt.y,Gt.z)},addColor:function(e,t,n){const r=this.colors,s=this.object.geometry.colors;r[e]!==void 0&&s.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&s.push(r[t+0],r[t+1],r[t+2]),r[n]!==void 0&&s.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){const r=this.uvs,s=this.object.geometry.uvs;s.push(r[e+0],r[e+1]),s.push(r[t+0],r[t+1]),s.push(r[n+0],r[n+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,s,a,o,l,c){const h=this.vertices.length;let u=this.parseVertexIndex(e,h),d=this.parseVertexIndex(t,h),p=this.parseVertexIndex(n,h);if(this.addVertex(u,d,p),this.addColor(u,d,p),o!==void 0&&o!==""){const _=this.normals.length;u=this.parseNormalIndex(o,_),d=this.parseNormalIndex(l,_),p=this.parseNormalIndex(c,_),this.addNormal(u,d,p)}else this.addFaceNormal(u,d,p);if(r!==void 0&&r!==""){const _=this.uvs.length;u=this.parseUVIndex(r,_),d=this.parseUVIndex(s,_),p=this.parseUVIndex(a,_),this.addUV(u,d,p),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let n=0,r=e.length;n<r;n++){const s=this.parseVertexIndex(e[n],t);this.addVertexPoint(s),this.addColor(s)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const n=this.vertices.length,r=this.uvs.length;for(let s=0,a=e.length;s<a;s++)this.addVertexLine(this.parseVertexIndex(e[s],n));for(let s=0,a=t.length;s<a;s++)this.addUVLine(this.parseUVIndex(t[s],r))}};return i.startObject("",!1),i}class a_ extends Ri{constructor(e){super(e),this.materials=null}load(e,t,n,r){const s=this,a=new Pl(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(o))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},n,r)}setMaterials(e){return this.materials=e,this}parse(e){const t=new s_;e.indexOf(`\r
3828
3828
  `)!==-1&&(e=e.replace(/\r\n/g,`
3829
3829
  `)),e.indexOf(`\\
3830
3830
  `)!==-1&&(e=e.replace(/\\\n/g,""));const n=e.split(`
3831
- `);let r=[];for(let o=0,l=n.length;o<l;o++){const c=n[o].trimStart();if(c.length===0)continue;const h=c.charAt(0);if(h!=="#")if(h==="v"){const u=c.split(Wo);switch(u[0]){case"v":t.vertices.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),u.length>=7?(Ar.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6]),Et),t.colors.push(Ar.r,Ar.g,Ar.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]));break}}else if(h==="f"){const d=c.slice(1).trim().split(Wo),p=[];for(let v=0,m=d.length;v<m;v++){const f=d[v];if(f.length>0){const b=f.split("/");p.push(b)}}const _=p[0];for(let v=1,m=p.length-1;v<m;v++){const f=p[v],b=p[v+1];t.addFace(_[0],f[0],b[0],_[1],f[1],b[1],_[2],f[2],b[2])}}else if(h==="l"){const u=c.substring(1).trim().split(" ");let d=[];const p=[];if(c.indexOf("/")===-1)d=u;else for(let _=0,v=u.length;_<v;_++){const m=u[_].split("/");m[0]!==""&&d.push(m[0]),m[1]!==""&&p.push(m[1])}t.addLineGeometry(d,p)}else if(h==="p"){const d=c.slice(1).trim().split(" ");t.addPointGeometry(d)}else if((r=Zm.exec(c))!==null){const u=(" "+r[0].slice(1).trim()).slice(1);t.startObject(u)}else if(Jm.test(c))t.object.startMaterial(c.substring(7).trim(),t.materialLibraries);else if($m.test(c))t.materialLibraries.push(c.substring(7).trim());else if(Qm.test(c))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(h==="s"){if(r=c.split(" "),r.length>1){const d=r[1].trim().toLowerCase();t.object.smooth=d!=="0"&&d!=="off"}else t.object.smooth=!0;const u=t.object.currentMaterial();u&&(u.smooth=t.object.smooth)}else{if(c==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+c+'"')}}t.finalize();const s=new Hi;if(s.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let o=0,l=t.objects.length;o<l;o++){const c=t.objects[o],h=c.geometry,u=c.materials,d=h.type==="Line",p=h.type==="Points";let _=!1;if(h.vertices.length===0)continue;const v=new en;v.setAttribute("position",new Ct(h.vertices,3)),h.normals.length>0&&v.setAttribute("normal",new Ct(h.normals,3)),h.colors.length>0&&(_=!0,v.setAttribute("color",new Ct(h.colors,3))),h.hasUVIndices===!0&&v.setAttribute("uv",new Ct(h.uvs,2));const m=[];for(let b=0,E=u.length;b<E;b++){const S=u[b],L=S.name+"_"+S.smooth+"_"+_;let w=t.materials[L];if(this.materials!==null){if(w=this.materials.create(S.name),d&&w&&!(w instanceof Ir)){const C=new Ir;yn.prototype.copy.call(C,w),C.color.copy(w.color),w=C}else if(p&&w&&!(w instanceof Vi)){const C=new Vi({size:10,sizeAttenuation:!1});yn.prototype.copy.call(C,w),C.color.copy(w.color),C.map=w.map,w=C}}w===void 0&&(d?w=new Ir:p?w=new Vi({size:1,sizeAttenuation:!1}):w=new Tl,w.name=S.name,w.flatShading=!S.smooth,w.vertexColors=_,t.materials[L]=w),m.push(w)}let f;if(m.length>1){for(let b=0,E=u.length;b<E;b++){const S=u[b];v.addGroup(S.groupStart,S.groupCount,b)}d?f=new fo(v,m):p?f=new Ss(v,m):f=new Jt(v,m)}else d?f=new fo(v,m[0]):p?f=new Ss(v,m[0]):f=new Jt(v,m[0]);f.name=c.name,s.add(f)}else if(t.vertices.length>0){const o=new Vi({size:1,sizeAttenuation:!1}),l=new en;l.setAttribute("position",new Ct(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(l.setAttribute("color",new Ct(t.colors,3)),o.vertexColors=!0);const c=new Ss(l,o);s.add(c)}return s}}class n_ extends wi{constructor(e){super(e)}load(e,t,n,r){const s=this,a=this.path===""?cu.extractUrlBase(e):this.path,o=new Al(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{t(s.parse(l,a))}catch(c){r?r(c):console.error(c),s.manager.itemError(e)}},n,r)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const n=e.split(`
3832
- `);let r={};const s=/\s+/,a={};for(let l=0;l<n.length;l++){let c=n[l];if(c=c.trim(),c.length===0||c.charAt(0)==="#")continue;const h=c.indexOf(" ");let u=h>=0?c.substring(0,h):c;u=u.toLowerCase();let d=h>=0?c.substring(h+1):"";if(d=d.trim(),u==="newmtl")r={name:d},a[d]=r;else if(u==="ka"||u==="kd"||u==="ks"||u==="ke"){const p=d.split(s,3);r[u]=[parseFloat(p[0]),parseFloat(p[1]),parseFloat(p[2])]}else r[u]=d}const o=new i_(this.resourcePath||t,this.materialOptions);return o.setCrossOrigin(this.crossOrigin),o.setManager(this.manager),o.setMaterials(a),o}}class i_{constructor(e="",t={}){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options.side:Sn,this.wrap=this.options.wrap!==void 0?this.options.wrap:Or}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;const t={};for(const n in e){const r=e[n],s={};t[n]=s;for(const a in r){let o=!0,l=r[a];const c=a.toLowerCase();switch(c){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(l=[l[0]/255,l[1]/255,l[2]/255]),this.options&&this.options.ignoreZeroRGBs&&l[0]===0&&l[1]===0&&l[2]===0&&(o=!1);break}o&&(s[c]=l)}}return t}preload(){for(const e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(const t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return this.materials[e]===void 0&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){const t=this,n=this.materialsInfo[e],r={name:e,side:this.side};function s(o,l){return typeof l!="string"||l===""?"":/^https?:\/\//i.test(l)?l:o+l}function a(o,l){if(r[o])return;const c=t.getTextureParams(l,r),h=t.loadTexture(s(t.baseUrl,c.url));h.repeat.copy(c.scale),h.offset.copy(c.offset),h.wrapS=t.wrap,h.wrapT=t.wrap,(o==="map"||o==="emissiveMap")&&(h.colorSpace=Et),r[o]=h}for(const o in n){const l=n[o];let c;if(l!=="")switch(o.toLowerCase()){case"kd":r.color=Qe.colorSpaceToWorking(new Ke().fromArray(l),Et);break;case"ks":r.specular=Qe.colorSpaceToWorking(new Ke().fromArray(l),Et);break;case"ke":r.emissive=Qe.colorSpaceToWorking(new Ke().fromArray(l),Et);break;case"map_kd":a("map",l);break;case"map_ks":a("specularMap",l);break;case"map_ke":a("emissiveMap",l);break;case"norm":a("normalMap",l);break;case"map_bump":case"bump":a("bumpMap",l);break;case"disp":a("displacementMap",l);break;case"map_d":a("alphaMap",l),r.transparent=!0;break;case"ns":r.shininess=parseFloat(l);break;case"d":c=parseFloat(l),c<1&&(r.opacity=c,r.transparent=!0);break;case"tr":c=parseFloat(l),this.options&&this.options.invertTrProperty&&(c=1-c),c>0&&(r.opacity=1-c,r.transparent=!0);break}}return this.materials[e]=new Tl(r),this.materials[e]}getTextureParams(e,t){const n={scale:new Xe(1,1),offset:new Xe(0,0)},r=e.split(/\s+/);let s;return s=r.indexOf("-bm"),s>=0&&(t.bumpScale=parseFloat(r[s+1]),r.splice(s,2)),s=r.indexOf("-mm"),s>=0&&(t.displacementBias=parseFloat(r[s+1]),t.displacementScale=parseFloat(r[s+2]),r.splice(s,3)),s=r.indexOf("-s"),s>=0&&(n.scale.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),s=r.indexOf("-o"),s>=0&&(n.offset.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),n.url=r.join(" ").trim(),n}loadTexture(e,t,n,r,s){const a=this.manager!==void 0?this.manager:bl;let o=a.getHandler(e);o===null&&(o=new ru(a)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin);const l=o.load(e,n,r,s);return t!==void 0&&(l.mapping=t),l}}const jo={type:"change"},La={type:"start"},Il={type:"end"},wr=new Xr,Ko=new Cn,r_=Math.cos(70*Mh.DEG2RAD),_t=new N,Ut=2*Math.PI,at={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Ps=1e-6;class s_ extends uu{constructor(e,t=null){super(e,t),this.state=at.NONE,this.target=new N,this.cursor=new N,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:_i.ROTATE,MIDDLE:_i.DOLLY,RIGHT:_i.PAN},this.touches={ONE:pi.ROTATE,TWO:pi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new N,this._lastQuaternion=new Zn,this._lastTargetPosition=new N,this._quat=new Zn().setFromUnitVectors(e.up,new N(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new vo,this._sphericalDelta=new vo,this._scale=1,this._panOffset=new N,this._rotateStart=new Xe,this._rotateEnd=new Xe,this._rotateDelta=new Xe,this._panStart=new Xe,this._panEnd=new Xe,this._panDelta=new Xe,this._dollyStart=new Xe,this._dollyEnd=new Xe,this._dollyDelta=new Xe,this._dollyDirection=new N,this._mouse=new Xe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=o_.bind(this),this._onPointerDown=a_.bind(this),this._onPointerUp=l_.bind(this),this._onContextMenu=m_.bind(this),this._onMouseWheel=u_.bind(this),this._onKeyDown=f_.bind(this),this._onTouchStart=d_.bind(this),this._onTouchMove=p_.bind(this),this._onMouseDown=c_.bind(this),this._onMouseMove=h_.bind(this),this._interceptControlDown=__.bind(this),this._interceptControlUp=g_.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(jo),this.update(),this.state=at.NONE}update(e=null){const t=this.object.position;_t.copy(t).sub(this.target),_t.applyQuaternion(this._quat),this._spherical.setFromVector3(_t),this.autoRotate&&this.state===at.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=Ut:n>Math.PI&&(n-=Ut),r<-Math.PI?r+=Ut:r>Math.PI&&(r-=Ut),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(_t.setFromSpherical(this._spherical),_t.applyQuaternion(this._quatInverse),t.copy(this.target).add(_t),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=_t.length();a=this._clampDistance(o*this._scale);const l=o-a;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const o=new N(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new N(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),a=_t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(wr.origin.copy(this.object.position),wr.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(wr.direction))<r_?this.object.lookAt(this.target):(Ko.setFromNormalAndCoplanarPoint(this.object.up,this.target),wr.intersectPlane(Ko,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Ps||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Ps||this._lastTargetPosition.distanceToSquared(this.target)>Ps?(this.dispatchEvent(jo),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Ut/60*this.autoRotateSpeed*e:Ut/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){_t.setFromMatrixColumn(t,0),_t.multiplyScalar(-e),this._panOffset.add(_t)}_panUp(e,t){this.screenSpacePanning===!0?_t.setFromMatrixColumn(t,1):(_t.setFromMatrixColumn(t,0),_t.crossVectors(this.object.up,_t)),_t.multiplyScalar(e),this._panOffset.add(_t)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;_t.copy(r).sub(this.target);let s=_t.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Ut*this._rotateDelta.x/t.clientHeight),this._rotateUp(Ut*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Ut*this._rotateDelta.x/t.clientHeight),this._rotateUp(Ut*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Xe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function a_(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i)))}function o_(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function l_(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Il),this.state=at.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function c_(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case _i.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=at.DOLLY;break;case _i.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=at.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=at.ROTATE}break;case _i.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=at.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=at.PAN}break;default:this.state=at.NONE}this.state!==at.NONE&&this.dispatchEvent(La)}function h_(i){switch(this.state){case at.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case at.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case at.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function u_(i){this.enabled===!1||this.enableZoom===!1||this.state!==at.NONE||(i.preventDefault(),this.dispatchEvent(La),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(Il))}function f_(i){this.enabled!==!1&&this._handleKeyDown(i)}function d_(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case pi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=at.TOUCH_ROTATE;break;case pi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=at.TOUCH_PAN;break;default:this.state=at.NONE}break;case 2:switch(this.touches.TWO){case pi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=at.TOUCH_DOLLY_PAN;break;case pi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=at.TOUCH_DOLLY_ROTATE;break;default:this.state=at.NONE}break;default:this.state=at.NONE}this.state!==at.NONE&&this.dispatchEvent(La)}function p_(i){switch(this._trackPointer(i),this.state){case at.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case at.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case at.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case at.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=at.NONE}}function m_(i){this.enabled!==!1&&i.preventDefault()}function __(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function g_(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const v_={class:"content-show"},x_={__name:"threeModel",props:{isShow:Boolean},setup(i){const e=$.ref(null),t=i,n=Jo.useModelComp(Wi.pinia),{nodeDev:r}=it.storeToRefs(n);let s,a,o,l,c;const h=async()=>{s=new Kh,s.background=new Ke(15790320),a=new Xt(75,e.value.clientWidth/e.value.clientHeight,.1,1e3),a.position.z=5,o=new Km({antialias:!0}),o.setSize(e.value.clientWidth,e.value.clientHeight),o.setPixelRatio(window.devicePixelRatio),e.value.appendChild(o.domElement),l=new s_(a,o.domElement),l.enableDamping=!0,l.dampingFactor=.05;const _=new lu(16777215,.5);s.add(_);const v=new ou(16777215,.8);v.position.set(1,1,1),s.add(v),await u(),d()},u=async _=>{const v=await Ua.downloadAvatarApi({url:"upload/2025/06/17/688010456879173.obj"}),m=new Blob([v.data],{type:"application/octet-stream;charset=UTF-8"}),f=URL.createObjectURL(m),b=await Ua.downloadAvatarApi({url:"upload/2025/06/17/688013326958661.mtl"}),E=new Blob([b.data],{type:"application/octet-stream;charset=UTF-8"}),S=URL.createObjectURL(E);new n_().load(S,w=>{w.preload();const C=new t_;C.setMaterials(w),C.load(f,P=>{c=P,c.rotation.set(50,-20,200),s.add(c);const y=new Ai().setFromObject(c),x=y.getSize(new N).length(),R=y.getCenter(new N);a.position.copy(R),a.position.z+=x*.6,a.lookAt(R),l.target.copy(R)},P=>{console.log(P.loaded/P.total*100+"% loaded")},P=>{console.error("An error happened loading the OBJ model:",P)})},w=>{console.log(w.loaded/w.total*100+"% loaded")},w=>{console.error("An error happened loading the MTL materials:",w)})},d=()=>{requestAnimationFrame(d),l.update(),o.render(s,a)},p=()=>{a.aspect=e.value.clientWidth/e.value.clientHeight,a.updateProjectionMatrix(),o.setSize(e.value.clientWidth,e.value.clientHeight)};return $.onMounted(async()=>{window.addEventListener("resize",p),await h()}),$.watch(()=>t==null?void 0:t.isShow,()=>{t!=null&&t.isShow&&!l&&!o&&(console.log(123,(t==null?void 0:t.isShow)&&!l&&!o),setTimeout(async()=>{window.addEventListener("resize",p),await h()},50))},{deep:!0,immediate:!0}),$.onBeforeUnmount(()=>{window.removeEventListener("resize",p),o&&o.dispose(),l&&l.dispose()}),(_,v)=>($.openBlock(),$.createElementBlock("div",v_,[$.createElementVNode("div",{ref_key:"container",ref:e,class:"three-container"},null,512)]))}},Nl=Ma._export_sfc(x_,[["__scopeId","data-v-5f5332e0"]]),Fl=it.defineStore("formToTableComp",{state:()=>({selectArray:[],selectString:""}),actions:{setSelectArray(i){this.selectArray=i},setSelectString(i){this.selectString=i}}}),Ol=it.defineStore("unit",{state:()=>({selectIndex:"",selectMenu:"",selectTitle:[]}),actions:{setSelectIndex(i){this.selectIndex=i},setSelectMenu(i){this.selectMenu=i},setSelectTitle(i){this.selectTitle=i}}}),Bl=(i,e)=>{let t=i,n=e;return Array.isArray(t)&&(t=t==null?void 0:t.map((r,s)=>{if(Array.isArray(r)){let a={};return r=r==null?void 0:r.forEach((o,l)=>{var c;(c=n==null?void 0:n[l])!=null&&c.prop?a[n[l].prop]=o:Array.isArray(o)&&(a.children=Bl(o,n))}),Object.assign(a,{id:s})}else return r})),t},zl=(i,e,t)=>{let n=i,r=e;return n=n==null?void 0:n.map((s,a)=>{var o,l;return!Array.isArray(s)||!((o=r==null?void 0:r[a])!=null&&o.label)&&!t||(s.unshift(((l=r==null?void 0:r[a])==null?void 0:l.label)??""),s.some(c=>Array.isArray(c))&&(s=s==null?void 0:s.map(c=>{var h;return Array.isArray(c)&&(c=zl(c,(h=r==null?void 0:r[a])==null?void 0:h.children,t)),c}))),s}),n},M_=(i,e,t)=>{if(e==="")return i==null?void 0:i.filter(n=>(n==null?void 0:n.id)!==t);{const n=e.split("-");return S_(i,n,t)}},S_=(i,e,t)=>{let n=i,r=e;return(r==null?void 0:r.length)===0?n=n==null?void 0:n.filter(s=>s.id!==t):n=n==null?void 0:n.map(s=>(s.id.toString()===(r==null?void 0:r[0])&&(r==null||r.shift(),s=kl(s,r,t)),s)),n},kl=(i,e,t)=>{var s,a;let n=i,r=e;return(r==null?void 0:r.length)===0?n.children=(s=n.children)==null?void 0:s.filter(o=>o.id!==t):n.children=(a=n.children)==null?void 0:a.map(o=>(o.id.toString()===(r==null?void 0:r[0])&&(r==null||r.shift(),o=kl(o,r,t)),o)),n},y_=(i,e,t)=>{if(e==="")return t;{const n=e.split("-");return E_(i,n,t)}},E_=(i,e,t)=>{let n=i,r=e;return(r==null?void 0:r.length)===0?n=t:n=n==null?void 0:n.map(s=>(s.id.toString()===(r==null?void 0:r[0])&&(r==null||r.shift(),s=Hl(s,r,t)),s)),n},Hl=(i,e,t)=>{var s;let n=i,r=e;return(r==null?void 0:r.length)===0?n.children=t:n.children=(s=n.children)==null?void 0:s.map(a=>(a.id.toString()===(r==null?void 0:r[0])&&(r==null||r.shift(),a=Hl(a,r,t)),a)),n},Vl=(i,e)=>i==null?void 0:i.map(n=>{var r,s,a,o,l,c;if(Array.isArray(n)?n=n:n=[n],(r=n==null?void 0:n.filter(h=>!(h!=null&&h.id)))!=null&&r.every(h=>typeof h!="object"||h===null))return n;if((s=n==null?void 0:n.filter(h=>!(h!=null&&h.id)))!=null&&s.some(h=>Array.isArray(h)))return n;{let h=[];if(h.push(n==null?void 0:n.find(u=>u==null?void 0:u.id)),Array.isArray(e==null?void 0:e[0])){const u=(a=n==null?void 0:n.filter(d=>!(d!=null&&d.id)))==null?void 0:a[0];(o=Wt.getColumnChild(Ae.cloneDeep(e==null?void 0:e[0])))==null||o.forEach(d=>{h.push(u==null?void 0:u[(d==null?void 0:d.prop)??(d==null?void 0:d.label)??d])})}else{const u=(l=n==null?void 0:n.filter(d=>!(d!=null&&d.id)))==null?void 0:l[0];(c=Wt.getColumnChild(Ae.cloneDeep(e)))==null||c.forEach(d=>{h.push(u==null?void 0:u[(d==null?void 0:d.prop)??(d==null?void 0:d.label)??d])})}return h}}),T_=i=>{try{return JSON.parse(i),!0}catch{return!1}},Zo=(i,e)=>Ec(i,e),bi=i=>{let e=[];function t(r){Array.isArray(r)&&(r==null||r.forEach(s=>{Array.isArray(s)||(s=[s]),s==null||s.forEach(a=>{!(a!=null&&a.children)||a.children.length===0?e.push(a.label):n(a.children)})}))}function n(r){r==null||r.forEach(s=>{!(s!=null&&s.children)||s.children.length===0?e.push(s.label):n(s.children)})}return t(i),e},b_=(i,e,t)=>{var r;let n=(r=Ae.cloneDeep(i))==null?void 0:r.map(s=>(s=s.filter(a=>!(a!=null&&a.id)),s));return n=n==null?void 0:n.map(s=>{var a;return s=(a=s.map((o,l)=>{let c={};if(t!=null&&t.find(h=>h===e[l]))return c[e[l]]=o,c}))==null?void 0:a.filter(o=>o),s}),n},A_=(i,e)=>{var a,o;const t=Ae.cloneDeep(i),n=(a=t==null?void 0:t.find(l=>(l==null?void 0:l.key)==="header"))==null?void 0:a.contents,r=(o=t==null?void 0:t.find(l=>(l==null?void 0:l.key)==="tableContents"))==null?void 0:o.contents;return b_(r,bi(n).slice(0,bi(n).length-1),e)},mn=i=>{var r,s,a,o;const e=i;let t=[];e.compData=(r=e.compData)==null?void 0:r.filter(l=>(l==null?void 0:l.key)!=="tableContents"&&(l==null?void 0:l.key)!=="tableIndex");const n=(a=(s=Ae.cloneDeep(e.compData))==null?void 0:s.find(l=>(l==null?void 0:l.key)==="tableIndexColumn"))==null?void 0:a.contents;return(o=Ae.cloneDeep(e.compData))==null||o.forEach(l=>{if((l==null?void 0:l.key)!=="tableIndexColumn"&&(l==null?void 0:l.key)!=="header")t.push(l);else if((l==null?void 0:l.key)==="header"){let c=l.contents;n&&(c!=null&&c.every(h=>Array.isArray(h))?c==null||c[0].unshift({label:n}):c.unshift({label:n})),t.push({key:"header",contents:c})}}),e.compData=t,e},va=i=>{var s,a,o,l,c;const e=(s=i.compData)==null?void 0:s.filter(h=>(h==null?void 0:h.key)==="tableContents"||(h==null?void 0:h.key)==="tableIndex"),t=(o=(a=e==null?void 0:e.find(h=>(h==null?void 0:h.key)==="tableIndex"))==null?void 0:a.contents)==null?void 0:o.map(h=>h.label),n=(l=e==null?void 0:e.find(h=>(h==null?void 0:h.key)==="tableContents"))==null?void 0:l.contents;let r=[];return(t==null?void 0:t.length)>0&&(n!=null&&n.every(h=>Array.isArray(h)))?r=t==null?void 0:t.map((h,u)=>n[u]?[h,...n[u]]:[h]):Array.isArray(n==null?void 0:n[0])&&((c=n==null?void 0:n[0])!=null&&c.every(h=>Array.isArray(h)))?r=n==null?void 0:n[0]:Array.isArray(n==null?void 0:n[0])?r=n:r.push(n),r},w_=i=>{const e=[];function t(n){!n||n.length===0||(e.push(n==null?void 0:n.map(r=>({label:r.label}))),n==null||n.forEach(r=>{r!=null&&r.children&&(r==null?void 0:r.children.length)>0&&t(r==null?void 0:r.children)}))}return t(i),e},R_=i=>{const e=[];function t(n,r=[]){!n||n.length===0||(e.push({key:r==null?void 0:r.filter(s=>!Array.isArray(s)),value:n}),n==null||n.forEach(s=>{s!=null&&s.some(a=>Array.isArray(a))&&t(s.find(a=>Array.isArray(a)),s)}))}return t(i),e},C_=i=>{const e=[];function t(n){!n||n.length===0||(e.push(n==null?void 0:n.map(r=>r==null?void 0:r.filter(s=>!Array.isArray(s)))),n==null||n.forEach(r=>{r!=null&&r.some(s=>Array.isArray(s))&&t(r.find(s=>Array.isArray(s)))}))}return t(i),e},P_=i=>{const e=[];function t(n){var r;!n||n.length===0||(n!=null&&n.every(s=>!Array.isArray(s))?e.push(n):(e.push((r=n==null?void 0:n.map(s=>s==null?void 0:s.filter(a=>!Array.isArray(a))))==null?void 0:r[0]),n==null||n.forEach(s=>{s!=null&&s.some(a=>Array.isArray(a))&&t(s.find(a=>Array.isArray(a)))})))}return t(i),e},D_=(i,e)=>{let t;function n(r,s,a=1){var l;if(!r||r.length===0)return;const o=(l=Ae.cloneDeep(s))==null?void 0:l.map(c=>c==null?void 0:c.filter(h=>!Array.isArray(h)));return o!=null&&o.find(c=>Zo(c,r==null?void 0:r.key))?(s==null||s.forEach(c=>{!n(r,c.find(u=>Array.isArray(u)))&&Zo(c.filter(u=>!Array.isArray(u)),r==null?void 0:r.key)&&(t={type:a,contents:c.filter(u=>!Array.isArray(u))})}),!0):!1}return n(i,e,0),t},$o=(i,e)=>{function t(n,r){return!n||n.length===0||n==null?void 0:n.map((a,o)=>{var c,h;let l=a;return l.unshift((c=r==null?void 0:r[o])==null?void 0:c.label),l.some(u=>Array.isArray(u))&&(l[l.length-1]=t(l.find(u=>Array.isArray(u)),(h=r==null?void 0:r[o])==null?void 0:h.children)),l})}return t(i,e)},xa=i=>{var t,n,r,s,a,o,l,c,h,u,d,p,_,v,m,f,b,E,S,L,w,C,P,y,x;const e=i;if((i==null?void 0:i.comp)==="Table"){if((r=(n=(t=i.compData)==null?void 0:t.find(R=>(R==null?void 0:R.key)==="tableIndex"))==null?void 0:n.contents)!=null&&r.every(R=>!(R!=null&&R.children))||!((s=i.compData)!=null&&s.find(R=>(R==null?void 0:R.key)==="tableIndex")))return((l=(o=(a=e.compData)==null?void 0:a.find(R=>(R==null?void 0:R.key)==="tableContents"))==null?void 0:o.contents)==null?void 0:l.length)===1&&((d=(u=(h=(c=e.compData)==null?void 0:c.find(R=>(R==null?void 0:R.key)==="tableContents"))==null?void 0:h.contents)==null?void 0:u[0])!=null&&d.every(R=>Array.isArray(R)))?(e.compData=(p=e.compData)==null?void 0:p.map(R=>{var H;return(R==null?void 0:R.key)==="tableContents"&&(R.contents=(H=R.contents)==null?void 0:H[0]),R}),[e]):[e];{let R=[];const H=e.compData,B=(_=Ae.cloneDeep(H))==null?void 0:_.find(se=>(se==null?void 0:se.key)==="tableIndexColumn"),j=(v=Ae.cloneDeep(H))==null?void 0:v.find(se=>(se==null?void 0:se.key)==="extraButton"),J=(m=Ae.cloneDeep(H))==null?void 0:m.find(se=>(se==null?void 0:se.key)==="rowButton"),W=P_((b=(f=Ae.cloneDeep(H))==null?void 0:f.find(se=>(se==null?void 0:se.key)==="header"))==null?void 0:b.contents),ne=(E=Ae.cloneDeep(H))==null?void 0:E.find(se=>(se==null?void 0:se.key)==="tableIndex"),G=C_((L=(S=Ae.cloneDeep(H))==null?void 0:S.find(se=>(se==null?void 0:se.key)==="tableContents"))==null?void 0:L.contents),fe=$o((C=(w=Ae.cloneDeep(H))==null?void 0:w.find(se=>(se==null?void 0:se.key)==="tableContents"))==null?void 0:C.contents,ne==null?void 0:ne.contents),xe=R_($o((y=(P=Ae.cloneDeep(H))==null?void 0:P.find(se=>(se==null?void 0:se.key)==="tableContents"))==null?void 0:y.contents,ne==null?void 0:ne.contents));if(ne)return(x=w_(ne.contents))==null||x.forEach((se,We)=>{var Y;let Ze=[];Ze.push({key:"tableIndex",contents:se}),Ze.push(B),Ze.push(j),Ze.push(J),Ze.push({key:"tableContents",contents:G[We]}),Ze.push({key:"header",contents:W!=null&&W[We]?[W==null?void 0:W[We]]:[W==null?void 0:W[0]]}),R.push({comp:"Table",compData:Ze,name:"",parentTableContents:((Y=D_(xe[We],fe))==null?void 0:Y.contents)??""})}),R}}else return[e]},Gr=(i,e)=>{let t={};return Array.isArray(i)?i==null||i.forEach((n,r)=>{t[e[r]]=n}):[i].forEach((n,r)=>{t[e[r]]=n}),t},L_=async i=>{let e=[];i==null||i.forEach(t=>{var n;(n=t.compData)==null||n.forEach(r=>{var s;(s=r.contents)==null||s.forEach(a=>{var o;Array.isArray(a)?a==null||a.forEach(l=>{var c;(c=xa(Ae.cloneDeep(l)))==null||c.forEach(async h=>{var u,d,p,_,v;if(l.comp==="Table"){const m=await it.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(h==null?void 0:h.parentTableContents)??""},value:{pageData:{comp:(u=mn(Ae.cloneDeep(h)))==null?void 0:u.comp,compData:(d=mn(Ae.cloneDeep(h)))==null?void 0:d.compData,name:(p=mn(Ae.cloneDeep(h)))==null?void 0:p.name}}}),f=m.data.result,b=await((_=va(Ae.cloneDeep(h)))==null?void 0:_.map(async E=>{var C,P,y,x,R;let S;E.length!==0&&(S=await it.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:f},value:{tableData:Gr(E,(x=bi((y=(P=(C=mn(Ae.cloneDeep(h)))==null?void 0:C.compData)==null?void 0:P.find(H=>(H==null?void 0:H.key)==="header"))==null?void 0:y.contents))==null?void 0:x.filter(H=>H!=="操作"))}}));const w=await((R=(await it.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",parentTable:E}})).data.result)==null?void 0:R.map(async H=>await it.updateInsofDataApi({id:H.id,key:{systemKey:H.key.systemKey,pageKey:H.key.pageKey,type:H.key.type,version:H.key.version,parentTable:S.data.result}})));return e.push(w),S}));e.push(m),e.push(b)}else if((h==null?void 0:h.key)==="extraButton"){if(((v=Object.values(h==null?void 0:h.value))==null?void 0:v.length)!==0){const m=await it.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structureMethod",version:1},value:{pageData:h.value}});e.push(m)}}else{const m=await it.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(h==null?void 0:h.parentTableContents)??""},value:{pageData:h}});e.push(m)}})}):(o=xa(Ae.cloneDeep(a)))==null||o.forEach(async l=>{var c,h,u,d,p;if(a.comp==="Table"){const _=await it.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(l==null?void 0:l.parentTableContents)??""},value:{pageData:{comp:(c=mn(Ae.cloneDeep(l)))==null?void 0:c.comp,compData:(h=mn(Ae.cloneDeep(l)))==null?void 0:h.compData,name:(u=mn(Ae.cloneDeep(l)))==null?void 0:u.name}}}),v=_.data.result,m=await((d=va(Ae.cloneDeep(l)))==null?void 0:d.map(async f=>{var L,w,C,P,y;let b;(f==null?void 0:f.length)!==0&&(b=await it.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:v},value:{tableData:Gr(f,(P=bi((C=(w=(L=mn(Ae.cloneDeep(l)))==null?void 0:L.compData)==null?void 0:w.find(x=>(x==null?void 0:x.key)==="header"))==null?void 0:C.contents))==null?void 0:P.filter(x=>x!=="操作"))}}));const S=await((y=(await it.getInsofDataApi({key:{parentTable:f,systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure"}})).data.result)==null?void 0:y.map(async x=>await it.updateInsofDataApi({id:x.id,key:{systemKey:x.key.systemKey,pageKey:x.key.pageKey,type:x.key.type,version:x.key.version,parentTable:x.key.parentTable===""?"":b.data.result}})));return e.push(S),b}));e.push(_),e.push(m)}else if((l==null?void 0:l.key)==="extraButton"){if(((p=Object.values(l==null?void 0:l.value))==null?void 0:p.length)!==0){const _=await it.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structureMethod",version:1},value:{pageData:l.value}});e.push(_)}}else{const _=await it.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(l==null?void 0:l.parentTableContents)??""},value:{pageData:l}});e.push(_)}})})})}),await Promise.all(e)},U_=it.useMenuState(Wi.pinia),I_=i=>{var t;const e=Array.isArray(i)?i==null?void 0:i[0]:{};return(t=e==null?void 0:e.contents)==null?void 0:t.map(n=>({...n[0],...n[1]}))},Gl=async(i,e,t="",n)=>{var u,d,p,_,v,m;const r=await it.getInsofDataApi({key:{pageKey:i,systemKey:e,parentTable:t}}),s=await it.getInsofDataApi({key:{pageKey:i,systemKey:e,type:"structureMethod"}}),a=(u=r.data.result)==null?void 0:u.map(f=>f.id),o=a==null?void 0:a.map(f=>it.getInsofDataApi({key:{pageKey:i,systemKey:e,tableId:f}})),l=await Promise.all(o),c=[];l==null||l.forEach(f=>{var S,L,w,C;const b=(S=f.data.result)==null?void 0:S.map(P=>{const y=Array.isArray(P.value.tableData)?P.value.tableData:[P.value.tableData];return y.unshift({id:P.id}),y}),E=(C=(w=(L=f.data.result)==null?void 0:L[0])==null?void 0:w.key)==null?void 0:C.tableId;c.push({key:E,contents:b})});const h=[];return(d=r.data.result)==null||d.forEach(f=>{var S,L,w,C;const b=f.value.pageData,E=(S=Ae.cloneDeep(b.compData))==null?void 0:S.filter(P=>(P==null?void 0:P.key)!=="tableContents");if(E&&(E!=null&&E.find(P=>(P==null?void 0:P.key)==="header"))&&E.push({key:"tableContents",contents:n==="/系统管理/用户管理"?I_(c):Vl((L=c==null?void 0:c.find(P=>(P==null?void 0:P.key)===f.id))==null?void 0:L.contents,(w=E==null?void 0:E.find(P=>(P==null?void 0:P.key)==="header"))==null?void 0:w.contents)}),b.compData=E,b.id=f.id,((C=f.key)==null?void 0:C.type)!=="method")h.push(b);else{let P;P={name:"",compData:[b],comp:"calculator"},h.push(P)}}),((_=(p=s.data.result)==null?void 0:p.map(f=>f.value.pageData))==null?void 0:_.filter(f=>Object.values(f).length>0).length)>0&&h.push({comp:"methodButton",name:"",compData:(m=(v=s.data.result)==null?void 0:v.map(f=>f.value.pageData))==null?void 0:m.filter(f=>Object.values(f).length>0)}),h},N_=async i=>{await it.deleteInsofDataApi({id:i})},F_=async(i,e,t,n,r,s)=>{var a;await it.createInsofDataApi({key:{type:i,pageKey:e,tableId:t,systemKey:n},value:{tableData:Gr(r,(a=bi(s))==null?void 0:a.filter(o=>o!=="操作"))}})},O_=async(i,e,t,n,r,s,a)=>{var o;await it.updateInsofDataApi({key:{type:i,pageKey:e,tableId:t,systemKey:r},value:{tableData:Gr(s,(o=bi(a))==null?void 0:o.filter(l=>l!=="操作"))},id:n})},B_=async(i,e)=>{await it.updateInsofDataApi({value:{pageData:e},id:i})},z_=async(i,e)=>await it.getInsofDataApi({key:i,valueLikes:e}),k_=async()=>{var i,e,t,n,r,s,a,o,l;try{const c=await it.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),layer:"superAdmin"}});((i=c==null?void 0:c.data)==null?void 0:i.code)===200&&(U_.setPlatform(((r=(n=(t=(e=c==null?void 0:c.data)==null?void 0:e.result)==null?void 0:t[0])==null?void 0:n.key)==null?void 0:r.type)==="制造系统"?"client":"browser"),(l=(o=(a=(s=c==null?void 0:c.data)==null?void 0:s.result)==null?void 0:a[0])==null?void 0:o.key)==null||l.type)}catch(c){return Promise.reject(c)}},H_={class:"table-content"},V_=["onClick"],G_={class:"form-content"},W_={key:0,class:"dialog-footer"},X_={__name:"index",props:{itemData:{type:Array,default:()=>[]},childItemData:{type:Array,default:()=>[]},index:Number,changedContent:{type:Object,default:()=>{}}},emits:["change","contentChange","onButtonClick","contentClick","pageChange"],setup(i,{emit:e}){const t=i,n=e,r=$.ref([]),s=it.useMenuState(),{activeMenuPath:a}=it.storeToRefs(s),o=Jo.useModelComp(Wi.pinia),{extraContents:l}=it.storeToRefs(o),c=$.ref([]),h=$.ref(!1),u=$.ref("");$.ref();const d=$.ref(!0),p=$.ref(0),_=$.ref(!1),v=$.ref(""),m=$.ref(!1),f=$.ref({label:"查看三维模型"}),b=$.ref([]),E=$.ref([]),S=$.ref(!1),L=$.ref([]),w=$.ref([]),C=$.ref(),P=$.ref(),y=Fl(Wi.pinia),x=$.ref(),R=Ol(Wi.pinia),{selectIndex:H,selectMenu:B,selectTitle:j}=it.storeToRefs(R),{selectString:J}=it.storeToRefs(y),W=$.ref(720),ne=()=>{m.value=!1},G=(Z,Q)=>{if(Object.values(Q).length!==0)return Object.values(Q).find(de=>{var Se,oe;return((Se=de==null?void 0:de.toString())==null?void 0:Se.includes(".obj"))||((oe=de==null?void 0:de.toString())==null?void 0:oe.includes(".stl"))})?[...Z,f.value]:Z},fe=Z=>{var oe;J.value===""?Z==null||Z[0]:(Z==null?void 0:Z.find(A=>(A==null?void 0:A.selectLabel)==="("+J.value+")"))??(Z==null||Z.find(A=>!(A!=null&&A.selectLabel)));let Q=Z;(oe=r.value)!=null&&oe.find(A=>A.prop==="index");let de=C.value;const Se=[];return Q==null||Q.forEach((A,ae)=>{var Ye;let Re={};if(Array.isArray(A)){let ie=[];A==null||A.filter(Fe=>!(Fe!=null&&Fe.id)).forEach((Fe,Ee)=>{var Ve,lt,T,g,F;if((Ve=de==null?void 0:de[Ee])!=null&&Ve.prop&&!Array.isArray(Fe)){let q={};q[de[Ee].column]=Fe,l!=null&&l.value&&((lt=l==null?void 0:l.value)==null?void 0:lt.length)>0&&((T=l==null?void 0:l.value)!=null&&T.find(K=>JSON.stringify(K==null?void 0:K[0])===JSON.stringify(q)))&&(ie=(g=l==null?void 0:l.value)==null?void 0:g.find(K=>JSON.stringify(K==null?void 0:K[0])===JSON.stringify(q))),ie&&ie.length>0?Re[de[Ee].prop]=ie!=null&&ie.find(K=>{var V;return((V=Object.keys(K))==null?void 0:V[0])===de[Ee].column})?(F=ie==null?void 0:ie.find(K=>{var V;return((V=Object.keys(K))==null?void 0:V[0])===de[Ee].column}))==null?void 0:F[de[Ee].column]:Fe:Re[de[Ee].prop]=Fe}})}else Re=A;Array.isArray(A)&&A.some(ie=>ie==null?void 0:ie.id)?Se.push(Object.assign(Re,{id:(Ye=A==null?void 0:A.find(ie=>ie.id))==null?void 0:Ye.id})):Re.id?Se.push(Re):Se.push(Object.assign(Re,{id:ae}))}),Se},xe=async Z=>{var oe,A,ae,Re,Ye;let Q={};for(let ie in Z)Z[ie]!==""&&(Q["tableData."+ie]=Z[ie]);const de=await z_({type:"data",tableId:t==null?void 0:t.index,systemKey:sessionStorage.getItem("systemKey"),pageKey:a.value},Q),Se=(ae=(A=(oe=Ae.cloneDeep(de))==null?void 0:oe.data)==null?void 0:A.result)==null?void 0:ae.map(ie=>{var Ee;let Fe=[];return Fe.push({id:ie.id}),Fe.push((Ee=ie==null?void 0:ie.value)==null?void 0:Ee.tableData),Fe});c.value=fe(Vl(Se,(Ye=(Re=Ae.cloneDeep(r.value))==null?void 0:Re.map(ie=>ie.label))==null?void 0:Ye.filter(ie=>ie!=="操作")))},se=async Z=>{var de,Se,oe,A,ae,Re,Ye;let Q=await Gl(a.value,sessionStorage.getItem("systemKey"),Z.id);if(Q=Q==null?void 0:Q.filter(ie=>ie.comp!=="methodButton"),Q&&Q.length>0){const ie=!Array.isArray(j.value)&&((de=j.value)==null?void 0:de.key)!=="main"?[]:j.value;ie.push({key:B.value===""?(Se=Z==null?void 0:Z.id)==null?void 0:Se.toString():B.value+"-"+((oe=Z==null?void 0:Z.id)==null?void 0:oe.toString()),value:Z[(A=Object.keys(Z))==null?void 0:A.filter(Fe=>Fe!=="index"&&Fe!=="id")[0]]}),R.setSelectMenu(B.value===""?(ae=Z==null?void 0:Z.id)==null?void 0:ae.toString():B.value+"-"+((Re=Z==null?void 0:Z.id)==null?void 0:Re.toString())),R.setSelectTitle(ie),R.setSelectIndex((Ye=Z==null?void 0:Z.id)==null?void 0:Ye.toString()),n("pageChange",Q)}},We=Z=>{var Q;(Q=Ae.cloneDeep(t.itemData))==null||Q.map(de=>((de==null?void 0:de.key)==="tableContents"&&(de.contents=Z),de))},Ze=(Z,Q,de)=>{n("contentClick",Z,Q,de,{id:t==null?void 0:t.index})};$.watch(()=>t.changedContent,()=>{var de,Se;if(!t.changedContent)return;let Z=(de=c.value)==null?void 0:de.map(oe=>{var A;return oe.id===((A=t.changedContent)==null?void 0:A.id)&&(oe={...t.changedContent,id:t.changedContent.newId?t.changedContent.newId:t.changedContent.id},delete oe.newId),oe});const Q=(Se=t.itemData)==null?void 0:Se.map(oe=>((oe==null?void 0:oe.key)==="tableContents"&&(oe.contents=Z),oe));c.value=Z,n("contentChange",{contents:Q,index:t.index}),n("change",{content:Z,index:t==null?void 0:t.index,buttonName:"",id:t==null?void 0:t.index})},{deep:!0,immediate:!0});const Y=(Z,Q)=>{var de;if(u.value="",S.value=!0,d.value=!0,n("onButtonClick",Z,Q),Z==="删除"){c.value=(de=Ae.cloneDeep(c.value))==null?void 0:de.filter(oe=>(oe==null?void 0:oe.id)!==(Q==null?void 0:Q.id));const Se=M_(x.value,B.value,Q==null?void 0:Q.id);We(Se),n("change",{content:c.value,singleContent:Q,index:t==null?void 0:t.index,type:"delete",buttonName:Z,column:r.value})}else Z==="新增"?(v.value="新增",Pe(""),m.value=!0):Z==="编辑"?(v.value="编辑",Pe(Q),m.value=!0):Z==="查看"?(v.value="查看",Pe(Q),S.value=!1,d.value=!1,m.value=!0):Z==="查看三维模型"&&(h.value=!0)},le=()=>{h.value=!1},Pe=Z=>{var Se,oe,A;const Q=[];let de=[];for(let ae in Z)Array.isArray(Z==null?void 0:Z[ae])&&de.push(ae);(oe=Wt.getColumnChild((Se=Ae.cloneDeep(r.value))==null?void 0:Se.filter(ae=>(ae==null?void 0:ae.label)!=="操作")))==null||oe.forEach((ae,Re)=>{de.find(Ye=>Ye===(ae==null?void 0:ae.prop))||Q.push({label:(ae==null?void 0:ae.label)??"",name:(ae==null?void 0:ae.prop)??"t"+Re,type:!(ae!=null&&ae.formType)||(ae==null?void 0:ae.formType)===""?"Input":ae==null?void 0:ae.formType,value:(Z==null?void 0:Z[ae==null?void 0:ae.prop])??"",id:(ae==null?void 0:ae.id)??Re,contents:(ae==null?void 0:ae.options)??[],width:1,isFormColHidden:ae==null?void 0:ae.isFormColHidden})}),Z===""||!Z||(u.value=Z==null?void 0:Z.id),w.value=b.value&&((A=b.value)==null?void 0:A.length)>0?b.value:Q};$.onMounted(()=>{});const ve=()=>{let Z,Q=Ae.cloneDeep(c.value);u.value===""?(p.value++,Q.push(Object.assign(P.value,{id:p.value})),Z=Object.assign(P.value,{id:p.value})):Q=Q==null?void 0:Q.map(Se=>((Se==null?void 0:Se.id)===u.value&&(Se=Object.assign(Se,P.value),Z=Se),Se)),c.value=Q;const de=y_(x.value,B.value,Q);We(de),m.value=!1,n("change",{content:de,singleContent:Z,index:t==null?void 0:t.index,buttonName:v.value,column:r.value})},Ue=Z=>{P.value=Z};return $.watch(()=>[t.itemData,J.value,H.value,B.value,l==null?void 0:l.value],()=>{var Ye,ie,Fe,Ee,Ve,lt,T,g,F,q,K,V,De,he,be,Le,ee,Me,Oe,Ne,ce,ke,D,pe,te,ye;const Z=(Ye=Ae.cloneDeep(t.itemData))==null?void 0:Ye.filter(O=>(O==null?void 0:O.key)==="header");(ie=Ae.cloneDeep(t.itemData))==null||ie.filter(O=>(O==null?void 0:O.key)==="tableIndexColumn")[0];const Q=(Fe=Ae.cloneDeep(t.itemData))==null?void 0:Fe.find(O=>(O==null?void 0:O.key)==="page"),de=(Ee=Ae.cloneDeep(t.itemData))==null?void 0:Ee.find(O=>(O==null?void 0:O.key)==="rowButton"),Se=(Ve=Ae.cloneDeep(t.itemData))==null?void 0:Ve.find(O=>(O==null?void 0:O.key)==="extraButton"),oe=(lt=Ae.cloneDeep(t.itemData))==null?void 0:lt.filter(O=>(O==null?void 0:O.key)==="tableContents"),A=(T=Ae.cloneDeep(t.itemData))==null?void 0:T.filter(O=>(O==null?void 0:O.key)==="tableIndex");b.value=(q=(F=(g=Ae.cloneDeep(t.itemData))==null?void 0:g.filter(O=>(O==null?void 0:O.key)==="tableToForm"))==null?void 0:F[0])==null?void 0:q.contents,_.value=(Q==null?void 0:Q.contents)??!1;let ae=[];J.value===""?ae=Z==null?void 0:Z[0]:ae=(Z==null?void 0:Z.find(O=>(O==null?void 0:O.selectLabel)==="("+J.value+")"))??(Z==null?void 0:Z.find(O=>!(O!=null&&O.selectLabel)));let Re=[];if(J.value===""?Re=A==null?void 0:A[0]:Re=(A==null?void 0:A.find(O=>(O==null?void 0:O.selectLabel)==="("+J.value+")"))??(A==null?void 0:A.find(O=>!(O!=null&&O.selectLabel))),((K=ae==null?void 0:ae.contents)==null?void 0:K.length)>0){let O=[];if(ae!=null&&ae.contents.some(Ce=>Array.isArray(Ce)&&(Ce==null?void 0:Ce.find(_e=>_e.children))))B.value===""?O=(De=(V=Wt.getGradeColumns(Ae.cloneDeep(ae==null?void 0:ae.contents)))==null?void 0:V[0])==null?void 0:De.filter(Ce=>!Array.isArray(Ce)):(B.value.split("-"),O=(he=Wt.getGradeColumns(Ae.cloneDeep(ae==null?void 0:ae.contents)))==null?void 0:he[0]);else{const Ce=ae!=null&&ae.contents.some(_e=>Array.isArray(_e))?(be=ae==null?void 0:ae.contents)==null?void 0:be[0]:ae==null?void 0:ae.contents;Ce==null||Ce.forEach((_e,xt)=>{O.push({label:(_e==null?void 0:_e.label)??"",prop:(_e==null?void 0:_e.label)==="操作"?"operate":(_e==null?void 0:_e.prop)??"a"+xt,width:(_e==null?void 0:_e.label)==="操作"?"200":_e!=null&&_e.width?parseInt(_e.width):"",fixed:(_e==null?void 0:_e.fixed)??void 0,sortable:(_e==null?void 0:_e.sortable)??!1,align:(_e==null?void 0:_e.align)??"center",showOverflowTooltip:(_e==null?void 0:_e.showOverflowTooltip)??!0,isNotDrag:(_e==null?void 0:_e.isNotDrag)??!1,isEditCol:(_e==null?void 0:_e.isEditCol)??!1,isOperate:(_e==null?void 0:_e.isOperate)??!1,id:(_e==null?void 0:_e.id)??xt,type:(_e==null?void 0:_e.label)==="操作"?"operate":void 0,formType:(_e==null?void 0:_e.formType)??"",isTableColHidden:_e==null?void 0:_e.isTableColHidden,isFormColHidden:_e==null?void 0:_e.isFormColHidden,options:(_e==null?void 0:_e.options)??[]})})}r.value=O;let X=(ee=(Le=Wt.getAllLeafNodes(Ae.cloneDeep(r.value)))==null?void 0:Le.filter(Ce=>(Ce==null?void 0:Ce.type)!=="operate"))==null?void 0:ee.map((Ce,_e)=>({prop:(Ce==null?void 0:Ce.prop)??"a"+_e,column:Ce.label}));C.value=X;let ue=[];J.value===""?ue=oe==null?void 0:oe[0]:ue=(oe==null?void 0:oe.find(Ce=>(Ce==null?void 0:Ce.selectLabel)==="("+J.value+")"))??(oe==null?void 0:oe.find(Ce=>!(Ce!=null&&Ce.selectLabel)));let Be=Array.isArray((Me=ue==null?void 0:ue.contents)==null?void 0:Me[0])&&((Oe=ue==null?void 0:ue.contents)!=null&&Oe[0].every(Ce=>Array.isArray(Ce)))?(Ne=Ae.cloneDeep(ue==null?void 0:ue.contents))==null?void 0:Ne[0]:Ae.cloneDeep(ue==null?void 0:ue.contents);Re!=null&&Re.contents&&((ce=Re==null?void 0:Re.contents)==null?void 0:ce.length)!==0&&(Be=(ke=Ae.cloneDeep(Be))==null?void 0:ke.map((Ce,_e)=>{if(!Array.isArray(Ce)){let xt={};for(let tn in Ce)tn!=="id"&&tn!=="index"&&(xt[tn]=Ce[tn]);Ce=Object.values(xt)}return Ce}));const ot=!!((D=r.value)!=null&&D.find(Ce=>Ce.prop==="index"));Be=zl(Ae.cloneDeep(Be),Re==null?void 0:Re.contents,ot);const et=[];Be==null||Be.forEach((Ce,_e)=>{var tn;let xt={};if(Array.isArray(Ce)){let ut=[];Ce==null||Ce.filter(At=>!(At!=null&&At.id)).forEach((At,zt)=>{var Ci,In,Pi,Nn,Di,Li;if((Ci=X==null?void 0:X[zt])!=null&&Ci.prop&&!Array.isArray(At)){let Ui={};Ui[X[zt].column]=At,l!=null&&l.value&&((In=l==null?void 0:l.value)==null?void 0:In.length)>0&&((Pi=l==null?void 0:l.value)!=null&&Pi.find(Nt=>JSON.stringify(Nt==null?void 0:Nt[0])===JSON.stringify(Ui)))&&(ut=(Nn=l==null?void 0:l.value)==null?void 0:Nn.find(Nt=>JSON.stringify(Nt==null?void 0:Nt[0])===JSON.stringify(Ui))),ut&&ut.length>0?xt[X[zt].prop]=ut!=null&&ut.find(Nt=>{var Fn;return((Fn=Object.keys(Nt))==null?void 0:Fn[0])===X[zt].column})?(Di=ut==null?void 0:ut.find(Nt=>{var Fn;return((Fn=Object.keys(Nt))==null?void 0:Fn[0])===X[zt].column}))==null?void 0:Di[X[zt].column]:At:xt[X[zt].prop]=At}else Array.isArray(At)&&((Li=X[zt])!=null&&Li.prop?xt[X[zt].prop]=At:xt.children=Bl(At,X))})}else xt=Ce;Array.isArray(Ce)&&Ce.some(ut=>ut==null?void 0:ut.id)?et.push(Object.assign(xt,{id:(tn=Ce==null?void 0:Ce.find(ut=>ut.id))==null?void 0:tn.id})):xt.id?et.push(xt):et.push(Object.assign(xt,{id:_e}))}),c.value=et}else r.value=[],c.value=[];((pe=de==null?void 0:de.contents)==null?void 0:pe.length)>0?E.value=de==null?void 0:de.contents:E.value=[],((te=Se==null?void 0:Se.contents)==null?void 0:te.length)>0?L.value=Se==null?void 0:Se.contents:L.value=[],p.value=((ye=c==null?void 0:c.value)==null?void 0:ye.length)??0,x.value=c.value},{deep:!0,immediate:!0}),(Z,Q)=>{var de;return $.openBlock(),$.createElementBlock("div",H_,[($.openBlock(),$.createBlock(Wt.ssTable,{columns:r.value,key:r.value,tableData:c.value,isShowPagination:_.value,isShowEdit:!1,isShowDelete:!1,onDbClickRow:se,extraButton:L.value,onButtonClick:Q[1]||(Q[1]=Se=>Y(Se,"")),onContentClick:Ze},$.createSlots({headerButton:$.withCtx(Se=>[$.createVNode(Dc,{buttons:Se.buttons,onButtonClick:Q[0]||(Q[0]=oe=>Y(oe,"")),columns:r.value,onFilter:xe},null,8,["buttons","columns"])]),_:2},[((de=E.value)==null?void 0:de.length)>0?{name:"actions",fn:$.withCtx(({item:Se})=>[($.openBlock(!0),$.createElementBlock($.Fragment,null,$.renderList(G(E.value,Se),(oe,A)=>($.openBlock(),$.createElementBlock("div",{key:A},[$.createElementVNode("div",{style:$.normalizeStyle({color:oe==null?void 0:oe.textColor}),class:"extra-button-label",onClick:ae=>Y(oe==null?void 0:oe.label,Se)},$.toDisplayString(oe==null?void 0:oe.label),13,V_)]))),128))]),key:"0"}:void 0]),1032,["columns","tableData","isShowPagination","extraButton"])),$.createVNode(Wt.ssDialog,{title:v.value,visible:m.value,width:W.value,onBeforeDestroy:ne},{default:$.withCtx(()=>[$.createElementVNode("div",G_,[$.createVNode(Wt.ssForm,{rowContents:w.value,isEnableWrap:!1,onChange:Ue,isEdit:d.value},null,8,["rowContents","isEdit"])])]),footer:$.withCtx(()=>[S.value?($.openBlock(),$.createElementBlock("div",W_,[$.createElementVNode("div",{onClick:Q[2]||(Q[2]=Se=>m.value=!1),class:"cancel-button"},$.toDisplayString("取消")),$.createElementVNode("div",{class:"ok-button",onClick:ve},$.toDisplayString("确认"))])):$.createCommentVNode("",!0)]),_:1},8,["title","visible","width"]),$.createVNode(Wt.ssDialog,{visible:h.value,fullScreen:"",onBeforeDestroy:le},{default:$.withCtx(()=>[$.createVNode(Nl,{isShow:h.value},null,8,["isShow"])]),_:1},8,["visible"])])}}},q_=Ma._export_sfc(X_,[["__scopeId","data-v-3458b8f1"]]);exports.IsJson=T_;exports.addTableContents=F_;exports.conStructContents=L_;exports.deleteTableContents=N_;exports.fixFormContents=B_;exports.fixTableContents=O_;exports.getItemData=Gl;exports.loadingSystemType=k_;exports.methodTableToContent=A_;exports.ssTable=q_;exports.tableEveryContents=xa;exports.tableToContents=va;exports.tableToStruct=mn;exports.threeModel=Nl;exports.useFormToTableComp=Fl;exports.useUnit=Ol;
3831
+ `);let r=[];for(let o=0,l=n.length;o<l;o++){const c=n[o].trimStart();if(c.length===0)continue;const h=c.charAt(0);if(h!=="#")if(h==="v"){const u=c.split(jo);switch(u[0]){case"v":t.vertices.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),u.length>=7?(Rr.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6]),Et),t.colors.push(Rr.r,Rr.g,Rr.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]));break}}else if(h==="f"){const d=c.slice(1).trim().split(jo),p=[];for(let v=0,m=d.length;v<m;v++){const f=d[v];if(f.length>0){const b=f.split("/");p.push(b)}}const _=p[0];for(let v=1,m=p.length-1;v<m;v++){const f=p[v],b=p[v+1];t.addFace(_[0],f[0],b[0],_[1],f[1],b[1],_[2],f[2],b[2])}}else if(h==="l"){const u=c.substring(1).trim().split(" ");let d=[];const p=[];if(c.indexOf("/")===-1)d=u;else for(let _=0,v=u.length;_<v;_++){const m=u[_].split("/");m[0]!==""&&d.push(m[0]),m[1]!==""&&p.push(m[1])}t.addLineGeometry(d,p)}else if(h==="p"){const d=c.slice(1).trim().split(" ");t.addPointGeometry(d)}else if((r=t_.exec(c))!==null){const u=(" "+r[0].slice(1).trim()).slice(1);t.startObject(u)}else if(i_.test(c))t.object.startMaterial(c.substring(7).trim(),t.materialLibraries);else if(n_.test(c))t.materialLibraries.push(c.substring(7).trim());else if(r_.test(c))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(h==="s"){if(r=c.split(" "),r.length>1){const d=r[1].trim().toLowerCase();t.object.smooth=d!=="0"&&d!=="off"}else t.object.smooth=!0;const u=t.object.currentMaterial();u&&(u.smooth=t.object.smooth)}else{if(c==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+c+'"')}}t.finalize();const s=new Gi;if(s.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let o=0,l=t.objects.length;o<l;o++){const c=t.objects[o],h=c.geometry,u=c.materials,d=h.type==="Line",p=h.type==="Points";let _=!1;if(h.vertices.length===0)continue;const v=new Qt;v.setAttribute("position",new Ct(h.vertices,3)),h.normals.length>0&&v.setAttribute("normal",new Ct(h.normals,3)),h.colors.length>0&&(_=!0,v.setAttribute("color",new Ct(h.colors,3))),h.hasUVIndices===!0&&v.setAttribute("uv",new Ct(h.uvs,2));const m=[];for(let b=0,E=u.length;b<E;b++){const S=u[b],D=S.name+"_"+S.smooth+"_"+_;let w=t.materials[D];if(this.materials!==null){if(w=this.materials.create(S.name),d&&w&&!(w instanceof Fr)){const R=new Fr;yn.prototype.copy.call(R,w),R.color.copy(w.color),w=R}else if(p&&w&&!(w instanceof Wi)){const R=new Wi({size:10,sizeAttenuation:!1});yn.prototype.copy.call(R,w),R.color.copy(w.color),R.map=w.map,w=R}}w===void 0&&(d?w=new Fr:p?w=new Wi({size:1,sizeAttenuation:!1}):w=new Rl,w.name=S.name,w.flatShading=!S.smooth,w.vertexColors=_,t.materials[D]=w),m.push(w)}let f;if(m.length>1){for(let b=0,E=u.length;b<E;b++){const S=u[b];v.addGroup(S.groupStart,S.groupCount,b)}d?f=new go(v,m):p?f=new Ts(v,m):f=new $t(v,m)}else d?f=new go(v,m[0]):p?f=new Ts(v,m[0]):f=new $t(v,m[0]);f.name=c.name,s.add(f)}else if(t.vertices.length>0){const o=new Wi({size:1,sizeAttenuation:!1}),l=new Qt;l.setAttribute("position",new Ct(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(l.setAttribute("color",new Ct(t.colors,3)),o.vertexColors=!0);const c=new Ts(l,o);s.add(c)}return s}}class o_ extends Ri{constructor(e){super(e)}load(e,t,n,r){const s=this,a=this.path===""?pu.extractUrlBase(e):this.path,o=new Pl(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{t(s.parse(l,a))}catch(c){r?r(c):console.error(c),s.manager.itemError(e)}},n,r)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const n=e.split(`
3832
+ `);let r={};const s=/\s+/,a={};for(let l=0;l<n.length;l++){let c=n[l];if(c=c.trim(),c.length===0||c.charAt(0)==="#")continue;const h=c.indexOf(" ");let u=h>=0?c.substring(0,h):c;u=u.toLowerCase();let d=h>=0?c.substring(h+1):"";if(d=d.trim(),u==="newmtl")r={name:d},a[d]=r;else if(u==="ka"||u==="kd"||u==="ks"||u==="ke"){const p=d.split(s,3);r[u]=[parseFloat(p[0]),parseFloat(p[1]),parseFloat(p[2])]}else r[u]=d}const o=new l_(this.resourcePath||t,this.materialOptions);return o.setCrossOrigin(this.crossOrigin),o.setManager(this.manager),o.setMaterials(a),o}}class l_{constructor(e="",t={}){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options.side:Sn,this.wrap=this.options.wrap!==void 0?this.options.wrap:kr}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;const t={};for(const n in e){const r=e[n],s={};t[n]=s;for(const a in r){let o=!0,l=r[a];const c=a.toLowerCase();switch(c){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(l=[l[0]/255,l[1]/255,l[2]/255]),this.options&&this.options.ignoreZeroRGBs&&l[0]===0&&l[1]===0&&l[2]===0&&(o=!1);break}o&&(s[c]=l)}}return t}preload(){for(const e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(const t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return this.materials[e]===void 0&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){const t=this,n=this.materialsInfo[e],r={name:e,side:this.side};function s(o,l){return typeof l!="string"||l===""?"":/^https?:\/\//i.test(l)?l:o+l}function a(o,l){if(r[o])return;const c=t.getTextureParams(l,r),h=t.loadTexture(s(t.baseUrl,c.url));h.repeat.copy(c.scale),h.offset.copy(c.offset),h.wrapS=t.wrap,h.wrapT=t.wrap,(o==="map"||o==="emissiveMap")&&(h.colorSpace=Et),r[o]=h}for(const o in n){const l=n[o];let c;if(l!=="")switch(o.toLowerCase()){case"kd":r.color=Qe.colorSpaceToWorking(new Ke().fromArray(l),Et);break;case"ks":r.specular=Qe.colorSpaceToWorking(new Ke().fromArray(l),Et);break;case"ke":r.emissive=Qe.colorSpaceToWorking(new Ke().fromArray(l),Et);break;case"map_kd":a("map",l);break;case"map_ks":a("specularMap",l);break;case"map_ke":a("emissiveMap",l);break;case"norm":a("normalMap",l);break;case"map_bump":case"bump":a("bumpMap",l);break;case"disp":a("displacementMap",l);break;case"map_d":a("alphaMap",l),r.transparent=!0;break;case"ns":r.shininess=parseFloat(l);break;case"d":c=parseFloat(l),c<1&&(r.opacity=c,r.transparent=!0);break;case"tr":c=parseFloat(l),this.options&&this.options.invertTrProperty&&(c=1-c),c>0&&(r.opacity=1-c,r.transparent=!0);break}}return this.materials[e]=new Rl(r),this.materials[e]}getTextureParams(e,t){const n={scale:new Xe(1,1),offset:new Xe(0,0)},r=e.split(/\s+/);let s;return s=r.indexOf("-bm"),s>=0&&(t.bumpScale=parseFloat(r[s+1]),r.splice(s,2)),s=r.indexOf("-mm"),s>=0&&(t.displacementBias=parseFloat(r[s+1]),t.displacementScale=parseFloat(r[s+2]),r.splice(s,3)),s=r.indexOf("-s"),s>=0&&(n.scale.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),s=r.indexOf("-o"),s>=0&&(n.offset.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),n.url=r.join(" ").trim(),n}loadTexture(e,t,n,r,s){const a=this.manager!==void 0?this.manager:Cl;let o=a.getHandler(e);o===null&&(o=new cu(a)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin);const l=o.load(e,n,r,s);return t!==void 0&&(l.mapping=t),l}}const Jo={type:"change"},Na={type:"start"},Bl={type:"end"},Cr=new jr,Qo=new Cn,c_=Math.cos(70*bh.DEG2RAD),_t=new N,Ut=2*Math.PI,st={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Us=1e-6;class h_ extends _u{constructor(e,t=null){super(e,t),this.state=st.NONE,this.target=new N,this.cursor=new N,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:gi.ROTATE,MIDDLE:gi.DOLLY,RIGHT:gi.PAN},this.touches={ONE:pi.ROTATE,TWO:pi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new N,this._lastQuaternion=new Zn,this._lastTargetPosition=new N,this._quat=new Zn().setFromUnitVectors(e.up,new N(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new yo,this._sphericalDelta=new yo,this._scale=1,this._panOffset=new N,this._rotateStart=new Xe,this._rotateEnd=new Xe,this._rotateDelta=new Xe,this._panStart=new Xe,this._panEnd=new Xe,this._panDelta=new Xe,this._dollyStart=new Xe,this._dollyEnd=new Xe,this._dollyDelta=new Xe,this._dollyDirection=new N,this._mouse=new Xe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=f_.bind(this),this._onPointerDown=u_.bind(this),this._onPointerUp=d_.bind(this),this._onContextMenu=M_.bind(this),this._onMouseWheel=__.bind(this),this._onKeyDown=g_.bind(this),this._onTouchStart=v_.bind(this),this._onTouchMove=x_.bind(this),this._onMouseDown=p_.bind(this),this._onMouseMove=m_.bind(this),this._interceptControlDown=S_.bind(this),this._interceptControlUp=y_.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Jo),this.update(),this.state=st.NONE}update(e=null){const t=this.object.position;_t.copy(t).sub(this.target),_t.applyQuaternion(this._quat),this._spherical.setFromVector3(_t),this.autoRotate&&this.state===st.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=Ut:n>Math.PI&&(n-=Ut),r<-Math.PI?r+=Ut:r>Math.PI&&(r-=Ut),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(_t.setFromSpherical(this._spherical),_t.applyQuaternion(this._quatInverse),t.copy(this.target).add(_t),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=_t.length();a=this._clampDistance(o*this._scale);const l=o-a;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const o=new N(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new N(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),a=_t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(Cr.origin.copy(this.object.position),Cr.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Cr.direction))<c_?this.object.lookAt(this.target):(Qo.setFromNormalAndCoplanarPoint(this.object.up,this.target),Cr.intersectPlane(Qo,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Us||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Us||this._lastTargetPosition.distanceToSquared(this.target)>Us?(this.dispatchEvent(Jo),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Ut/60*this.autoRotateSpeed*e:Ut/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){_t.setFromMatrixColumn(t,0),_t.multiplyScalar(-e),this._panOffset.add(_t)}_panUp(e,t){this.screenSpacePanning===!0?_t.setFromMatrixColumn(t,1):(_t.setFromMatrixColumn(t,0),_t.crossVectors(this.object.up,_t)),_t.multiplyScalar(e),this._panOffset.add(_t)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;_t.copy(r).sub(this.target);let s=_t.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Ut*this._rotateDelta.x/t.clientHeight),this._rotateUp(Ut*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Ut*this._rotateDelta.x/t.clientHeight),this._rotateUp(Ut*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Xe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function u_(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i)))}function f_(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function d_(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Bl),this.state=st.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function p_(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case gi.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=st.DOLLY;break;case gi.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=st.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=st.ROTATE}break;case gi.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=st.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=st.PAN}break;default:this.state=st.NONE}this.state!==st.NONE&&this.dispatchEvent(Na)}function m_(i){switch(this.state){case st.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case st.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case st.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function __(i){this.enabled===!1||this.enableZoom===!1||this.state!==st.NONE||(i.preventDefault(),this.dispatchEvent(Na),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(Bl))}function g_(i){this.enabled!==!1&&this._handleKeyDown(i)}function v_(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case pi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=st.TOUCH_ROTATE;break;case pi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=st.TOUCH_PAN;break;default:this.state=st.NONE}break;case 2:switch(this.touches.TWO){case pi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=st.TOUCH_DOLLY_PAN;break;case pi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=st.TOUCH_DOLLY_ROTATE;break;default:this.state=st.NONE}break;default:this.state=st.NONE}this.state!==st.NONE&&this.dispatchEvent(Na)}function x_(i){switch(this._trackPointer(i),this.state){case st.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case st.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case st.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case st.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=st.NONE}}function M_(i){this.enabled!==!1&&i.preventDefault()}function S_(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function y_(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const E_={class:"content-show"},T_={__name:"threeModel",props:{isShow:Boolean},setup(i){const e=$.ref(null),t=i,n=nl.useModelComp(ot.pinia),{nodeDev:r}=mn.storeToRefs(n);let s,a,o,l,c;const h=async()=>{s=new eu,s.background=new Ke(15790320),a=new Wt(75,e.value.clientWidth/e.value.clientHeight,.1,1e3),a.position.z=5,o=new e_({antialias:!0}),o.setSize(e.value.clientWidth,e.value.clientHeight),o.setPixelRatio(window.devicePixelRatio),e.value.appendChild(o.domElement),l=new h_(a,o.domElement),l.enableDamping=!0,l.dampingFactor=.05;const _=new du(16777215,.5);s.add(_);const v=new fu(16777215,.8);v.position.set(1,1,1),s.add(v),await u(),d()},u=async _=>{const v=await Fa.downloadAvatarApi({url:"upload/2025/06/17/688010456879173.obj"}),m=new Blob([v.data],{type:"application/octet-stream;charset=UTF-8"}),f=URL.createObjectURL(m),b=await Fa.downloadAvatarApi({url:"upload/2025/06/17/688013326958661.mtl"}),E=new Blob([b.data],{type:"application/octet-stream;charset=UTF-8"}),S=URL.createObjectURL(E);new o_().load(S,w=>{w.preload();const R=new a_;R.setMaterials(w),R.load(f,L=>{c=L,c.rotation.set(50,-20,200),s.add(c);const y=new wi().setFromObject(c),x=y.getSize(new N).length(),C=y.getCenter(new N);a.position.copy(C),a.position.z+=x*.6,a.lookAt(C),l.target.copy(C)},L=>{console.log(L.loaded/L.total*100+"% loaded")},L=>{console.error("An error happened loading the OBJ model:",L)})},w=>{console.log(w.loaded/w.total*100+"% loaded")},w=>{console.error("An error happened loading the MTL materials:",w)})},d=()=>{requestAnimationFrame(d),l.update(),o.render(s,a)},p=()=>{a.aspect=e.value.clientWidth/e.value.clientHeight,a.updateProjectionMatrix(),o.setSize(e.value.clientWidth,e.value.clientHeight)};return $.onMounted(async()=>{window.addEventListener("resize",p),await h()}),$.watch(()=>t==null?void 0:t.isShow,()=>{t!=null&&t.isShow&&!l&&!o&&(console.log(123,(t==null?void 0:t.isShow)&&!l&&!o),setTimeout(async()=>{window.addEventListener("resize",p),await h()},50))},{deep:!0,immediate:!0}),$.onBeforeUnmount(()=>{window.removeEventListener("resize",p),o&&o.dispose(),l&&l.dispose()}),(_,v)=>($.openBlock(),$.createElementBlock("div",E_,[$.createElementVNode("div",{ref_key:"container",ref:e,class:"three-container"},null,512)]))}},zl=Ea._export_sfc(T_,[["__scopeId","data-v-5f5332e0"]]),kl=mn.defineStore("formToTableComp",{state:()=>({selectArray:[],selectString:""}),actions:{setSelectArray(i){this.selectArray=i},setSelectString(i){this.selectString=i}}}),Hl=mn.defineStore("unit",{state:()=>({selectIndex:"",selectMenu:"",selectTitle:[]}),actions:{setSelectIndex(i){this.selectIndex=i},setSelectMenu(i){this.selectMenu=i},setSelectTitle(i){this.selectTitle=i}}}),Vl=(i,e)=>{let t=i,n=e;return Array.isArray(t)&&(t=t==null?void 0:t.map((r,s)=>{if(Array.isArray(r)){let a={};return r=r==null?void 0:r.forEach((o,l)=>{var c;(c=n==null?void 0:n[l])!=null&&c.prop?a[n[l].prop]=o:Array.isArray(o)&&(a.children=Vl(o,n))}),Object.assign(a,{id:s})}else return r})),t},Gl=(i,e,t)=>{let n=i,r=e;return n=n==null?void 0:n.map((s,a)=>{var o,l;return!Array.isArray(s)||!((o=r==null?void 0:r[a])!=null&&o.label)&&!t||(s.unshift(((l=r==null?void 0:r[a])==null?void 0:l.label)??""),s.some(c=>Array.isArray(c))&&(s=s==null?void 0:s.map(c=>{var h;return Array.isArray(c)&&(c=Gl(c,(h=r==null?void 0:r[a])==null?void 0:h.children,t)),c}))),s}),n},b_=(i,e,t)=>{if(e==="")return i==null?void 0:i.filter(n=>(n==null?void 0:n.id)!==t);{const n=e.split("-");return A_(i,n,t)}},A_=(i,e,t)=>{let n=i,r=e;return(r==null?void 0:r.length)===0?n=n==null?void 0:n.filter(s=>s.id!==t):n=n==null?void 0:n.map(s=>(s.id.toString()===(r==null?void 0:r[0])&&(r==null||r.shift(),s=Wl(s,r,t)),s)),n},Wl=(i,e,t)=>{var s,a;let n=i,r=e;return(r==null?void 0:r.length)===0?n.children=(s=n.children)==null?void 0:s.filter(o=>o.id!==t):n.children=(a=n.children)==null?void 0:a.map(o=>(o.id.toString()===(r==null?void 0:r[0])&&(r==null||r.shift(),o=Wl(o,r,t)),o)),n},w_=(i,e,t)=>{if(e==="")return t;{const n=e.split("-");return R_(i,n,t)}},R_=(i,e,t)=>{let n=i,r=e;return(r==null?void 0:r.length)===0?n=t:n=n==null?void 0:n.map(s=>(s.id.toString()===(r==null?void 0:r[0])&&(r==null||r.shift(),s=Xl(s,r,t)),s)),n},Xl=(i,e,t)=>{var s;let n=i,r=e;return(r==null?void 0:r.length)===0?n.children=t:n.children=(s=n.children)==null?void 0:s.map(a=>(a.id.toString()===(r==null?void 0:r[0])&&(r==null||r.shift(),a=Xl(a,r,t)),a)),n},ql=(i,e)=>i==null?void 0:i.map(n=>{var r,s,a,o,l,c;if(Array.isArray(n)?n=n:n=[n],(r=n==null?void 0:n.filter(h=>!(h!=null&&h.id)))!=null&&r.every(h=>typeof h!="object"||h===null))return n;if((s=n==null?void 0:n.filter(h=>!(h!=null&&h.id)))!=null&&s.some(h=>Array.isArray(h)))return n;{let h=[];if(h.push(n==null?void 0:n.find(u=>u==null?void 0:u.id)),Array.isArray(e==null?void 0:e[0])){const u=(a=n==null?void 0:n.filter(d=>!(d!=null&&d.id)))==null?void 0:a[0];(o=qi(be.cloneDeep(e==null?void 0:e[0])))==null||o.forEach(d=>{h.push(u==null?void 0:u[(d==null?void 0:d.prop)??(d==null?void 0:d.label)??d])})}else{const u=(l=n==null?void 0:n.filter(d=>!(d!=null&&d.id)))==null?void 0:l[0];(c=qi(be.cloneDeep(e)))==null||c.forEach(d=>{h.push(u==null?void 0:u[(d==null?void 0:d.prop)??(d==null?void 0:d.label)??d])})}return h}}),C_=i=>{try{return JSON.parse(i),!0}catch{return!1}},el=(i,e)=>wc(i,e),Ai=i=>{let e=[];function t(r){Array.isArray(r)&&(r==null||r.forEach(s=>{Array.isArray(s)||(s=[s]),s==null||s.forEach(a=>{!(a!=null&&a.children)||a.children.length===0?e.push(a.label):n(a.children)})}))}function n(r){r==null||r.forEach(s=>{!(s!=null&&s.children)||s.children.length===0?e.push(s.label):n(s.children)})}return t(i),e},P_=(i,e,t)=>{var r;let n=(r=be.cloneDeep(i))==null?void 0:r.map(s=>(s=s.filter(a=>!(a!=null&&a.id)),s));return n=n==null?void 0:n.map(s=>{var a;return s=(a=s.map((o,l)=>{let c={};if(t!=null&&t.find(h=>h===e[l]))return c[e[l]]=o,c}))==null?void 0:a.filter(o=>o),s}),n},D_=(i,e)=>{var a,o;const t=be.cloneDeep(i),n=(a=t==null?void 0:t.find(l=>(l==null?void 0:l.key)==="header"))==null?void 0:a.contents,r=(o=t==null?void 0:t.find(l=>(l==null?void 0:l.key)==="tableContents"))==null?void 0:o.contents;return P_(r,Ai(n).slice(0,Ai(n).length-1),e)},pn=i=>{var r,s,a,o;const e=i;let t=[];e.compData=(r=e.compData)==null?void 0:r.filter(l=>(l==null?void 0:l.key)!=="tableContents"&&(l==null?void 0:l.key)!=="tableIndex");const n=(a=(s=be.cloneDeep(e.compData))==null?void 0:s.find(l=>(l==null?void 0:l.key)==="tableIndexColumn"))==null?void 0:a.contents;return(o=be.cloneDeep(e.compData))==null||o.forEach(l=>{if((l==null?void 0:l.key)!=="tableIndexColumn"&&(l==null?void 0:l.key)!=="header")t.push(l);else if((l==null?void 0:l.key)==="header"){let c=l.contents;n&&(c!=null&&c.every(h=>Array.isArray(h))?c==null||c[0].unshift({label:n}):c.unshift({label:n})),t.push({key:"header",contents:c})}}),e.compData=t,e},Sa=i=>{var s,a,o,l,c;const e=(s=i.compData)==null?void 0:s.filter(h=>(h==null?void 0:h.key)==="tableContents"||(h==null?void 0:h.key)==="tableIndex"),t=(o=(a=e==null?void 0:e.find(h=>(h==null?void 0:h.key)==="tableIndex"))==null?void 0:a.contents)==null?void 0:o.map(h=>h.label),n=(l=e==null?void 0:e.find(h=>(h==null?void 0:h.key)==="tableContents"))==null?void 0:l.contents;let r=[];return(t==null?void 0:t.length)>0&&(n!=null&&n.every(h=>Array.isArray(h)))?r=t==null?void 0:t.map((h,u)=>n[u]?[h,...n[u]]:[h]):Array.isArray(n==null?void 0:n[0])&&((c=n==null?void 0:n[0])!=null&&c.every(h=>Array.isArray(h)))?r=n==null?void 0:n[0]:Array.isArray(n==null?void 0:n[0])?r=n:r.push(n),r},L_=i=>{const e=[];function t(n){!n||n.length===0||(e.push(n==null?void 0:n.map(r=>({label:r.label}))),n==null||n.forEach(r=>{r!=null&&r.children&&(r==null?void 0:r.children.length)>0&&t(r==null?void 0:r.children)}))}return t(i),e},U_=i=>{const e=[];function t(n,r=[]){!n||n.length===0||(e.push({key:r==null?void 0:r.filter(s=>!Array.isArray(s)),value:n}),n==null||n.forEach(s=>{s!=null&&s.some(a=>Array.isArray(a))&&t(s.find(a=>Array.isArray(a)),s)}))}return t(i),e},I_=i=>{const e=[];function t(n){!n||n.length===0||(e.push(n==null?void 0:n.map(r=>r==null?void 0:r.filter(s=>!Array.isArray(s)))),n==null||n.forEach(r=>{r!=null&&r.some(s=>Array.isArray(s))&&t(r.find(s=>Array.isArray(s)))}))}return t(i),e},N_=i=>{const e=[];function t(n){var r;!n||n.length===0||(n!=null&&n.every(s=>!Array.isArray(s))?e.push(n):(e.push((r=n==null?void 0:n.map(s=>s==null?void 0:s.filter(a=>!Array.isArray(a))))==null?void 0:r[0]),n==null||n.forEach(s=>{s!=null&&s.some(a=>Array.isArray(a))&&t(s.find(a=>Array.isArray(a)))})))}return t(i),e},F_=(i,e)=>{let t;function n(r,s,a=1){var l;if(!r||r.length===0)return;const o=(l=be.cloneDeep(s))==null?void 0:l.map(c=>c==null?void 0:c.filter(h=>!Array.isArray(h)));return o!=null&&o.find(c=>el(c,r==null?void 0:r.key))?(s==null||s.forEach(c=>{!n(r,c.find(u=>Array.isArray(u)))&&el(c.filter(u=>!Array.isArray(u)),r==null?void 0:r.key)&&(t={type:a,contents:c.filter(u=>!Array.isArray(u))})}),!0):!1}return n(i,e,0),t},tl=(i,e)=>{function t(n,r){return!n||n.length===0||n==null?void 0:n.map((a,o)=>{var c,h;let l=a;return l.unshift((c=r==null?void 0:r[o])==null?void 0:c.label),l.some(u=>Array.isArray(u))&&(l[l.length-1]=t(l.find(u=>Array.isArray(u)),(h=r==null?void 0:r[o])==null?void 0:h.children)),l})}return t(i,e)},ya=i=>{var t,n,r,s,a,o,l,c,h,u,d,p,_,v,m,f,b,E,S,D,w,R,L,y,x;const e=i;if((i==null?void 0:i.comp)==="Table"){if((r=(n=(t=i.compData)==null?void 0:t.find(C=>(C==null?void 0:C.key)==="tableIndex"))==null?void 0:n.contents)!=null&&r.every(C=>!(C!=null&&C.children))||!((s=i.compData)!=null&&s.find(C=>(C==null?void 0:C.key)==="tableIndex")))return((l=(o=(a=e.compData)==null?void 0:a.find(C=>(C==null?void 0:C.key)==="tableContents"))==null?void 0:o.contents)==null?void 0:l.length)===1&&((d=(u=(h=(c=e.compData)==null?void 0:c.find(C=>(C==null?void 0:C.key)==="tableContents"))==null?void 0:h.contents)==null?void 0:u[0])!=null&&d.every(C=>Array.isArray(C)))?(e.compData=(p=e.compData)==null?void 0:p.map(C=>{var H;return(C==null?void 0:C.key)==="tableContents"&&(C.contents=(H=C.contents)==null?void 0:H[0]),C}),[e]):[e];{let C=[];const H=e.compData,B=(_=be.cloneDeep(H))==null?void 0:_.find(se=>(se==null?void 0:se.key)==="tableIndexColumn"),j=(v=be.cloneDeep(H))==null?void 0:v.find(se=>(se==null?void 0:se.key)==="extraButton"),J=(m=be.cloneDeep(H))==null?void 0:m.find(se=>(se==null?void 0:se.key)==="rowButton"),W=N_((b=(f=be.cloneDeep(H))==null?void 0:f.find(se=>(se==null?void 0:se.key)==="header"))==null?void 0:b.contents),ne=(E=be.cloneDeep(H))==null?void 0:E.find(se=>(se==null?void 0:se.key)==="tableIndex"),G=I_((D=(S=be.cloneDeep(H))==null?void 0:S.find(se=>(se==null?void 0:se.key)==="tableContents"))==null?void 0:D.contents),fe=tl((R=(w=be.cloneDeep(H))==null?void 0:w.find(se=>(se==null?void 0:se.key)==="tableContents"))==null?void 0:R.contents,ne==null?void 0:ne.contents),xe=U_(tl((y=(L=be.cloneDeep(H))==null?void 0:L.find(se=>(se==null?void 0:se.key)==="tableContents"))==null?void 0:y.contents,ne==null?void 0:ne.contents));if(ne)return(x=L_(ne.contents))==null||x.forEach((se,We)=>{var Y;let Ze=[];Ze.push({key:"tableIndex",contents:se}),Ze.push(B),Ze.push(j),Ze.push(J),Ze.push({key:"tableContents",contents:G[We]}),Ze.push({key:"header",contents:W!=null&&W[We]?[W==null?void 0:W[We]]:[W==null?void 0:W[0]]}),C.push({comp:"Table",compData:Ze,name:"",parentTableContents:((Y=F_(xe[We],fe))==null?void 0:Y.contents)??""})}),C}}else return[e]},qr=(i,e)=>{let t={};return Array.isArray(i)?i==null||i.forEach((n,r)=>{t[e[r]]=n}):[i].forEach((n,r)=>{t[e[r]]=n}),t},O_=async i=>{let e=[];i==null||i.forEach(t=>{var n;(n=t.compData)==null||n.forEach(r=>{var s;(s=r.contents)==null||s.forEach(a=>{var o;Array.isArray(a)?a==null||a.forEach(l=>{var c;(c=ya(be.cloneDeep(l)))==null||c.forEach(async h=>{var u,d,p,_,v;if(l.comp==="Table"){const m=await ot.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(h==null?void 0:h.parentTableContents)??""},value:{pageData:{comp:(u=pn(be.cloneDeep(h)))==null?void 0:u.comp,compData:(d=pn(be.cloneDeep(h)))==null?void 0:d.compData,name:(p=pn(be.cloneDeep(h)))==null?void 0:p.name}}}),f=m.data.result,b=await((_=Sa(be.cloneDeep(h)))==null?void 0:_.map(async E=>{var R,L,y,x,C;let S;E.length!==0&&(S=await ot.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:f},value:{tableData:qr(E,(x=Ai((y=(L=(R=pn(be.cloneDeep(h)))==null?void 0:R.compData)==null?void 0:L.find(H=>(H==null?void 0:H.key)==="header"))==null?void 0:y.contents))==null?void 0:x.filter(H=>H!=="操作"))}}));const w=await((C=(await ot.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",parentTable:E}})).data.result)==null?void 0:C.map(async H=>await ot.updateInsofDataApi({id:H.id,key:{systemKey:H.key.systemKey,pageKey:H.key.pageKey,type:H.key.type,version:H.key.version,parentTable:S.data.result}})));return e.push(w),S}));e.push(m),e.push(b)}else if((h==null?void 0:h.key)==="extraButton"){if(((v=Object.values(h==null?void 0:h.value))==null?void 0:v.length)!==0){const m=await ot.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structureMethod",version:1},value:{pageData:h.value}});e.push(m)}}else{const m=await ot.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(h==null?void 0:h.parentTableContents)??""},value:{pageData:h}});e.push(m)}})}):(o=ya(be.cloneDeep(a)))==null||o.forEach(async l=>{var c,h,u,d,p;if(a.comp==="Table"){const _=await ot.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(l==null?void 0:l.parentTableContents)??""},value:{pageData:{comp:(c=pn(be.cloneDeep(l)))==null?void 0:c.comp,compData:(h=pn(be.cloneDeep(l)))==null?void 0:h.compData,name:(u=pn(be.cloneDeep(l)))==null?void 0:u.name}}}),v=_.data.result,m=await((d=Sa(be.cloneDeep(l)))==null?void 0:d.map(async f=>{var D,w,R,L,y;let b;(f==null?void 0:f.length)!==0&&(b=await ot.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:v},value:{tableData:qr(f,(L=Ai((R=(w=(D=pn(be.cloneDeep(l)))==null?void 0:D.compData)==null?void 0:w.find(x=>(x==null?void 0:x.key)==="header"))==null?void 0:R.contents))==null?void 0:L.filter(x=>x!=="操作"))}}));const S=await((y=(await ot.getInsofDataApi({key:{parentTable:f,systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure"}})).data.result)==null?void 0:y.map(async x=>await ot.updateInsofDataApi({id:x.id,key:{systemKey:x.key.systemKey,pageKey:x.key.pageKey,type:x.key.type,version:x.key.version,parentTable:x.key.parentTable===""?"":b.data.result}})));return e.push(S),b}));e.push(_),e.push(m)}else if((l==null?void 0:l.key)==="extraButton"){if(((p=Object.values(l==null?void 0:l.value))==null?void 0:p.length)!==0){const _=await ot.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structureMethod",version:1},value:{pageData:l.value}});e.push(_)}}else{const _=await ot.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(l==null?void 0:l.parentTableContents)??""},value:{pageData:l}});e.push(_)}})})})}),await Promise.all(e)},B_=mn.useMenuState(ot.pinia),z_=i=>{var t;const e=Array.isArray(i)?i==null?void 0:i[0]:{};return(t=e==null?void 0:e.contents)==null?void 0:t.map(n=>({...n[0],...n[1]}))},Yl=async(i,e,t="",n)=>{var u,d,p,_,v,m;const r=await ot.getInsofDataApi({key:{pageKey:i,systemKey:e,parentTable:t}}),s=await ot.getInsofDataApi({key:{pageKey:i,systemKey:e,type:"structureMethod"}}),a=(u=r.data.result)==null?void 0:u.map(f=>f.id),o=a==null?void 0:a.map(f=>ot.getInsofDataApi({key:{pageKey:i,systemKey:e,tableId:f}})),l=await Promise.all(o),c=[];l==null||l.forEach(f=>{var S,D,w,R;const b=(S=f.data.result)==null?void 0:S.map(L=>{const y=Array.isArray(L.value.tableData)?L.value.tableData:[L.value.tableData];return y.unshift({id:L.id}),y}),E=(R=(w=(D=f.data.result)==null?void 0:D[0])==null?void 0:w.key)==null?void 0:R.tableId;c.push({key:E,contents:b})});const h=[];return(d=r.data.result)==null||d.forEach(f=>{var S,D,w;const b=f.value.pageData,E=be.cloneDeep(b.compData);if(E&&(E!=null&&E.find(R=>(R==null?void 0:R.key)==="header"))&&E.push({key:"tableContents",contents:n==="/系统管理/用户管理"?z_(c):ql((S=c==null?void 0:c.find(R=>(R==null?void 0:R.key)===f.id))==null?void 0:S.contents,(D=E==null?void 0:E.find(R=>(R==null?void 0:R.key)==="header"))==null?void 0:D.contents)}),b.compData=E,b.id=f.id,((w=f.key)==null?void 0:w.type)!=="method")h.push(b);else{let R;R={name:"",compData:[b],comp:"calculator"},h.push(R)}}),((_=(p=s.data.result)==null?void 0:p.map(f=>f.value.pageData))==null?void 0:_.filter(f=>Object.values(f).length>0).length)>0&&h.push({comp:"methodButton",name:"",compData:(m=(v=s.data.result)==null?void 0:v.map(f=>f.value.pageData))==null?void 0:m.filter(f=>Object.values(f).length>0)}),h},k_=async i=>{await ot.deleteInsofDataApi({id:i})},H_=async(i,e,t,n,r,s)=>{var a;await ot.createInsofDataApi({key:{type:i,pageKey:e,tableId:t,systemKey:n},value:{tableData:qr(r,(a=Ai(s))==null?void 0:a.filter(o=>o!=="操作"))}})},V_=async(i,e,t,n,r,s,a)=>{var o;await ot.updateInsofDataApi({key:{type:i,pageKey:e,tableId:t,systemKey:r},value:{tableData:qr(s,(o=Ai(a))==null?void 0:o.filter(l=>l!=="操作"))},id:n})},G_=async(i,e)=>{await ot.updateInsofDataApi({value:{pageData:e},id:i})},W_=async(i,e)=>await ot.getInsofDataApi({key:i,valueLikes:e}),X_=async()=>{var i,e,t,n,r,s,a,o,l;try{const c=await ot.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),layer:"superAdmin"}});((i=c==null?void 0:c.data)==null?void 0:i.code)===200&&(B_.setPlatform(((r=(n=(t=(e=c==null?void 0:c.data)==null?void 0:e.result)==null?void 0:t[0])==null?void 0:n.key)==null?void 0:r.type)==="制造系统"?"client":"browser"),(l=(o=(a=(s=c==null?void 0:c.data)==null?void 0:s.result)==null?void 0:a[0])==null?void 0:o.key)==null||l.type)}catch(c){return Promise.reject(c)}},q_={class:"table-content"},Y_=["onClick"],j_={class:"form-content"},K_={key:0,class:"dialog-footer"},Z_={__name:"index",props:{itemData:{type:Array,default:()=>[]},childItemData:{type:Array,default:()=>[]},index:Number,changedContent:{type:Object,default:()=>{}}},emits:["change","contentChange","onButtonClick","contentClick","pageChange"],setup(i,{emit:e}){const t=i,n=e,r=$.ref([]),s=mn.useMenuState(),{activeMenuPath:a}=mn.storeToRefs(s),o=nl.useModelComp(ot.pinia),{extraContents:l}=mn.storeToRefs(o),c=$.ref([]),h=$.ref(!1),u=$.ref("");$.ref();const d=$.ref(!0),p=$.ref(0),_=$.ref(!1),v=$.ref(""),m=$.ref(!1),f=$.ref({label:"查看三维模型"}),b=$.ref([]),E=$.ref([]),S=$.ref(!1),D=$.ref([]),w=$.ref([]),R=$.ref(),L=$.ref(),y=kl(ot.pinia),x=$.ref(),C=Hl(ot.pinia),{selectIndex:H,selectMenu:B,selectTitle:j}=mn.storeToRefs(C),{selectString:J}=mn.storeToRefs(y),W=$.ref(720),ne=()=>{m.value=!1},G=(Z,Q)=>{if(Object.values(Q).length!==0)return Object.values(Q).find(de=>{var Se,oe;return((Se=de==null?void 0:de.toString())==null?void 0:Se.includes(".obj"))||((oe=de==null?void 0:de.toString())==null?void 0:oe.includes(".stl"))})?[...Z,f.value]:Z},fe=Z=>{var oe;J.value===""?Z==null||Z[0]:(Z==null?void 0:Z.find(A=>(A==null?void 0:A.selectLabel)==="("+J.value+")"))??(Z==null||Z.find(A=>!(A!=null&&A.selectLabel)));let Q=Z;(oe=r.value)!=null&&oe.find(A=>A.prop==="index");let de=R.value;const Se=[];return Q==null||Q.forEach((A,ae)=>{var Ye;let Re={};if(Array.isArray(A)){let ie=[];A==null||A.filter(Fe=>!(Fe!=null&&Fe.id)).forEach((Fe,Ee)=>{var Ve,lt,T,g,F;if((Ve=de==null?void 0:de[Ee])!=null&&Ve.prop&&!Array.isArray(Fe)){let q={};q[de[Ee].column]=Fe,l!=null&&l.value&&((lt=l==null?void 0:l.value)==null?void 0:lt.length)>0&&((T=l==null?void 0:l.value)!=null&&T.find(K=>JSON.stringify(K==null?void 0:K[0])===JSON.stringify(q)))&&(ie=(g=l==null?void 0:l.value)==null?void 0:g.find(K=>JSON.stringify(K==null?void 0:K[0])===JSON.stringify(q))),ie&&ie.length>0?Re[de[Ee].prop]=ie!=null&&ie.find(K=>{var V;return((V=Object.keys(K))==null?void 0:V[0])===de[Ee].column})?(F=ie==null?void 0:ie.find(K=>{var V;return((V=Object.keys(K))==null?void 0:V[0])===de[Ee].column}))==null?void 0:F[de[Ee].column]:Fe:Re[de[Ee].prop]=Fe}})}else Re=A;Array.isArray(A)&&A.some(ie=>ie==null?void 0:ie.id)?Se.push(Object.assign(Re,{id:(Ye=A==null?void 0:A.find(ie=>ie.id))==null?void 0:Ye.id})):Re.id?Se.push(Re):Se.push(Object.assign(Re,{id:ae}))}),Se},xe=async Z=>{var oe,A,ae,Re,Ye;let Q={};for(let ie in Z)Z[ie]!==""&&(Q["tableData."+ie]=Z[ie]);const de=await W_({type:"data",tableId:t==null?void 0:t.index,systemKey:sessionStorage.getItem("systemKey"),pageKey:a.value},Q),Se=(ae=(A=(oe=be.cloneDeep(de))==null?void 0:oe.data)==null?void 0:A.result)==null?void 0:ae.map(ie=>{var Ee;let Fe=[];return Fe.push({id:ie.id}),Fe.push((Ee=ie==null?void 0:ie.value)==null?void 0:Ee.tableData),Fe});c.value=fe(ql(Se,(Ye=(Re=be.cloneDeep(r.value))==null?void 0:Re.map(ie=>ie.label))==null?void 0:Ye.filter(ie=>ie!=="操作")))},se=async Z=>{var de,Se,oe,A,ae,Re,Ye;let Q=await Yl(a.value,sessionStorage.getItem("systemKey"),Z.id);if(Q=Q==null?void 0:Q.filter(ie=>ie.comp!=="methodButton"),Q&&Q.length>0){const ie=!Array.isArray(j.value)&&((de=j.value)==null?void 0:de.key)!=="main"?[]:j.value;ie.push({key:B.value===""?(Se=Z==null?void 0:Z.id)==null?void 0:Se.toString():B.value+"-"+((oe=Z==null?void 0:Z.id)==null?void 0:oe.toString()),value:Z[(A=Object.keys(Z))==null?void 0:A.filter(Fe=>Fe!=="index"&&Fe!=="id")[0]]}),C.setSelectMenu(B.value===""?(ae=Z==null?void 0:Z.id)==null?void 0:ae.toString():B.value+"-"+((Re=Z==null?void 0:Z.id)==null?void 0:Re.toString())),C.setSelectTitle(ie),C.setSelectIndex((Ye=Z==null?void 0:Z.id)==null?void 0:Ye.toString()),n("pageChange",Q)}},We=Z=>{var Q;(Q=be.cloneDeep(t.itemData))==null||Q.map(de=>((de==null?void 0:de.key)==="tableContents"&&(de.contents=Z),de))},Ze=(Z,Q,de)=>{n("contentClick",Z,Q,de,{id:t==null?void 0:t.index})};$.watch(()=>t.changedContent,()=>{var de,Se;if(!t.changedContent)return;let Z=(de=c.value)==null?void 0:de.map(oe=>{var A;return oe.id===((A=t.changedContent)==null?void 0:A.id)&&(oe={...t.changedContent,id:t.changedContent.newId?t.changedContent.newId:t.changedContent.id},delete oe.newId),oe});const Q=(Se=t.itemData)==null?void 0:Se.map(oe=>((oe==null?void 0:oe.key)==="tableContents"&&(oe.contents=Z),oe));c.value=Z,n("contentChange",{contents:Q,index:t.index}),n("change",{content:Z,index:t==null?void 0:t.index,buttonName:"",id:t==null?void 0:t.index})},{deep:!0,immediate:!0});const Y=(Z,Q)=>{var de;if(u.value="",S.value=!0,d.value=!0,n("onButtonClick",Z,Q),Z==="删除"){c.value=(de=be.cloneDeep(c.value))==null?void 0:de.filter(oe=>(oe==null?void 0:oe.id)!==(Q==null?void 0:Q.id));const Se=b_(x.value,B.value,Q==null?void 0:Q.id);We(Se),n("change",{content:c.value,singleContent:Q,index:t==null?void 0:t.index,type:"delete",buttonName:Z,column:r.value})}else Z==="新增"?(v.value="新增",Pe(""),m.value=!0):Z==="编辑"?(v.value="编辑",Pe(Q),m.value=!0):Z==="查看"?(v.value="查看",Pe(Q),S.value=!1,d.value=!1,m.value=!0):Z==="查看三维模型"&&(h.value=!0)},le=()=>{h.value=!1},Pe=Z=>{var Se,oe,A;const Q=[];let de=[];for(let ae in Z)Array.isArray(Z==null?void 0:Z[ae])&&de.push(ae);(oe=qi((Se=be.cloneDeep(r.value))==null?void 0:Se.filter(ae=>(ae==null?void 0:ae.label)!=="操作")))==null||oe.forEach((ae,Re)=>{de.find(Ye=>Ye===(ae==null?void 0:ae.prop))||Q.push({label:(ae==null?void 0:ae.label)??"",name:(ae==null?void 0:ae.prop)??"t"+Re,type:!(ae!=null&&ae.formType)||(ae==null?void 0:ae.formType)===""?"Input":ae==null?void 0:ae.formType,value:(Z==null?void 0:Z[ae==null?void 0:ae.prop])??"",id:(ae==null?void 0:ae.id)??Re,contents:(ae==null?void 0:ae.options)??[],width:1,isFormColHidden:ae==null?void 0:ae.isFormColHidden})}),Z===""||!Z||(u.value=Z==null?void 0:Z.id),w.value=b.value&&((A=b.value)==null?void 0:A.length)>0?b.value:Q};$.onMounted(()=>{});const ve=()=>{let Z,Q=be.cloneDeep(c.value);u.value===""?(p.value++,Q.push(Object.assign(L.value,{id:p.value})),Z=Object.assign(L.value,{id:p.value})):Q=Q==null?void 0:Q.map(Se=>((Se==null?void 0:Se.id)===u.value&&(Se=Object.assign(Se,L.value),Z=Se),Se)),c.value=Q;const de=w_(x.value,B.value,Q);We(de),m.value=!1,n("change",{content:de,singleContent:Z,index:t==null?void 0:t.index,buttonName:v.value,column:r.value})},Ue=Z=>{L.value=Z};return $.watch(()=>[t.itemData,J.value,H.value,B.value,l==null?void 0:l.value],()=>{var Ye,ie,Fe,Ee,Ve,lt,T,g,F,q,K,V,De,he,Ae,Le,ee,Me,Oe,Ne,ce,ke,P,pe,te,ye;const Z=(Ye=be.cloneDeep(t.itemData))==null?void 0:Ye.filter(O=>(O==null?void 0:O.key)==="header");(ie=be.cloneDeep(t.itemData))==null||ie.filter(O=>(O==null?void 0:O.key)==="tableIndexColumn")[0];const Q=(Fe=be.cloneDeep(t.itemData))==null?void 0:Fe.find(O=>(O==null?void 0:O.key)==="page"),de=(Ee=be.cloneDeep(t.itemData))==null?void 0:Ee.find(O=>(O==null?void 0:O.key)==="rowButton"),Se=(Ve=be.cloneDeep(t.itemData))==null?void 0:Ve.find(O=>(O==null?void 0:O.key)==="extraButton"),oe=(lt=be.cloneDeep(t.itemData))==null?void 0:lt.filter(O=>(O==null?void 0:O.key)==="tableContents"),A=(T=be.cloneDeep(t.itemData))==null?void 0:T.filter(O=>(O==null?void 0:O.key)==="tableIndex");b.value=(q=(F=(g=be.cloneDeep(t.itemData))==null?void 0:g.filter(O=>(O==null?void 0:O.key)==="tableToForm"))==null?void 0:F[0])==null?void 0:q.contents,_.value=(Q==null?void 0:Q.contents)??!1;let ae=[];J.value===""?ae=Z==null?void 0:Z[0]:ae=(Z==null?void 0:Z.find(O=>(O==null?void 0:O.selectLabel)==="("+J.value+")"))??(Z==null?void 0:Z.find(O=>!(O!=null&&O.selectLabel)));let Re=[];if(J.value===""?Re=A==null?void 0:A[0]:Re=(A==null?void 0:A.find(O=>(O==null?void 0:O.selectLabel)==="("+J.value+")"))??(A==null?void 0:A.find(O=>!(O!=null&&O.selectLabel))),((K=ae==null?void 0:ae.contents)==null?void 0:K.length)>0){let O=[];if(ae!=null&&ae.contents.some(Ce=>Array.isArray(Ce)&&(Ce==null?void 0:Ce.find(_e=>_e.children))))B.value===""?O=(De=(V=Ha(be.cloneDeep(ae==null?void 0:ae.contents)))==null?void 0:V[0])==null?void 0:De.filter(Ce=>!Array.isArray(Ce)):(B.value.split("-"),O=(he=Ha(be.cloneDeep(ae==null?void 0:ae.contents)))==null?void 0:he[0]);else{const Ce=ae!=null&&ae.contents.some(_e=>Array.isArray(_e))?(Ae=ae==null?void 0:ae.contents)==null?void 0:Ae[0]:ae==null?void 0:ae.contents;Ce==null||Ce.forEach((_e,xt)=>{O.push({label:(_e==null?void 0:_e.label)??"",prop:(_e==null?void 0:_e.label)==="操作"?"operate":(_e==null?void 0:_e.prop)??"a"+xt,width:(_e==null?void 0:_e.label)==="操作"?"200":_e!=null&&_e.width?parseInt(_e.width):"",fixed:(_e==null?void 0:_e.fixed)??void 0,sortable:(_e==null?void 0:_e.sortable)??!1,align:(_e==null?void 0:_e.align)??"center",showOverflowTooltip:(_e==null?void 0:_e.showOverflowTooltip)??!0,isNotDrag:(_e==null?void 0:_e.isNotDrag)??!1,isEditCol:(_e==null?void 0:_e.isEditCol)??!1,isOperate:(_e==null?void 0:_e.isOperate)??!1,id:(_e==null?void 0:_e.id)??xt,type:(_e==null?void 0:_e.label)==="操作"?"operate":void 0,formType:(_e==null?void 0:_e.formType)??"",isTableColHidden:_e==null?void 0:_e.isTableColHidden,isFormColHidden:_e==null?void 0:_e.isFormColHidden,options:(_e==null?void 0:_e.options)??[]})})}r.value=O;let X=(ee=(Le=Cc(be.cloneDeep(r.value)))==null?void 0:Le.filter(Ce=>(Ce==null?void 0:Ce.type)!=="operate"))==null?void 0:ee.map((Ce,_e)=>({prop:(Ce==null?void 0:Ce.prop)??"a"+_e,column:Ce.label}));R.value=X;let ue=[];J.value===""?ue=oe==null?void 0:oe[0]:ue=(oe==null?void 0:oe.find(Ce=>(Ce==null?void 0:Ce.selectLabel)==="("+J.value+")"))??(oe==null?void 0:oe.find(Ce=>!(Ce!=null&&Ce.selectLabel)));let Be=Array.isArray((Me=ue==null?void 0:ue.contents)==null?void 0:Me[0])&&((Oe=ue==null?void 0:ue.contents)!=null&&Oe[0].every(Ce=>Array.isArray(Ce)))?(Ne=be.cloneDeep(ue==null?void 0:ue.contents))==null?void 0:Ne[0]:be.cloneDeep(ue==null?void 0:ue.contents);Re!=null&&Re.contents&&((ce=Re==null?void 0:Re.contents)==null?void 0:ce.length)!==0&&(Be=(ke=be.cloneDeep(Be))==null?void 0:ke.map((Ce,_e)=>{if(!Array.isArray(Ce)){let xt={};for(let en in Ce)en!=="id"&&en!=="index"&&(xt[en]=Ce[en]);Ce=Object.values(xt)}return Ce}));const at=!!((P=r.value)!=null&&P.find(Ce=>Ce.prop==="index"));Be=Gl(be.cloneDeep(Be),Re==null?void 0:Re.contents,at);const et=[];Be==null||Be.forEach((Ce,_e)=>{var en;let xt={};if(Array.isArray(Ce)){let ut=[];Ce==null||Ce.filter(At=>!(At!=null&&At.id)).forEach((At,zt)=>{var Pi,In,Di,Nn,Li,Ui;if((Pi=X==null?void 0:X[zt])!=null&&Pi.prop&&!Array.isArray(At)){let Ii={};Ii[X[zt].column]=At,l!=null&&l.value&&((In=l==null?void 0:l.value)==null?void 0:In.length)>0&&((Di=l==null?void 0:l.value)!=null&&Di.find(Nt=>JSON.stringify(Nt==null?void 0:Nt[0])===JSON.stringify(Ii)))&&(ut=(Nn=l==null?void 0:l.value)==null?void 0:Nn.find(Nt=>JSON.stringify(Nt==null?void 0:Nt[0])===JSON.stringify(Ii))),ut&&ut.length>0?xt[X[zt].prop]=ut!=null&&ut.find(Nt=>{var Fn;return((Fn=Object.keys(Nt))==null?void 0:Fn[0])===X[zt].column})?(Li=ut==null?void 0:ut.find(Nt=>{var Fn;return((Fn=Object.keys(Nt))==null?void 0:Fn[0])===X[zt].column}))==null?void 0:Li[X[zt].column]:At:xt[X[zt].prop]=At}else Array.isArray(At)&&((Ui=X[zt])!=null&&Ui.prop?xt[X[zt].prop]=At:xt.children=Vl(At,X))})}else xt=Ce;Array.isArray(Ce)&&Ce.some(ut=>ut==null?void 0:ut.id)?et.push(Object.assign(xt,{id:(en=Ce==null?void 0:Ce.find(ut=>ut.id))==null?void 0:en.id})):xt.id?et.push(xt):et.push(Object.assign(xt,{id:_e}))}),c.value=et}else r.value=[],c.value=[];((pe=de==null?void 0:de.contents)==null?void 0:pe.length)>0?E.value=de==null?void 0:de.contents:E.value=[],((te=Se==null?void 0:Se.contents)==null?void 0:te.length)>0?D.value=Se==null?void 0:Se.contents:D.value=[],p.value=((ye=c==null?void 0:c.value)==null?void 0:ye.length)??0,x.value=c.value},{deep:!0,immediate:!0}),(Z,Q)=>{var de;return $.openBlock(),$.createElementBlock("div",q_,[($.openBlock(),$.createBlock(Vi.ssTable,{columns:r.value,key:r.value,tableData:c.value,isShowPagination:_.value,isShowEdit:!1,isShowDelete:!1,onDbClickRow:se,extraButton:D.value,onButtonClick:Q[1]||(Q[1]=Se=>Y(Se,"")),onContentClick:Ze},$.createSlots({headerButton:$.withCtx(Se=>[$.createVNode(Fc,{buttons:Se.buttons,onButtonClick:Q[0]||(Q[0]=oe=>Y(oe,"")),columns:r.value,onFilter:xe},null,8,["buttons","columns"])]),_:2},[((de=E.value)==null?void 0:de.length)>0?{name:"actions",fn:$.withCtx(({item:Se})=>[($.openBlock(!0),$.createElementBlock($.Fragment,null,$.renderList(G(E.value,Se),(oe,A)=>($.openBlock(),$.createElementBlock("div",{key:A},[$.createElementVNode("div",{style:$.normalizeStyle({color:oe==null?void 0:oe.textColor}),class:"extra-button-label",onClick:ae=>Y(oe==null?void 0:oe.label,Se)},$.toDisplayString(oe==null?void 0:oe.label),13,Y_)]))),128))]),key:"0"}:void 0]),1032,["columns","tableData","isShowPagination","extraButton"])),$.createVNode(Vi.ssDialog,{title:v.value,visible:m.value,width:W.value,onBeforeDestroy:ne},{default:$.withCtx(()=>[$.createElementVNode("div",j_,[$.createVNode(Vi.ssForm,{rowContents:w.value,isEnableWrap:!1,onChange:Ue,isEdit:d.value},null,8,["rowContents","isEdit"])])]),footer:$.withCtx(()=>[S.value?($.openBlock(),$.createElementBlock("div",K_,[$.createElementVNode("div",{onClick:Q[2]||(Q[2]=Se=>m.value=!1),class:"cancel-button"},$.toDisplayString("取消")),$.createElementVNode("div",{class:"ok-button",onClick:ve},$.toDisplayString("确认"))])):$.createCommentVNode("",!0)]),_:1},8,["title","visible","width"]),$.createVNode(Vi.ssDialog,{visible:h.value,fullScreen:"",onBeforeDestroy:le},{default:$.withCtx(()=>[$.createVNode(zl,{isShow:h.value},null,8,["isShow"])]),_:1},8,["visible"])])}}},$_=Ea._export_sfc(Z_,[["__scopeId","data-v-15e21968"]]);exports.IsJson=C_;exports.addTableContents=H_;exports.conStructContents=O_;exports.deleteTableContents=k_;exports.fixFormContents=G_;exports.fixTableContents=V_;exports.getColumnChild=qi;exports.getItemData=Yl;exports.loadingSystemType=X_;exports.methodTableToContent=D_;exports.ssTable=$_;exports.tableEveryContents=ya;exports.tableToContents=Sa;exports.tableToStruct=pn;exports.threeModel=zl;exports.useFormToTableComp=kl;exports.useUnit=Hl;